Skip to content

chore: stop tracking generated model files - #617

Draft
jeremymcs wants to merge 7 commits into
mainfrom
codex/ignore-generated-model-files
Draft

chore: stop tracking generated model files#617
jeremymcs wants to merge 7 commits into
mainfrom
codex/ignore-generated-model-files

Conversation

@jeremymcs

@jeremymcs jeremymcs commented Jun 9, 2026

Copy link
Copy Markdown
Member

Removes the generated model registries from version control and ignores them going forward, eliminating the recurring generated-model drift that shows up as noise in worktrees and stashes.

Changes

  • .gitignore — ignore packages/pi-ai/src/*.generated.ts
  • Delete packages/pi-ai/src/models.generated.ts and image-models.generated.ts (~17k lines, regenerated at build time)

Important

Verify the build's model-generation step runs before any consumer imports these files, since they're no longer committed. Branch is behind main; rebase before merge.

🤖 Generated with Claude Code


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.


Note

Medium Risk
Build and test now require successful network fetches (or fixtures via OPENROUTER_MODELS_URL); empty-fetch failures will block compile until generation succeeds, shifting operational risk from repo drift to CI/local connectivity.

Overview
Stops committing packages/pi-ai/src/*.generated.ts and treats chat/image model registries as build-time artifacts regenerated from live provider metadata.

Workflow: build and pretest now run pnpm run generate before compile/tests, so a fresh clone relies on generation instead of checked-in catalogs. README documents that pnpm run generate needs network (models.dev, OpenRouter, Vercel AI Gateway) and that OPENROUTER_MODELS_URL can point image-model generation at a fixture or mirror.

generate-image-models.ts: OpenRouter fetch URL is overridable via OPENROUTER_MODELS_URL; the script exits with an error if the fetch returns zero models (avoids wiping catalogs on failed/offline fetches). generateImageModelsFile is exported for unit tests; main only runs when executed as the CLI entrypoint.

Reviewed by Cursor Bugbot for commit 5077dd8. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

🟢 PR Risk Report — LOW

Files changed 3
Systems affected 0
Overall risk 🟢 LOW

@jeremymcs

Copy link
Copy Markdown
Member Author

Started an automated PR update.

Merge conflicts were detected while updating this branch from the base branch.

Conflicted files:

  • packages/pi-ai/src/image-models.generated.ts
  • packages/pi-ai/src/models.generated.ts

An automatic resolution attempt is running. If it cannot complete safely, this PR will be marked for manual follow-up.

Comment thread .gitignore Outdated
@jeremymcs

Copy link
Copy Markdown
Member Author

Accepted — queued for a code change.

@jeremymcs

Copy link
Copy Markdown
Member Author

Started an automated PR update.

Merge conflicts were detected while updating this branch from the base branch.

Conflicted files:

  • packages/pi-ai/src/image-models.generated.ts
  • packages/pi-ai/src/models.generated.ts

An automatic resolution attempt is running. If it cannot complete safely, this PR will be marked for manual follow-up.

@jeremymcs
jeremymcs force-pushed the codex/ignore-generated-model-files branch from 69c91a4 to 1168b0e Compare June 9, 2026 15:28
Comment thread packages/pi-ai/scripts/generate-image-models.ts
jeremymcs added a commit that referenced this pull request Jul 4, 2026
…ce change (#1218)

## Problem

`pkg/dist/core/export-html/template.js` is a tracked vendored artifact
(force-added past the `pkg/dist` gitignore), last committed in the
original pi-vendoring commit (`af9d27b5`). Commit `910808d8` ("Normalize
malformed tool result content", #1107) updated its **source** at
`packages/gsd-agent-core/src/export-html/template.js` without
regenerating the vendored copy.

Since the build's `scripts/copy-export-html.cjs` step copies the freshly
compiled `packages/gsd-agent-core/dist/export-html/` over
`pkg/dist/core/export-html/`, **every `pnpm run build:core` now leaves
the working tree dirty on a tracked file** (+53/−4 on `template.js`) — a
footgun for any contributor, and a merge hazard for downstream forks
carrying local state.

The other tracked files in that dir (`template.css`, `template.html`,
`vendor/*`) are unaffected — `template.js` is the only stale one.

## Fix

Recommit the regenerated artifact. Produced with the build's own
pipeline (`pnpm run build:core` → `copy-export-html.cjs`); the committed
file is byte-identical to
`packages/gsd-agent-core/dist/export-html/template.js`. The diff is
exactly #1107's `normalizeToolResultContent` fallback logic compiled
into the standalone template — no other changes.

## Verification

- `pnpm run build:core` on this branch → `git status` clean (no
tracked-file drift)
- `diff pkg/dist/core/export-html/template.js
packages/gsd-agent-core/dist/export-html/template.js` → identical

## Note

The structural alternative — not tracking generated artifacts at all —
is the direction of #617; this PR just restores consistency for the
tracked-artifact status quo.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- codesmith:footer -->
---
<a
href="https://app.blacksmith.sh/open-gsd/codesmith/gsd-pi/pr/1218"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v2.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-light-v2.svg"><img
alt="View with Codesmith"
src="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v2.svg"></picture></a>
<a
href="https://backend.blacksmith.sh/track/enable-autofix?expires=1785775931&installation_id=134682257&pr_number=1218&repository=open-gsd%2Fgsd-pi&return_to=https%3A%2F%2Fgithub.com%2Fopen-gsd%2Fgsd-pi%2Fpull%2F1218&signature=1fb257f392d69ab0666815c2788004771305fc73862220fadf496087223a8b98"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-light.svg"><img
alt="Autofix with Codesmith"
src="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"></picture></a>
<sup>Need help on this PR? Tag <code>/codesmith</code> with what you
need. Autofix is disabled.</sup>

<!-- codesmith:autofix:disabled -->
<!-- /codesmith:footer -->
@jeremymcs
jeremymcs force-pushed the codex/ignore-generated-model-files branch from 43cd300 to 9a4af3f Compare July 7, 2026 21:02

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: pi-ai test lacks generation
    • Added a pretest script that runs pnpm run generate so Vitest can resolve *.generated.ts imports on fresh clones without requiring a prior build.

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit 9a4af3f. Configure here.

Comment thread packages/pi-ai/package.json
@jeremymcs

Copy link
Copy Markdown
Member Author

Started an automated PR update.

Accepted review feedback is being applied.
Progress and final results will be posted in the related review thread(s).

jeremymcs added a commit that referenced this pull request Jul 7, 2026
jeremymcs added a commit that referenced this pull request Jul 7, 2026
@jeremymcs
jeremymcs force-pushed the codex/ignore-generated-model-files branch from dfed6ed to 5077dd8 Compare July 7, 2026 21:38
@jeremymcs
jeremymcs marked this pull request as draft July 8, 2026 14:06
@jeremymcs

Copy link
Copy Markdown
Member Author

Started an automated PR update.

Merge conflicts were detected while updating this branch from the base branch.

Conflicted files:

  • packages/pi-ai/src/models.generated.ts

An automatic resolution attempt is running. If it cannot complete safely, this PR will be marked for manual follow-up.

jeremymcs and others added 7 commits July 8, 2026 22:06
…turns no models

Mirrors the guard already in generate-models.ts: if OpenRouter returns an
empty model list (network failure, bad response), exit 1 instead of writing
an empty IMAGE_MODELS catalog that would silently break image routing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Cover the new behavior from 1168b0e: export `generateImageModelsFile`
for unit testing, guard `main()` against import-time execution, and add
an `OPENROUTER_MODELS_URL` override so a local mock server can exercise
the process.exit(1) path.

Tests cover:
- Valid TypeScript output shape (3 unit assertions)
- exit(1) + error message when the OpenRouter API returns no models

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
With generated model catalogs no longer tracked in git, vitest fails
on a fresh clone because src/models.ts imports models.generated.js at
load time. Add a pretest script that runs generate, matching build.
@jeremymcs
jeremymcs force-pushed the codex/ignore-generated-model-files branch from 5077dd8 to aaf08c7 Compare July 9, 2026 03:19
@jeremymcs

Copy link
Copy Markdown
Member Author

Started an automated PR update.

Merge conflicts were detected while updating this branch from the base branch.

Conflicted files:

  • packages/pi-ai/src/models.generated.ts

An automatic resolution attempt is running. If it cannot complete safely, this PR will be marked for manual follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants