Skip to content

Consolidate overlapping test cases to recover test budget - #1797

Closed
eowca wants to merge 2 commits into
mainfrom
lean178/575-test-headroom-r51
Closed

eowca wants to merge 2 commits into
mainfrom
lean178/575-test-headroom-r51

Conversation

@eowca

@eowca eowca commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Consolidate overlapping test cases to recover 152 lines

Context and goal

Refs #575

Acceptance

  • Remove at least 150 net Python test lines while retaining coverage of the different scenarios.
  • Prove retained assertions reject representative mutations. Keep the source, cap settings, and core docs unchanged.
  • Pass the full slotted check, review, and merged-candidate size budget before landing.

Evidence

The resolved merge removes 155 net test lines. It preserves #1766’s hosted snapshot-change cases and REST-call bounds. Focused runs passed in each of the eight retained test modules.

Eight isolated spot mutants caused assertion failures in the retained tests: skipped architecture acknowledgment, reversed default network setting, missing-review verdict misreported as success, separated stderr when merging streams, reversed completed-order selection, missing empty-key rejection, ignored stage-runner fallback, and uncommitted content included in the review diff.

The hosted review matrix shares the same readiness evaluator as the retained CLI tests for pending and dismissed verdicts. The ordinary closed-predecessor case is also exercised by the more demanding publisher-failure case.

Base

Base: ec7a26f

Validation

Recorded for 0538de698953

  • 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

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

Review

Architecture-Review: unchanged; this test-only change preserves the delivery and trust behavior.
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 d4a2bd0c84790acb5818e0ac7e27e486fd46633f, 61.3s: approve (0 critical, 0 important, 3 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.

Comment thread tests/test_config.py
],
],
)
MINIMAL = '[repo]\nname = "o/n"\n'

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: MINIMAL is defined twice

MINIMAL = '[repo]\nname = "o/n"\n' is defined at the top of the module (line 10) and again just before test_invalid_content. Ruff's F811 does not flag a plain reassignment, so this passes lint, but a later edit to one copy would quietly diverge from the other. Smallest fix: delete the second definition, which also saves two lines.

Comment thread tests/test_hosted.py
review = approval() | {"state": "COMMENTED"}
reviews = {
"absent": [], "APPROVED": [approval()], "revoked": [approval(), review | {"state": "DISMISSED"}],
"untrusted": [review | {"user": {"login": "attacker"}}], "stale": [approval("b" * 40)],

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: The "stale" case now tests the ancestor-review path instead of a commit_id/marker mismatch

The old "stale" fixture was a COMMENTED review with commit_id = b*40 and a marker that still said head=HEAD. In eligibility.readiness_review, that review failed eligible_review(marked, HEAD) because of the commit_id == head filter at src/loopzero/eligibility.py:80. The new approval("b" * 40) changes both commit_id and the marker to b*40. That routes the case through the ancestor path (reviewed = b*40), where it stays pending for a different reason: the body has no valid evidence or primary-review summary. As a result, no case in this matrix still covers a review whose marker claims the current head while GitHub binds it to another commit. If you want to keep that guard, use approval() | {"commit_id": "b" * 40} for "stale". It costs no extra lines.

Comment thread tests/test_worktree.py

from loopzero import worktree
from tests.conftest import commit_file, git, git_environment, init_git_repo
from tests.test_setup import SETUP, setup_commands

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: test_worktree imports a helper from another test module

from tests.test_setup import SETUP, setup_commands couples two test modules together, and setup_commands("sh", "", text=...) uses an empty prefix plus a text override that only this caller needs. The repo already imports between test modules (tests.test_github and tests.test_candidate in test_hosted), so this is acceptable. Still, moving setup_commands into tests/conftest.py would avoid hidden dependencies between test modules.

Architecture-Review: unchanged; the conflict resolution preserves the hosted check and test contracts.
Co-Authored-By: Codex <noreply@openai.com>
@eowca eowca changed the title Consolidate overlapping test cases to recover 152 lines Consolidate overlapping test cases to recover test budget Nov 26, 2026

@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 delta review by codex on 0538de6989538cdaeae37afaebb2c076783367d8, 33.1s: approve (0 critical, 0 important, 1 suggestion)

Same-family fallback: independent reviewers failed: claude: not authenticated. Cross-family review is preferred.

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

  • Call 1: requested model gpt-6.2-astra (effort medium); CLI-reported model gpt-6.2-astra (effort medium); configured model gpt-6.2-astra (effort medium)
Raw reviewer output
Native Codex transcript retained in the restricted local review receipt; public evidence is publisher-derived, not backend attestation. Exact raw SHA256: e6cdcfef4d61afe9c0c3e9d54cb65c0330994548923ba8d52866cd91abbbe360

Comment thread tests/test_hosted.py
if error in {"head", "metadata", "merged"}:
changes = {"head": {"headRefOid": "b" * 40}, "metadata": {"labels": [{"name": "hold"}]},
"merged": {"state": "MERGED"}}
publisher.respond_pr_view(pr_json(**changes[error]))

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: Distinguish head changes from metadata changes in the final-read tests

The head and metadata cases accept any LoopZeroError and expect the same status sequence. Because the metadata fingerprint includes the head SHA, removing the dedicated head-change check would still pass the head case through the generic metadata error. Set message to the expected diagnostic for each case. Also pass branch="lz/task" on the second read so each fixture changes only the field under test.

@eowca
eowca marked this pull request as ready for review November 26, 2026 10:41
@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

🚫 Left the queue · conflict with base branch

1 min in the queue, with no time running CI.

So far

Reason

The pull request conflicts with main

Conflicting file: tests/test_worktree.py

Before this, the pull request was held in the queue behind 2 pull requests ahead of it.

To get back in the queue

  • You should update or rebase your pull request. A pull request in a stack is updated by rebasing the stack onto the branch it conflicts with. A pull request queued by a rule comes back to the queue once updated, as long as the rule still matches.
  • If it was queued with a command, update it, then comment @mergifyio queue to queue it again.

Times in UTC · dashboard · how the merge queue works

@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #1821. #1805 introduced a new conflict after this PR used both review rounds. The authorized replacement preserves #1805’s carriage-return coverage and carries the prior approved test consolidation on current main.

@eowca eowca closed this Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant