Skip to content

feat(service-automation)!: a sync-in pull marks the rows the source deleted (ADR-0153 D3, #32062 slice 6) - #37179

Merged
os-zhuang merged 14 commits into
mainfrom
claude/issue-32062-sync-in-d3-deletes
Nov 25, 2026
Merged

os-zhuang merged 14 commits into
mainfrom
claude/issue-32062-sync-in-d3-deletes

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Yibo Wang · project thread

Part of #32062

Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: none (no skills/ page names deletePolicy, deletedField or _sync_deleted_at: git grep -c -E "deletePolicy|deletedField|_sync_deleted_at" -- skills/ exits 1 with zero hits at 0f46c64, control git grep -c "name:" -- skills/ hits; the guide that teaches them is content/docs/automation/jobs.mdx, updated here)

维护者速读

  • 同步数据的管理员会看到:源系统删掉的记录,在平台里被打上"源已删除"标记(不会真删),源里恢复后标记自动清除;增量同步若没说明如何识别删除,保存时会被拒。
  • 属于"单向同步进平台(sync-in)"这件事的第六步:让同步能如实反映源系统的删除。
  • 出错时最坏是某些行被误标或漏标为"已删除",数据本身不丢、不删;下一次完整同步会纠正,改动可整体撤回。
  • 无

What changes

ADR-0153 D3 (delete marking) on both sync-in read paths, plus the carried review nits. Not in this PR (later slices of the card): D4 purge, D6 drift, D8 refusals beyond what landed, the connector paging loop.

  • Delete marking (packages/services/service-automation/src/sync-delete-mark.ts, new sibling module). Under deletePolicy absent (reads as 'mark') or 'mark', a pull stamps _sync_deleted_at on a row the source deleted and clears it when a later pull reads the row again; 'ignore' leaves every row. Two detections:

    • deletedField, on any pull that declares it: truthy marks the row's copy, anything else clears it.
    • Absence, on a full pull whose read was complete: every row of this mapping (_sync_source) not stamped by this run (_sync_pulled_at before the run start) and not refused by it is marked.
  • Completeness, per ADR-0153 D3. Datasource source: full: true, the windows read to their end on either read path, and the NULL-watermark count (D2 invariant 11, under the D8 organization predicate; through the floor on a floored driver, recorded as cap plus one above the cap) is zero, else unjudged, null watermark. The mark's range is limited to rows whose copied watermark is non-NULL and at or above watermark.start. Connector source: no watermark and paging: { style: 'none' }; no paging records unjudged, no paging declared, a paging style whose loop is not built records unjudged, pages not followed. A refused or interrupted pull marks nothing by absence; more than 1000 runner-refused rows, or any read row with a blank match key (it names no target row), records unjudged, rows refused (review M1). A batch's keys go into each find 500 at a time (KEYS_PER_FILTER), far below any dialect's bound-parameter limit, however long a connector response is (review S1).

  • Incremental-mark refusal (the narrowing). incrementalSourceDeleteRefusal (@objectstack/spec/data, new export) refuses at parse (MappingSchema, path [source, 'deletePolicy']) an incremental source (connector with watermark, datasource without full: true) under 'mark' with no deletedField; both pulls ask the same rule at run time (400 VALIDATION_ERROR, reason delete_policy_unhonourable). Migration entry incremental-source-delete-policy-stated (ADR-0087 semantic); changeset carries the marker and the FROM/TO fix.

  • A synced target that withholds the provenance columns (systemFields: false) is refused under 'mark' (mapping_target_refused). This is the second BREAKING arm: it is judged only when the pull runs, and os validate does not catch it. Migration entry 18 names it, its replacement, and the failed sys_sync_run as the signal for a mapping stored at run time; the changeset and jobs.mdx say the same (review S3, N8). No parse-time refusal is added for it. A datasource deletedField that is not a source field is refused source_binding_invalid.

  • sys_sync_run: new marked_deleted_count, deletes, skipped_null_watermark; end-of-pull log line says what was marked and cleared.

  • Liveness: deletePolicy / deletedField under both sources flip planned to live with evidence, authorWarn dropped. paging stays planned.

  • Nits. Record 6791935060: N1 JobHandlerContext declares trigger / runId, the jobs guide lists them; N2 originOf keeps a trigger or job run id only when the run record can hold it; N3 the self-contradicting jobs.mdx sentence reworded; N5 job_run_id / trigger descriptions say when each is empty; N4 is NOT fixed here (see Acceptance notes). Record 7119012685 / 7120208665: N1 the reordered-upsertKey consequence stated at encodeSyncExternalId and in the marker; N4 the bare-name _sync_source scope stated in the marker (see Decision below); N8 the Object.is sentence in refuseHookSyncProvenanceWrite; N9 the unreadable-target refusal says whether the object is not registered or the metadata read failed (same reason mapping_target_refused, no new reason).

  • Review round 2 (L2 7151034259, L1 7151052312). M1 and S1 above; S2 packages/spec/docs/SYNC_ARCHITECTURE.md's ordersPull example states deletedField: 'is_deleted', so it parses; S3 above; S4 below; L1 M1 the changeset names '@objectstack/objectql': patch. Nits: N1 marks and clears are counted per row, so a run that fails part-way closes with the rows it changed; N2 deletedField truthiness (text 'false' / '0' marks, a misspelt connector field marks nothing) stated in jobs.mdx, the changeset and the marker; N3 the NULL-watermark count reads only id (floored and paged fallback); N4 a stored deletePolicy outside 'mark' / 'ignore' is refused delete_policy_unhonourable by both pulls instead of read as 'mark'; N5 the connectorSource D3 liveness evidence names pullOnce (the executor pin's pullConnectorSource kept beside it); N6 sys_sync_run.deletes says it is also empty for a connector target with no provenance columns; N7 rows pulled before the provenance columns existed are no mapping's and are never marked (changeset, jobs.mdx); N8 entry 18's acceptance criteria name the run-time signal; N9 is the report's.

Decision

Two mappings on one target: decided here. Each mapping marks and clears only rows whose _sync_source is its own; a second mapping is not refused. Cross-package same-name residual carried as item 7151120322 on #32062.

This is the behaviour of this tree: SyncDeleteMarker scopes every find by _sync_source equal to the mapping's name, and no pull refuses a second mapping on a target.

Read first (by risk)

  1. packages/services/service-automation/src/sync-delete-mark.ts — afterBatch (the keyless-row count and the 500-key chunks) and canMarkAbsent decide whether absence is judged; markAbsent (the where clause: _sync_source, _sync_pulled_at before runStartedAt, the refused-key $nin, the range) decides which rows are marked.
  2. packages/services/service-automation/src/datasource-pull.ts — the delete judgment after readSourceInWindows and countNullWatermarks.
  3. packages/spec/src/data/mapping.zod.ts — incrementalSourceDeleteRefusal and its use in the sourced-mapping refinement (the narrowing).

Two-minute check

pnpm --filter @objectstack/service-automation exec vitest run --maxWorkers=2 src/sync-delete-mark.test.ts src/datasource-pull.test.ts src/connector-pull.test.ts — expect 135 passing, among them the four [review M1] cases.

