Skip to content

Go lane 6c slice B: ordinary sync finalization on workerd, rebased onto main (admission closed) - #26346

Draft
Git-on-my-level wants to merge 95 commits into
mainfrom
sca-3551-b2
Draft

Git-on-my-level wants to merge 95 commits into
mainfrom
sca-3551-b2

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Summary

Refresh the Slice B draft with SCA-6041 callback settlement and settled-outbox comparison, plus the SCA-6042 paired R7 replay adapter. Both callback routes acknowledge delivery once same-revision Go custody records completed fanout. The adapter compares isolated candidate and frozen Python replays against a deterministic loopback provider. This draft supersedes the scope of #26643 for SCA-4852 F2, F4, F5 and F6. The Go admission switch remains off with an empty allowlist.

  • Register the folded ordinary-sync producer with the authenticated workerd serving composition. Pin only new eligible sources when the existing Go admission cohort grants access.
  • Save the managed notes v2 key and submitted revision before the paid request. Require a committed gateway receipt before advancing the parked job's ownership epoch. Resume through the Python sync outbox, preserving the receipt's original revision and using a different key for new input.
  • Resolve panel F2 by clearing a fresh, unsubmitted checkpoint when the pre-POST revision fence detects new content. Resolve panel F3 by binding canonical memory replacement to the Go source and deletion fence.
  • SCA-6041 keeps queued enrichment on the same durable obligation while folded admission is unresolved. The callback requests admission for a pending pin, preserves the task token on retry, and parks the row while Go owns the revision.
  • Fresh ordinary sync sources record cohort eligibility during assignment. For a held candidate, the callback runs the incumbent quiet-window policy and revalidates eligibility before the transaction clears the hold and writes the pending owner epoch. Held assignment leaves the stored BYOK lookup to the ready callback. The promotion transaction preserves the intake clock or restores it from the durable outbox. The winning transaction records the existing Go admission counter once after commit. Incumbent processing keeps its existing hold receipt.
  • The stock ordinary-sync replay starts from the pending owner fence and exercises folded admission with the Python reference adapter and a loopback keyed gateway. Account erasure sweeps the owner’s top-level enrichment obligations, including Go-parked work. Account-operation receipts keep their incumbent 90-day retry window.

The v2 result has a 24-hour read window. Activation still requires custody approval for physical expiry and a deployment decision for the sweep. Rollback closes admission and drains or reconciles pinned work before routing it back to Python.

  • After completed handback, the public status route resolves the retained Go receipt using the same owner, conversation, job and revision, with adjacent ownership epochs.

  • Workerd completes the held snapshot with the same fenced notes write. Hold release keeps the original summary acceptance and its deadline.

  • A completed handback returns the settled summary for the current revision, avoiding a repeat paid notes call.

  • Sync finalization retains the relevance hint and the existing Home icon on empty captures, with the neutral Structured default when the source has no icon.

  • After the Go empty-discard receipt and fanout commit, record the terminal noise stage in a lease-, revision-, and deletion-fenced transaction. The candidate replay measured four additional reads and one write per empty discard.

  • Trim legacy inline transcript text and compress changed lists in the existing Go persistence transaction. Preserve segment IDs, timing, and unrelated fields.

  • Keep main’s shared conversation tombstone check and the Go effect fence’s field projection. Update the sync emulator fixtures for the builder lease token and outbox callback and task lookup contracts.

  • Normalize the ruled timestamp and token differences only on settled outbox receipts. The comparator still reports incompatible field types, active defer values, and retained owner data.

  • Share the Go custody check between both callback routes, classify its reads, and update the outbox emulator fixtures to exercise the current callback contracts.

Product invariants affected

  • INV-MEM-4. Eager sync uses the canonical memory writer with the Go source fence and starts intake in Short-term.
  • INV-TASK-2. Eager sync uses the ordinary sync trigger and the existing task writer. Capture proposals remain pending Candidates.

Failure class

Failure-Class: FC-retry-resume-behind-own-fence

Line-count exceptions

