Skip to content

fix(verify): os verify writes nothing to an object on an external datasource, even one whose write gate is open - #35509

Merged
objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/issue-35255-verify-external-no-writes
Nov 19, 2026
Merged

objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/issue-35255-verify-external-no-writes

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #35255

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:应用作者对声明了可写外部数据源的应用跑校验时,校验不再往那个外部数据库里写测试数据,报告里把这类对象标成“外部、未演练”,之前会真的插入、改、删测试行。
  • 为什么做:校验工具承诺只在自己的临时内存库里写,这次补上外部数据源这个漏口,并把说明文字改成与实际一致。
  • 出错会怎样:最坏情况是外部对象少测一项、报告里显示为跳过,不会让校验失败,也不碰任何数据;可以直接撤回。
  • 要你做什么:无

What changes

  • packages/verify/src/derive.ts: deriveCrudCases now blocks every object on an external datasource, whatever its write gate says. Before, an object whose gate was open (the datasource's external.allowWrites and the object's external.writable) got a CRUD case with a synthesized body, and every write family that builds its records from that case (CRUD, RLS, reference shapes, delete behaviours, unique scopes, parent write reach, dashboard windows) wrote to it. The harness connects the app's declared datasources the way os dev does (ADR-0062 D1/D2, DatasourceAdminServicePlugin in harness.ts), so those writes went to the real database behind it. The skip reason names the gate's state: external datasource "NAME" (writes allowed): not exercised — verify writes only to its ephemeral store, or (read-only). A datasource counts as external the way the engine's write gate counts it (a declared schemaMode other than managed, or an object with an external block), so an object bound by schemaMode alone is covered too.
  • The seat's ruling (leave external objects out of the write phases, name them external and not exercised, no new flag or interface) is the shape implemented. It reuses the existing blocked / skipped reporting; no interface changes.
  • harness.ts header, the quotation of it at the sign-up site, packages/verify/README.md and the os verify section of content/docs/deployment/cli.mdx no longer say the harness "never touches a real database". They say what happens: its own database is in-memory; declared datasources are connected as under os dev, so reads reach them; verify's own writes never reach an object on an external datasource; a write the app makes itself (its seed, or a hook or flow one of verify's writes fires) goes where the app sends it; only --flow refuses every write routed away from the in-memory database.
  • Two tests used "a write-opted-in external object is NOT blocked" as their witness that datasources resolves across packages (ADR-0130 D4): packages/verify/src/artifact-collections.test.ts and the option-B probe row in packages/cli/test/fixtures/option-b-reader-probe.ts. Both now read the same map through the reason: it says (writes allowed) only when the datasource was found.

Tests

  • New packages/verify/src/verify.external-datasource-no-writes.test.ts boots one stack whose app declares an external datasource with an open write gate, backed by a driver the suite owns that records every write. It runs the CRUD round trip, reference shapes, delete behaviours and unique scopes over it. The recording driver receives no write, each family's report names the external object not exercised, and the CRUD report lists it skipped with (writes allowed). A managed object that requires it is skipped; one that only references it is verified. CONTROL: a write sent through the REST door to the same object does reach the recording driver.
  • derive.test.ts: the external block now pins read-only, half-open, fully open and schemaMode-only shapes, the cascade to a dependent, and a managed secondary datasource staying unaffected.
Ablation (one run, then restored)

node scripts/ablation-replace.mjs on packages/verify/src/derive.ts, restoring the old behaviour (let a fully write-opted-in external object through): anchor x1 to x0, blob d29f7503 to 0aa7a191. The suite resolves derive.ts from source (relative import), so no rebuild was needed for this leg.

  • Mutated: Tests 2 failed | 1 passed (3). The recording driver received 10 writes (expected []), every one a create on vxn_remote, from the four families run. The CRUD row read vxn_remote read-failed (404) instead of skipped.
  • Restored: blob after restore d29f7503 == blob at HEAD, git diff HEAD empty.

This also measures the card's premise: the harness does connect the declared external datasource, and the derived writes do reach its driver. Against a real database they would land.

