fix(deploy): rebuild when the data the bundle inlines changes - #24
Merged
Conversation
resources/data/*.json reads like content and is not. Every file in there is imported by a module under resources/js — comparisons.json by data/comparisons.ts, databases.json by data/databases.ts, database-grid.json by the grid component — so Vite inlines them into the bundle at build time. The deploy classified the whole directory as content, alongside blog markdown, and rebuilt nothing. Corrected prices and database counts therefore merged, deployed green, and never reached the site: /compare/postico still promises "Postgres plus 17 other databases" on a page whose own table says 25, an hour after the fix for exactly that shipped. DeployScriptTest asserted the wrong behaviour outright — resources/data was in the list of paths that must NOT trigger a rebuild — so the bug had a passing test defending it. The replacement derives the expectation from the imports themselves rather than naming files, so a new data file cannot join the bundle and quietly miss the rebuild, and covers everything in the directory besides, so a file that is not imported yet still rebuilds rather than waiting for someone to notice it became bundled.
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.
/compare/posticois live right now promising "Postgres plus 17 other databases" on a page whose own table says 25 — an hour after #21 shipped the fix for exactly that, merged green and deployed successfully.Why
resources/data/*.jsonreads like content and isn't. Every file in there is imported by a module underresources/js:Vite inlines them into the bundle at build time. But the deploy classified the whole directory as content, next to blog markdown:
So the deploy log read:
Green, sitemap regenerated, old bundle still serving the old data.
The test was defending the bug
DeployScriptTestasserted the wrong behaviour outright —resources/data/databases.jsonsat in the list of paths that must not trigger a rebuild. The bug had a passing test protecting it.The fix
resources/data/joins the front-end pattern. The replacement test derives its expectation from the imports themselves rather than naming files:preg_match_all("#from '[^']*data/([a-z0-9-]+\.json)'#i", ...)…so a new data file can't join the bundle and quietly miss the rebuild. It also covers everything else in the directory, so a not-yet-imported file still rebuilds rather than waiting for someone to notice it became bundled.
Note on the smoke test
The deploy that shipped this ran the server's pre-#22 copy of
deploy.sh, so it printedserver-rendered markup presentrather than the newserving assets/app-XXX.jsassertion. #22's build-identity check is on the server now and applies from the next deploy — it would not have caught this one anyway, since the assets were genuinely current; only their inlined data was stale.Verification