Append-only migrations and the size ratchet
-
[E] Migrations are append-only: the job “Migrations append-only” compares
MIGRATIONSwith the base of the pull request (or the previous tip ofmainon a push) and blocks when a released migration was moved, removed or changed, whitespace included, or when its ID changed (#213), and the same against the last release tag. It also blocks a list that is not in strict order of valid IDs and a new migration with an ID older than the newest migration of the last release, the newest CalVer tag of all refs (owner, 2026-11-16); unreleased migrations may be merged in any order. On a hotfix branch it blocks every new migration (O19). It reads the migrations from their files (src/server/db/migrations/) and older layouts of a base fromschema.ts.pnpm checkruns the same gate offline against the localorigin/main(pnpm check:migrations; a warning withoutorigin/main), so a changed migration ofmainfails before the push (owner, 2026-11-16). It runs for every change. A schema snapshot (src/server/db/schema.snapshot.sql) shows the resulting schema in the review. See SQLite storage. -
[E] Size ratchet of
src/client/main.ts(#242, owner, 2026-11-16; form of 2026-11-19, #317 part 4: „lowered on main only“):main.tsmust not grow while #118 takes it apart. It must not have more lines than it has on its base, the branch it goes into: no file holds a limit any more (size-ratchet.jsonis deleted), so no branch edits a number and two branches that shrinkmain.tsdo not conflict for it.scripts/size-ratchet.ts(pnpm lint:size, part ofpnpm checkand of the CI job „Lint, types, unit tests with coverage, build“, so of the CI Gate) counts the lines of the working tree file and of the file on the base and fails when the file has more („move the code into a module or component (#118)“); fewer is fine and needs nothing. The base isHEAD^1in the CI (the job checks out two commits): the first parent is main for the merge commit that a pull request is tested as, so the check measures what this pull request changes and does not blame it for what main shrank after the branch started; for a push it is the commit before. Locally (pnpm lint:sizewithout an argument) it is the merge base withorigin/main, and the check is skipped whenorigin/mainis not fetched;node scripts/size-ratchet.ts <commit>takes another base. The limit goes down by merge: the pull request that shrinksmain.tsmerges,mainhas the smaller file, and every later change is measured against it, so the freed lines never come back. What a branch does: keepmain.tsat or below its length at the fork point (a feature puts its code into its own module); if it moves code out, it just commits the smallermain.ts, with no number to set. A feature that needs client code puts it into its own module, not intomain.ts. Onlymain.tsis limited. Lines are counted aswc -lcounts them, after Prettier, sinceformat:checkruns anyway [V]. Two pull requests whose changes ofmain.tsdo not conflict in git cannot add up to growth: each is at or below its base, so the sum of their changes is at most zero. The change of #317 part 4 removed the exact-equality rule (a smallermain.tsno longer fails until the limit is lowered): that rule needed the file with the number, and its job, to keep the freed lines from coming back, is done by the base moving down.