Line-Count-Exception: backend/database/conversation_finalization_jobs.py | 3812 -> 3818 | Pin the notes protocol and durable prompt clock when creating a job.
Line-Count-Exception: backend/database/conversations.py | 6170 -> 6226 | Keep handback ownership and multipart guards in the existing transaction and preserve the original pending clock and deadline at hold release.
Line-Count-Exception: backend/database/firestore_index_registry.py | 2427 -> 2428 | Exclude encrypted keyed notes results from indexing.
Line-Count-Exception: backend/utils/conversations/process_conversation.py | 3581 -> 3613 | Keep ordinary sync empty-capture disposition beside its existing decision and bind eager memory and notes writes to their source revision.
Line-Count-Exception: backend/utils/sync/assignment.py | 1689 -> 1696 | Pin an eligible source at creation or record its candidacy inside the existing hold.
Line-Count-Exception: backend/utils/sync/pipeline.py | 4063 -> 4072 | Recover queued admission and return already settled notes at the legacy sync callback without repeating provider work.

SCA-6042 fresh-held replay verification

The Go replay starts from fresh held assignment and enters Workerd through the serving callback after quiet-window release. The callback reads stored BYOK state and refuses Go admission for active BYOK users. The replay attributes privacy operations to their serving callers.

The archived manifest amendment replaces go_seeded_sync_dispatch with go_serving_sync_admission_from_fresh_held_assignment in the expected Go entrypoints. The audit still requires exact ordered matches. The Python labels and pinned corpus digest are unchanged.

  • Verified on m1 at ac28a19812008bab3ff14758708d2c3c2c1168a3. The local 42-case run completed all pairs and passed the exact entrypoint audit with zero violations. Serving refused all five BYOK cases with zero Workerd admission POSTs for those cases.

  • The closed assignment control passed all 42 cases. Each side recorded 217 reads, 257 writes, zero deletes, and zero upstream calls. Go admission remains off with an empty allowlist.

  • The serving replay recorded 4,444 reads, 1,545 writes, 75 deletes, and 60 upstream calls for Go. Frozen Python recorded 15,252 reads, 3,351 writes, 78 deletes, and 53 upstream calls.

  • Go exceeded Python's per-case Firestore operation count in 35 cases and upstream call count in seven, for 36 distinct cases. The budget gate remains blocked. The upstream is a deterministic loopback fixture, and the run remains ineligible for R7 qualification.

  • make -C backend-go check passed vet, architecture, lint with zero findings, and the Firestore/Postgres race run across 26 test packages. go test -count=1 ./tools/replay passed 76 top-level tests. backend-go/tools/replay/test.sh passed 26 Python contract tests, 10 admission parity cases, the 41-case expected-drift contract and its mutation checks. Seven adapter unit tests passed. The changed-files Python selector selected 3,140 files for CI, including 408 affected contract and changed-test files in its focused set.

  • The focused Python run covered all 408 selected files. It recorded 16,767 passes, 72 expected failures, four Firestore-required skips, and one failure. The failure is the new r7_held.py dependency on retiring utils.sync.pipeline, rejected by test_sync_legacy_import_ratchet.py. A separate Firestore emulator run passed all 102 backfill tests, including the four requiring Firestore.

  • Main was left out of this refresh because deploy(listen): re-pin the reviewed evidence scripts tree (SCA-2185) #26914 had not landed. The standalone Listen overlay workflow test had 40 passes and one failure on the stale reviewed scripts-tree pin.

Callback settlement, comparator, and adapter verification

Verified on m1 at 7bb6615484686cbed00c2b4b48aa9d3e57303e38. The branch includes SCA-6041 settlement 7310d1b026, the SCA-6042 adapter bc48658703, the SCA-6041 comparator 3f22f25fbf, and main through ed306bba58e.

  • make -C backend-go check passed vet, architecture, lint with zero findings, and the Firestore/Postgres race run across 26 packages. The six-package race run passed 163 top-level tests. The opt-in worker paths ran through F6 and the adapter. go test -count=1 ./tools/replay passed 76 top-level tests.
  • backend-go/tools/replay/test.sh passed 26 Python contract tests, 10 admission parity cases, the 41-case expected-drift contract, and its mutation checks.
  • The changed-files selector produced 3,140 files for CI. The file-isolated local run covered 409 files, including settlement route, parity and coalescing. It passed 16,771 tests with 72 expected failures. Four tests that require Firestore passed on the emulator.
  • Ten Firestore/Postgres emulator suites passed 177 tests. The separate loopback replay also passed four Firestore-backed backfill tests. In both F6 hold modes the dispatch and rollup counts were 1/1 through handback and 2/2 after a new source revision.
  • The independent hold-ON run matched frozen Python on all 42 assignment cases. Each side totaled 217 reads, 257 writes, zero deletes, and zero provider calls. The candidate wrote zero early Go pins. Admission was off and the allowlist was empty.
  • backend-go/tools/replay/r7-adapter.sh completed 42 of 42 synthetic lifecycle pairs. Go measured 1,815 reads, 786 writes, and 53 upstream calls. Frozen Python measured 15,035 reads, 3,094 writes, and 53 upstream calls. Each side's gateway portion was 156 reads and 119 writes. The frozen manifest reports 42 candidate entrypoint mismatches because the adapter records the serving admission handler from seeded custody. This loopback fixture is ineligible for R7 qualification.
  • make preflight passed 46 checks. Pipeline Lab passed four Home and sync scenarios. The adapter unit suite passed six tests.

