Repository navigation
test(backend): characterize conversation lifecycle - #9532
Merged
Git-on-my-level merged 4 commits intoJul 12, 2026
Merged
Conversation
added 2 commits
July 11, 2026 23:31
Refs #9516. Verification: focused lifecycle and workflow-contract tests pass; the full backend suite is blocked by the unchanged app-client schema inventory line-number assertion, recorded in the PR body.
Filter static workflow scans to Python sources, normalize glob paths to the repository root, and retain the existing app-key tuple exception with its migration reason.
7 tasks
Concurrent first calls to _record_legacy_lifecycle_mutation could double-register the Prometheus Counter; use threading.Lock with double-checked initialization. Co-authored-by: Cursor <[email protected]>
kodjima33
approved these changes
Jul 12, 2026
kodjima33
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed — conversation lifecycle characterization tests. Approve-only.
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.
Summary
Phase 1 of #9516: add a hermetic characterization suite for the current conversation lifecycle and temporary, bounded telemetry for legacy lifecycle writers.
Refs #9516
Root cause and recurrence evidence
database/conversations.pyexposes unconstrained status/discarded writes, while lifecycle drivers independently create, claim, finalize, reprocess, merge, discard, and import conversations. The one existing CAS claim protects one finalization path, but generic writes and several direct upserts bypass it. This is the failure class described in #9516; recent churn spansutils/conversations/,routers/transcribe.py, androuters/conversations.py.Durable guard
conversation_lifecycletobackend/testing/workflow_contracts.json, mapping the current direct-writer inventory to the new contract suite.conversation_lifecycle_legacy_mutations_total{writer,operation}. Writer labels are bounded to the ten inventoried modules plusother; it lets Phase 2 prove legacy usage reaches zero before deletion without breaking import purity.Scope and rollback
No user-facing behavior, Firestore schema, or lifecycle policy changes. This only observes and locks the current behavior. Roll back by reverting this commit; the collector is lazily registered and has no persisted state.
Verification
cd backend && .venv/bin/python -m pytest tests/unit/test_conversation_lifecycle_contract.py tests/unit/test_workflow_contracts.py -q— 31 passed.cd backend && .venv/bin/python scripts/check_workflow_contracts.py— passed.make preflight— passed (12 manifest checks).black --check --line-length 120 --skip-string-normalization backend/database/conversations.py backend/tests/unit/test_conversation_lifecycle_contract.py backend/tests/unit/test_workflow_contracts.py— passed.cd backend && .venv/bin/python scripts/scan_import_time_side_effects.py --files /tmp/omi-9516-import-files.txt— 0 violations.backend/test.shwas run across all 540 unit-test files. It is blocked by the unrelated, unchanged baseline assertion intests/unit/test_app_client_schema_inventory.py: the test expectsapp/lib/backend/schema/app.dart:31, while the unchangedorigin/mainsource and inventory report line 32. This PR does not touch either file.Product invariants
None affected (
scripts/pr-preflight --suggest).