Skip to content

fix(deploy): rebuild when the data the bundle inlines changes - #24

Merged
datlechin merged 1 commit into
mainfrom
fix/deploy-rebuilds-for-bundled-data
Aug 17, 2026
Merged

fix(deploy): rebuild when the data the bundle inlines changes#24
datlechin merged 1 commit into
mainfrom
fix/deploy-rebuilds-for-bundled-data

Conversation

@datlechin

Copy link
Copy Markdown
Member

/compare/postico is 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/*.json reads like content and isn't. Every file in there is imported by a module under resources/js:

resources/js/data/comparisons.ts:1        import comparisonsData from '../../data/comparisons.json'
resources/js/data/databases.ts:1          import databasesData   from '../../data/databases.json'
resources/js/components/landing/database-grid.tsx:3  import gridData from '../../../data/database-grid.json'

Vite inlines them into the bundle at build time. But the deploy classified the whole directory as content, next to blog markdown:

if changed '^(resources/blog/|resources/data/|routes/)'; then
    CONTENT_CHANGED=true      # regenerates the sitemap, rebuilds nothing
fi

So the deploy log read:

now at 182a035
frontend=false composer=false php=false content=true
Deployed 182a035 (was bc795f1)

Green, sitemap regenerated, old bundle still serving the old data.

The test was defending the bug

DeployScriptTest asserted the wrong behaviour outright — resources/data/databases.json sat 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 printed server-rendered markup present rather than the new serving assets/app-XXX.js assertion. #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

pint:  passed
Tests: 168 passed (2152 assertions)   ← REQUIRE_SSR=1, no skips
bash -n scripts/deploy.sh: syntax OK

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.
@datlechin
datlechin merged commit 33afa36 into main Aug 17, 2026
5 checks passed
@datlechin
datlechin deleted the fix/deploy-rebuilds-for-bundled-data branch August 17, 2026 15:16
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.

1 participant