Noise ledger and transcript refresh verification

  • Full Go make check passed vet, lint with zero findings, the architecture checks, and the Firestore/Postgres race run across 26 test packages. The requested six-package race run passed 163 top-level tests, and go test ./tools/replay passed 75. The two opt-in worker replay paths ran separately through F6 and the notes replay harness.
  • The changed-files selector identified 407 affected Python files. The local file-isolated run passed 16,731 tests with 72 expected failures. The four backfill tests that require Firestore passed when rerun with the emulator. The selector expands to 3,135 files for CI.
  • Eight Python Firestore/Postgres emulator suites passed 98 tests. In both hold modes, F6 observed one dispatch and one rollup through handback, then two of each after a revision change.
  • The 42-case hold-on assignment run matched frozen Python case by case at 217 document and query reads, 257 writes, and zero deletes, with zero early Go pins. The separate fresh-timestamp serving run registered 37 successful admission POSTs, each after its epoch-1 pending pin. Its 43 recent-conversation subscription reads bring that profile to 260 reads and 257 writes.
  • Completed-handback replay returned the existing notes and preserved the stored row on all 13 living receipt cases, with zero repeat provider calls.

Four-candidate refresh verification

  • Six Go race packages passed 152 tests with two existing opt-in skips. The Go replay package passed 75.
  • The lifecycle and hold verification passed 3,011 Python tests with 72 existing expected failures. This run included the previously failing summary debt entry and the adjacent writer inventory.
  • Five local Firestore/Postgres integration suites passed 102 tests. F6 produced one dispatch and one rollup through handback, then two of each after a revision change, with hold on and off.
  • Across 42 hold-on cases, assignment matched the frozen Python budget of 217 reads, 257 writes and zero deletes. Serving admitted 37 held sources, each with one successful POST after an epoch-1 pending pin. The living handback replay completed all 13 retries with zero repeat provider calls.
  • Pipeline Lab passed the Home paging and two sync scenarios.
  • The changed-files selector's focused set passed 16,556 tests across 405 files with zero failures. The legacy sync file is 4,071 lines under the existing 4,072-line ceiling.

Previous successor verification

  • Local Go vet, lint and architecture passed. Six Go race packages passed 150 tests with two opt-in skips, and the Go replay package passed 75 tests.
  • The Python emulator run passed 65 tests. F6 recovered 1 dispatch and 1 rollup through handback and reached 2 and 2 after a new source revision in both hold profiles. The wipe fixture removed the owner's parked rows for live and missing user roots and preserved another owner's row. A replay through the real account-wipe entry point also removed both Go-parked obligations.
  • The changed-files selector passed 5,242 unit tests across 58 files, with one test deselected by the local runner.
  • The 42-case hold-on assignment meter recorded 217 reads, 257 writes and zero deletes, matching frozen Python case by case. Assignment created no pins before the quiet window. On hold release, 37 sources wrote an epoch-1 pending pin and each made one successful admission POST. The replay verified all 16 historical first-summary-pending rows in each profile, preserving the intake clock or recovering the original outbox clock.
  • The previous backend unit run found an import in the frozen placement scope, overly eager handback loading in sync fixtures, stale People and lifecycle inventories, and two endpoint settings missing from the budget inventory. Current main supplies the renewal for the expired budget entries. The five failure-related files also passed on current main.
  • Pipeline Lab passed both sync scenarios, late_sync_joins_published_card and sync_safety_copy_repeats_live.

