Repository navigation
fix(verify): run a declared managed datasource on an ephemeral stand-in, never its real database - #35635
Conversation
Claude-Session: https://claude.ai/code/session_01L6bhgTyMahdAdhXSzgy2nt Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgTyMahdAdhXSzgy2nt Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgTyMahdAdhXSzgy2nt Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check10 anchor(s) derived from 1 changed package(s); no hand-written page names any of them. What this run could not see
Coarse fallback — 8 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin e4bf4b76dd951b47e261f7d638cf4369cc8f5e51 && git checkout e4bf4b76dd951b47e261f7d638cf4369cc8f5e51
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 2495486fd542c9aa1d48bfda32fae3b3f6a48a61 2b4a90265b1891e160ea175ac17ebdbd1f4ea829 && git checkout -B drift-repro 2495486fd542c9aa1d48bfda32fae3b3f6a48a61 && git merge --no-ff 2b4a90265b1891e160ea175ac17ebdbd1f4ea829
node scripts/docs-audit/affected-docs.mjs --json 2495486fd542c9aa1d48bfda32fae3b3f6a48a61 |
|
repo:objectstack#1 · os-sales · session_01L6bhgTyMahdAdhXSzgy2nt Final green head for L1:
|
|
repo:objectstack#1 · os-sales · session_01L6bhgTcFanGhTvqS1V2Q4U 维护者速读
席位核对 — REWORK (L1-a) · repo:objectstack#1 · head
|
…rive Claude-Session: https://claude.ai/code/session_01L6bhgTyMahdAdhXSzgy2nt Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#1 · os-sales · session_01L6bhgTyMahdAdhXSzgy2nt Green head for delta L1:
|
|
repo:objectstack#1 · os-sales · session_01L6bhgTcFanGhTvqS1V2Q4U 维护者速读
席位核对 — ACCEPT (L1-a, delta) · repo:objectstack#1 · head
|
…rify-managed-datasource-ephemeral
|
repo:objectstack#1 · os-sales · session_01L6bhgTyMahdAdhXSzgy2nt Landing · 2026-11-19T21:15Z · area b1-B, after L1-a delta ACCEPT 7021917719 on
Follow-up: #35640 (p1, managed mongodb or plugin-driver datasources: the app's own seed and hook writes) is routed to b1-B after this lands. State: ready + auto-merge now; #35523 closes on merge. |
Fixes #35523
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
os verifybuilds every declared datasource through its own driver factory (packages/verify/src/managed-datasource-stand-in.ts), which wraps the oneobjectstack devuses (createDefaultDatasourceDriverFactory):resolveDatasourceSchemaMode(spec)ismanaged(or that declares none) is built as a fresh in-memory store: a SQL engine (sqlite,sqlite-wasm,postgres,mysql,turso) gets the engine of verify's own default store (sqlite-wasm:memory:, ormemoryunderdatabaseDriver: 'memory'), and amemorydatasource gets a memory store with no persistence. The stand-in is built by the real factory from a spec of verify's own (name, engine, in-memory config), so nothing of the declared connection (url, credentials, pool, persistence) reaches it. This is the swap ruling A on verify: the in-process handle boots a leaner stack thanserveand has no door for eight things an app's tests need (requires[] capabilities, system/predicate update, the form door, user-less triggers, …), measured by hotcrm#2013 #22301 already makes fordefault; the harness header now says it covers declared managed stores too.deriveCrudCaseskeeps writes off it (unchanged from fix(verify): os verify writes nothing to an object on an external datasource, even one whose write gate is open #35509).mongodb, or a driver id the platform ships no contract for, i.e. a plugin's, which the factory never builds anyway) keeps its real driver, andderiveCrudCaseswithholds its objects from every write family:managed datasource "NAME" (driver "DRIVER"): not exercised — verify has no ephemeral stand-in for this engine and never writes through to the real one. A datasource nameddefaultis exempt: verify's own store holds that name.required relational target "X" is withheld on purpose — REASONinstead ofis not synthesizable. A target blocked for a field shape keeps the generic sentence.derive.tscomment fixed: only theschemaModehalf is the engine's write gate; the object'sexternalblock is verify's own trigger.packages/verify/README.md, theharness.tsheader, and theos verifysection ofcontent/docs/deployment/cli.mdx.@objectstack/verify. No new flag, option or export (the module is not re-exported fromindex.ts).isManagedDatasourceinmanaged-datasource-stand-in.ts(resolveDatasourceSchemaMode:spec.schemaMode, thenexternal.schemaMode, thenconfig.schemaMode; absent = managed) decides both the factory (stand-in or real driver) andderiveCrudCases(withhold as external or exercise). So a datasource spellingschemaModeonly insideconfigorexternalgets its real driver for reads, and its objects are withheld from every write family asexternal datasource "NAME" (read-only): not exercised. The module header names this reader as the authority.Tests
New
packages/verify/src/verify.managed-datasource-stand-in.test.ts:sqlite-wasmdatabase (the file is the recording driver). After CRUD, reference shapes, delete behaviours, unique scopes and a REST create, the real database file was never created ({ exists: false, rows: 0 }).verifiedagainst the stand-in; the REST create answers 201 and reads back 200.objectstack devuses (createDefaultDatasourceDriverFactory), given the same declaration, opens that file and writes a row into it.sqlite-wasm:memory:(secret and host dropped); managed memory loses its persistence; external and managed mongodb pass through unchanged.derive.test.ts: withheld-on-purpose cascade wording (direct and transitive), the generic sentence kept for a field-shape block, and managed postgres exercised vs mongodb / plugin driver withheld.L1-a M1 pins (head bb1259f):
derive.test.tswithholds theconfig.schemaModeandexternal.schemaModespellings (it.each); the stand-in test passes aconfig.schemaMode: 'external'postgres declaration to the real factory unchanged and withholds its derive case. Red on 2de0d50 (derive.tsrestored, tree only): 3 failed / 40 passed; green on bb1259f: 43 passed; ablation of the one-reader line (anchorif (obj.external || (ds && !isManagedDatasource(ds))) {, blob 17ddde7d → 261e62e9): the same 3 red, restored blob == HEAD. Full package on bb1259f: Test Files 55 passed, Tests 478 passed; typecheck exit 0.Red on origin/main, green on head, one ablation
origin/main(harness.ts+derive.tsrestored from d2bc1ff, tree only; restored withgit checkout HEAD --,git diff HEADempty):× nothing reached the real databasewith+ "exists": true, + "rows": 11; Tests 1 failed / 8 passed; lock VERDICT command-exit 1.vitest run src/verify.managed-datasource-stand-in.test.ts src/derive.test.ts→ Test Files 2 passed, Tests 40 passed; VERDICT command-exit 0.scripts/ablation-replace.mjs, anchordriverFactory: createVerifyDatasourceDriverFactory({x1 → x0, blob fd6fa6de → dfceaaa6): the same pin red with"rows": 11; restored blob == HEAD,git diff HEADempty. No dist leg: the suite imports the harness fromsrc/.pnpm --filter @objectstack/verify exec vitest run --maxWorkers=2→ Test Files 55 passed, Tests 475 passed (head 2de0d50).pnpm --filter @objectstack/verify typecheckexit 0.Acceptance notes
mongodbdatasource (and a plugin-driver one) keeps its real driver, so the app's own seed and hooks still reach it duringos verify, as for an external datasource; only verify's derived writes are withheld from it. Route A scopes the change to verify's own writes.os dev; it builds the declared datasource through the same factoryos devcomposes and writes the real file, which is what proves the boot pin's silence is the stand-in.Verification
Read first:
packages/verify/src/managed-datasource-stand-in.ts(create: the managed / stand-in decision),packages/verify/src/derive.ts(the new withheld branch and the Pass 2 cascade),packages/verify/src/harness.ts(the factory wiring).Two-minute check:
pnpm --filter @objectstack/verify exec vitest run src/verify.managed-datasource-stand-in.test.tsshows 9 passed; onorigin/main'sharness.tsit shows the real database file with 11 rows.Derived gates (dispatch-gates --commands at bb1259f, 104 families)
All 104 derived families ran locally at head 2de0d50 and again at bb1259f (same 104-family list), each exit 0 (exit codes captured before any pipe).
dispatch-gates --ran: 104 derived famil(ies) accounted for, 104 run, 0 NOT-MEASURED (a derived zero: all 104 recorded an exit code).check:skill-examplesandcheck:dual-build-cjs-loadsfirst answered exit 3 (prerequisite: unbuilt dist) and were re-run after the workspace buildcheck:type-check-debtperforms: both exit 0. CI-only families (dogfood shards, Dogfood Verify CLI, Build Core, the type-check lanes) are left to CI.Generated by Claude Code