Skip to content

fix(tests): let merge-copy stubs accept #23445's skip_existing keyword - #23447

Merged
Git-on-my-level merged 1 commit into
mainfrom
m1/fix-merge-copy-fixtures-23445
Oct 23, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
m1/fix-merge-copy-fixtures-23445

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

#23445 (37010d3, merged 20:04Z) passes skip_existing=True to _copy_audio_chunks_for_merge from merge_conversations.py:293. Four test stubs replace that function with fixed-arity lambdas, so these tests now fail on main with TypeError: unexpected keyword argument 'skip_existing':

  • test_merge_deleted_source_race.py (2 stubs)
  • test_speaker_match_scores.py (1)
  • test_merge_created_webhook.py (1)

#23445's own CI was green because selective test selection didn't run these files. Seen on #23393 (run 40016931073, shards 1 and 5).

Fix: test-only. Each stub now accepts **_kw. No production change.

Verification (m1, omi-heavy, nice 19): pytest tests/unit/test_merge_deleted_source_race.py tests/unit/test_speaker_match_scores.py tests/unit/test_merge_created_webhook.py tests/unit/test_merge_audio_chunk_copy_failure.py gives 129 passed.

Failure-Class: none

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

#23445 passes skip_existing=True to _copy_audio_chunks_for_merge; four
fixed-arity lambda stubs now raise TypeError on main. Test-only fix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-23T20:31:02.788263Z 7985304 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Git-on-my-level
Git-on-my-level merged commit 532990a into main Oct 23, 2026
62 checks passed
@Git-on-my-level
Git-on-my-level deleted the m1/fix-merge-copy-fixtures-23445 branch October 23, 2026 20:42
Git-on-my-level added a commit that referenced this pull request Oct 23, 2026
…nt stack

Include reviewed main #23447 without rewriting the published draft history.
Preserve the deletion order and all production retirement gates.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Oct 23, 2026
…nt stack

Include reviewed main #23447 without rewriting the published draft history.
Preserve the deletion order and all production retirement gates.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Oct 23, 2026
…nt stack

Include reviewed main #23447 without rewriting the published draft history.
Preserve the deletion order and all production retirement gates.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Oct 23, 2026
## What changed and why

Redirected sync owner reads loaded the final survivor twice. Reuse the
operation's detached raw snapshot and Firestore revision for ordinary
photo/transcript hydration. A metadata-only bridge with no donor lineage
or effect attempts reuses its initial metadata. Donor traversal and
every attempted effect retain the final refresh. Transaction reads, CAS,
deletion markers, owner/path checks and outbox custody remain
authoritative.

Redirect helpers accept a keyword-only `firestore_client`. One lazily
selected client serves redirect resolution, either hydration mode and
photo reads. This addresses the P1 injection finding at
discussion_r4360643026; scoped-client tests reject fallback to legacy
globals. Invalid paths reject before client initialization.

Default ON. Kill switch: `SYNC_OPERATION_SNAPSHOT_ENABLED=false`. Both
modes use `origin=job:sync_operation_snapshot`;
`omi_sync_operation_snapshot_reads_avoided_total{origin,operation}`
counts avoided redirect-hydration and no-effect bridge lookups. No
reads-loop configuration changes. Keep renamed caller
`sync_conversation_snapshot:resolve_snapshot` in the measurement
baseline; label movement is not savings.

Both the snapshot counter and shared origin-overflow counter reuse
existing Prometheus collectors across fresh imports. The origin helper
is copied unchanged from fs-p2's reviewed commit
`77a033e14a0a53d7eaffb04b7da3fbde2875019c`; the archive contract test is
unchanged.

This is the bounded P5 snapshot slice.
`backend/docs/sync-operation-snapshots.md` records the remaining index
contract and P4 design only. The content-free <=4KiB enrichment outbox
cannot carry structured user content. An id+writer-generation index
obligation needs all-writer coverage, live eligibility, replay/CAS and
migration proof; lead owns the scope ruling. P4 excludes every privacy
caller and requires residual phase measurement after WQ12. The 22M/day
and 25M/day figures are unverified planning ceilings; daily savings are
unknown and none are booked.

## Product invariants affected

none

