Skip to content

Consolidate repeated test setup and scenario assertions - #1795

Merged
mergify[bot] merged 2 commits into
mainfrom
lean178/575-test-dedupe-pass4
Nov 26, 2026
Merged

mergify[bot] merged 2 commits into
mainfrom
lean178/575-test-dedupe-pass4

Conversation

@eowca

@eowca eowca commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Consolidate repeated test setup and scenario assertions

Context and goal

Acceptance

Validation

Recorded for 46c1a5790122

  • uv run --group dev ruff check src tests: exit 0
  • uv run --group dev tach check: exit 0
  • uv run --python 3.14 python scripts/check_architecture_docs.py: exit 0
  • scripts/size_budget.sh: exit 0
  • uv run --group dev pytest -q: exit 0

All six changed test files passed. The optional IntelFlo policy snapshot cases stayed skipped because no pinned snapshot was supplied.

Integrated size proof at main ec7a26f: tests 13,774 → 13,671 (−103, headroom 179). Source 8,145/8,250, core docs 1,500/1,500, delegation docs 596/660, and complexity passed.

Six isolated spot mutations each made a retained test fail, and the same test passed after restoring source. They covered candidate tree comparison, explicit GitHub GET pagination, producing workflow identity, Mergify retry delay, publication body verification, and Claude authentication environment forwarding. The proof used independent bytecode caches for each mutated and restored run.

The PR changes tests only. Architecture and production behavior are unchanged.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Review

  • primary, claude, 46c1a57, approve

eowca and others added 2 commits November 26, 2026 11:07
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>

@loopzero-feder-positronics loopzero-feder-positronics 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.

loopzero primary review by claude on 46c1a57901226d79be06875dab1e3e4d82e4e953, 73.0s: approve (0 critical, 0 important, 2 suggestion)

Settings per native call (launch configuration and CLI claims, not backend attestation):

  • Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)

Native Claude output is retained in the restricted local review receipt.

head = lost_reply(wt, gh, fake_bin, monkeypatch, kind="delta", verdict=5, interrupted=True)
assert run(capsys, "review")[0] == 130
path = wt / ".loopzero" / f"review-{head[:12]}-delta.json"
path = cli._review_file(wt, head, "delta")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: Expected review-file path now comes from the production helper

The test used to spell out the expected path as wt / ".loopzero" / f"review-{head[:12]}-delta.json". It now calls cli._review_file(wt, head, "delta"), so the expected value comes from the same production code it is checking. If someone changes the on-disk naming by mistake, for example the prefix length or the kind suffix, this test will follow the change and still pass. This is the only line in the change that replaces a hard-coded expectation with production logic. Smallest fix: keep the literal path, which costs no extra lines.

Comment thread tests/test_mergify.py
@pytest.mark.parametrize("failure", ["http503", "dropped_read", "truncated"])
def test_api_get_retries_transient_reads(monkeypatch, failure):
calls = []
@pytest.mark.parametrize("failure,expected_sleeps", [

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: Merged retry/terminal test branches on the parameter type

test_api_get_retries_and_classifies_failures now handles three different failure mechanisms in one test: an HTTP 503, a failing body read, and a URLError. The fake opener and the final assertions both branch on failure == "http503" or failure in body_errors. Coverage is the same or better, and it now also asserts sleeps == [2.0] on the transient paths. The cost is that the fake's behaviour is decided by the type of the parameter, and that is easy to break when adding a case. For example, a new string failure that is meant to be transient would silently become a terminal URLError. Consider a small explicit mode field in each parameter tuple instead of inferring the mode. test_provider_errors_are_typed in tests/test_runners.py has the same pattern: whether the case is malformed output is inferred from exit_code == 0, and the codex fake swaps stdout and stderr on that basis.

@eowca
eowca marked this pull request as ready for review November 26, 2026 10:33
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

✅ Merged into main as a31a2b0 at 10:39 UTC

5 min in the queue, 5 min of it CI.

So far

  • ✅ Entered the queue Thu 26 Nov, 10:34 · rule main · triggered by @eowca with the @mergifyio queue command
  • ✅ Passed · draft #1810
  • ✅ Merged 10:39 · a31a2b0 · squash
3 merge conditions met
  • github-review-approved · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = checks
    • check-neutral = checks
    • check-skipped = checks
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = Loop-zero Eligibility
    • check-neutral = Loop-zero Eligibility
    • check-skipped = Loop-zero Eligibility

Times in UTC · dashboard · how the merge queue works

@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

No description provided.

@mergify
mergify Bot merged commit a31a2b0 into main Nov 26, 2026
18 checks passed
@mergify mergify Bot removed the queued label Nov 26, 2026
@eowca
eowca deleted the lean178/575-test-dedupe-pass4 branch November 26, 2026 10:40
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