teleo-infrastructure/tests
m3taversal 1f5eb324f3
Some checks are pending
CI / lint-and-test (push) Waiting to run
refactor: centralize PR state transitions in lib/pr_state.py
Replace 38 hand-crafted UPDATE prs SET status calls across evaluate.py
and merge.py with 7 centralized functions that enforce invariants:
- close_pr: always syncs Forgejo (opt-out for reconciliation)
- approve_pr: raises ValueError on empty domain (prevents NULL bugs)
- mark_merged: always sets merged_at, clears last_error
- mark_conflict: always increments merge_failures, sets merge_cycled
- mark_conflict_permanent: terminal conflict state
- reopen_pr: handles all reopen scenarios (transient, rejection, reeval)
- start_review: atomic claim with bool return

This eliminates the class of bugs that produced 3 incidents:
1. Domain NULL on musings bypass (7 PRs stuck, 20h zero throughput)
2. Forgejo ghost PRs (70 PRs open on Forgejo but closed in DB)
3. Merge_cycled missing on various close paths

Also fixes: 3 close paths in merge.py had DB update before Forgejo call
(reversed order). close_pr does Forgejo first, then DB.

Only remaining raw status transition: _claim_next_pr (approved→merging)
which is an atomic subquery and doesn't have invariant requirements.

20 new tests, 264 total passing, 0 regressions. Net -101 lines in
evaluate.py + merge.py.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 12:08:57 +01:00
..
__init__.py ganymede: add dev infrastructure — pyproject.toml, CI, deploy script 2026-03-13 14:24:27 +00:00
conftest.py ganymede: add dev infrastructure — pyproject.toml, CI, deploy script 2026-03-13 14:24:27 +00:00
test_attribution.py feat: atomic extract-and-connect + stale PR monitor + response audit 2026-03-28 22:34:20 +00:00
test_enrichment_dedup.py fix: enrichment idempotency — three-layer dedup prevents duplicate evidence blocks 2026-03-31 13:18:23 +01:00
test_entity_queue.py epimetheus: sync VPS-deployed code to repo — Mar 18-20 reliability + features 2026-03-20 20:17:27 +00:00
test_eval_pipeline.py fix: rename eval.py to eval_checks.py to avoid shadowing stdlib eval 2026-03-31 13:44:04 +01:00
test_extraction_prompt.py epimetheus: sync VPS-deployed code to repo — Mar 18-20 reliability + features 2026-03-20 20:17:27 +00:00
test_feedback.py epimetheus: sync VPS-deployed code to repo — Mar 18-20 reliability + features 2026-03-20 20:17:27 +00:00
test_merge.py Replace rebase-retry with cherry-pick merge mechanism 2026-03-31 13:18:26 +01:00
test_post_extract.py feat: atomic extract-and-connect + stale PR monitor + response audit 2026-03-28 22:34:20 +00:00
test_pr_state.py refactor: centralize PR state transitions in lib/pr_state.py 2026-04-16 12:08:57 +01:00
test_reweave.py feat: consolidate eval pipeline, reweave fixes, enrichment dedup, cherry-pick merge, TG batching 2026-03-31 13:21:59 +01:00
test_reweave_merge.py fix: handle indented YAML list items in _serialize_edge_fields 2026-04-04 14:01:34 +01:00
test_search.py feat: two-pass retrieval with sort order and graph expansion 2026-03-28 22:34:45 +00:00
test_tg_batching.py fix: TG message batching — group by chat_id + time proximity 2026-03-31 13:19:35 +01:00
test_x_content_pipeline.py Add X content pipeline: output gates + tweet queue + pluggable approval 2026-04-15 17:02:08 +01:00