Repository navigation
feat(driver-sql)!: the file family's column holds the bare sys_file id, per deployment (#15989) - #17403
Conversation
…a codec Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XTBcV7zZHmokdyQgXjbyEU
… JSON-column parity pin arm-aware Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XTBcV7zZHmokdyQgXjbyEU
… dialect Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XTBcV7zZHmokdyQgXjbyEU
…asting null away Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XTBcV7zZHmokdyQgXjbyEU
…le id, per deployment Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XTBcV7zZHmokdyQgXjbyEU
…ng it Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XTBcV7zZHmokdyQgXjbyEU
📓 Docs Drift CheckThis PR changes 1 package(s): 8 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 1 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 10 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 9b2f633d4986cb7d7b0c5282a4690990d695d7c8 && git checkout 9b2f633d4986cb7d7b0c5282a4690990d695d7c8
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 776d64cd3da79e30c8fc87783020e3e52c3a7c28 d76b8ef8c3d79056b9d67dcf08a9371e858424be && git checkout -B drift-repro 776d64cd3da79e30c8fc87783020e3e52c3a7c28 && git merge --no-ff d76b8ef8c3d79056b9d67dcf08a9371e858424be
node scripts/docs-audit/affected-docs.mjs --json 776d64cd3da79e30c8fc87783020e3e52c3a7c28
|
…and its kernel→driver supply (objectstack-ai#15989) (objectstack-ai#17859) Fixes objectstack-ai#15989 Clause-②: yes Step 2 of the maintainer ruling on objectstack-ai#15041, completed. PR objectstack-ai#17403 landed the encoding half; this lands the two things it named as still owed — **the kernel→driver supply seam** and **the column step** — under the director ruling `5643444495` (decision batch objectstack-ai#120 item 1). ## ⛔ The ruling supersedes the card body in two places, and both are honoured **1 · Keying.** The card body's "Shape of the change" item 1 says the wiring is keyed on the `adr-0104-file-references` flag. That is **overturned**. The arm is keyed on `sys_migration.columns_moved_at`, and it additionally requires the flag to be verified — never the flag alone. The reason is measured, not formal: every creation-attested store since 17.0 holds that flag **and** JSON-quoted ids in a JSON column, so flag-keying would read every existing deployment as migrated and then write bare ids into a JSON column. `adr0104-file-columns-moved-supply.test.ts` pins exactly that row — verified, unstamped — as "not moved". **2 · The migration SQL.** The addendum's `USING (col #>> '{}')` is **not used bare**. It is preceded by the pre-check the dev seat measured, which aborts on a non-JSON-string cell. See the ablation below: the superseded form was executed on live PostgreSQL 16.13 in this PR's own suite, and it does not abort. ⭐ Worth carrying forward, in the card's own words: *"an Execution paragraph is authoritative about intent, not immune to being wrong about SQL."* ## The ablation — the single most important measurement here Both clauses, executed on one fixture (one converted cell, one inline blob the backfill has not reached), in `sql-driver-15989-file-column-move.test.ts` §1, on every dialect this step serves. | clause | what happened | |:--|:--| | **superseded** — `ALTER … TYPE varchar(2048) USING (col #>> '{}')`, alone | **ACCEPTED**, exit 0, no warning. The column is no longer `json`, so the unconverted object is now a plain string in a column whose declared contents are bare ids. | | **this PR** — the same DDL behind `json_typeof(col) IS DISTINCT FROM 'string'` | pre-check answers **1** ⇒ the step runs **no statement**. Cells byte-identical, column still `json`. | | **CONTROL** — the same pre-check on a fixture with no unconverted row | answers **0** ⇒ the move proceeds, producing bare ids, `NULL` preserved. So the `1` above is a reading, not a pre-check that always blocks. |⚠️ **What is lost differs by dialect, and the PR states the two separately rather than averaging them.** On PostgreSQL the `json` type stores its input text verbatim and `#>> '{}'` hands that same text back, so the **bytes survive and the TYPE is destroyed** — which is exactly why the defect is invisible to a byte diff. On SQLite there is no type to lose, so the loss is in the **bytes**: `json_extract` re-serialises the blob and its formatting is gone. Either way the superseded form wrote to a row it was required to refuse. Reproduced outside the suite first, against a cluster started for the purpose (PostgreSQL 16.13, port 54331, torn down afterwards); the readings are in the report. ## The seam — "every way of not knowing answers not moved"⚠️ **Why the wiring is owed: ruling item 2, not a zero-hit reading.** `fileColumnsMoved` had no supplier outside `driver-sql` on the dispatch base — re-measured here with a same-subject control, asking the identical question of each of `SqlDriverConfig`'s own added keys over the same corpus and package boundary: `schemaMode` 72 files · `autoMigrate` 14 · `sqliteAbsentFile` 6 (the firing control, and it includes a real host wiring site, `service-datasource/src/default-datasource-driver-factory.ts`) · `sqliteJournalMode` **0** · `fileColumnsMoved` **0**. ⛔ So the zero proves only that there was no supplier — `sqliteJournalMode` reads zero too and is a perfectly ordinary optional key no host sets. What makes this one owed is the director ruling's item 2, which places the kernel→driver wiring inside this dispatch rather than after it. `ObjectQL.registerDriver` hands every driver that has the seam a closure over the new `ObjectQL.haveFileColumnsMoved()`. Pinned on both sides — thirteen engine-side cases and twelve driver-side ones: - option omitted · resolver throws · resolver rejects · resolver answers a non-`true` value · resolver never runs (the host never calls `initObjects`) · driver has no seam at all; - no `sys_migration` object · no row · unreadable table · null stamp · empty-string stamp · stamp on an unverified row · stamp on a row with blocking findings; - ⭐ and the **control** in both files: a verified row **with** a stamp answers `true`, so every `false` above is a reading rather than a welded-shut arm. ⛔ **A host that names `fileColumnsMoved` in its own config wins, in either polarity.** The engine only fills an empty slot. Overruling a declared `false` is the bare-ids-into-a-JSON-column failure this whole mechanism exists to prevent; overruling a declared `true` writes JSON into columns already retyped. The host is the more specific authority about its own storage, so the engine never contradicts it. A resolver arriving **after** the first `initObjects` is also refused: `registerObjectMetadata` has already frozen `isJsonField`'s answer for every media column, so a late resolver would be a promise the driver cannot keep. ## The column step `os migrate files-to-references --apply` gains it, and it moves nothing until three gates pass: the migration's own gate (zero blocking rows), **every** pre-check across **every** planned column, and no refusals. Two-phase on purpose — a step that moved three columns and aborted on the fourth leaves a datastore in a state no flag can describe. The shape is read off the column's **physical type**, never off the dialect: a `json` column is retyped; a column already `varchar` — the population `os generate migration --format sql` creates and a JSON-arm driver fills with quoted ids (objectstack-ai#15771) — has its values unquoted in place. Classifying by dialect would have left that population full of quoted ids behind a `columns_moved_at` stamp claiming it was converted. ⛔ **MySQL is out of scope and refused by name**, per ruling item 3 — objectstack-ai#17788 owns it, on a real instance, because the addendum leaves its statement ORDER unsettled. `mediaColumnMoveDialect('mysql')` answers `null` and the step reports a named refusal. §5 pins that refusal so nobody "completes the matrix" by transcribing a form nobody has run — which is the move that produced the Postgres clause this card had to overturn. ## Per-dialect pin results `sql-driver-15989-file-column-move.test.ts`, both arms, both encodings, across the window: - **SQLite** — 7 passed, 1 skipped (the unprovisioned PG cell, named). - **live PostgreSQL 16.13** — 13 passed, 0 skipped, with `OS_TEST_POSTGRES_URL` provisioned. - ⛔ **MySQL — NOT MEASURED, and not a cell.** No `mysqld`/`mariadb` binary and no docker daemon in this container; more to the point the step has no MySQL statements to measure. This is a named absence, never a pass and never a fail. §3 is the reverse verification the card asks for: after the move, a driver on the **moved** arm writes a bare id and reads it back unchanged, and reads the row the move itself converted; §3b holds the other half of the window, where an **unmoved** deployment still stores and reads its JSON-quoted id.⚠️ One fixture correction worth naming: the SQLite cell is `:memory:`, so two driver instances are two **separate** databases — a §3 written against it would have been green while measuring nothing (the second driver creates its own table, its own writes read back perfectly, and the migrated rows are simply absent). The suite uses a file-backed SQLite database so the two arms share bytes, as the live cells already do. ## Changeset `.changeset/15989-file-family-column-step.md` — `minor` on the five packages that publish a change, with the launch-window `**BREAKING**` banner, and the ADR-0087 disposition **not-required (no-migration-prescription)** derived from this diff: nothing authorable moves. `DataMigrationFlagSchema` and its `columns_moved_at` member landed under objectstack-ai#16185 and are read here, not edited; the one `packages/spec` edit is a new exported predicate function over that existing type. So `os migrate meta` has nothing to visit, `spec-changes.json` nothing to project, the upgrade guide no row to gain. The other four categories are closed on facts in the changeset itself. ## Verification Every exit code captured by redirect-then-`$?`, never across a pipe. **Suites — each package's own `test` target, unnarrowed. ⛔ No `--project` filter anywhere** (a `--project` filter silently drops a named file outside that project and reports it as passing — objectstack-ai#17853). | package | tiers | files | tests | |:--|:--|--:|--:| | `@objectstack/driver-sql` | single | 182 passed, 3 skipped (185) | 3213 passed, 81 skipped (3294) | | `@objectstack/cli` | **unit + integration, both** | 246 passed (246) | 3247 passed (3247) | | `@objectstack/objectql` | single | 298 passed (298) | 4990 passed (4990) | | `@objectstack/spec` | single | 472 passed (472) | 13434 passed (13434) | | `@objectstack/platform-objects` | single | 40 passed (40) | 571 passed (571) | `driver-sql` ran against **live PostgreSQL 16.13** with the server at `Asia/Shanghai` and the process at `America/New_York`, matching how `ci.yml` provisions the live matrix — the live suites assert a three-way zone skew and are vacuous on a UTC server, which is a guard, not an obstacle. ⛔ **MySQL: NOT MEASURED.** No `mysqld`/`mariadb` binary and no docker daemon in this container — and the column step has no MySQL statements to measure in the first place (objectstack-ai#17788). A named absence: never a pass, never a fail. **Gates.** `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived **103** families for this diff; all 103 were run and reconciled with `--ran`, each carrying its real exit code, so the NOT-MEASURED zero is derived rather than claimed. ⛔ Four hit `exit 3` (PREREQUISITE NOT MET — never a pass) and went green after a full `pnpm build`: `check:dual-build-cjs-loads`, `check:i18n`, `check:i18n-coverage`, `check:i18n-walk-parity`. **Four gates went genuinely RED on my own first draft, and are recorded rather than smoothed over:** - `check:doc-authoring` — a tracker id in two runtime strings an operator reads. Fixed by removing the id from the driver's refusal text and by writing the engine's log literal once instead of duplicating it. - `check:engine-double-contract` / `check:objectql-double-limit` / `check:where-matcher` — all three on my new fakes. They now route `update()` through `assertEngineUpdateDispatch`, apply the caller's `limit` by presence after the filter, and REFUSE a combinator they do not implement instead of reading it as a field name. The last one matters here more than usual: a matcher that answers "no rows" for a filter it does not understand is indistinguishable from an empty ledger, which is exactly the false "not moved" every case in those files is trying to tell apart from a real reading. **Cross-package reverse verification** (an additive optional member on a type crossing a package boundary is exactly the shape a cached `.d.ts` answers the same way twice, so both legs were run): planting `MediaColumnMoveScan['plansZZ']` in `@objectstack/cli` goes RED with `TS2339: Property 'plansZZ' does not exist on type 'MediaColumnMoveScan'` (leg 2 exit 1), while the real member typechecks (leg 1 exit 0) — so `tsc` is reading `driver-sql`'s rebuilt declaration, not a cached one. Restored under a `trap … EXIT INT TERM` with repo-absolute paths via `git checkout HEAD -- path`, and the restore proven by state rather than by an exit code: `git hash-object` back to `88f1ad9944` byte-identical to the HEAD blob, `git diff HEAD` empty. All gate figures above are read at the final commit `303d7946e4`; the reconciliation and the suites were re-run on the head that produced them rather than on the tree that first did. The last commit is a one-line correction inside the ADR-0087 marker — the seat's review measured my rationale's counts as understated, I re-measured them independently off the three-dot diff and got the same answer, and the marker now NAMES what it counts so a reader can recount it: **13** new declarations reaching a package entry (11 on `@objectstack/driver-sql`'s entry — 6 values and 5 types — plus `recordFileColumnMove` on `@objectstack/platform-objects/system` and `hasMovedFileColumns` on `@objectstack/spec`) and **3** new public methods on exported classes (`SqlDriver.planMediaColumnMove`, `SqlDriver.setFileColumnsMovedResolver`, `ObjectQL.haveFileColumnsMoved` — none private or protected, on classes exported at `sql-driver.ts:4514` and `engine.ts:2768`). The level, the BREAKING banner and the disposition itself are unchanged; the clause those counts support is simply more true at 13/3 than at the 5/2 I first wrote. Control-byte self-scan over all changed files: zero hits, with a control that fires on an in-class byte (0x0B). `pnpm check:nul-bytes` exit 0. ## Acceptance notes - **filed as objectstack-ai#17869:** a non-`Command` module under `packages/cli/src/commands/` makes EVERY `os` invocation warn `findCommand … not found` on stderr, because the oclif command table is a `**/*.js` glob — and it corrupts machine-readable output for any consumer that reads stdout and stderr together (`os validate --json` then fails `JSON.parse`). Found because my own first draft put the column-step helper there; that instance is fixed in this PR by moving it to `src/utils/`, where every other CLI helper already lives. The missing GUARD is the card: `check:cli-command-ids` walks the same population but asks the opposite question, and the trap was caught by exactly one of 3247 CLI cases. Dedup ran before filing, with a firing control. - `noted, not filed:` the docblock on `SqlDriverConfig.fileColumnsMoved` pointed at `SqlDriver.setFileColumnsMoved`, a method that did not exist — a dangling link left when the option landed without its supply. Repaired in place by this PR, since the method the link wanted is the one this PR adds. Successor: none needed, it is fixed here. - `noted, not filed:` `readDataMigrationFlag` dropped `columns_moved_at` on the way out, so a moved deployment was indistinguishable from an unmoved one to every caller reading the ledger through it. Fixed here because the column step is the first caller that has to tell them apart. Successor: none needed. - `noted, not filed:` the TS and SQL halves of the generator still disagree on this family's width — `generateMigrationSql` emits `VARCHAR(2048)` while `generateMigrationTs` emits knex's `varchar(255)`. Carried from the objectstack-ai#17403 round, which named the column-step seat as its successor. This PR retypes to 2048, the SQL half's width and the one the ruling calls the end-state, so the disagreement is now between the generator's two halves alone. Successor: a `packages/cli/src/commands/generate.ts` card; the file is untouched here. - `noted, not filed:` `os migrate plan` prose for a media column still describes the JSON end-state, generated from the drift entry's message. Correct for an unmoved deployment and wrong once one can be moved — which this PR makes possible for the first time. Successor: the drift-message half of objectstack-ai#16184, which rewrites that arm. Authored by the `domain:engine` execution seat, session `https://claude.ai/code/session_01RuoNSXUbBoWHkNS4AknTrM`. (Carried in prose: on this repository the PR-body UPDATE channel does not recognise the session-URL footer block and appends a second, bare one — measured on the create/update pair for this very PR, so the platform's own appended footer below is left as the single one.) --- _Generated by [Claude Code](https://claude.ai/code)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
Part of #15989 — deliberately
Part of, not a closing keyword: the column step this card also names is not in this diff, and the half that remains is stated below so the card stays open for it.Executes the maintainer ruling on #15041 (decision batch #49 item 1), verbatim: 「15041 应该改为实际 id 保存。选A,其他同意」. The physical column for the file family —
file/image/avatar/video/audio— holds the actualsys_fileid, a bare id string in a string column, not a JSON-quoted id in a JSON column. The SQL generator already emittedVARCHAR(2048)for the family and does not move; the driver is the side that moves, per deployment.Clause-②: yes— the ruling's own word (published storage behaviour of@objectstack/driver-sqlchanges). Changeset isminorwith a**BREAKING**banner and an ADR-0087 disposition, under the launch-window rule.What this PR lands
1 · the family leaves
JSON_COLUMN_TYPES, and the arm is a per-deployment fact. A single-value media field is a JSON column on a deployment that has not moved its columns and avarchar(2048)on one that has.isJsonField,createColumn,varcharColumnCharsand the drift detector all ask the same one question (mediaColumnIsJson).multiple: truemedia is untouched on both arms — its value is a list of ids, it is a JSON column everywhere, andcreateColumndecidesmultipleabove its type switch.2 · the distinguishing mechanism, and why absence is the JSON arm. The addendum forbids keying on the
adr-0104-file-referencesflag alone: every creation-attested store since 17.0 and every earlieros migrate files-to-references --applyrun holds that flag and JSON-quoted ids. The evidence issys_migration.columns_moved_at(landed on #16185), reaching the driver as the new published optionSqlDriverConfig.fileColumnsMoved— a boolean or an async resolver, resolved once atinitObjectsand memoized. Every way of not knowing answers "not moved": omitted, throws, rejects, never runs, or a host that never callsinitObjects. Every flag row that exists in the world today lacks the field, so every existing deployment reads "not moved" with no extra logic, which is the direction the addendum requires.3 · the window reads BOTH encodings, on every dialect. MEASURED on live PostgreSQL 16.13 before this change: a JSON-quoted id in a generator-shaped
varcharcolumn read back with its quotes — the corruption #15771 named, alive on any deployment built byos generate migration --format sqland served on a server dialect.formatOutputnow decodes a JSON-encoded media cell on all three dialects and on both arms. It is a repair, not a second encoding flip: the write side is unchanged on the JSON arm, and the decode engages only on a leading",{or[— none of which can begin asys_fileid, a resolver URL or adata:URI. SQLite never had this defect; its read arm already parsed the cell and kept the raw string on failure, which is why the gap was a server-dialect one.4 · the drift detector moves with the writer.
JSON_COLUMN_FIELD_TYPESno longer names the family, because the family is not a constant on either side of the module cycle any more;diffManagedTabletakes afileColumnsMovedinput instead, and omitting it reproduces the previous verdicts exactly — the same intentionally additive posture thevarcharColumnCharsmirror already takes. Without this the ruled end-state column would be reported astype_mismatch/severity: 'error'with a remedy that converts it back tojson, i.e. every migrated deployment told by its own tooling to undo the ruling.5 · the generator pin is retired to coverage, in the same commit.
generate-field-type-vocabulary.pin.test.ts's block labelled 「recorded divergence, NOT coverage」 asserted that the driver DID seed the JSON set fromFILE_REFERENCE_TYPES. That is the ruling's own step 3, and it is not optional cleanup: the first edit of deliverable 1 reddens it by design. It now pins the retirement direction — the driver must NOT seed from the family again — with an anti-vacuity control on the neighbouring classes.The two decisions this card delegates, decided
schema-drift — folded in, and it was not a free choice. #15771 is closed (PR #16073) and its widening already spreads
FILE_REFERENCE_TYPESintoJSON_COLUMN_FIELD_TYPES, so the ruling's 「fold #15771 in or leave it adjacent」 is moot as written. What replaced it is an obligation:schema-drift.json-column-parity.test.tsholds the differ's JSON-class predicate equal to the writer's, so the moment the writer's answer becomes per-deployment the pin reds by name on those five types. Leaving schema-drift adjacent was therefore not available — the choice was between threading the arm and weakening a good pin. The arm is threaded, and the pin now asserts the agreement on both arms rather than at one point. This answers the question #16184 carries; that card is left open for its own seat to verify and dispose of rather than closed from here.born-fresh stores — option B, explicitly, and here is the cost. A datastore born after this lands is attested at
kernel:ready, after schema sync has already created its media columns, and at sync time no flag exists. The seam between column creation and attestation cannot be closed in this change, and recording a column step that did not happen is the one thing the mechanism must never do. So a born-fresh store starts on the JSON arm and needs oneos migrate files-to-references --applylike everyone else. The cost, named rather than left to be discovered: the bare arm has no standing canary — every dogfood boot exercises the legacy arm only, and the bare arm's coverage is the dialect matrix in this PR.⛔ What this PR does NOT land
The column step itself.
os migrate files-to-references --applydoes not yet retype or rewrite media columns, and nothing here moves any deployment's storage. That is deliberate, and it is the PM's own sequencing on this card (comment5556979386: 「the PG/MySQL decode arm → the registry-freeze rework of arm 1 → step 3 with its measured abort」 — this PR is the first two). Two reasons it is not folded in:SqlDriverConfig.fileColumnsMoved) that does not exist yet. Landing the migration without it is exactly the half-migrated storage format the card rules out.mysqld/mariadbbinary, no docker daemon —dial unix /var/run/docker.sock: no such file or directory). Landing an unrehearsed DDL sequence inside a data migration is the data-loss shape the previous round refused, and the PG half of that same sketch was already measured wrong:ALTER ... USING (col #>> '{}')does not abort on a non-string cell.Evidence
Dialect coverage, stated rather than implied.
OS_TEST_POSTGRES_URLwired, database dropped and the server stopped afterwardsDIALECT_CELLS, so CI'sTemporal Conformance (live PG + MySQL)job carries that cell; a missing URL there is a named skip, never a silent passRed before green, in the real direction. Three pins reddened by design before they were updated, each with the real output captured: the JSON-column parity pin (
expected [ 'address', 'audio', 'avatar', …(12) ] to deeply equal [ 'address', 'checkboxes', …(8) ]), the CLI vocabulary pin (expected '// Copyright …' to contain '...STRUCTURED_JSON_TYPES, ...FILE_REF…'), and the base-type-mismatch sweep.Ablations — two, each proved on disk and each restored by bytes. Every leg ran under a
trap … EXIT INT TERMwith an absolute path, restored withgit checkout HEAD --naming the file, and was verified bygit diff HEADempty plusgit hash-objectequal to the HEAD blob, with a fixed-string control grep that fires.mediaColumnIsJson()always answers "json" — the shape the driver has today, and the one a careless refactor restores). Predicted: the moved-arm cases red on both pin files. Observed 11 failed / 10 passed across both files, including all three arm-aware parity cases.this.mediaFields[object]— a bracket expression to grep), so that reading is void in both directions. The mutation's presence on disk rests on the blob-hash comparison and on the injected marker's grep, which fired (1). Ablation B usedgrep -Fthroughout and read 1 → 0 on the original line and 0 → 1 on the plant.Reverse verification that the consumer reads the rebuilt declaration — because an additive optional field is exactly the shape a cached
.d.tsanswers the same way twice. In@objectstack/cli's owndiffManagedTablecall: plantingfileColumnsMoved: falsetypechecks (exit 0, 0 errors); planting the one-character typofileColumnsMovedXgoes red withTS2561 … Did you mean to write 'fileColumnsMoved'?. Both legs restored,git diff HEADempty, blob equal.Gates. All 65 families
dispatch-gates.mjs --repo objectstack-ai/objectstackderives for this diff were run with their exit codes captured by redirect-then-$?, and reconciled with--ran: 65 accounted for — 65 run, 0 NOT-MEASURED (a DERIVED zero). Three needed their prerequisite met first and were re-run after it (check:dual-build-cjs-loadsandcheck:i18n-coverageafter a fullpnpm build;check:type-check-debtafter raising the heap past an OOM), andcheck:query-options-erasurecaught a real erased options bag in the new pin, which is now typed.pnpm lint— the whole-repo scan,node --stack-size=4000 eslint . --no-inline-config— ran green over 6491 files (0 errors, 0 warnings, count read from--format json) atd76b8ef8c3.Suites.
@objectstack/driver-sqlpnpm test: 168 passed / 11 skipped files, 2491 passed / 154 skipped tests.@objectstack/cli--project unit: 192 files, 2667 tests green (two of them neededpnpm --filter @objectstack/cli buildfirst — a PREREQUISITE NOT MET, re-run green after it).typecheckgreen on both packages. The media pins against live PG: 3 files, 54 passed / 3 skipped.Docs — measured, and the page needs nothing
content/docs/protocol/objectql/types.mdx:1148states the file family's stored value unconditionally:Decision: no edit, because that sentence is about the VALUE CONTRACT and this PR does not move it — it makes it MORE true, uniformly. The reasoning, with the two structural facts measured rather than assumed:
valueSchemaFor(def, form)pair inpackages/spec/src/data/field-value.zod.ts—FileReferenceIdValueSchemafor the stored form, the union withFileValueSchemafor the expanded one. That contract has been id-only since 17.0, andpackages/specis untouched by this diff.###type sections,location(line 1130) andaddress(line 1090) carry a**Database mapping:**block andfile/imagecarry none; and the Type Conversion Matrix has no row namingfile/image/avatar/video/audio, while the control rowjson/location/addressis present. So the page makes no claim this PR could falsify.varcharmedia column on Postgres or MySQL handed the value back as"file_01HXYZ", quotes included. After it, every dialect and both arms hand back the id. The per-deployment thing is the physical column, which this page does not state for this family.Adding a flag-window sentence here would introduce a physical-column claim the section does not currently make, in a section whose sibling mechanism for exactly that claim (
**Database mapping:**) the family deliberately does not have — and it would need a second edit when the window closes. The legacy direction is already carried, conditionally and correctly, by the callout directly below the sentence.Spot-check of the two pages that could not appear in an emitter-only diff (they name the family by its type names, sharing no identifier with
SqlDriver):content/docs/kernel/contracts/storage-service.mdxis clean — zero hits forcolumn/VARCHAR/stored value, against a control that fires 72 times ontypes.mdx.content/docs/permissions/attachments-access.mdxis not clean, and the direction is the opposite of the page above: line 19-21 saysField.file/Field.image「store a file URL in the record's own column」, which ADR-0104 D3 retired —isFileIdToken's own docblock says a URL 「can never match」. Filed as #17406 rather than folded in: touchingcontent/docspulls theBuild Docsjob into this PR's check set, a verification surface this diff otherwise does not have.Acceptance notes
Out-of-scope findings, noted and not filed — each with who would meet it:
generateMigrationSqlemitsVARCHAR(2048);generateMigrationTsemitstable.string('f_file'), i.e. knex'svarchar(255). The driver now matches the SQL half, because that is the width the ruling calls the end-state. Harmless for an id (~26 chars) but not for a legacy inline blob on a lax deployment. Not filed: it is insidepackages/cli/src/commands/generate.ts, which the ruling freezes for this card, and the next PR to touch the generator's width table is the one that meets it. Successor: the seat that lands the column step, which has to decide what width it retypes to.op.tosaysjsonwhile the driver's ownjsonColumnemitsjsonbon Postgres, andop.fromrenderscharacter varyingwith the width dropped. Carried over from the driver-sql(schema-drift): during #15989's dual-encoding window a staticJSON_COLUMN_FIELD_TYPEScannot serve both moved and unmoved deployments — ⚠️ the body's "reports the ruled end-state" framing is MEASURED FALSE, see comment 5588614136 #16184 round's measurement, still true, and it lives in the arm driver-sql(schema-drift): during #15989's dual-encoding window a staticJSON_COLUMN_FIELD_TYPEScannot serve both moved and unmoved deployments — ⚠️ the body's "reports the ruled end-state" framing is MEASURED FALSE, see comment 5588614136 #16184 rewrites. Successor: driver-sql(schema-drift): during #15989's dual-encoding window a staticJSON_COLUMN_FIELD_TYPEScannot serve both moved and unmoved deployments — ⚠️ the body's "reports the ruled end-state" framing is MEASURED FALSE, see comment 5588614136 #16184.os migrate planprose for a media column still describes the JSON end-state. It is generated from the drift entry's message, which is correct for an unmoved deployment and becomes wrong once a deployment can be moved. Successor: the column-step PR, which is the first change that can produce a moved deployment.Those three were not filed: each lands inside #15989's own remaining deliverable or inside #16184, and filing them separately would duplicate an open card's scope. One finding WAS filed — #17406, the
attachments-access.mdxstored-form error above — because it is an error rather than an omission, it is load-bearing on a page whose whole subject is access, and a targeted dedup scan over the 76 opendocumentationissues found no existing card for it (control termdocs: 51 hits, so the zero is a reading).Authored by Claude Code, session
session_01XTBcV7zZHmokdyQgXjbyEU(https://claude.ai/code/session_01XTBcV7zZHmokdyQgXjbyEU) — carried in prose because this PR body's UPDATE channel appends its own footer block and would otherwise leave two.Generated by Claude Code