Skip to content

test(backend): add hermetic lifecycle simulator and leak reproductions - #24597

Merged
Git-on-my-level merged 10 commits into
mainfrom
lane/lcsim
Nov 4, 2026
Merged

Git-on-my-level merged 10 commits into
mainfrom
lane/lcsim

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

What changed and why

Adds WP-A's hermetic lifecycle simulator to the existing listen/pusher stack. It drives production custody, registration, admission, scheduler/worker, merge, projection and recovery-summary persistence over a disposable Firestore emulator and local encrypted synthetic audio. GPU and summary-provider leaves are synthetic.

Includes credential/project/network refusal, persisted job-clock aging, exact seal/register/admit faults with fired events, and a real pusher process-death control. The existing gauntlet runner includes the simulator and retains its diagnostics. No workflow or CI-budget edits.

Product invariants affected

none

How it was verified

  • Canonical backend/test.sh with a list containing test_lifecycle_sim_unit.py, test_listen_pusher_stack_ci_wiring.py and test_listen_lifecycle_emulator_harness_wiring.py: 65 passed (49 helper, 15 CI wiring, 1 lifecycle wiring) on current main plus this candidate.
  • backend/testing/lifecycle_sim/run.sh --keep: 3 passed, 4 strict xfailed. Latest main-integration rerun: added module wall 65.308 seconds; standalone Firebase wrapper 99.365 seconds (earlier run137.699/164.04). Below the three-minute target without a budget change.
  • Physically removed the four remaining xfail decorators locally: exactly four final LifecycleInvariantError failures and all three controls passed, with no setup/proof/transport errors. Original source restored byte-for-byte; SHA-256 a7f24418cc832294cf3651c2fdc14966f4884f1fa9641e56dc6eb16fc3fec370. Unmarked source is never pushed.
  • Ordinary push gates run with ambient GCP variables removed, default shared slot counts and background priority. Earlier head c7b54f3 passed 33 preflight checks, 49 helper tests and all 62 CI checks; it was intentionally held because main advanced during CI.
  • Full local gauntlet attempts encountered unchanged teardown killpg EPERM. A detached main 773c4ced baseline instead hit a different REST-finalization ReadTimeout; no common cause is claimed. Lead ruling bcb72a authorizes publication with this local limit disclosed and requires the fresh CI Listen Pusher Stack Gauntlet to pass before merge.

Current main 6cf56c7 was integrated unchanged as 38a04386. The stale BYOK metric inventory caused the same file failure on earlier main and ce5 CI. The exact-file local comparison reproduced both alert assertions on ce5; main #24605 passes143 tests plus79 expected table gaps. After importing that fix unchanged, local gates pass208 tests plus79 table xfails, and the simulator passes3 controls plus4 strict xfails. The PR diff remains only 19 harness/test/doc paths, with no production or .github changes. Dependencies did not change.

Tests

The happy control verifies the actual decrypted provider title/overview after real transcript projection and summary persistence. The typed dead-producer control kills a real local pusher after its production barrier persists a live token.

The two-replica admission test originally failed on the earlier main with:

record_pending entered admission concurrently on 2 replicas; expected one lease owner

That exact pre-fix proof is archived. Fix #24587 merged while A1 CI was running. On current main the unchanged test produced strict XPASS, with both other controls passing and four remaining xfails. Only then was its obsolete marker removed. It is now an ordinary green regression. This proves the source fix; no production deployment/health claim is made.

The four remaining strict failures accept only the final invariant assertion:

  1. sealed capture has no registration after sweeper and no-job recovery — freshtitles no-job-after-seal fix, no PR yet.
  2. successful re-upload remains failed and outside custody — freshtitles failed-upload retry fix, no PR yet.
  3. finalization completed with zero batch results and no re-armed generation — ordering fix from lead ruling a50c5b, no PR yet.
  4. conversation completed while audio was open and its upload session remained pending — ordering fix from a50c5b, no PR yet.

The ordering cases use real durable admission, leases, fanout and completion. Result arrival must leave actionable finalization or a new generation; stranded leases/failures and stale conversation projections do not satisfy the invariant.

Lead ruling 1c8084 preserves the green dead-producer control: supplied incident evidence contains aggregate counts without the leaking token payload shape. The original fleet shape remains unproven; no failure is manufactured.

Review corrections and decision

Preserves the existing single-runner CI wiring contract; forwards only supported lifecycle options; resolves relative state roots once; cleans only owned automatic roots on refusal; retains caller roots/diagnostics; reserves bounded producers before suspension; and checks reservation identity before cancellation cleanup. Boundary selectors explicitly have conversation scope, while legacy session-write selectors retain their four-field contract.

Both Luna reports remain FIX-FIRST. The sole remaining round-2 P2 was manually reviewed and closed by lead uicleanup in ruling cf4b50. After the current-main admission promotion, ruling 4894ba extends that closure to exact ce5e8dca, authorizing merge only after fresh CI is green/CLEAN, with no round 3. Ruling 1da2bd extends the same closure to exact 38a04386: the lead verified a pure main merge and byte-unchanged simulator/unit test; fresh CI green/CLEAN remains required. No Luna SHIP verdict is fabricated.

UI evidence

UI-Evidence: none -- emulator test harness only

Failure class (fixes)

Failure-Class: none

New guards

The lifecycle incident exposed obligations lost at seal/registration/admission and finalization ordering. This shared simulator is WP-A's primitive for WP-B real-store invariant coverage, with strict expected failures that cannot swallow fixture or transport errors. No production repairs, GCP calls, user-data reads/writes, feature flips or deploys occur in this PR.

Exercise the real finalization lease and completion before batch results and
while an upload producer remains open. Restrict expected failures to their
final lifecycle invariant, and inspect the durable job generation for rearm.

Preserve caller-owned state roots and Python 3.11 lock annotations.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 17 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread backend/testing/lifecycle_sim/run.py Resolved
Comment thread backend/testing/lifecycle_sim/run.py Resolved
Preserve the existing gauntlet command contract and retain lifecycle diagnostics
under the caller state root. Resolve paths once and clean owned roots on refusal.

Require persisted provider output and actionable finalization after result arrival.
Record exact conversation-scoped boundary faults and reject session selectors.
Reserve bounded producer slots before suspension and keep mutation calls outside
assert expressions. Exercise existing wiring, cleanup and concurrency contracts.
Keep conversation-boundary and legacy session selector validation together in
the fault helper. This shrinks the oversized stack runner below its main
baseline and adds table coverage for both selector scopes.
…tion

Release only the barrier owned by the cancelled begin attempt. A controlled
replacement regression covers the ownership fence without starting services.
PR #24587 merged to main while A1 CI was running. Verify its real two-replica
case trips strict XPASS, then retain it as a green regression. Keep the four
remaining leak cases strict and preserve the original pre-fix red proof.
Import main6cf56c7e unchanged after #24605 fixes the pre-existing BYOK metric
inventory failure. Keep WP-A scoped to its test harness and fixtures.
@Git-on-my-level
Git-on-my-level merged commit 8dc79e6 into main Nov 4, 2026
59 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/lcsim branch November 4, 2026 14:54
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