Tests

  • connector-pull.test.ts: D3 block on a real engine (complete full pull marks then clears; no paging and an unfollowed style mark nothing by absence; deletedField marks and clears; incremental under mark refused before the action; ignore); systemFields: false under ignore vs mark; N2 origin bounds; N9 read-failure refusal.
  • datasource-pull.test.ts: D3 block (complete full pull marks then clears; floored path, with a NULL count over the cap recorded as cap plus one; range below a raised start untouched; NULL watermark blocks the mark and is counted; the count carries the organization predicate; refused row not marked; another mapping's rows untouched; refused part-way marks nothing; ignore; deletedField; the three refusals).
  • Round 2: [review M1] on both pulls (datasource: one blank-key row plus a deleted row leaves unjudged, rows refused, nothing marked, run record says so; connector: a response whose records all lost the key, and one keyless record beside a dropped one); [review N4] on both pulls; new sync-delete-mark.test.ts (the 1000-key limit at 1000 and 1001, one keyless row makes the run unjudgeable, $in chunks of 500/500/1 on clear and 500/1 on mark, a mark failing at row 3 keeps marked at 2).
  • mapping-sync-in.test.ts, mapping-connector-source.test.ts: the parse refusal and its legal twins; the liveness pin now expects only paging planned.
Local runs (round 2, head 0f46c64)

Each through scripts/pm/os-verify-lock.sh, verdict line quoted. Head 0f46c64 = 357423a plus one liveness-evidence text edit (N5).

  • pnpm --filter @objectstack/service-automation test && ... typecheck at 357423a: Test Files 295 passed (295), Tests 4316 passed (4316), VERDICT command-exit 0. The three touched suites again at 0f46c64's code: Tests 135 passed (135), VERDICT command-exit 0.
  • pnpm --filter @objectstack/spec test && ... typecheck at 0f46c64: Test Files 890 passed (890), Tests 28308 passed | 1 todo (28309), VERDICT command-exit 0. (At 357423a the connectorSource liveness pin was red on the first N5 spelling, which dropped pullConnectorSource; fixed in 0f46c64.)
  • Ablation (one, the M1 fix): node scripts/ablation-replace.mjs --anchor 'return this.unnamed === 0 && this.unwritten.size' --replacement 'return this.unwritten.size' (anchor 1 -> 0, blob 5707ffa9842a -> a7b315ca2f01); vitest run src/sync-delete-mark.test.ts src/datasource-pull.test.ts src/connector-pull.test.ts: Tests 4 failed | 131 passed (135), the four failures being exactly the three [review M1] pull pins and the unit pin "one read row with no key makes the run unjudgeable", VERDICT command-exit 1; restored, blob == HEAD 5707ffa9842a, git diff HEAD empty. The suites import the module from src/ by relative path, so no dist leg applies.
  • Dogfood battery (title carries !) at 0f46c64, after pnpm --filter '@objectstack/dogfood^...' ... build (VERDICT command-exit 0): pnpm --filter @objectstack/dogfood test: Test Files 487 passed | 3 skipped (490), Tests 4128 passed | 68 skipped (4196), VERDICT command-exit 0.

Acceptance notes

  • N4 of record 6791935060 (cli CHANGELOG "see its own entry") is not fixed here. The sentence is in released entries (packages/cli/CHANGELOG.md:1203, packages/spec/CHANGELOG.md:3173; the same phrase in four more packages' released entries). CHANGELOGs are release-owned: a released-entry correction is a dedicated docs-only PR, never a rider on a code PR. Carrier: the seat.
  • Edge stated, not fixed: on the first run after upsertKey is reordered, a runner-refused row keeps its old _sync_external_id spelling, so the refused-key exclusion (new spelling) does not cover it and the absence mark stamps it; the next run that writes it clears it. Stated in sync-delete-mark.ts.
  • incrementalSourceDeleteRefusal and syncDeletePolicyRefusal judge a stored block at run time, a mapping no parse saw, with the parse's rule; a second door for the same rule, not a lenient alias (a deletePolicy outside the enum is now refused, review N4).
  • The refused-key $nin of markAbsent holds at most 1000 keys, unchanged this round (the L2 accepted the bound).
  • Files outside the order's surface: packages/objectql/src/sync-provenance-write.ts (comment only, N8), packages/runtime/src/job-handler-context.ts (N1), packages/spec/src/data/injected-system-column*.ts (describe text of _sync_deleted_at), the spec migration entry and generated api-surface / export-origins / liveness counts; round 2 adds packages/spec/docs/SYNC_ARCHITECTURE.md (review S2). The zone amended the claim for them.

Verification

Local subset = node scripts/pm/dispatch-gates.mjs --commands (124 commands), each run with its exit captured before any pipe; reconciled with --ran on a record carrying every exit code: "124 derived, 124 run, 0 NOT-MEASURED, 0 UNRUN" ("a DERIVED zero — all 124 recorded an exit code and none of them is 3").

  • First pass at 357423a: 121 exit 0; cli vitest run test/migrate-meta-engine-guidance.test.ts exit 1 (MODULE_NOT_FOUND for @objectstack/mcp/dist, the cli closure not built yet), spec check:skill-examples and check:dual-build-cjs-loads exit 3 (client dist not built). After the closure build, all three re-run at 0f46c64: exit 0. spec check:liveness, check:upgrade-guide, check:generated and check-nul-bytes re-run at 0f46c64: exit 0.
  • CI on 0f46c64: 60 success, 10 skipped, 0 failure (Lint & Repo Gates, TypeScript Type Check, Test Core, Build Core, Test UI, Dogfood Regression Gate, Check Changeset and the PR-body guards among them). The reds on 677bad4 were the aggregators over lanes cancelled by the next push.

Generated by Claude Code

… migration entry

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzg3KqwSpt61Y8ovKK7
…/runId, comment nits

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzg3KqwSpt61Y8ovKK7
…pies rows

check:objectql-double-limit: apply the caller's limit after the filter and
before the copy, so rows outside the bound are not touched.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzg3KqwSpt61Y8ovKK7
…dered-upsertKey refused-row edge

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzg3KqwSpt61Y8ovKK7
@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation protocol:data tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 4 package(s): @objectstack/objectql, @objectstack/runtime, @objectstack/service-automation, @objectstack/spec, touching 62 documentable anchor(s). ⚠️ 9 changed file(s) yielded no anchor (packages/objectql/src/sync-provenance-write.ts, packages/services/service-automation/src/sync-provenance-stamp.ts, packages/spec/api-surface/data.json, …), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

42 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json 3b4f0b9832836e75a8300ece68acc970d1c7adf6.

⛔ 14 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 9 changed file(s) yielded no anchor (packages/objectql/src/sync-provenance-write.ts, packages/services/service-automation/src/sync-provenance-stamp.ts, packages/spec/api-surface/data.json, …) — pages documenting those are invisible to this run
  • 1 cross-cutting symbol(s) contributed no route anchor: environmentId (48 routes)
  • 21 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 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; 124 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 — 180 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 3b4f0b9832836e75a8300ece68acc970d1c7adf6 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 0dd9b2d60ff17b4c406adbe53f01f6a9e4225011 — the merge of head 0f46c642ca89768b5124a5439c1119ae4ee5142f into base 3b4f0b9832836e75a8300ece68acc970d1c7adf6, 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 0dd9b2d60ff17b4c406adbe53f01f6a9e4225011 && git checkout 0dd9b2d60ff17b4c406adbe53f01f6a9e4225011
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 3b4f0b9832836e75a8300ece68acc970d1c7adf6 0f46c642ca89768b5124a5439c1119ae4ee5142f && git checkout -B drift-repro 3b4f0b9832836e75a8300ece68acc970d1c7adf6 && git merge --no-ff 0f46c642ca89768b5124a5439c1119ae4ee5142f

node scripts/docs-audit/affected-docs.mjs --json 3b4f0b9832836e75a8300ece68acc970d1c7adf6

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

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 3b4f0b9832836e75a8300ece68acc970d1c7adf6 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs

Contract-review-claim: session_01WGufzgv2LZN1W2qSYTZvYs · head 167cb91 · 2026-11-25T02:29Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 167cb91793e160e32b009b99ea34120b94dc7932
Local-runs: none
Scope: packages/spec/src/data/injected-system-column-provenance.ts, packages/spec/src/data/injected-system-columns.ts, packages/spec/src/data/mapping.zod.ts, packages/spec/src/migrations/entries/semantic/18.incremental-source-delete-policy-stated.ts + packages/services/service-automation/src/sync-delete-mark.ts, packages/services/service-automation/src/connector-pull.ts, packages/services/service-automation/src/datasource-pull.ts, packages/services/service-automation/src/datasource-window-read.ts, packages/services/service-automation/src/pull-refusal.ts, packages/services/service-automation/src/sync-provenance-stamp.ts, packages/services/service-automation/src/sync-run-ledger.ts, packages/services/service-automation/src/sys-sync-run.object.ts, packages/objectql/src/sync-provenance-write.ts, packages/runtime/src/job-handler-context.ts, packages/spec/api-surface/data.json, packages/spec/export-origins/data.json, packages/spec/liveness/mapping.json, packages/spec/liveness/object.json, packages/spec/liveness/state-counts/mapping.md, and as evidence packages/services/service-automation/src/connector-pull.test.ts, packages/services/service-automation/src/datasource-pull.test.ts, packages/services/service-automation/src/connector-pull.integration.test.ts, packages/services/service-automation/src/connector-pull-undeclared-input-key.test.ts, packages/spec/src/data/mapping-sync-in.test.ts, packages/spec/src/data/mapping-connector-source.test.ts

① Derived judgments

  1. New export incrementalSourceDeleteRefusal (@objectstack/spec/data): right. A pure function of one source block that answers a sentence or undefined; additive; api-surface/data.json and export-origins/data.json carry it and nothing else moved. It is the one rule both doors ask (the MappingSchema refinement and both pulls), which is what keeps the parse and the run-time refusal from drifting. It sits beside sourcedMappingModeRefusal and is a parse rule, not runtime logic, so Prime Directive 2 holds.
  2. The parse-time refusal: right, and it is exactly ADR-0153 D3's ("An incremental source that cannot see deletes refuses at build"). The authored mappings that stop parsing, at path [source, 'deletePolicy']:
    • a mapping whose connectorSource declares a watermark, with deletePolicy absent or 'mark' and no deletedField;
    • a mapping whose datasourceSource does not declare full: true (absent or false), with deletePolicy absent or 'mark' and no deletedField.
      Nothing else stops parsing: deletePolicy: 'ignore' passes, a non-empty deletedField passes, a connectorSource with no watermark passes, a datasourceSource with full: true passes. The first shape is the released incremental connector binding (a watermark and no delete key, which is every incremental connectorSource written before the key existed), so the break reaches released metadata; the ADR decided it and measured no known producer.
  3. sys_sync_run gains marked_deleted_count, deletes, skipped_null_watermark: right. Additive, optional, read-only columns on an engine-owned object; ADR-0153 D7 lists the marked-deleted and NULL-watermark counts and D3 names the deletes note. deletes is free text holding a closed set of seven notes (longest 28 characters against maxLength: 64); a select would state the set, which is a taste call.
  4. deletePolicy / deletedField liveness, both sources, planned to live with authorWarn and authorHint dropped: right. Each row has a reader in the tree (syncDeletePolicyOf, SyncDeleteMarker.afterBatch, markAbsent), paging stays planned, and the count moves 24/9 to 28/5, which is the four rows. The flip lands with the reader, as the ADR's children table orders.
  5. Injected system columns: right, and no plan change. The two spec files change one field description (_sync_deleted_at) and one doc comment; the plan, the column set and the index are untouched. The old text ("Not written yet") is false at this head, so the edit is owed here.
  6. Other surface the diff moves, each right: the refusal reason delete_policy_unhonourable joins ConnectorPullRefusalReason (additive); DatasourcePullResult.deletes and ConnectorSourcePullOutcome.deletes are service-level additions the spec contract ConnectorSourcePullResult does not name (a caller through IAutomationService cannot read them typed; nothing needs them yet); JobHandlerContext gains optional trigger and runId (additive; JobRunTrigger already exists in @objectstack/spec/contracts).
  7. One run-time refusal the ADR does not name: a synced target with systemFields: false under deletePolicy absent or 'mark' (mapping_target_refused). The rule is sound (no row could carry the mark), but see S3: it is a second narrowing, judged only when the pull runs, and the ledger entry does not carry it.

② Semver level

  • Level: right. Metadata-protocol: narrowed takes at least minor on every package the diff moves; the changeset bumps @objectstack/spec, @objectstack/service-automation and @objectstack/runtime at minor. @objectstack/objectql moves by a doc comment only and is in the fixed group, so it needs no line.
  • Clause-②: no (narrowing): right. Something an author could write is now refused, and nothing is widened on the declared arm (the new export, columns and context members are additive beside it).
  • Metadata-protocol: narrowed: right (narrowed over added).
  • Breaking payload: carried. The title carries !, the body carries the BREAKING banner, FROM (an incremental source under deletePolicy absent or 'mark' with no deletedField) and TO (deletedField: 'is_deleted', or deletePolicy: 'ignore'), and the one-line fix. The disposition is one marker, registered incremental-source-delete-policy-stated, and the id resolves to a file that is new in the diff.
  • Migration entry 18: right kind, right shape. A SemanticMigration in entries/semantic/, file named 18. plus the id as the README requires, no index touched, registry.ts not committed. A structured to-do rather than a D2 conversion is the correct call: a conversion that wrote deletePolicy: 'ignore' would restore the old behaviour, but ADR-0153 D3 makes the author state the choice, and an author who wrote 'mark' meant marking. On a stored mapping: one without the keys is refused when it is pulled, with the parse's own sentence (delete_policy_unhonourable), and one with either key runs; the entry's acceptanceCriteria names only os validate, so a mapping stored at run time is reached by the pull's refusal alone (nit N8).
  • Gap: the second BREAKING bullet has no ledger row (S3).

③ Boundary flags

Inputs read: card #32062 body and all 33 comments (claim 7145967588, release 7122297060, the slice orders and seat answers, every earlier report), PR #37179 body and file list, the net diff 49c8e0f0..167cb917 (27 files), ADR-0153 D3, D4, D7, the children table and the open points at pr-37179, ADR-0087 D2 and its 2026-08-13 addendum, the dev report 7150755927, and the 70 check-runs on the head (60 success, 10 skipped, 0 failure). Code outside the diff was read, not reviewed.

Dev flags and deviations (report 7150755927), each answered:

  1. Runtime package tests not run locally. Answered: the runtime diff is two optional type members; Test Core (10 shards) and TypeScript Type Check are success on the head.
  2. Three derived gates NOT MEASURED locally. Answered: Type Check · debt ledger, Lint · repo & tooling gates and Lint · CI, release & engine gates are success on the head.
  3. Dogfood battery, one timeout. Answered with a reservation for the seat: the failing file (approval-flow-name-per-namespace.dogfood.test.ts) is not in the diff and passed alone. On the head the Dogfood Regression Gate check is success but its three shards are skipped, so the local run is the only dogfood reading at this head.
  4. Merge commit without the trailer pair; the Chinese reading section. Process, not contract. Left to the seat.
  5. N4 of record 6791935060 not fixed (released CHANGELOG entries). Accepted: a released entry is not a code PR's to edit. It still has no card ("noted, not filed"): escalated to the seat to file or carry.
  6. Reordered-upsertKey edge, stated and not fixed. Accepted as stated (one wrong mark on one refused row for one run, cleared by the next write).
  7. Run-time tolerant readers (syncDeletePolicyOf, incrementalSourceDeleteRefusal). Accepted as a second door for one rule; see N4 for the one lenient reading in it.
  8. Files outside the claim's surface. The spec describe edits and the migration entry are consequences of D3 and of the narrowing; the objectql comment and JobHandlerContext are the carried nits. They are declared in the PR body only, while claim 7145967588 asks for them in the report (N9).
  9. ADR open point "two mappings on one target". Not answered by the PR as the ADR asks: see S4.

SQL push-down (Prime Directive 5):

  • The "absent from source" set is computed in the database, and no source key set is held in memory: right. markAbsent is one predicate on the target: _sync_source is this mapping, _sync_deleted_at is NULL, _sync_pulled_at is before the run's start, and on a datasource source the copied watermark is non-NULL and at or above watermark.start. The strict comparison is safe at the stored precision (DATETIME(3) on MySQL, finer elsewhere): a row written in the run's first millisecond compares equal and is left alone.
  • Refused keys are bounded at 1001 in memory and 1000 in one $nin.
  • Marks are written one row at a time, after paging ids 500 at a time, although the engine has a single filtered update (sync-run-ledger.ts uses multi: true). A reason is given in the module doc: the mark goes through the protocol's data door so the pull's write mark admits the _sync_ column and hooks and audit run per row. Accepted. Cost stated for the seat: one round trip per marked row.
  • The built-in NULL-watermark count is the door's COUNT (limit: 1, count: true), with a keyed paging fallback only when the door answers no total. Right.
  • afterBatch sends every key of the batch in one $in. Bounded on a datasource source (1000 a page; at most the row cap, ceiling 10,000, on a floored window). Unbounded on a connector source: S1.

④ Design judgment

Against ADR-0153 D3, sentence by sentence, the tree holds on: mark and clear, never a physical delete; ignore as a no-op that also leaves earlier marks; the datasource completeness rule on both read paths; the range limit (copied watermark non-NULL and at or above watermark.start); the NULL-watermark count taken after the read, under the organization predicate, cap plus one through the floor; the connector rule (paging declared, none included; no paging records unjudged, no paging declared); the incremental refusal at both doors; a row marked earlier that reappears is cleared in afterBatch; an already-marked row keeps its first mark time; a target row of another mapping or of no mapping (_sync_source different or NULL) is never touched.

Break attempts that held: a full pull versus an incremental pull (an incremental run never calls markAbsent); a pull refused part-way (readSourceInWindows throws before the delete judgment, so no absence mark; deletedField marks already made on read rows stay, which is a positive reading and is right); deletePolicy unset, 'mark', 'ignore'; a deletedField that is not a field of the datasource source (source_binding_invalid); two overlapping runs (each marks only rows stamped before its own start).

Break attempts that did not hold:

M1 (must-fix) — a read row whose match key is blank is neither excluded nor counted, so a complete full pull marks rows the source still has. SyncDeleteMarker.afterBatch returns early on a stamped row with no _sync_external_id (sync-delete-mark.ts, the typeof key !== 'string' line), before the unwritten bookkeeping. stampSyncProvenance stamps no key on a blank match key, and the runner refuses such a row (BLANK_MATCH_KEY, rewritten to a failed row by refuseBlankMatchKeys). So these rows are read, are not restamped, are not in the $nin, and do not move canMarkAbsent. Consequence: a source that stops sending the upsertKey field (the case #31810 measured; ADR-0153 D6's drift refusal has not landed) makes a full pull under paging: { style: 'none' }, or a full: true datasource pull whose key values went blank, refuse every row and then stamp _sync_deleted_at on every row of the mapping, one update and one automation run per row, with deletes: judged. This contradicts the contract the PR ships: the changeset ("a row the import runner refused was read, so it is not marked") and jobs.mdx ("one whose rows the import runner refused beyond a thousand, marks nothing by absence"). The pull cannot say which target rows a keyless record stands for, so it cannot judge absence at all. Fix: any read row the marker cannot name makes the run unjudged, rows refused (count it; one is enough), with a pin on each pull. The unjudged, rows refused arm has no test at this head on either pull (git grep finds the note only in source); pin the 1000-key limit in the same change.

S1 (should-fix) — afterBatch on a connector source puts every key of the response in one $in. The connector pull hands the whole response to one afterBatch; toClear (and toMark) are sent unchunked, and the SQL driver renders $in as one whereIn with one bound parameter per key. Once any row of the mapping carries a mark, a response past the dialect's parameter limit (32,766 on SQLite, 65,535 on Postgres) fails the pull after its rows were written, on every run. Chunk the two lists (the marker already pages at 500).

S2 (should-fix) — packages/spec/docs/SYNC_ARCHITECTURE.md (the ordersPull example at L470) teaches the shape this PR refuses. Its "After" example, the migration target of the retired pipeline layer and the page jobs.mdx links for the watermark, is a connectorSource with a watermark and neither delete key. At this head it does not parse. Add deletePolicy: 'ignore' or a deletedField to the example in this PR.

S3 (should-fix) — the second BREAKING change is in the changeset only. A synced target with systemFields: false pulled under deletePolicy absent or 'mark' was written before this PR and is refused after it. Entry 18's surface does not name it, so the upgrade guide and migrate meta say nothing of it, and it is judged only when the pull runs: os validate stays green while every scheduled run fails. collectSourcedMappingErrors has the objects at build and could refuse it there (Prime Directive 12). Add the prescription to the ledger (a second registered id, or this entry's surface) and file the build refusal for the spec lane.

S4 (should-fix) — the ADR's open point is decided by the tree and denied by the PR. ADR-0153 leaves "two mappings on one target object" to this child, "to be decided in its PR and said there". The tree decides it: each mapping marks only its own rows by _sync_source, nothing is refused. The PR body and the claim say the point stays open. Say the decision. Its residual needs a card: _sync_source holds the bare mapping name, while a mapping's identity is holder package plus name (record 6786503520 S1), so two packages' same-name mappings on one target mark and clear each other's rows run after run. The module doc names the case and not its consequence.

Nits, none blocking:

  • N1 — a failure inside stamp loses the count: marked is added only after stamp returns, so a run that fails mid-mark closes with marked_deleted_count below the rows it stamped.
  • N2 — deletedField truthiness is JavaScript's: a source that sends the text 'false' or '0' has every row marked. On a connector source a misspelt deletedField reads as falsy on every record and marks nothing, silently. Say both in jobs.mdx, or judge the declared type on a datasource source.
  • N3 — the floored NULL-watermark count reads whole rows up to the cap to count them; project the key.
  • N4 — syncDeletePolicyOf reads a stored deletePolicy outside the enum as 'mark'; the strict reading refuses it.
  • N5 — the connectorSource liveness evidence names pullConnectorSource; the read is in pullOnce.
  • N6 — sys_sync_run.deletes is also empty for a target that carries no provenance columns, while its description says "Empty when the pull failed".
  • N7 — rows pulled before the provenance columns existed carry no _sync_source; one the source has since deleted is no mapping's row and is never marked. The changeset does not say so.
  • N8 — entry 18's acceptanceCriteria names os validate only; a mapping stored at run time learns of the rule from the failed pull.
  • N9 — the report's deviations omit the files outside the claim's surface that the PR body lists.

Implemented-by: claude/issue-32062-sync-in-d3-deletes
Reviewed-by: session_01WGufzgv2LZN1W2qSYTZvYs

VERDICT: FAIL

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs

席位核对 — REWORK · repo:objectstack#3 · head 167cb91 · 2026-11-25T02:41Z

L1: REWORK (L1-w, zone wf-A)
Head-sha: 167cb91793e160e32b009b99ea34120b94dc7932

The L2 at CONTRACT_REVIEW_TIER on this head is FAIL: comment 7151034259, claim 7150802612. I adopt its M1 and S1–S4 as they stand. I checked M1 against the tree: in SyncDeleteMarker.afterBatch, a stamped row with no string _sync_external_id returns before the refused-key bookkeeping, so it is neither excluded nor counted. If every row of a complete full pull is keyless and refused, markAbsent then marks the mapping's every row with deletes: judged. Tier H by card size: six PRs, 7,804 changed lines on #32062. After a final ACCEPT plus an L2 PASS it goes to the seat for the approver. Never ready, queue or arm it here.

Must-fix (L1)

  • L1 M1. The changeset does not name @objectstack/objectql. packages/objectql/src/sync-provenance-write.ts moves (the N8 sentence in refuseHookSyncProvenanceWrite's docblock), and @objectstack/objectql is published. l1-face: "published package(s) touched with no changeset entry … @objectstack/objectql". Add '@objectstack/objectql': patch. The criterion is "a published package touched", not the size of the change.

Should-fix (L1)

  • L1 S1. The claim's file surface was not amended for the files outside it. The PR body's acceptance notes list them with reasons: packages/objectql/src/sync-provenance-write.ts, packages/runtime/src/job-handler-context.ts, packages/spec/src/data/injected-system-column*.ts, the spec migration entry and generated artefacts. The claim (7145967588) still names only service-automation, mapping.zod.ts plus liveness rows, sys_sync_run, the docs and changesets. The zone amends the claim in the same round. The PR body already carries the evidence. (The L2's N9, the report's deviations omitting them, is the same gap.)

Must-fix and should-fix (from the L2, adopted; details in 7151034259)

  • L2 M1. A keyless read row slips the refused-row guard, and a pull whose rows all lack the key marks every row. Make any keyless read row mean unjudged, rows refused, with a pin on both pulls. The unjudged, rows refused arm also has no test yet.
  • L2 S1. On a connector source, afterBatch sends the whole response's keys in one $in. Chunk them below the dialect's bound-parameter limit.
  • L2 S2. The ordersPull example in packages/spec/docs/SYNC_ARCHITECTURE.md (around L470, linked from jobs.mdx) is now refused at parse. Fix it.
  • L2 S3. The second BREAKING arm (systemFields: false under 'mark') is judged at run time only and is not named by migration entry 18. Name it in entry 18, and either refuse it at parse too or say plainly that os validate will not catch it.
  • L2 S4. The tree decides ADR-0153's "two mappings on one target" open point (each marks only its own _sync_source, no refusal), but the PR body says it stays open. State the decision in the PR body and the ADR note the open point asks for. File the bare-name residual as a card: two packages' same-name mappings share a _sync_source.

Nits N1–N9 are listed in the L2 record. Fix any that ride the same push; the rest each need a follow-up card under the nit rule.

Read and found right (head 167cb91)

  • l1-face --pr 37179: 11 of 13 items clean. changeset is flagged (L1 M1 above). dogfood is flagged as owed, read below. The draft is against main, and Part of #32062 binds no closing keyword. The declarations are Clause-②: no (narrowing) · Metadata-protocol: narrowed · Skills-docs: none with its grep and control. Floors and all checks are green: 60 success, 10 expected skips, 0 failed. mergeable_state clean.
  • Changeset levels. minor on spec, service-automation and runtime, since a narrowed kind takes at least minor. It carries the BREAKING FROM → TO and fix lines, plus the ADR-0087 registered incremental-source-delete-policy-stated marker.
  • Changeset and jobs.mdx, sentence by sentence, against sync-delete-mark.ts, datasource-pull.ts, connector-pull.ts and sys-sync-run.object.ts. The two detections, the completeness rules per source, the range limit at watermark.start, the REFUSED_KEY_LIMIT of 1,000, the deletes values, skipped_null_watermark, the JobHandlerContext trigger / runId rows and the N9 sentence all hold. Except "a row the import runner refused was read, so it is not marked", which is false for a keyless row (L2 M1). That sentence becomes true again once M1 is fixed.
  • Dogfood battery (! and (narrowing)). It is pinned to 167cb917 and ran in full. Its one red was approval-flow-name-per-namespace.dogfood.test.ts timing out at 5 s while the kernel OOM-killed a process; it passed re-run alone, and it does not touch sync-in. The red is reported. The L2 notes that CI's dogfood shards are skipped on this head, so this local battery is the only dogfood reading. The fix-round head needs a fresh battery.
  • Notes, not findings. The PR body's 维护者速读 is Chinese by os-dev.md, as on every seat PR. The branch's merge commit carries git's default message without the trailer pair; the squash merge replaces it. N4 of 6791935060 (released CHANGELOG entries) is accepted unfixed here but still has no card. That is the seat's to file.

Path to final ACCEPT

  1. Card thread: one push covering L1 M1, L2 M1 and S1–S3, the S4 statements, any nits it takes, and a fresh dogfood battery on that head.
  2. Zone: amend the claim (L1 S1) and file the S4 residual card.
  3. L1-w: a new claim, the same L2 reviewer reads the delta, and I read the L1 delta.
  4. Then the seat hands it to the approver as Tier H.

…judged; chunk afterBatch keys

[ADR-0153 D3] A read row with no _sync_external_id (a blank match key the
runner refuses) names no target row, so a full pull that read one cannot
judge absence: record 'unjudged, rows refused' and mark nothing (review M1).
afterBatch sends its keys 500 per $in (review S1); marks and clears are
counted per row so a run that fails part-way keeps its count (N1).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzg3KqwSpt61Y8ovKK7
…g arms; review nits

[ADR-0153 D3] Pins on both pulls that a read row with a blank match key
leaves the run 'unjudged, rows refused' (review M1), unit pins for the
1000-key limit and the 500-key $in chunks (S1). Migration entry 18 names
the systemFields: false arm and says os validate does not catch it (S3, N8);
SYNC_ARCHITECTURE's ordersPull example states a deletedField (S2); the
changeset names @objectstack/objectql. Nits N2-N7: truthiness and the
pre-provenance rows documented, the floored NULL count reads the key only,
a stored deletePolicy outside the enum is refused, liveness evidence names
pullOnce, sys_sync_run.deletes says when it is empty.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzg3KqwSpt61Y8ovKK7
…side pullConnectorSource

Review N5: the read is in pullOnce; the executor pin still finds pullConnectorSource.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzg3KqwSpt61Y8ovKK7
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs

Contract-review-claim: session_01WGufzgv2LZN1W2qSYTZvYs · head 0f46c64 · 2026-11-25T04:27Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 0f46c642ca89768b5124a5439c1119ae4ee5142f
Local-runs: none
Scope: packages/spec/src/data/injected-system-column-provenance.ts, packages/spec/src/data/injected-system-columns.ts, packages/spec/src/data/mapping.zod.ts, packages/spec/src/migrations/entries/semantic/18.incremental-source-delete-policy-stated.ts + packages/services/service-automation/src/sync-delete-mark.ts, packages/services/service-automation/src/connector-pull.ts, packages/services/service-automation/src/datasource-pull.ts, packages/services/service-automation/src/datasource-window-read.ts, packages/services/service-automation/src/pull-refusal.ts, packages/services/service-automation/src/sync-provenance-stamp.ts, packages/services/service-automation/src/sync-run-ledger.ts, packages/services/service-automation/src/sys-sync-run.object.ts, packages/objectql/src/sync-provenance-write.ts, packages/runtime/src/job-handler-context.ts, packages/spec/docs/SYNC_ARCHITECTURE.md, packages/spec/api-surface/data.json, packages/spec/export-origins/data.json, packages/spec/liveness/mapping.json, packages/spec/liveness/object.json, packages/spec/liveness/state-counts/mapping.md, and as evidence packages/services/service-automation/src/sync-delete-mark.test.ts, packages/services/service-automation/src/connector-pull.test.ts, packages/services/service-automation/src/datasource-pull.test.ts, packages/services/service-automation/src/connector-pull.integration.test.ts, packages/services/service-automation/src/connector-pull-undeclared-input-key.test.ts, packages/spec/src/data/mapping-sync-in.test.ts, packages/spec/src/data/mapping-connector-source.test.ts

Delta review of record 7151034259 (head 167cb917, FAIL), under claim 7152870538. The delta 167cb917..0f46c642 carries a merge of main (677bad4d, second parent 3b4f0b98); the PR's own net diff against that parent is 29 files, 1427 added and 96 removed. Of the PR's own files the delta moves these: sync-delete-mark.ts and its new test, connector-pull.ts, datasource-pull.ts, datasource-window-read.ts, pull-refusal.ts, sys-sync-run.object.ts, the two pull tests, migration entry 18, SYNC_ARCHITECTURE.md, liveness/mapping.json, the changeset and jobs.mdx. Nothing else of the PR moved: mapping.zod.ts, the two injected-column files, api-surface, export-origins, sync-run-ledger.ts, sync-provenance-stamp.ts, sync-provenance-write.ts and job-handler-context.ts are byte-identical to the first head.

① Derived judgments

The seven judgments of record 7151034259 stand unchanged: the export incrementalSourceDeleteRefusal, the two authored shapes the parse refuses, the three sys_sync_run columns, the four liveness flips, the injected-columns description, and the additive service types. The delta adds three:

  1. syncDeletePolicyRefusal (service-automation, run time only): right, and it moves no authorable surface. A stored deletePolicy that is neither absent, 'mark' nor 'ignore' is refused by both pulls before anything is read, under the existing reason delete_policy_unhonourable. MappingSchema already refuses the same value (z.enum(['mark', 'ignore'])), so no door an author writes through changes its answer; only a stored block no parse saw meets it. It narrows the pull's reading of off-spec input (the first head read such a value as 'mark', and no release ever read it at all), which is Prime Directive 12's direction. It needs no new declaration, no level change and no new ADR-0087 id: the changeset names it, and narrowed already covers the PR.
  2. KEYS_PER_FILTER and the optional SyncWindowQuery.fields: right. Both are module-level; the package index is not in the diff, so neither is published surface.
  3. SyncDeleteMarker.stamp now counts as it writes and answers nothing: right as far as the marker goes (see N1 for the run record).

② Semver level

  • Declarations: unchanged and still right. Clause-②: no (narrowing), Metadata-protocol: narrowed, in the changeset and in the PR body.
  • Levels. spec, service-automation and runtime stay minor. The delta adds '@objectstack/objectql': patch for the doc-comment hunk. By AGENTS.md's letter a kind takes at least minor on a package the diff moves; objectql sits in the fixed group with spec, so it publishes at the group's minor whatever this line says, and Check Changeset is success on the head. Left as N10.
  • ADR-0087: one marker, one id, still registered incremental-source-delete-policy-stated, the id still new in the diff. Entry 18 now carries both breaking arms in surface, replacement and acceptanceCriteria, and says in each that os validate does not see the second arm. One entry with two arms is acceptable here: both are the same decision (a mark policy no row could honour), and the marker names every id the diff adds.
  • Breaking payload. Both BREAKING bullets carry FROM, TO and the one-line fix; the second now says in plain words that a stack validating green can still fail every scheduled pull.

③ Boundary flags

Inputs read for the delta: the delta itself, the dev report 7152841523, the claim amendment 7151075506, the claim notes 7151103856 and 7151122322, the triage item 7151120322, the PR body at the head, and the 74 check-runs on the head (0 failure; the rest success or skipped).

  1. N9 of the first record (files outside the claim's surface). Closed: the claim is amended (7151075506) and the report's deviations list them.
  2. The N4 run-time refusal as a deviation. Answered in ① 1.
  3. Service-automation's full suite ran one commit before the head. Accepted: the last commit changes two evidence strings in liveness/mapping.json only, and Test Core is success on the head.
  4. Dogfood. The report gives a full local battery at the head with no failure. The three CI dogfood shards are still skipped on the head, so that local run remains the only dogfood reading.
  5. Chunk size chosen without a shared helper. Accepted: see the bound-parameter judgment in ④.
  6. N4 of record 6791935060 (released CHANGELOG entries). Still "noted, not filed". Escalated to the seat again.
  7. The build-time refusal of the systemFields: false arm. No carrier is named anywhere for it. Escalated to the seat: file it for the spec lane (collectSourcedMappingErrors knows the stack's objects).

SQL push-down: unchanged from the first record, and improved. The absent set is still one predicate in the database; the batch key lists are now bounded at 500 a filter; the NULL-watermark count on the floored path and on the paging fallback now projects the key only.

④ Design judgment

M1 (must-fix): closed — a read row with no _sync_external_id is counted (unnamed) and canMarkAbsent is false when any exists, so both pulls record unjudged, rows refused and never call markAbsent. Break attempts, all held:

  • a key present but empty: the key === '' arm counts it, and it is pinned;
  • a non-string key: encodeSyncExternalId answers a string or nothing, and anything else is counted as unnamed, which errs toward not marking;
  • a composite key with one blank part: the encoder answers nothing for the whole key, so the row is unnamed;
  • a row refused for another reason: it has a key, is excluded by name, and absence is still judged (the first head's pin still holds);
  • a mixed batch: one keyless record beside written ones is enough, pinned on the connector pull with a record the response left out staying unmarked;
  • the incremental pull: the count is kept but never read, since an incremental run never marks by absence, and its deletedField marks are untouched;
  • where the runner and the encoder could disagree on "blank", the row lands either in the named exclusion or in unnamed; neither direction marks a row the source still has.
    The unjudged, rows refused arm now has pins on both pulls and at the 1000 and 1001 boundary. A source that keeps one permanently keyless row leaves every full run unjudged; that is the safe reading and the guide says it.

S1 (should-fix): closed — toMark and toClear go into the find 500 keys at a time, pinned at 500/500/1 and 500/1. One statement then binds 500 keys plus the mapping name, the organization filter, an id cursor and a limit: a few more than 500, under every supported dialect's limit (SQLite 32,766, Postgres and MySQL 65,535) and under the historical 999. The largest list in the module is still the refused-key $nin at 1000, which the first record judged bounded; it is inside the same limits.

S2 (should-fix): closed — the ordersPull example declares deletedField: 'is_deleted' with a comment saying why, so the page's migration target parses again.

S3 (should-fix): closed — by the documents route, which is an acceptable answer for this PR. Entry 18, the changeset and jobs.mdx each name the arm, its fix, and the fact that os validate stays green on it; an upgrading author now meets it in the upgrade guide before a pull fails. The build refusal is spec-lane work outside this claim's surface, and it has no carrier yet (③ 7).

S4 (should-fix): closed — the decision is said where the ADR asks: the PR body's Decision section, the module doc, the changeset and jobs.mdx all state that each mapping marks and clears only rows whose _sync_source is its own and that a second mapping is not refused. The same-name residual is carried on this card (item 7151120322, to land before the card closes). No docs/adr edit was needed or made.

Nits of the first record: N2, N3, N4, N5, N6, N7, N8 and N9 are closed in the tree as the report says. Open nits, none blocking:

No must-fix, no should-fix.

Implemented-by: claude/issue-32062-sync-in-d3-deletes
Reviewed-by: session_01WGufzgv2LZN1W2qSYTZvYs

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs

席位核对 — ACCEPT · repo:objectstack#3 · head 0f46c64 · 2026-11-25T04:33Z

L1: ACCEPT (L1-w, delta read, zone wf-A)
Head-sha: 0f46c642ca89768b5124a5439c1119ae4ee5142f

No must-fix, no should-fix. The L2 at CONTRACT_REVIEW_TIER on this head is PASS with nothing open: comment 7152947987, claim 7152870538. It closes M1 and S1–S4 of 7151034259. Tier H by card size: #32062 now totals well over 3,000 lines across its PRs, and this PR alone has 1,523. It goes to the seat for the maintainer. ⛔ Never ready, queue or arm it here.

Closed this round

  • L1 M1 closed. The changeset now names '@objectstack/objectql': patch. l1-face reports every published package touched as covered.
  • L1 S1 closed. Claim amendment 7151075506 on sync-in P2 engine (epic #31763, ADR-0153): windowed and paged reads, committed position, delete marking, provenance, drift, sys_sync_run, organization scope #32062 widens the file surface to the objectql and runtime files, the injected-column files, the migration entry, the generated artefacts and SYNC_ARCHITECTURE.md, each with its reason. The report's deviations answer N9.
  • L2 M1, S1–S4 closed (see the L2 record). These are the sentences I read in the changeset and jobs.mdx, sentence by sentence:
    • "A record whose upsertKey value is blank names no row, so one such record makes the run mark nothing by absence (unjudged, rows refused)". With M1 fixed, the earlier "a row the import runner refused was read, so it is not marked" is now true again.
    • "Two mappings on one target: each marks and clears only the rows whose _sync_source is its own; a second mapping is not refused". This is S4's decision.
    • The systemFields: false arm "is judged only when the pull runs: os validate and defineStack do not catch it", and entry 18 "names both arms". This is S3, by the docs route.
    • The deletedField truthiness sentence and the stored-deletePolicy run-time refusal. N4 moves no authorable surface, since the parse already refuses the same value.
  • Dogfood (owed for ! and (narrowing)). The report's battery is pinned to 0f46c642ca: "Test Files 487 passed | 3 skipped (490) · Tests 4128 passed | 68 skipped (4196) · no failures". The CI dogfood shards skip on this head, so this local battery is the only dogfood reading. It is green.
  • l1-face --pr 37179: every item is clean except dogfood, which is flagged as owed and read above. There were 62 success, 12 expected skips, 0 failed and 0 pending. Floors are green and mergeable_state is clean. The head carries a merge of main (677bad4d). The PR's own net diff is 29 files, +1427/−96.

Accepted deviations (nits; each needs a follow-up card under the nit rule, or a prose fix that moves no code)

For the seat at hand-over

The L2 escalates:

  • the build-time refusal of the systemFields: false arm, which has no carrier yet and wants a spec-lane card;
  • N4 of record 6791935060 (released CHANGELOG entries), which is still unfiled.

Part of #32062 binds no closing keyword, so the card stays open at merge.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 0f46c642ca89768b5124a5439c1119ae4ee5142f
Local-runs: none
Scope: packages/spec/src/data/injected-system-column-provenance.ts, packages/spec/src/data/injected-system-columns.ts, packages/spec/src/data/mapping.zod.ts, packages/spec/src/migrations/entries/semantic/18.incremental-source-delete-policy-stated.ts + packages/services/service-automation/src/sync-delete-mark.ts, packages/services/service-automation/src/connector-pull.ts, packages/services/service-automation/src/datasource-pull.ts, packages/services/service-automation/src/datasource-window-read.ts, packages/services/service-automation/src/pull-refusal.ts, packages/services/service-automation/src/sync-provenance-stamp.ts, packages/services/service-automation/src/sync-run-ledger.ts, packages/services/service-automation/src/sys-sync-run.object.ts, packages/objectql/src/sync-provenance-write.ts, packages/runtime/src/job-handler-context.ts, packages/spec/docs/SYNC_ARCHITECTURE.md, packages/spec/api-surface/data.json, packages/spec/export-origins/data.json, packages/spec/liveness/mapping.json, packages/spec/liveness/object.json, packages/spec/liveness/state-counts/mapping.md, and as evidence packages/services/service-automation/src/sync-delete-mark.test.ts, packages/services/service-automation/src/connector-pull.test.ts, packages/services/service-automation/src/datasource-pull.test.ts, packages/services/service-automation/src/connector-pull.integration.test.ts, packages/services/service-automation/src/connector-pull-undeclared-input-key.test.ts, packages/spec/src/data/mapping-sync-in.test.ts, packages/spec/src/data/mapping-connector-source.test.ts

This record restates 7152947987 with the closures spelled by id, at the same head. Delta review of record 7151034259 (head 167cb917, FAIL). Contract-review claim: 7152870538. The delta 167cb917..0f46c642 carries a merge of main (677bad4d, second parent 3b4f0b98); the PR's own net diff against that parent is 29 files, 1427 added and 96 removed. Of the PR's own files the delta moves these: sync-delete-mark.ts and its new test, connector-pull.ts, datasource-pull.ts, datasource-window-read.ts, pull-refusal.ts, sys-sync-run.object.ts, the two pull tests, migration entry 18, SYNC_ARCHITECTURE.md, liveness/mapping.json, the changeset and jobs.mdx. Nothing else of the PR moved: mapping.zod.ts, the two injected-column files, api-surface, export-origins, sync-run-ledger.ts, sync-provenance-stamp.ts, sync-provenance-write.ts and job-handler-context.ts are byte-identical to the first head.

① Derived judgments

The seven judgments of record 7151034259 stand unchanged: the export incrementalSourceDeleteRefusal, the two authored shapes the parse refuses, the three sys_sync_run columns, the four liveness flips, the injected-columns description, and the additive service types. The delta adds three:

  1. syncDeletePolicyRefusal (service-automation, run time only): right, and it moves no authorable surface. A stored deletePolicy that is neither absent, 'mark' nor 'ignore' is refused by both pulls before anything is read, under the existing reason delete_policy_unhonourable. MappingSchema already refuses the same value (z.enum(['mark', 'ignore'])), so no door an author writes through changes its answer; only a stored block no parse saw meets it. It narrows the pull's reading of off-spec input (the first head read such a value as 'mark', and no release ever read it at all), which is Prime Directive 12's direction. It needs no new declaration, no level change and no new ADR-0087 id: the changeset names it, and narrowed already covers the PR.
  2. KEYS_PER_FILTER and the optional SyncWindowQuery.fields: right. Both are module-level; the package index is not in the diff, so neither is published surface.
  3. SyncDeleteMarker.stamp now counts as it writes and answers nothing: right as far as the marker goes (see N1 for the run record).

② Semver level

  • Declarations: unchanged and still right. Clause-②: no (narrowing), Metadata-protocol: narrowed, in the changeset and in the PR body.
  • Levels. spec, service-automation and runtime stay minor. The delta adds '@objectstack/objectql': patch for the doc-comment hunk. By AGENTS.md's letter a kind takes at least minor on a package the diff moves; objectql sits in the fixed group with spec, so it publishes at the group's minor whatever this line says, and Check Changeset is success on the head. Left as N10.
  • ADR-0087: one marker, one id, still registered incremental-source-delete-policy-stated, the id still new in the diff. Entry 18 now carries both breaking arms in surface, replacement and acceptanceCriteria, and says in each that os validate does not see the second arm. One entry with two arms is acceptable here: both are the same decision (a mark policy no row could honour), and the marker names every id the diff adds.
  • Breaking payload. Both BREAKING bullets carry FROM, TO and the one-line fix; the second now says in plain words that a stack validating green can still fail every scheduled pull.

③ Boundary flags

Inputs read for the delta: the delta itself, the dev report 7152841523, the claim amendment 7151075506, the claim notes 7151103856 and 7151122322, the triage item 7151120322, the PR body at the head, and the 74 check-runs on the head (0 failure; the rest success or skipped).

  1. N9 of the first record (files outside the claim's surface). Closed: the claim is amended (7151075506) and the report's deviations list them.
  2. The N4 run-time refusal as a deviation. Answered in ① 1.
  3. Service-automation's full suite ran one commit before the head. Accepted: the last commit changes two evidence strings in liveness/mapping.json only, and Test Core is success on the head.
  4. Dogfood. The report gives a full local battery at the head with no failure. The three CI dogfood shards are still skipped on the head, so that local run remains the only dogfood reading.
  5. Chunk size chosen without a shared helper. Accepted: see the bound-parameter judgment in ④.
  6. N4 of record 6791935060 (released CHANGELOG entries). Still "noted, not filed". Escalated to the seat again.
  7. The build-time refusal of the systemFields: false arm. No carrier is named anywhere for it. Escalated to the seat: file it for the spec lane (collectSourcedMappingErrors knows the stack's objects).

SQL push-down: unchanged from the first record, and improved. The absent set is still one predicate in the database; the batch key lists are now bounded at 500 a filter; the NULL-watermark count on the floored path and on the paging fallback now projects the key only.

④ Design judgment

M1: closed — a read row with no _sync_external_id is counted (unnamed) and canMarkAbsent is false when any exists, so both pulls record unjudged, rows refused and never call markAbsent. Break attempts, all held:

  • a key present but empty: the key === '' arm counts it, and it is pinned;
  • a non-string key: encodeSyncExternalId answers a string or nothing, and anything else is counted as unnamed, which errs toward not marking;
  • a composite key with one blank part: the encoder answers nothing for the whole key, so the row is unnamed;
  • a row refused for another reason: it has a key, is excluded by name, and absence is still judged (the first head's pin still holds);
  • a mixed batch: one keyless record beside written ones is enough, pinned on the connector pull with a record the response left out staying unmarked;
  • the incremental pull: the count is kept but never read, since an incremental run never marks by absence, and its deletedField marks are untouched;
  • where the runner and the encoder could disagree on "blank", the row lands either in the named exclusion or in unnamed; neither direction marks a row the source still has.
    The unjudged, rows refused arm now has pins on both pulls and at the 1000 and 1001 boundary. A source that keeps one permanently keyless row leaves every full run unjudged; that is the safe reading and the guide says it.

S1: closed — toMark and toClear go into the find 500 keys at a time, pinned at 500/500/1 and 500/1. One statement then binds 500 keys plus the mapping name, the organization filter, an id cursor and a limit: a few more than 500, under every supported dialect's limit (SQLite 32,766, Postgres and MySQL 65,535) and under the historical 999. The largest list in the module is still the refused-key $nin at 1000, which the first record judged bounded; it is inside the same limits.

S2: closed — the ordersPull example declares deletedField: 'is_deleted' with a comment saying why, so the page's migration target parses again.

S3: closed — by the documents route, which is an acceptable answer for this PR. Entry 18, the changeset and jobs.mdx each name the arm, its fix, and the fact that os validate stays green on it; an upgrading author now meets it in the upgrade guide before a pull fails. The build refusal is spec-lane work outside this claim's surface, and it has no carrier yet (③ 7).

S4: closed — the decision is said where the ADR asks: the PR body's Decision section, the module doc, the changeset and jobs.mdx all state that each mapping marks and clears only rows whose _sync_source is its own and that a second mapping is not refused. The same-name residual is carried on this card (item 7151120322, to land before the card closes). No docs/adr edit was needed or made.

Nits of the first record: N2, N3, N4, N5, N6, N7, N8 and N9 are closed in the tree as the report says. Open nits, none blocking:

No must-fix, no should-fix.

Implemented-by: claude/issue-32062-sync-in-d3-deletes
Reviewed-by: session_01WGufzgv2LZN1W2qSYTZvYs

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzi4PechTRCTBrfxV8W

维护者速读

  • 这是「单向同步进平台」(sync-in,sync-in P2 engine (epic #31763, ADR-0153): windowed and paged reads, committed position, delete marking, provenance, drift, sys_sync_run, organization scope #32062)的第 6 片。源系统里删掉的记录,平台会打上「源已删除」标记,不会真删;源里恢复后,标记自动清除。
  • 需要您审,原因有两个:一是整张卡 6 个 PR 合计约 8,000 行,超过 3,000 行;二是这片收紧了两处规则。第一处:增量同步如果用默认的「标记删除」,又没说明怎么识别删除,保存时会被拒。第二处:目标对象关掉了同步系统字段(systemFields: false)时,运行时会被拒。两处都有迁移说明。
  • 一个由本卡定下的点:同一个目标对象上有两个同步映射时,每个映射只标记、只清除自己同步来的行,第二个映射不会被拒。两个应用各带一个同名映射时还有遗留问题,已交给分诊另立卡,不在这里修。
  • 出错时最坏的情况是某些行被误标或漏标为「已删除」。数据本身不会丢、不会删,下一次完整同步会纠正,改动也可以整体撤回。
  • 评审:L1 通过;契约评审在同一提交上通过,没有未结项。检查全绿,dogfood 本地全绿。批准后由您入队。

Request: approval · Tier H by card size (per card across all its PRs: about 8,000 changed lines over #32062's six PRs; this PR is +1,427/−96) and by narrowing (Clause-②: no (narrowing), Metadata-protocol: narrowed) · 2026-11-25T04:37Z

Seat's view: land. This is slice 6 of #32062: ADR-0153 D3 delete marking on both sync-in read paths, plus the carried nits. One review pass covers it, and no split is used to move it under the size line.

  • L1: ACCEPT 7152961674 (L1-w) at head 0f46c642. Round 1 was REWORK (L1 7151052312, L2 7151034259); every finding is fixed.
  • Contract review (CONTRACT_REVIEW_TIER): claim 7152870538, PASS 7152947987 at 0f46c642, restated clean as 7152998660, nothing open.
  • Checks at 0f46c642: 62 success, 0 failed, mergeable_state clean. Dogfood battery on the head: 4128 passed.
  • Decision stated in the PR body (ADR-0153 leaves it to this child): two mappings on one target each mark and clear only their own _sync_source rows; no refusal. The cross-package same-name residual is carried as item 7151120322 on sync-in P2 engine (epic #31763, ADR-0153): windowed and paged reads, committed position, delete marking, provenance, drift, sys_sync_run, organization scope #32062.
  • Accepted nits, carried: N1 (under-reported mark count when a run throws mid-mark), N10 (objectql patch entry beside narrowed), N11 (residual carrier citation). The released-CHANGELOG nit N4 of 6791935060 has a triage request (pm:mailbox — triage#1 · os-warren #36743 7150804863). The build-time refusal of the systemFields: false arm goes to triage as a spec-lane carrier.
  • Part of #32062: the card stays open for its later slices (D4 purge, D6 drift, the connector paging loop).

Generated by Claude Code

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 25, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 25, 2026 04:38
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 8236d9b Nov 25, 2026
83 of 84 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-32062-sync-in-d3-deletes branch November 25, 2026 05:08
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 pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue protocol:data size/xl 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.

3 participants