Acceptance notes

  • Not changed, and now stated in the header and docs instead of hidden: the boot is the app's, so a write the APP makes to an external object (its seed datasets for that object, or a hook or flow that a verify write fires) still goes to that datasource, as under os dev. Confining every write the way --flow does (a middleware refusing writes routed away from the ephemeral driver) is the other shape the card allowed; the seat ruled for this one. Read from the code (the seed loader and the engine's write gate do not gate on verify), not measured.
  • An object the app routes to a declared MANAGED datasource (not external) is still written through that datasource. If an app points such a datasource at a real database, verify writes there. Out of this card's scope (the card is about external datasources); read from the code, not measured.
  • A managed object that requires a reference to an external object is reported with the existing cascade sentence (required relational target "X" is not synthesizable), which does not say the target was withheld on purpose. Wording only.

Verification

Two-minute check: pnpm --filter @objectstack/verify exec vitest run src/verify.external-datasource-no-writes.test.ts. Expect 3 passed, with no write recorded by the external driver.

Read first:

  1. packages/verify/src/derive.ts, the external branch of pass 1: the only behaviour change.
  2. packages/verify/src/verify.external-datasource-no-writes.test.ts: the recording driver and the control.
  3. packages/cli/test/fixtures/option-b-reader-probe.ts: the witness row's new lost predicate.

Local readings are in the report comment on the card; CI runs the rest.


Generated by Claude Code

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

2 anchor(s) derived from 1 changed package(s); no hand-written page names any of them. ⚠️ 1 changed file(s) yielded no anchor (packages/verify/README.md), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/verify/README.md) — pages documenting those are invisible to this run
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 8 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json d76d57ab466a4aae62f80f135d4ccbd4b1a42a1f → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 5ef3eaacf2ec0711511aa34719936f359d40c7fd — the merge of head ff7922b62bfb4d287c3c8e0ff586d169f7014353 into base d76d57ab466a4aae62f80f135d4ccbd4b1a42a1f, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 5ef3eaacf2ec0711511aa34719936f359d40c7fd && git checkout 5ef3eaacf2ec0711511aa34719936f359d40c7fd
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin d76d57ab466a4aae62f80f135d4ccbd4b1a42a1f ff7922b62bfb4d287c3c8e0ff586d169f7014353 && git checkout -B drift-repro d76d57ab466a4aae62f80f135d4ccbd4b1a42a1f && git merge --no-ff ff7922b62bfb4d287c3c8e0ff586d169f7014353

node scripts/docs-audit/affected-docs.mjs --json d76d57ab466a4aae62f80f135d4ccbd4b1a42a1f

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

… and pays its boot imports at collection

Claude-Session: https://claude.ai/code/session_01L6bhgTyMahdAdhXSzgy2nt
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgTyMahdAdhXSzgy2nt

Final green head for L1: 2c3c6e69d38783cda92dd87fcdddd0d40b02a0b7(2026-11-19T14:00Z)

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgTcFanGhTvqS1V2Q4U

维护者速读

  • 用户能看到什么变化:os verify 不再往外部数据源上的对象写测试数据,哪怕该对象开了写入;报告里会写明“外部数据源,未测”。
  • 为什么还不能落:README 和 harness 头注释新写的一句说“verify 自己的写都不会到达应用声明的数据源”,但应用若把对象绑到一个声明的 managed 次数据源,verify 仍会写过去(开发自己的报告也这样说)。这句随 npm 包发布就是假话。只需把两处措辞收窄,不改代码。
  • 要你做什么:不需要你做任何事,区域修完再送审。

