You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A fresh git worktree has no seeded blog database, so four tests fail locally that CI never sees. Nothing in the output says the database is the cause, so each failure reads as a real regression.
examples/blog/db/dev.db is gitignored (examples/blog/.gitignore:26), and a worktree does not carry it. npm run worktree:link links node_modules and packages/core/dist but touches the database not at all (scripts/link-worktree-deps.mjs, zero mentions of db / seed / sqlite). CI does not hit this because every job runs npm run db:migrate && npm run db:seed first (.github/workflows/ci.yml:98, :368, :432).
The four failures, all from an empty posts table:
test/integration/blog-http.test.mjs "dynamic route: /blog/[slug] renders the post title in <head>", which asserts "homepage should list at least one /blog/... link"
test/e2e/e2e.test.mjs "a server-rendered form submits and the response renders with JS off", which asserts Found 2 results for "web"
test/e2e/e2e.test.mjs "content reads and a display-only component renders with JS off"
the enclosing progressive enhancement (JS disabled) (#183) suite
The cost is real and repeated. During #1307 (PR #1317) I baselined against pristine main TWICE to establish these were environmental rather than caused by the branch, and the second of those two runs is the kind of thing every agent in a fresh worktree repeats. The failing assertions look alarming precisely because they are about progressive enhancement and form submission, which is exactly the area a form-related change would break.
Design / approach
Preferred: seed as part of npm run worktree:link. That command already exists as the one thing you run in a new worktree, it is documented in AGENTS.md as such, and it is where an agent already looks. Add a step that runs the blog's db:migrate + db:seed when examples/blog/db/dev.db is missing.
Constraints on the implementation:
Must be idempotent and must NEVER overwrite an existing dev.db. The script's existing contract is "never overwrites an existing path, never creates a dangling link, safe to re-run"; keep it.
Must not fail the whole link step if seeding fails. A worktree used only for framework unit work should still link successfully. Warn and continue.
Seeding needs a resolvable @webjsdev/cli, so it has to run AFTER the node_modules links are in place.
Alternative, weaker: make the failure self-describing. Have the blog fixtures detect an empty posts table and fail with "the blog database is not seeded; run cd examples/blog && npm run db:migrate && npm run db:seed". Cheaper, and it does remove the misdiagnosis, but it still leaves four red tests in every fresh worktree, which trains agents to ignore red.
Doing both is reasonable: seed automatically, and keep a clear message for the case where seeding was skipped.
Implementation notes (for the implementing agent)
Where to edit
scripts/link-worktree-deps.mjs. This is the whole of npm run worktree:link (root package.json). Add the seed step at the END, after the node_modules and packages/core/dist links, since seeding resolves @webjsdev/cli through them.
The commands to run, from examples/blog: npm run db:migrate then npm run db:seed (they wrap webjs db migrate / webjs db seed, see examples/blog/package.json).
Seed data lives in examples/blog/db/seed.server.ts. Confirm it produces at least two posts matching "web", which is what the e2e asserts.
If the alternative is also implemented, the fixtures are test/integration/blog-http.test.mjs and the progressive enhancement (JS disabled) (#183) block in test/e2e/e2e.test.mjs.
Landmines
examples/blog/db/dev.db is gitignored, so it will never arrive with a checkout. Do not "fix" this by committing the database.
worktree:link must stay safe to re-run and must never clobber existing state (AGENTS.md, the fresh-worktree section).
Do not make the script require network access or a full npm install.
Tests + docs
test/repo-health/ is where a script-behaviour test would fit if one is warranted.
Docs: the fresh-worktree section of root AGENTS.md documents what worktree:link does and should mention seeding. framework-dev.md covers monorepo dev commands.
Acceptance criteria
After git worktree add + npm run worktree:link, the four listed tests pass with no manual step
Re-running worktree:link does not overwrite an existing dev.db
A worktree where seeding fails still links successfully, with a warning rather than a hard failure
AGENTS.md's fresh-worktree section states that the blog database is seeded, so an agent reading it is not surprised
Counterfactual: with examples/blog/db/dev.db deleted and the new step disabled, the four tests fail as they do today
Problem
A fresh git worktree has no seeded blog database, so four tests fail locally that CI never sees. Nothing in the output says the database is the cause, so each failure reads as a real regression.
examples/blog/db/dev.dbis gitignored (examples/blog/.gitignore:26), and a worktree does not carry it.npm run worktree:linklinksnode_modulesandpackages/core/distbut touches the database not at all (scripts/link-worktree-deps.mjs, zero mentions of db / seed / sqlite). CI does not hit this because every job runsnpm run db:migrate && npm run db:seedfirst (.github/workflows/ci.yml:98,:368,:432).The four failures, all from an empty
poststable:test/integration/blog-http.test.mjs"dynamic route: /blog/[slug] renders the post title in<head>", which asserts "homepage should list at least one /blog/... link"test/e2e/e2e.test.mjs"a server-rendered form submits and the response renders with JS off", which assertsFound 2 results for "web"test/e2e/e2e.test.mjs"content reads and a display-only component renders with JS off"progressive enhancement (JS disabled) (#183)suiteThe cost is real and repeated. During #1307 (PR #1317) I baselined against pristine main TWICE to establish these were environmental rather than caused by the branch, and the second of those two runs is the kind of thing every agent in a fresh worktree repeats. The failing assertions look alarming precisely because they are about progressive enhancement and form submission, which is exactly the area a form-related change would break.
Design / approach
Preferred: seed as part of
npm run worktree:link. That command already exists as the one thing you run in a new worktree, it is documented in AGENTS.md as such, and it is where an agent already looks. Add a step that runs the blog'sdb:migrate+db:seedwhenexamples/blog/db/dev.dbis missing.Constraints on the implementation:
dev.db. The script's existing contract is "never overwrites an existing path, never creates a dangling link, safe to re-run"; keep it.@webjsdev/cli, so it has to run AFTER thenode_moduleslinks are in place.Alternative, weaker: make the failure self-describing. Have the blog fixtures detect an empty
poststable and fail with "the blog database is not seeded; runcd examples/blog && npm run db:migrate && npm run db:seed". Cheaper, and it does remove the misdiagnosis, but it still leaves four red tests in every fresh worktree, which trains agents to ignore red.Doing both is reasonable: seed automatically, and keep a clear message for the case where seeding was skipped.
Implementation notes (for the implementing agent)
Where to edit
scripts/link-worktree-deps.mjs. This is the whole ofnpm run worktree:link(rootpackage.json). Add the seed step at the END, after thenode_modulesandpackages/core/distlinks, since seeding resolves@webjsdev/clithrough them.examples/blog:npm run db:migratethennpm run db:seed(they wrapwebjs db migrate/webjs db seed, seeexamples/blog/package.json).examples/blog/db/seed.server.ts. Confirm it produces at least two posts matching "web", which is what the e2e asserts.test/integration/blog-http.test.mjsand theprogressive enhancement (JS disabled) (#183)block intest/e2e/e2e.test.mjs.Landmines
examples/blog/db/dev.dbis gitignored, so it will never arrive with a checkout. Do not "fix" this by committing the database.node_modulesat all untilworktree:linkruns, so any seed step must come after linking or it cannot resolve the CLI. See the fresh-worktree section of AGENTS.md, and dogfood: a fresh git worktree can't resolve @webjsdev/* (no node_modules) #954.examples/blog.packages/core/distis built, not committed. If you extend the script, keep that step working; PR feat: make a bound form submitter carry its own submission #1317 hit a related trap where a staledistmade an e2e counterfactual pass vacuously.Invariants to respect
worktree:linkmust stay safe to re-run and must never clobber existing state (AGENTS.md, the fresh-worktree section).npm install.Tests + docs
test/repo-health/is where a script-behaviour test would fit if one is warranted.AGENTS.mddocuments whatworktree:linkdoes and should mention seeding.framework-dev.mdcovers monorepo dev commands.Acceptance criteria
git worktree add+npm run worktree:link, the four listed tests pass with no manual stepworktree:linkdoes not overwrite an existingdev.dbAGENTS.md's fresh-worktree section states that the blog database is seeded, so an agent reading it is not surprisedexamples/blog/db/dev.dbdeleted and the new step disabled, the four tests fail as they do today