No transcript, speaker, Free-plan, entitlement, polling, hold, deletion
or privacy authority changes.

## How it was verified

- Counted fake document gets: redirect hydration 5 -> 4 with identical
decoded content and unchanged compressed stored bytes; eligible bridge 2
-> 1. Scoped/default-client cases preserve photo hydration. Fresh
deletions, owner/path mismatches, revision contracts, donor lifecycle,
post-effect races, paid unlock recovery and callback parity are covered.
- Real detail handler through FastAPI TestClient: equivalent JSON across
modes, then 404 after a fresh deletion marker. This is an in-process
endpoint check.
- Snapshot metric regression proves collector identity and exported
increments survive fresh config imports. The unchanged archive-contract
tests exercise repeated database imports with both counter repairs
present.
- Follow-up integration: merged main `532990aee3` as merge commit
`252b517e11`. Conflicts were additive documentation and flag entries
only; preserved both fs-p1 #23394 entries and P5 entries. No Python
conflict resolution. Head `8de371d00851ed4b0e9bd1180633b65faa156944`
also carries the exact fs-p2 shared-origin helper (blob
`d3b25323f440457705bfd6eab3ce83a55217a176`).
- Current published head: 16 focused files PASS, 373 tests, including
all four archive-contract cases, the snapshot metric regression, list
projections and repaired merge fixtures. From `backend/`:
`/Users/david/workspace/omi-workspace/bin/omi-heavy run -- env
BACKEND_PYTEST_WORKERS=4
BACKEND_UNIT_TEST_FILE_LIST=/Volumes/scratch/m1-lanes/fs-p5/merge-focused-files.txt
nice -n 19 bash test.sh`. Log:
`/Volumes/scratch/m1-lanes/fs-p5/merge-focused.log`.
- Current head: `make preflight` PASS37/37 (169.88s) and full mandatory
pre-push PASS, including full-backend typecheck (zero errors), runtime
source closure, bounded selected tests, schema checks and formatting.
Ran through `omi-heavy`, nice19; log
`/Volumes/scratch/m1-lanes/fs-p5/merge-publish.log`. Normal push
succeeded after re-fetching main and the shared lane branch; no
force-push. Exact-head
[CI40024971016](https://github.com/BasedHardware/omi/actions/runs/40024971016)
PASS: all six unit shards, guardrails and suite gate. All PR checks
terminal at collection, 37SUCCESS and zero failures; GitHub merge state
CLEAN. No rerun needed. Lead delta review remains required before merge.
- Earlier m1 metric head `61d363f23a`: eight focused files PASS (134
tests); published CI exposed the separate fs-p2 origin-counter
dependency and main #23445 fixture mismatches. This integration contains
the origin repair and main #23447 fixture repair. Earlier full mandatory
pre-push and full-backend typecheck passed. No checks bypassed.
- Prior Luna R1/R2: SHIP on production head
`f4e376f649fac50a232ea03a929b8b395f9d92a3`. Lead must inspect the
seven-line fixture delta at `7186a6bf67d`, client-injection delta
`7186..526e` and metric delta `06d8..61d3`. No third round: two-round
cap exhausted, and current conflict resolution changes no runtime
behavior. The shared origin fix was reviewed by fs-p2's read-only Luna
delta review.

Line-Count-Exception: backend/database/conversations.py | 4431 -> 4449 |
Add scoped-client parameters and forwarding at existing
redirect/hydration boundaries for P1 correctness; operation
orchestration remains extracted in sync_conversation_snapshot.py.

## UI evidence

UI-Evidence: none -- backend read optimization with unchanged response
contract.

## Failure class (fixes)

Failure-Class: none

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Git-on-my-level added a commit that referenced this pull request Oct 23, 2026
…23402)

## Summary

Repeated released-memory reads reload identical canonical, historical
and metadata windows. This change atomically maintains a content-free
owner change head with source commits, including deletes, and reuses
exact raw-query projections at internal canonical, historical,
list-window, status-pair and MCP-card callers. Existing authorization,
policy, lineage, privacy, decryption and lever paths remain
authoritative.

Warm 100-document pages use two head reads instead of 100
source-document reads. Cold pages add head checks; queries smaller than
three rows bypass reuse. The sprint's **50M/day target is conditional
and unmeasured**. Grade avoided source reads minus marker reads and
added writes before booking savings.