席位核对 — REWORK (L1-a) · repo:objectstack#1 · head 2c3c6e69d38783cda92dd87fcdddd0d40b02a0b7 · 2026-11-19T14:03Z

  • 形态 — draft, base main, 5 commits, 11 files, +367/−67. Merge-base 5756ae0d. check-governed-merges.mjs --pr 35509: NOT governed, 434 lines ≤ 3000. Clause-②: no, Metadata-protocol: none; no contract face ⇒ no L2 owed. Fixes #35255 is right once M1 lands: the seat-ruled shape (leave external objects out, name them "not exercised", no new flag) is built.
  • Must-fix M1 (prose only) — two sentences this PR writes claim more than the code does:
    • packages/verify/README.md (shipped: files lists README.md): "Datasources the app declares are connected …, so reads of an object bound to one reach that datasource. Verify's own writes do not: every derived write family leaves an object on an external datasource out …". The justification covers external datasources only; an object the app binds to a declared datasource with schemaMode: 'managed' (or none) is not blocked by deriveCrudCases and is written through that datasource, the dev's own second out-of-scope finding (os-dev-report 7011226452).
    • packages/verify/src/harness.ts header: "What verify itself writes stays here: every derived write family leaves an object on an external datasource out …" — same overclaim.
    • Fix: say what holds, as content/docs/deployment/cli.mdx in this PR already does ("no stage below writes to an object on an external datasource"): verify's own writes never reach an object on an external datasource; an object bound to a declared managed datasource is written through it, as under os dev. That keeps the card's "the header and docs match what the test shows". No code or test change needed; L1 delta will read only these lines.
  • Read and holding (carried to the next head if only M1 moves):
    • derive.ts: every object with an external block, or on a datasource whose declared schemaMode is a string other than managed, is blocked with external datasource "NAME" (writes allowed | read-only): not exercised — verify writes only to its ephemeral store; the gate state only words the reason. The engine's gate (externalWriteGateClosure, engine-registration.ts) is exactly the schemaMode half; the external-block half is verify's previous trigger, kept. nit: the changeset attributes both halves to "the way the engine's write gate counts it" — only the first is the engine's.
    • Every write family reads the same case: rls.ts (if (c.blocked) skip), reference-shape.ts, delete-behavior.ts, unique-scope.ts, parent-write-reach.ts, dashboard-window.ts all consult deriveCrudCases(...).blocked (read at this head).
    • New verify.external-datasource-no-writes.test.ts: one boot, a recording driver behind a writable external datasource, CRUD + reference shapes + delete behaviours + unique scopes run; zero writes recorded, each family's report says "not exercised", the CRUD report names the gate open, a requiring managed object skipped and a referencing one verified; CONTROL: a REST create to the same object does reach the driver. The ablation (old derive.ts: 10 creates reached the driver) is in the report.
    • Changeset, README and cli.mdx otherwise read sentence by sentence: the seed/hook/flow sentence and the --flow confinement sentence match the code and the ruled shape.
  • Your question 1 — the four files outside the claimed surface: accepted. option-b-reader-probe.ts row B2 and artifact-collections.test.ts are cross-package witnesses of deriveCrudCases's datasource map that asserted an unblocked write-opted-in external case; this PR makes that assertion false by design, so they had to move, and each now reads the map through the reason's (writes allowed), which still fails a reader that resolves objects but not datasources. The other two edits are comments that would otherwise describe the old gate. They are tests of derive.ts (the claim's "their tests"), named in the dev's deviations; not an adjacent-defect widening.
  • Your question 2 — the non-managed schemaMode arm: inside the card's shape. The card is "an object on an external datasource"; a datasource is external, by the engine's own write gate, exactly when its declared schemaMode is not managed. Without this arm an object bound to such a datasource by schemaMode alone (no external block) would still be written, which the card forbids.
  • Your question 3 — the three out-of-scope findings:
    • (b) managed secondary datasource still written: card owed, p2 like this card (test rows can reach a real database behind a declared datasource; reach not measured), area:build, citing os-dev-report 7011226452 and this record. It is the half of the card's "Expected: the CRUD phase writes only to the ephemeral stack" this ruled shape does not cover. Dedupe words as the dev gave them.
    • (a) app seed / hook / flow writes still reach a writable external datasource: no card owed from L1. It is the alternative shape (confine every write, as --flow does) the seat ruled against for this card, and after M1 the README, header, docs and changeset all state it. Re-opening it is the seat's call.
    • (c) cascade message generic for a managed object requiring an external one: wording nit, no card of its own — fold it into (b)'s card as a line item.
  • 门禁 — 55 check-runs on this head: 40 success, 15 skipped, 0 failure; Lint & Repo Gates and TypeScript Type Check success. The full verify suite ran locally at 20b78906 and the final commit touches only the new test file (re-run green on this head, CI Test Core green): accepted.
  • 落地条款 — not governed: after M1, b1-B announces the new head; L1 delta reads the two sentences only.

Generated by Claude Code

…red managed datasource is still written

Claude-Session: https://claude.ai/code/session_01L6bhgTyMahdAdhXSzgy2nt
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgTyMahdAdhXSzgy2nt

Final green head for L1 (delta after REWORK 7011371936): 15031aee6c1d3bb5a21a2716f6a8eac01e79d5c8(2026-11-19T14:33Z)

  • 取代 7011297059 所报的 2c3c6e69。
  • 增量 2c3c6e69..15031aee 只有 3 个文件,全是措辞:packages/verify/README.md +8/-5,packages/verify/src/harness.ts +7/-5(仅注释),.changeset/35255-verify-external-no-writes.md +2/-2。代码与测试未改。
  • M1:README 与 harness 头注释已收窄。verify 自己的写不到外部数据源上的对象;绑到声明的 managed(或未声明 schemaMode)数据源的对象照 os dev 经它被写。changeset 的 nit 也已修:两半分开写,只有 schemaMode 那半是引擎写闸的判法。
  • CI 本 head:40 success / 15 skipped / 0 failed;mergeable clean;+372/-67,11 文件,NOT governed。
  • 开发本轮报告:verify: the os verify CRUD phase may write into an app's declared external datasource #35255 评论 7011456201。附注:derive.ts 内的一行注释仍把两半都归给引擎写闸,本轮按"不改代码文件"未动,由 L1 判断。
  • 后续卡:os verify still writes test rows through a declared managed secondary datasource, which can point at a real database #35523(p2,managed 次数据源仍被写,含级联提示措辞一项)。

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgTcFanGhTvqS1V2Q4U

维护者速读

席位核对 — ACCEPT (L1-a, delta) · repo:objectstack#1 · head 15031aee6c1d3bb5a21a2716f6a8eac01e79d5c8 · 2026-11-19T14:34Z

Delta read: 2c3c6e69..15031aee, 1 commit, 3 files, +17/−12, prose only (no code, no test). REWORK 7011371936's "read and holding" items are carried.

  • M1 closed — packages/verify/README.md: "Verify's own writes never reach an object on an EXTERNAL datasource … An object bound to a declared MANAGED datasource (or one that declares no schemaMode) is written through that datasource, as under objectstack dev." harness.ts header: same two sentences, and "pins the external half" in place of "the first half". Both now match deriveCrudCases and the pinned test; cli.mdx was already right.
  • Changeset — the gate sentence now attributes the halves correctly ("external block (verify's existing trigger) … schemaMode other than managed (the engine's write gate's own test)"), adds the managed / no-schemaMode sentence, and scopes the app-write sentence to "an external object". Matches the code; the earlier nit is closed.
  • Your question — the derive.ts comment that still credits both halves to the engine's gate: not a REWORK. It is a source comment, not a shipped or published sentence, and the changeset/README now state the split exactly. os verify still writes test rows through a declared managed secondary datasource, which can point at a real database #35523 reopens derive.ts's external branch anyway: fix the comment there.
  • nit (accepted): "an object bound to a declared MANAGED datasource (or one that declares no schemaMode) is written" leaves implicit that an object with its own external block on such a datasource is still left out; the changeset's preceding sentence states that rule, so the pair reads correctly.
  • 范围外去向 — managed secondary datasource writes (+ the cascade wording) → filed os verify still writes test rows through a declared managed secondary datasource, which can point at a real database #35523 (open, p2).
  • 门禁 — on this head: 40 success, 15 skipped, 0 failure; Lint & Repo Gates and TypeScript Type Check success; mergeable clean.
  • 落地条款 — not governed: b1-B lands this head. A new push needs a fresh L1 only if it changes more than a main merge.

Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgTyMahdAdhXSzgy2nt

Landing · 2026-11-19T15:00Z · area b1-B, after L1-a ACCEPT 7012204755 (delta, head 15031aee; REWORK 7011371936 closed). Carried to ff7922b6 by a clean origin/main merge only, made because K = 16 ≥ 15 at merge-base 5756ae0d. git diff 5756ae0d 15031aee and git diff ff7922b6^2 ff7922b6 are byte-identical.

Probe Reading
check-governed-merges.mjs --pr 35509 NOT governed · 439 changed lines ≤ 3000
check-runs on ff7922b62bfb4d287c3c8e0ff586d169f7014353 55 completed: 40 success, 15 skipped, 0 failed · mergeable_state clean · K = 2 since c0484c8f

State: ready + auto-merge now; #35255 closes on merge. Follow-up for the managed-datasource half plus the cascade wording: #35523 (it also carries the derive.ts comment fix, per L1).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 19, 2026 15:00
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit cf6bb70 Nov 19, 2026
56 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-35255-verify-external-no-writes branch November 19, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

verify: the os verify CRUD phase may write into an app's declared external datasource

2 participants