Rebuild the app when a shared module it bundles changes - #594
Merged
davidmckayv merged 2 commits intoSep 18, 2026
Merged
Conversation
The build cache behind `bun run serve` keyed app/dist on app/src, the lockfile, the manifests, the Vite config and the tenant package, but not on shared/, which the app bundles too: the attachment limits and the handoff markers are imported from there. A change to shared/ alone left the old build in place while the server ran the new code. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
kevin9327
requested review from
MikeRyanDev,
davidmckayv,
guidovizoso,
mxmzb and
tylerslaton
as code owners
September 17, 2026 10:59
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
davidmckayv
approved these changes
Sep 18, 2026
davidmckayv
left a comment
Contributor
There was a problem hiding this comment.
Code-verified clean; CI green on this sha.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
#584 made
bun run servereuseapp/distwhen a hash of the build's inputs matches the one stored beside it. The inputs areapp/src,bun.lock, bothpackage.jsonfiles,app/vite.config.ts,app/index.htmland the tenant package.shared/is not among them, but the app bundles three modules from it:app/src/lib/channels/attachments.tsre-exportsshared/attachments.ts(attachment count, size limits, accepted types)app/src/lib/channels/routine-firing.tsre-exportsshared/routine-firing.tsapp/src/lib/copilot/markers.tsre-exportsshared/handoff-markers.tsThose files exist so the browser and the server read one declaration. After an update that changes only a file in
shared/,bun run serveprintsReusing app/dist from build cacheand serves the old bundle, while the server runs the new code. The composer then applies the old attachment limits and the transcript matches the old handoff markers. Nothing says the build is stale.The fix hashes
shared/with the same extension filter asapp/src. Nothing else about the key changes.No CHANGELOG line: the build cache came in with #584 after v0.0.12 and has no entry of its own, so no released deployment behaves differently.
Where it runs
serve-or-build.ts.Boundary and audit
Changelog
Proof
A new row in the existing
rejects a build when %s changestable changesshared/attachments.tsafter the manifest is written.With
build-cache.tsfrommain:With the fix,
bun test --coverage tests/build-cache.test.ts: 13 pass, 0 fail. The added lines are covered. The only uncovered lines inbuild-cache.tsare 61 and 77–78, which this change does not touch.I also ran it against the real repo, in
app/:bun scripts/serve-or-build.tsonmainbuiltapp/dist.HANDED_OVERinshared/handoff-markers.tsto a probe string and ran it again. It printedReusing app/dist from build cache, and no file indistcontained the probe.Building app/dist because the build cache is stale or missing, and the probe was in the bundle.Reusing app/dist from build cache.Checks:
bun run typecheck(app, server, worker): exit 0.bunx biome formatandbunx biome lint --error-on-warningson both files: clean.main. The 44 failures are the same tests on both runs (serve ports and WebSockets, path handling, locale). None are inbuild-cache.test.ts.🤖 Generated with Claude Code