This branch merges main through
`251892e223fca3bf5c90f060d3b9673683e258fa`, including P1 list
projections (#23394), fs-p5 operation snapshots (#23393), the typecheck
repair (#23440), merge-copy fixture repairs (#23447), and apt CI repair
(#23446). Conflict resolution retains BOTH writer installers, BOTH
account-erasure cleanup families, and all flag contracts. New real-SDK
sync/async mixed-batch checks verify one atomic commit, both projection
families, and unchanged source result counts. Erasure checks cover late
head recreation with both present and missing user roots. The final
fs-p5 refresh resolved only an adjacent flag insertion; its
origin-counter repair is byte-identical to P2's.

The archive-filter CI regression is fixed in production registration:
`firestore_read_origin` and `released_memory_projection` recover their
existing process-wide Prometheus counters after import-isolation
teardown evicts modules. Two re-import cycles prove collector identity
and counts survive. No test catches the error or weakens archive
behavior. The earlier shard-5 rerun passed all four archive cases in
514s against its unchanged 720s budget.

## Lane / contract

fs-p2 owns `released_memory_changes_v1`, `MEMORY_RELEASED_PROJECTION`,
`MEMORY_RELEASED_WRITERS_COVERED`, and
`omi_memory_released_projection_total`; original design bus 9012d9. MCP
consumes P1's `list_serving_versions/conversations.version`, writer kill
switch and coverage epoch (original bus dd3ecb). Missing P1 metadata
retains source reads. No additional conversation writer is introduced.

## Product invariants affected

- INV-MEM-1: existing three-tier policy, pending/expiry and
archive/device visibility checks rerun on raw candidates. No transcript,
speaker or Free-plan changes.
- INV-MEM-3: source errors and canonical/suppression/lineage checks
still fail closed. Projection faults fall back to the same authoritative
query.
- INV-MEM-4: projections grant no promotion authority. Canonical
receipts, graph transitions and lineage collapsing retain their existing
owners; source/head writes remain atomic, including deletes.

## Verification

Final focused conflict-resolution run on m1: **433 tests across 21 files
passed** through `/Users/david/workspace/omi-workspace/bin/omi-heavy run
-- nice -n 19 env
BACKEND_UNIT_TEST_FILE_LIST=/Volumes/scratch/m1-lanes/fs-p2/fs5-merge-files.txt
BACKEND_PYTEST_WORKERS=4 bash backend/test.sh`. Covers P1/P2
projections, mixed sync/async writes, erasure/privacy, archive
filtering, origin attribution/wiring, MCP consumers, memory policy, all
three shared-main merge-copy stub files, and fs-p5
snapshot/metric/tombstone/unlock contracts. Log:
`/Volumes/scratch/m1-lanes/fs-p2/fs5-merge-focused.log`. The prior P1/P2
refresh passed 353 tests across 17 files.

Full backend typecheck passed with **zero errors** (existing warnings
remain), via `omi-heavy run --cache-default backend-typecheck -- nice -n
19 bash backend/scripts/typecheck.sh`; log
`/Volumes/scratch/m1-lanes/fs-p2/merge-typecheck.log`. One read-only
Luna conflict delta review completed with **no P0/P1 findings**:
`exec-curve-yellow-plunge-fancy-pill-obtain`, result
`/Volumes/scratch/m1-lanes/fs-p2/luna-merge-result.txt`. Historical
metric delta review: `exec-rhythm-sort-chapter-traffic-comic-vendor`;
its P1 typing finding was corrected and verified.

Published final merge head: `6ac131f9f566b0eb2d35447329c685d76c951ed1`.
**Exact-head CI is green**: [Backend Unit Tests, attempt
2](https://github.com/BasedHardware/omi/actions/runs/40028276311),
[Firestore emulator
proofs](https://github.com/BasedHardware/omi/actions/runs/40028276314),
and [hermetic backend
gates](https://github.com/BasedHardware/omi/actions/runs/40028276356)
pass. All visible checks are terminal: 37 successful, 30 intentionally
skipped, no failures. Final-head shard 5 passes all four archive cases
with wall **673s/720s**. The single permitted failed-job rerun passed
shard 4 (all 66 runtime-contract assertions, GPU closure CPU
**0.88s/1.00s**, shard wall **615s/720s**). No threshold, allowlist or
source changes and no further reruns.

Attempt 1's sole failure was the unchanged GPU closure CPU guard at
1.01s against 1.00s, with all 66 assertions passing. **Exact main also
fails the same guard at 1.16s** in [run
40026957577](https://github.com/BasedHardware/omi/actions/runs/40026957577/job/120665436845);
test and closure tool blobs match. ANX `card:fs-p2-runtime-duration`
retains the shared-main timing follow-up for the lead.

**Normal pre-push exited 0**: all 37 manifest checks, full backend
typecheck with zero errors, runtime source closure and bounded selected
unit checks passed; log
`/Volumes/scratch/m1-lanes/fs-p2/fs5-merge-push.log`. The prior main
refresh also passed all normal pre-push gates; log
`/Volumes/scratch/m1-lanes/fs-p2/merge-push.log`.

Prior-head CI passed five unit shards, guardrails, Firestore emulator
proofs and hermetic gates. Shard 5 passed all four archive cases in
**635s against its unchanged 720s wall budget**. Shard 4 passed all 66
assertions in unchanged `test_runtime_image_contracts.py` but failed its
CPU guard on the GPU import-closure test at 1.05s versus 1.00s. A
focused same-runner local reproduction passed all 66 tests, that case at
0.31s; log `/Volumes/scratch/m1-lanes/fs-p2/runtime-focused.log`. No
threshold/allowlist changes and no CI rerun used. Tracking: ANX
`card:fs-p2-runtime-duration`. Main advanced with fs-p5 during this CI
run, so the final merge gets fresh CI rather than rerunning the
superseded head.

Earlier synthetic P2 Firestore emulator proof passed failed-batch
atomicity, SDK transaction retry, result cardinality, sync/async
deletes, bulk exclusion and raw-read parity at recovered head bf6f72c.
Emulator project `demo-fs-p2`, local `127.0.0.1:18585`; log
`/Volumes/scratch/m1-lanes/fs-p2/emulator.log`. This historical emulator
run is not claimed as fresh conflict-resolution evidence. New-head
registered CI emulator proofs must pass before merge.

## Rollout / rollback

Writer maintenance is on. Reader preference defaults on with
`MEMORY_RELEASED_PROJECTION=off` as kill switch. **Reuse requires
`MEMORY_RELEASED_WRITERS_COVERED=v1:<unique-epoch>`**, initially absent
until complete writer-fleet attestation. MCP additionally requires P1
writer coverage and its fresh epoch. Bulk-blocked or missing-head owners
retain source reads; no user-data backfill.

Owner: rollout lead. Target T2 **2026-10-24 08:00Z**, cutoff **07:30Z**,
only after exact-head CI is green. By cutoff, verify every
backend/sync/backfill/integration/listen/pusher/desktop/job writer
release and synthetic create/update/delete parity, including
standalone/non-Python/raw-RPC writers. If proof is missing, record the
blocker and keep reuse disabled. Once proved, enable all eligible owners
with a fresh epoch.

Metrics: bounded `surface/outcome/origin` on
`omi_memory_released_projection_total`; marker reads use
`origin=job:released_memory_projection`, and source reads retain their
existing caller/origin. Compare output/order/access parity and p95. Any
mismatch or regression disables readers. Grade net reads in equal
full-day windows and mature billing before recording savings.

Clear coverage before ANY writer rollback or gap; rotate the epoch after
restoration. Reader-only rollback keeps head writers installed. Details:
`backend/docs/released-memory-change-projection.md`.

Failure-Class: none
Line-Count-Exception: backend/database/memories.py | 1968 -> 1971 |
three raw query calls adopt the shared projection transport; query and
policy ownership remain in place

Tracking: ANX `card:fs-p2-released-memory-projection`, owner fs-p2; lead
owns merge/deploy and full writer-fleet audit/activation by 2026-10-24
07:30Z. Handoff: `/Volumes/scratch/m1-lanes/fs-p2/HANDOFF.md`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.

1 participant