Repository navigation
chore: squash the platform migrations into one baseline per capability before launch - #503
Merged
Merged
Conversation
The Migrator only runs ids above the ledger's highest and never backfills, so a database migrated by another history (one from before a squash, or a branch's own steps) would silently skip steps. migrate now compares the ledger with the record up to the lower of their highest ids, inside the Migrator's locked transaction, and fails with a BadState MigrationError that names the id, both steps, and `pnpm dev reset`. Ids above the record's highest pass, so an earlier build can still start after a newer one migrated. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… steps Inventory.upgrade existed for company databases created by earlier inventory shapes; none worth keeping exist before launch. initialize now creates the whole inventory (uploads, file handle key, object-id lookup, mutation keys) in its one idempotent pass, and ensureReady leaves ready placements alone instead of opening a pool to run the checks. The schema matches the old initialize-plus-upgrade output exactly on PostgreSQL and PGlite. The upgrade-only tests go; the portable contract keeps the reinitialization check for the file handle key, inventory and rows, and the int8 resource revision read-back. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Production has not launched, and the fifteen platform steps carried backfills and upgrade tests for databases that only exist in dev and the disposable spike. Each capability now has one baseline, ids 1 to 8 in foreign-key order (companies, auth, patches, company_database, runtime, integrations, limits, execution). They produce exactly the schema the old record did: pg_dump and a catalog listing of both match apart from the ledger rows. The new names differ from every old step's, so a pre-squash database fails the ledger check at id 1 and its developer runs `pnpm dev reset`. The upgrade-only tests for runtime, patches and the company directory go with the steps; the record's id test stays. Docs say when upgrade tests come back. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The supervisor runs detached with its output discarded, so when migrate failed (now including a ledger from before the squash) `pnpm dev` said "see dev.log" and dev.log said nothing. The supervisor now writes the migration error there, including the `pnpm dev reset` advice. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The case dropped patchy.mutation_keys to model a company database from before mutation keys and relied on ensureReady to recreate it. Inventory upgrades are gone with the squash, so the sweep no longer calls ensureReady first: its placements come from listReady and are ready. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
#432 added it for company databases created before mutation keys: a 42P01 on the key lookup ran ensureReady, whose inventory upgrade created the table, then read again. The upgrade is gone with the squash. withCompany only opens ready placements, and a placement turns ready only after Inventory.initialize created mutation_keys, so the retry could only repeat the same failing read. A missing table now answers SourceUnavailable directly, as it did after the retry. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The squash removed the lifecycle migration, and with it any patch deleted before it, so the note about legacy deleted ids describes nothing. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
That cleanup was an inventory upgrade step and went with them in the squash. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Owner
Author
|
Codex review (GPT 6.1 Sol, read-only): one minor finding, now fixed.
|
allisonmahmood
added a commit
that referenced
this pull request
Oct 3, 2026
#504) The test suite had grown expensive without growing more useful. A whole-repo audit (seven area reviews plus an independent Codex pass and a discussion round) found three patterns: - **The CLI tests were two thirds of offline test time.** Most of that went on tables of pure-function cases, each one spawning the bundled CLI and often a real Vite build. - **`cli-smoke` spent about 4 minutes testing its own harness** (Windows command lookup in a script that refuses Windows, port retries, temp-dir cleanup) before the real end-to-end run. - **Tests that add nothing:** duplicates of stronger tests, tests of Effect Schema rather than our code, tests pinning features that were removed, exact-copy assertions, and padded matrices. This removes or moves them, keeping every behaviour that only those tests proved. **What changed** - **Ownership between layers.** Unit tests (stubbed instance) own CLI mapping, formatting and exit codes. The packed e2e owns "the installed artifact works against a real server", one representative path per journey. Its discovery flow, `--json` ladder, no-key and login-resume blocks are gone. It keeps the real foreign-share refusal and the login → logout → key refused proof. - **Pure checks run in-process.** HTML bundle inspection, page-import syntax, description sync and the definitive publish refusals (now `Api.isDefinitivePublishRefusal`, tabled over the whole ADR-0004 list) run in-process. A few CLI rows stay to prove each check is wired into the real publish and dev builds. - **`cli-smoke`.** The three probe modes are replaced by one `--cleanup-check`: an orphaned process group that ignores SIGTERM is killed, its port closed and its temp root removed. It takes under a second. Along the way, `cleanup()` no longer sits up to 15 s after PASS (a race timer was never cleared). - **Fleet controller-state cases run over in-memory tasks** whose supervisors fence epochs. Real processes stay for fencing, adoption, draining, metering, the fleet budget and one real watchdog kill. The other breaker kills are synthetic reports through the real collection path. - **Browser.** The Firefox project and the manual-only `@print` test are gone (Chromium desktop is the supported browser). The members tier 2 test runs on a 1 s reconcile tick. `subscriptions-recovery` deliberately keeps 30 s, because its long interval is what proves writes arrive through NOTIFY. The CSV codec table moved to `csv.test.ts`. - **Removed outright:** feature-deletion tests and the dead `/d/*` route, Effect Schema round trips, same-engine duplicates (including offline copies of races `postgres-concurrency` owns), the openability-seam tests, PGlite legs that check nothing PGlite-specific, and Supervisor wall-clock upper bounds that fail under load. **Effect (this machine, full offline suite with the gap-tests PR on top):** 1,625 → 1,537 tests, 1,494 s → 1,033 s cumulative test time, test-phase wall 173 s → 101 s. The longest file is 101 s instead of 140 s. Locally `packed-cli-e2e` goes from 162 s to 109 s, plus the ~4 min of probes CI ran first. This PR alone is 110 files, +5,173 / −10,040. Coverage gaps the audit found are filled in the stacked PR. The migration squash is #503. Made by Claude Opus 5.5 via Claude Code --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.
Before launch (#416) no database we need to keep exists, yet the platform record carried 15 migrations, and several tests and code paths existed only to upgrade databases built by older steps (decision O1 from the test audit). This squashes each capability into one baseline that builds exactly today's schema, and deletes the upgrade-only code and tests with it.
_baseline, so an old ledger can never match the new history by name./tmp/lane-e-proof): databases built from main's record and from this record have identicalpg_dump --schema-only, identical data apart from the ledger, and an identical catalog listing (columns, defaults, constraints, indexes, functions, triggers, grants). That holds for the platform database, a Postgres company inventory and a PGlite company directory.packages/sql):migratenow refuses a ledger whose history differs from the record's, up to the lower of the two highest ids. The Migrator only applies ids above the ledger's highest, so a pre-squash database would otherwise silently skip the baselines and every future migration with an id up to 15. Ids above the record's highest still pass, so an older build can start after a newer one migrated (the rollback in OPERATIONS.md). The dev runner now writes the refusal todev.log.Inventory.upgradeand its calls in bothensureReadys, the mutation-key lookup's missing-table retry (added in feat(runtime): make server mutations atomic and safe to retry #432 for databases created before mutation keys), and the upgrade-only tests:runtimeandpatchesmigrations.test.ts, the directory migration block, two inventory-upgrade tests, and an orphan-sweep case for retained inventories. Docs: DEVELOPMENT.md,packages/sqlREADME and CONTEXT (new Baseline term), ADR-0003/0009/0012, product.md, API.md.After this merges:
pnpm dev reset, which wipes its local data. An instance that isn't reset refuses to start and says why indev.log.patchy devdata in patch repos made by a CLI older than feat(primitives): let patches look up and assign company members #449 needspatchy dev reset.Upgrade tests start again with the first migration that has to keep retained state.
Made by Claude Opus 5.5 via Claude Code