Prior Slice B verification

  • Go vet, lint and the architecture check passed. The full go test -race -count=1 ./... run using local Postgres and Firestore passed 402 top-level tests across 26 test packages. Two opt-in replays were skipped in that run. The F6 integration runs the interrupted-notes replay separately.
  • The three requested Python unit files passed 182 tests. The local changed-file selection covered 48 files with 1,874 tests passed. The gateway and sync reference suites passed 45 emulator tests.
  • The F6 emulator fixture exercises Go admission for a synthetic allowlist member, then interrupts Go after the real gateway settles its completion. Python keeps the totals at one dispatch and one rollup across handback, and two of each after a source revision change.
  • SCA-6041's worker replay recorded 217 assignment reads after the fix, matching the frozen Python baseline on each of 42 cases. The local first-week tests verify the expired-window read is skipped.

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R19 review at 732f694739929ae5a903bac7e31c659b7628e710: no blocker found in the requested profile-refresh scope. The receiver constructs GoConversationEffectSource from the conversation ID, sync revision, owner epoch, job ID and finalization revision; apply_eager_sync_enrichment passes it through refresh_for_finalization into the profile writer. The commit transaction rechecks the account marker, source row and tombstone, Go owner epoch, job ID, finalization revision, sync revision, and the prior profile text before its existing profile update. The new Go source validation contributes two reads (source row and tombstone) and no writes. The three-attempt cap and cooldown/in-progress reservation cleanup are unchanged; the wrapper also releases its semaphore in finally. Regression coverage checks mismatches in engine, epoch, job ID, finalization revision and sync revision.

Git-on-my-level added a commit that referenced this pull request Nov 26, 2026
SCA-3551 adds the paired missing-row fence and account erasure fixtures
to the pinned workerd diagnostics. The runner captures the pre-wipe
views and records the post-wipe Firestore absence and Go queue custody
through the workerd test seam on #26346.

**Current head: `ac891072`** (fast-forward of `db654737` via
`99fbd280`). `99fbd280` validates the fence memo against the pre-delete
conversation and link snapshot and checks the link survives unchanged
(oracle artifact; accepted count 86→85). `ac891072` requires the bound
intake memo whenever intake expects one, so both-sides-missing evidence
is rejected. Worker 2 R19 SHIP at `ac891072` (Python replay 44 passed/1
skipped; Go memo comparator tests passed). Test tooling only:
`backend-go/tools/replay/` and `backend/testing/finalization_replay/`;
no serving code. Rollback: revert the merge commit.

The comparator landed on main in #26322 at `58a67241`. This PR now
targets main and contains only the paired lifecycle runner changes.

Set `ORACLE_DIAG_PAIRED_LIFECYCLE=1` to enable the paired fixtures and
`ORACLE_DIAG_SIDE_TIMEOUT_SECONDS=720` for the supplemental suite. The
109 jobd pre-wipe rows stay diagnostic. The serving missing-row attach
memo evidence contributes one accepted gap, bringing SCA-3551 to 86
before later group releases.

At `db654737`, the Python replay suite passed 42 tests with one
replay-binary-dependent skip, and all 37 local preflight checks passed.

The full 720-second-budget run against pinned worker `0a0640ae`
completed all 41 cases. R7 held in every case at a minimum margin of +2
Firestore operations. Fence used 13 Go vs 25 Python operations, and
erasure used 126 vs 130. The run had 163 diagnostic gap rows, zero
unlabelled, zero pre-wipe binding failures, and zero execution errors.
The normalized findings match the accepted baseline.
Multica Worker 2 Codex (Sol) and others added 23 commits November 28, 2026 17:28
Carry forward ordinary sync finalization and use a standalone OIDC status endpoint after the Episodes engine retirement. Keep the Python notes deadline and record the current Home projection with the effects receipt.

Co-authored-by: multica-agent <[email protected]>
# Conflicts:
#	backend/utils/llm/conversation_processing.py
Git-on-my-level and others added 30 commits December 1, 2026 02:30
# Conflicts:
#	backend/database/conversations.py
#	backend/database/llm_gateway_accounting.py
# Conflicts:
#	backend/database/conversation_effect_fence.py

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants