chore: stop tracking generated model files - #617
Conversation
🟢 PR Risk Report — LOW
|
|
Started an automated PR update. Merge conflicts were detected while updating this branch from the base branch. Conflicted files:
An automatic resolution attempt is running. If it cannot complete safely, this PR will be marked for manual follow-up. |
|
Accepted — queued for a code change. |
|
Started an automated PR update. Merge conflicts were detected while updating this branch from the base branch. Conflicted files:
An automatic resolution attempt is running. If it cannot complete safely, this PR will be marked for manual follow-up. |
69c91a4 to
1168b0e
Compare
…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 -->
43cd300 to
9a4af3f
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: pi-ai test lacks generation
- Added a
pretestscript that runspnpm run generateso Vitest can resolve*.generated.tsimports on fresh clones without requiring a prior build.
- Added a
You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 9a4af3f. Configure here.
|
Started an automated PR update. Accepted review feedback is being applied. |
dfed6ed to
5077dd8
Compare
|
Started an automated PR update. Merge conflicts were detected while updating this branch from the base branch. Conflicted files:
An automatic resolution attempt is running. If it cannot complete safely, this PR will be marked for manual follow-up. |
…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.
5077dd8 to
aaf08c7
Compare
|
Started an automated PR update. Merge conflicts were detected while updating this branch from the base branch. Conflicted files:
An automatic resolution attempt is running. If it cannot complete safely, this PR will be marked for manual follow-up. |

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— ignorepackages/pi-ai/src/*.generated.tspackages/pi-ai/src/models.generated.tsandimage-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
Need help on this PR? Tag
/codesmithwith 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.tsand treats chat/image model registries as build-time artifacts regenerated from live provider metadata.Workflow:
buildandpretestnow runpnpm run generatebefore compile/tests, so a fresh clone relies on generation instead of checked-in catalogs. README documents thatpnpm run generateneeds network (models.dev, OpenRouter, Vercel AI Gateway) and thatOPENROUTER_MODELS_URLcan point image-model generation at a fixture or mirror.generate-image-models.ts: OpenRouter fetch URL is overridable viaOPENROUTER_MODELS_URL; the script exits with an error if the fetch returns zero models (avoids wiping catalogs on failed/offline fetches).generateImageModelsFileis exported for unit tests;mainonly 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.