Repository navigation
test(dogfood): a home field added to an object that already holds rows migrates as add_columns and the recompute fills it (multi-currency M2-4) - #30186
Conversation
…nd recomputed (multi-currency M2-4) Co-Authored-By: Claude <[email protected]>
📓 Docs Drift CheckNothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 0 changed package(s)), so this run has no opinion about the docs. What this run could not see
Coarse fallback — 0 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
|
epic:#8345#1 · os-bill · session_01Utp6CZWjnSeed8H4dMjt9d Seat review · PR #30186 · 31fe289..cf2a4d5 · TIER_DEFAULT Must-fixNone. Should-fix (non-blocking)
Confirmed
Local commands
Cleanup: PG stopped ( |
… before registerDriver, as the CLI does Co-Authored-By: Claude <[email protected]> Claude-Session: https://claude.ai/code/session_01Utp6CaGBD59SYKhNDMRa8h
|
epic:#8345#1 · os-bill · session_01Utp6CZWjnSeed8H4dMjt9d Seat ACCEPT · PR #30186 · Head-sha: 维护者速读
席位意见:证明成立,两条建议已改,可落地。 席位核对
|
Requested by Bill · project thread
epic:#8345#1 · os-bill · session_01Utp6CZWjnSeed8H4dMjt9d
Fixes #27194
Ruling-ref: 6465431966
Clause-②: no — one new test file under
packages/qa/dogfood/test/; no export, schema, route or accepted value changesMetadata-protocol: none
维护者速读
record模式写入 4 行,再补一行homeAmount指针和两个字段,走os migrate apply同一条延迟 DDL 路径加列,然后跑recomputeHomeAmounts回填。add_columns,回填就是 M2-3 的重算,不需要新门。packages/qa/dogfood/test/home-amount-added-to-existing-object.test.ts。OS_TEST_POSTGRES_URL=… npx vitest run test/home-amount-added-to-existing-object.test.ts(在packages/qa/dogfood,6 条,SQLite×2 + PG);跳过重算或跳过加列,各自变红。What changes
One proving test,
packages/qa/dogfood/test/home-amount-added-to-existing-object.test.ts, on three cells: better-sqlite3 (file), sqlite-wasm (file), PostgreSQL (one schema, named skip withoutOS_TEST_POSTGRES_URL). Each boot is its own engine and its own driver over the same database, as two processes are.currencyMode: 'record'with nohomeAmountand no home field. Four rows written through the engine: USD 10,000 (2026-03-15), USD 1,500 (2026-04-15), CNY 12.345, SEK 500 (no SEK rate row).os migrate applyruns it. The amount gainscurrencyConfig.homeAmount: { field: 'amount_home', rateDate: 'invoice_date', rateField: 'amount_rate' }and the two author-declared readonly fields it names (D8 rule 2). The driver boots withsetDeferredDdl(true)(the plan/apply deferral). Pinned:previewDeferredSchemaWork()for the object is exactly[{ kind: 'add_columns', columns: ['amount_home', 'amount_rate'] }], and nothing for any other table (no in-place work);detectManagedDrift()has no entry for the object;flushDeferredSchemaDdl()performs that same entry, and a plan after it is[];recomputeHomeAmounts, behindos migrate recompute-home-amounts, PR feat(objectql,cli): recompute stored home-currency amounts at the rates in force now, report first, rows without a rate listed and skipped (multi-currency M2-3) #30183):rate_missing, SEK, 2026-03-15) and skipped, its home field and rate stay blank, the run is not complete (homeAmountRecomputeCompletefalse), and a fresh write of that row is refusedERR_EXCHANGE_RATE_MISSING;Finding: the add-column path is ordinary. No refusal, no flag, no data loss: the two columns are a plain
add_columnsentry, as for any field added to an existing object. Nothing in the migrate path changed.The in-memory driver has no add-column path (it is schemaless), so it has no cell here; the recompute's in-memory face is
packages/objectql/src/engine-home-amount-projection.test.ts.Why
ADR-0144 D5: a home field added to an object that already holds rows is filled by "an explicit recompute operation" (the recompute's own header names this case). #27194's task asks for the proof that the R1-to-R2 upgrade is one pointer line, the ordinary migration and the recompute, with nothing new in the product.
Verification
OS_TEST_POSTGRES_URLset).scripts/ablation-replace.mjs(each mutation landed, anchor 1 → 0, file restored after):applyforced tofalse): 3 failed, one per cell, on the column read back: expected{ home: 71994.24, rate: 0.1389 }, received{ home: null, rate: null };add_columnsentry, and the recompute's apply writes nothing: its report carries onefailuresentry per row,no such column: amount_home(SQLite).npx tsc --noEmit -p packages/qa/dogfood: 0 errors.eslinton the file: exit 0.dispatch-gates --commands: 51 commands, exit codes captured before any pipe: 49 exit 0;check-plugin-teardown-shape --self-testexited 3 on the shallow clone and exit 0 after fetching its pinned fixture commit;pnpm check:dual-build-cjs-loadsexit 3, NOT MEASURED (it reads every package'sdist/; this worktree built only the test's closure), left to CI.No changeset: a test file in a private package releases nothing (
skip-changeset).Human Minimum
packages/specholds no runtime logic. (spec not touched)pnpm lintleft to CI).main, one pull request.packages/spectouched: n/a.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01Utp6CaGBD59SYKhNDMRa8h