Repository navigation
feat(service-automation)!: a sync-in pull marks the rows the source deleted (ADR-0153 D3, #32062 slice 6) - #37179
Conversation
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg3KqwSpt61Y8ovKK7
…source Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg3KqwSpt61Y8ovKK7
… migration entry Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg3KqwSpt61Y8ovKK7
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg3KqwSpt61Y8ovKK7
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
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
📓 Docs Drift CheckThis PR changes 4 package(s): 42 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 14 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 180 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 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
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs Contract-review-claim: session_01WGufzgv2LZN1W2qSYTZvYs · head 167cb91 · 2026-11-25T02:29Z |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs Contract reviewServed-tier: ① Derived judgments
② Semver level
③ Boundary flagsInputs 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 Dev flags and deviations (report 7150755927), each answered:
SQL push-down (Prime Directive 5):
④ Design judgmentAgainst ADR-0153 D3, sentence by sentence, the tree holds on: mark and clear, never a physical delete; Break attempts that held: a full pull versus an incremental pull (an incremental run never calls 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. S1 (should-fix) — S2 (should-fix) — S3 (should-fix) — the second BREAKING change is in the changeset only. A 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 Nits, none blocking:
Implemented-by: VERDICT: FAIL |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs 席位核对 — REWORK · repo:objectstack#3 · head 167cb91 · 2026-11-25T02:41ZL1: REWORK (L1-w, zone wf-A) The L2 at Must-fix (L1)
Should-fix (L1)
Must-fix and should-fix (from the L2, adopted; details in 7151034259)
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)
Path to final ACCEPT
|
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg3KqwSpt61Y8ovKK7
…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
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs Contract-review-claim: session_01WGufzgv2LZN1W2qSYTZvYs · head 0f46c64 · 2026-11-25T04:27Z |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs Contract reviewServed-tier: Delta review of record 7151034259 (head ① Derived judgmentsThe seven judgments of record 7151034259 stand unchanged: the export
② Semver level
③ Boundary flagsInputs 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).
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 judgmentM1 (must-fix): closed — a read row with no
S1 (should-fix): closed — S2 (should-fix): closed — the S3 (should-fix): closed — by the documents route, which is an acceptable answer for this PR. Entry 18, the changeset and S4 (should-fix): closed — the decision is said where the ADR asks: the PR body's Decision section, the module doc, the changeset and 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: VERDICT: PASS |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs 席位核对 — ACCEPT · repo:objectstack#3 · head 0f46c64 · 2026-11-25T04:33ZL1: ACCEPT (L1-w, delta read, zone wf-A) No must-fix, no should-fix. The L2 at Closed this round
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-overThe L2 escalates:
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs Contract reviewServed-tier: This record restates 7152947987 with the closures spelled by id, at the same head. Delta review of record 7151034259 (head ① Derived judgmentsThe seven judgments of record 7151034259 stand unchanged: the export
② Semver level
③ Boundary flagsInputs 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).
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 judgmentM1: closed — a read row with no
S1: closed — S2: closed — the S3: closed — by the documents route, which is an acceptable answer for this PR. Entry 18, the changeset and S4: closed — the decision is said where the ADR asks: the PR body's Decision section, the module doc, the changeset and 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: VERDICT: PASS |
|
repo:objectstack#3 · os-support-ai · session_01WGufzi4PechTRCTBrfxV8W 维护者速读
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 ( 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.
Generated by Claude Code |
Requested by Yibo Wang · project thread
Part of #32062
Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: none (no skills/ page names
deletePolicy,deletedFieldor_sync_deleted_at:git grep -c -E "deletePolicy|deletedField|_sync_deleted_at" -- skills/exits 1 with zero hits at 0f46c64, controlgit grep -c "name:" -- skills/hits; the guide that teaches them iscontent/docs/automation/jobs.mdx, updated here)维护者速读
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). UnderdeletePolicyabsent (reads as'mark') or'mark', a pull stamps_sync_deleted_aton 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._sync_source) not stamped by this run (_sync_pulled_atbefore 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, elseunjudged, null watermark. The mark's range is limited to rows whose copied watermark is non-NULL and at or abovewatermark.start. Connector source: nowatermarkandpaging: { style: 'none' }; nopagingrecordsunjudged, no paging declared, a paging style whose loop is not built recordsunjudged, 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), recordsunjudged, 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-
markrefusal (the narrowing).incrementalSourceDeleteRefusal(@objectstack/spec/data, new export) refuses at parse (MappingSchema, path[source, 'deletePolicy']) an incremental source (connector withwatermark, datasource withoutfull: true) under'mark'with nodeletedField; both pulls ask the same rule at run time (400 VALIDATION_ERROR, reasondelete_policy_unhonourable). Migration entryincremental-source-delete-policy-stated(ADR-0087 semantic); changeset carries the marker and the FROM/TO fix.A
syncedtarget 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, andos validatedoes not catch it. Migration entry 18 names it, its replacement, and the failedsys_sync_runas the signal for a mapping stored at run time; the changeset andjobs.mdxsay the same (review S3, N8). No parse-time refusal is added for it. A datasourcedeletedFieldthat is not a source field is refusedsource_binding_invalid.sys_sync_run: newmarked_deleted_count,deletes,skipped_null_watermark; end-of-pull log line says what was marked and cleared.Liveness:
deletePolicy/deletedFieldunder both sources flipplannedtolivewith evidence,authorWarndropped.pagingstaysplanned.Nits. Record 6791935060: N1
JobHandlerContextdeclarestrigger/runId, the jobs guide lists them; N2originOfkeeps a trigger or job run id only when the run record can hold it; N3 the self-contradictingjobs.mdxsentence reworded; N5job_run_id/triggerdescriptions say when each is empty; N4 is NOT fixed here (see Acceptance notes). Record 7119012685 / 7120208665: N1 the reordered-upsertKeyconsequence stated atencodeSyncExternalIdand in the marker; N4 the bare-name_sync_sourcescope stated in the marker (see Decision below); N8 theObject.issentence inrefuseHookSyncProvenanceWrite; N9 the unreadable-target refusal says whether the object is not registered or the metadata read failed (same reasonmapping_target_refused, no new reason).Review round 2 (L2 7151034259, L1 7151052312). M1 and S1 above; S2
packages/spec/docs/SYNC_ARCHITECTURE.md'sordersPullexample statesdeletedField: '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; N2deletedFieldtruthiness (text'false'/'0'marks, a misspelt connector field marks nothing) stated injobs.mdx, the changeset and the marker; N3 the NULL-watermark count reads onlyid(floored and paged fallback); N4 a storeddeletePolicyoutside'mark'/'ignore'is refuseddelete_policy_unhonourableby both pulls instead of read as'mark'; N5 the connectorSource D3 liveness evidence namespullOnce(the executor pin'spullConnectorSourcekept beside it); N6sys_sync_run.deletessays 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_sourceis 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:
SyncDeleteMarkerscopes every find by_sync_sourceequal to the mapping's name, and no pull refuses a second mapping on a target.Read first (by risk)
packages/services/service-automation/src/sync-delete-mark.ts—afterBatch(the keyless-row count and the 500-key chunks) andcanMarkAbsentdecide whether absence is judged;markAbsent(the where clause:_sync_source,_sync_pulled_atbeforerunStartedAt, the refused-key$nin, the range) decides which rows are marked.packages/services/service-automation/src/datasource-pull.ts— the delete judgment afterreadSourceInWindowsandcountNullWatermarks.packages/spec/src/data/mapping.zod.ts—incrementalSourceDeleteRefusaland 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; nopagingand an unfollowed style mark nothing by absence;deletedFieldmarks and clears; incremental under mark refused before the action; ignore);systemFields: falseunder 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).[review M1]on both pulls (datasource: one blank-key row plus a deleted row leavesunjudged, 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; newsync-delete-mark.test.ts(the 1000-key limit at 1000 and 1001, one keyless row makes the run unjudgeable,$inchunks of 500/500/1 on clear and 500/1 on mark, a mark failing at row 3 keepsmarkedat 2).mapping-sync-in.test.ts,mapping-connector-source.test.ts: the parse refusal and its legal twins; the liveness pin now expects onlypagingplanned.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 && ... typecheckat 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 && ... typecheckat 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 droppedpullConnectorSource; fixed in 0f46c64.)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 HEADempty. The suites import the module fromsrc/by relative path, so no dist leg applies.!) at 0f46c64, afterpnpm --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
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.upsertKeyis reordered, a runner-refused row keeps its old_sync_external_idspelling, 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 insync-delete-mark.ts.incrementalSourceDeleteRefusalandsyncDeletePolicyRefusaljudge 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 (adeletePolicyoutside the enum is now refused, review N4).$ninofmarkAbsentholds at most 1000 keys, unchanged this round (the L2 accepted the bound).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 generatedapi-surface/export-origins/ liveness counts; round 2 addspackages/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--ranon 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").cli vitest run test/migrate-meta-engine-guidance.test.tsexit 1 (MODULE_NOT_FOUNDfor@objectstack/mcp/dist, the cli closure not built yet),spec check:skill-examplesandcheck:dual-build-cjs-loadsexit 3 (client dist not built). After the closure build, all three re-run at 0f46c64: exit 0.spec check:liveness,check:upgrade-guide,check:generatedandcheck-nul-bytesre-run at 0f46c64: exit 0.Generated by Claude Code