fix(app): unbreak the frontend deploy that #10485 broke - #10486
Conversation
The frontend image is built with `docker build -f app/Dockerfile app`, so the build context is `app/` alone. #10485 read the version from the repo-root `pyproject.toml` at build time — one level above the context, and therefore absent inside the builder. `vite build` died with `ENOENT /workspace/pyproject.toml`, Cloud Build failed, and Cloud Run kept serving the previous revision. Every PR check was green while the CSP fix never reached anyplot.ai: the exact deploy-blind-spot CLAUDE.md warns about. Reproduced locally by hiding pyproject.toml and running `yarn build` (fails before the change, passes after). The version now comes from `app/package.json`, which is always inside the build context. That reintroduces a second version field, so the drift that left it at 2.0.0 through the whole 3.x line is closed structurally rather than by discipline: tests/unit/test_version_sync.py asserts the two are equal and runs on every PR that touches pyproject.toml — which is every release PR. Step 4 of the release command now names the second bump. Also switches global-config to a named `version` import: the default import inlined the whole manifest, dependency list included, into a shipped chunk. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hw82Vmq7yUMk8YoXTfSzBV
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hw82Vmq7yUMk8YoXTfSzBV
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hw82Vmq7yUMk8YoXTfSzBV
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR fixes a frontend Cloud Build deploy failure introduced by #10485 by removing the frontend build-time dependency on the repo-root pyproject.toml (which is not present in the Docker build context) and switching the frontend version source to app/package.json. It also adds a backend unit test and release-procedure documentation to prevent version drift between the two version fields.
Changes:
- Switch
CONFIG.appVersionto read fromapp/package.jsonand remove thepyproject.toml-based Vite injection path (__APP_VERSION__). - Add
tests/unit/test_version_sync.pyto assertapp/package.jsonversion matchespyproject.tomlversion. - Update release docs and changelog to reflect the new dual-bump requirement and the deploy fix.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
tests/unit/test_version_sync.py |
Adds a unit test to prevent version drift between pyproject.toml and app/package.json. |
CHANGELOG.md |
Documents the deploy fix and the dependency-list bundle reduction. |
app/vitest.config.ts |
Removes __APP_VERSION__ injection for tests (no longer used). |
app/vite.config.ts |
Removes __APP_VERSION__ injection for builds (no longer used). |
app/tsconfig.node.json |
Updates config-file TypeScript include list after removing project-version.ts usage. |
app/src/vite-env.d.ts |
Removes the __APP_VERSION__ global declaration. |
app/src/global-config.ts |
Switches CONFIG.appVersion to app/package.json version and adjusts comments accordingly. |
app/src/global-config.test.ts |
Updates version assertion to reflect the new source of CONFIG.appVersion. |
app/project-version.ts |
Removes the Node helper that read the repo-root pyproject.toml. |
app/package.json |
Bumps frontend package version to match the project version. |
agentic/commands/release.md |
Updates release steps to bump app/package.json alongside pyproject.toml. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 11 changed files in this pull request and generated no new comments.
Suppressed comments (1)
app/src/global-config.test.ts:16
- The test claims CONFIG.appVersion is a semver triple, but the regex only asserts a prefix (it would pass e.g. "3.1.0-dev" or "3.1.0placeholder"). If the intent is to enforce exactly X.Y.Z (matching tests/unit/test_version_sync.py), anchor the end of the pattern too.
it('is a semver triple, not a placeholder', () => {
expect(CONFIG.appVersion).toMatch(/^\d+\.\d+\.\d+/);
});
Copilot review on #10486: `/^\d+\.\d+\.\d+/` accepted `3.1.0-beta` and `3.1.0.1`. Releases are plain X.Y.Z triples — tests/unit/test_version_sync.py already anchors both ends — so a non-triple reaching the masthead is a bug, not a variant to tolerate. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hw82Vmq7yUMk8YoXTfSzBV
Summary
pyproject.tomlat build time, but the frontend image is built withdocker build -f app/Dockerfile app— the build context isapp/alone, so nothing above it exists inside the builder.vite builddied withENOENT .../pyproject.toml, Cloud Build failed, and Cloud Run kept serving the previous revision. Every PR check on fix(app): the masthead has been claiming v1.0 since the CSP rollout #10485 was green while the CSP fix never reached anyplot.ai: the exact deploy blind spotCLAUDE.mdcalls out. My mistake — the four CI commands I validated against all run inside a full checkout, so none of them exercises the Docker build context.app/package.json, which is always inside the build context.package.jsonreintroduces a second version field — the same one that sat at2.0.0through the whole 3.x line.tests/unit/test_version_sync.pyasserts it equals thepyproject.toml[project]version and runs on every PR that touchespyproject.toml, which is every release PR. Step 4 ofagentic/commands/release.mdnow names the second bump, with the test as the backstop if someone forgets.global-config.tsimportedpackage.jsonas a default import, which inlined the entire manifest — every dependency name and version range — into a shipped chunk. It now imports only theversionnamed export.The user-facing fix from #10485 is unchanged:
api.github.comstays allowed inconnect-src, and the masthead still falls back to the real project version instead of a hardcoded'v1.0'.Test plan
pyproject.tomland ranyarn build— fails withENOENT ... /pyproject.tomlon the merged code, exits 0 on this branch. This is the Cloud Build condition.appVersionis3.1.0, the'v1.0'literal is absent, and the dependency list no longer appears in any chunk (checked forreact-force-graph-2dacrossdist/assets/*.js).app/package.jsonback to2.0.0and confirmedtest_version_sync.pyfails with a diff naming both versions, then restored it.yarn lint,yarn fm:check,yarn type-check,yarn test --coverage(69 files / 617 tests).uv run pytest tests/unit/test_version_sync.py— 2 passed.curl -sSI https://anyplot.ai/ | grep -i content-security-policylistinghttps://api.github.com, then a cold load (clearedlocalStorage) showingv3.1.0.Checklist
CHANGELOG.mdupdated under[Unreleased]— two### Fixedbullets with PR refs.agentic/commands/release.mdstep 4 gained theapp/package.jsonbump; the reasoning for readingpackage.jsonrather thanpyproject.tomlis documented at the point of use inglobal-config.tsand in the test's module docstring.Generated by Claude Code