Skip to content

test(dev-loop): add #702 T1/T5/T6 approval-failure tests - #711

Merged
mashkovd merged 1 commit into
mainfrom
test/702-approval-failure-tests
Oct 19, 2026
Merged

mashkovd merged 1 commit into
mainfrom
test/702-approval-failure-tests

Conversation

@mashkovd

Copy link
Copy Markdown
Member

Follow-up to #702 (PR #709): the review found the planned tests T1, T5, T6 and T9 missing. Test-only change; no production code touched.

What

  • Fixture: _canonical_activities / _fake_activities accept a list for delegated_result (answers flips in order, repeating the last), and digest_state["after_flip"] rewrites the proposal digest while a flip runs.
  • T1 (test_failed_approve_flip_never_implements): also asserts the we_ advances exactly once, as Failed.
  • T5 (test_702_t5_...): first flip ends Failed on a rewritten proposal -> grant superseded, re-asked on the same we_test_own (attempt + 1), second flip succeeds, implementer runs, single Succeeded advance, one GRANT_SUPERSEDED comment naming both digests.
  • T6 (test_702_t6_...): every flip fails on a fresh rewrite -> past MAX_GRANT_SUPERSEDES the loop ends approval_refused ("approval superseded too many times"), no implementer, single Failed advance.
  • T2 is already covered by test_a_non_stale_refusal_ends_typed_approval_refused.

T9 revert check

With orchestrator/temporal/workflows/dev_loop.py replaced by 56b9224^ (pre-#702), T1, T2, T5 and T6 all fail; on main they pass.

Verification

  • pytest tests/test_dev_loop_workflow.py tests/test_temporal_cli.py: 251 passed
  • ruff check: clean

Refs #702

🤖 Generated with Claude Code

The #702 review found the planned T1, T5, T6 and T9 tests missing. T1 now
asserts the we_ advances once as Failed. T5 covers a flip that fails on a
rewritten proposal: the grant is superseded, re-asked on the same we_, and
the second flip reaches the implementer. T6 covers repeated stale flip
failures ending typed approval_refused past MAX_GRANT_SUPERSEDES.

T9: run against the pre-#702 dev_loop.py (56b9224^), T1, T2, T5 and T6 all
fail; against main they pass.
@claude

claude Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Claude finished @mashkovd's task in 3m 38s —— View job


Review complete ✅

  • Gather context (diff, CLAUDE.md, AGENTS.md)
  • Review changed test file for correctness, coverage, style
  • Post findings (if any) as inline comments
  • Submit verdict (approve / request changes)

Verdict: APPROVE (no P1/P2, 1 P3)

This is a test-only change adding T1 (assertion strengthening), T5, and T6 coverage for #702's approval-supersede flow. I traced the new fixture behavior against the production code it exercises:

  • tests/test_dev_loop_workflow.py:306-311 — delegated_result now also accepts a list, consumed in order and sticking on the last entry; digest_state["after_flip"] rewrites the digest mid-flip. This correctly feeds check_grant_freshness (via fake_check_grant_freshness) so the post-failure freshness check in _supersede_grant_if_stale (orchestrator/temporal/workflows/dev_loop.py:2193) sees a mismatched digest exactly when the tests intend.
  • T1 (test_failed_approve_flip_never_implements): new [a.phase for a in advances] == ["Failed"] assertion matches _approval_ended setting _canonical_end_phase = "Failed" (dev_loop.py:2339).
  • T5: walked the digest/attempt bookkeeping call-by-call — the first flip's Failed result is correctly detected as stale (bound digest v1 vs. rewritten v2), superseded, re-asked on the same we_test_own with attempt+1, and the second flip (Succeeded) proceeds to the implementer with a single Succeeded advance and one GRANT_SUPERSEDED comment naming both digests — consistent with dev_loop.py:2162-2179.
  • T6: confirmed MAX_GRANT_SUPERSEDES = 8 (dev_loop.py:335) and the _supersede_count > MAX_GRANT_SUPERSEDES cap (dev_loop.py:2237) line up exactly with the test's range(MAX_GRANT_SUPERSEDES + 1) loop and len(delegated) == MAX_GRANT_SUPERSEDES + 1 assertion.
  • No lines introduced by this diff exceed the repo's 120-char ruff limit (pyproject.toml:91); no new imports or production code touched.

P3 (nit, non-blocking): tests/test_dev_loop_workflow.py:311 — delegated_result[0] would raise IndexError if an empty list were ever passed (the len > 1 branch pops, the else indexes unconditionally). Unreachable today since every caller passes a non-empty list; flagged inline for awareness only.

No P1/P2 findings. Approved.

# post-failure freshness check sees a new digest.
digest_state["current"] = digest_state.pop("after_flip")
if isinstance(delegated_result, list):
return delegated_result.pop(0) if len(delegated_result) > 1 else delegated_result[0]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: delegated_result[0] raises IndexError if an empty list is ever passed (the len > 1 branch pops, but the else branch indexes unconditionally without checking for empty). Not reachable today since every caller passes a non-empty list, but a guard or docstring note on _canonical_activities/_fake_activities would make the fixture's contract explicit.

@claude claude 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.

No P1/P2 findings (1 P3). Verified the new fixture logic (list-valued delegated_result, after_flip digest rewrite) and the T5/T6 assertions against the production supersede/freshness logic in orchestrator/temporal/workflows/dev_loop.py (MAX_GRANT_SUPERSEDES, _supersede_grant_if_stale, _delegated_approve) — the test flow matches it precisely. Good to merge.

@github-actions

Copy link
Copy Markdown
Contributor

Antigravity (agy) review

Model: gemini-3.8-flash-high · commit 7bfad29.

No significant issues found.

@mashkovd
mashkovd merged commit a568df5 into main Oct 19, 2026
12 checks passed
@mashkovd
mashkovd deleted the test/702-approval-failure-tests branch October 19, 2026 05:25
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