Repository navigation
test(backend): add hermetic lifecycle simulator and leak reproductions - #24597
Merged
Merged
Conversation
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.
There was a problem hiding this comment.
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
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
backend/test.shwith a list containingtest_lifecycle_sim_unit.py,test_listen_pusher_stack_ci_wiring.pyandtest_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.LifecycleInvariantErrorfailures and all three controls passed, with no setup/proof/transport errors. Original source restored byte-for-byte; SHA-256a7f24418cc832294cf3651c2fdc14966f4884f1fa9641e56dc6eb16fc3fec370. Unmarked source is never pushed.c7b54f3passed 33 preflight checks, 49 helper tests and all 62 CI checks; it was intentionally held because main advanced during CI.killpgEPERM. A detached main773c4cedbaseline instead hit a different REST-finalizationReadTimeout; no common cause is claimed. Lead rulingbcb72aauthorizes publication with this local limit disclosed and requires the fresh CI Listen Pusher Stack Gauntlet to pass before merge.Current main
6cf56c7was integrated unchanged as38a04386. 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.githubchanges. 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 ownerThat 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:
sealed capture has no registration after sweeper and no-job recovery— freshtitles no-job-after-seal fix, no PR yet.successful re-upload remains failed and outside custody— freshtitles failed-upload retry fix, no PR yet.finalization completed with zero batch results and no re-armed generation— ordering fix from lead rulinga50c5b, no PR yet.conversation completed while audio was open and its upload session remained pending— ordering fix froma50c5b, 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
1c8084preserves 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 leaduicleanupin rulingcf4b50. After the current-main admission promotion, ruling4894baextends that closure to exactce5e8dca, authorizing merge only after fresh CI is green/CLEAN, with no round 3. Ruling1da2bdextends the same closure to exact38a04386: the lead verified a pure main merge and byte-unchanged simulator/unit test; fresh CI green/CLEAN remains required. No LunaSHIPverdict 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.