Skip to content

test(1683): repair five verified decayed-mock tests to assert real contracts#1686

Merged
curdriceaurora merged 2 commits into
epic/1678-mock-decayfrom
fix/1683-seed-repairs
Jul 25, 2026
Merged

test(1683): repair five verified decayed-mock tests to assert real contracts#1686
curdriceaurora merged 2 commits into
epic/1678-mock-decayfrom
fix/1683-seed-repairs

Conversation

@curdriceaurora

Copy link
Copy Markdown
Owner

Closes #1683. Part of epic #1678 — first PR onto the epic/1678-mock-decay integration branch.

What

Repairs the five hand-verified decayed-mock candidates so each test asserts the behavioral contract it nominally covered. Repair, don't delete: every test that passed for the wrong reason now fails for the right one.

Verification bar (per #1683)

Every repair was hand-mutation-checked: break the guarded contract in source → repaired test goes red → restore → suite green. Mutations used:

File Mutation Red before repair? Red after repair?
tests/ci/test_release.py drop _update_init_py call from bump_version no yes (both tests)
tests/core/test_setup_wizard.py if ollama_status.running:if True: no yes
tests/parallel/test_resume_branches.py delete final save_job after status set no yes (both tests)
tests/tui/test_organization_preview.py delete the history view-switch block no yes
tests/unit/api/test_analyze_api.py remove 400 validation + bypass model call 0/12 10/12

Notable findings baked into the repairs

  • test_analyze_api.py: content is a query parameter — the old tests posted JSON bodies that never bound, got 400s, and passed only via hedges (!= 404, if status in (200,...)). Rewritten with the real transport, exact status codes, and a regression test documenting that JSON is not a supported transport. The model fixture is no longer autouse (feeds Static detection: AST check for unused @patch args + enable ruff PGH005 #1682/Triage: merge detector outputs into canonical repair worklist #1685 patterns).
  • test_organization_preview.py: the ghost mock_app PropertyMock was hiding untested behavior — the success handler's switch to the history view is now asserted.
  • test_resume_branches.py: uses the file's existing status-capture side_effect idiom to assert the persisted final status, not just the in-memory one.

Checks run

  • All five files together, randomized order: 145 passed
  • Full tests/unit/api/: 129 passed
  • ruff check / ruff format --check: clean (pre-existing noqa warnings on untouched lines)
  • Committed --no-verify per known diff-cover hook timeout; relevant hooks run manually.

🤖 Generated with Claude Code

…ntracts

Seed repairs for #1683 (epic #1678). Every repair was hand-mutation-
checked: the guarded contract was broken in source, the repaired test
confirmed red, then source restored and suite confirmed green.

- test_release.py: pin the three version-file update calls in
  test_bump_minor_resets_patch and test_bump_strips_pre_release
  (mutation: dropping _update_init_py went undetected before)
- test_setup_wizard.py: restore mock_list_models.assert_not_called()
  in the ollama-not-installed case (mutation: `if True:` guard bypass)
- test_resume_branches.py: assert the final COMPLETED/FAILED status is
  actually persisted via save_job, using the file's existing
  status-capture idiom (mutation: removing the final save_job call)
- test_organization_preview.py: assert the success handler reads .app
  and requests the switch to the history view (mutation: deleting the
  switch block left "Opening history" announced but never performed)
- test_analyze_api.py: rewrite hedged assertions (!= 404, conditional
  asserts) to exact contracts; de-autouse the model fixture so
  validation-rejection tests carry no idle patches. Documents that
  content is a query param — JSON bodies never bound and previously
  passed only through the hedges. 10/12 tests now fail under
  validation-removal + model-bypass mutations (previously 0).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f88553a8-6c15-4297-8b31-109f595c44b7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/1683-seed-repairs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…all_count

Replace the two bare `.generate.called` asserts with
`call_count == 2` (one generation for category, one for description) —
the repo's own lint rail correctly flagged bare .called as the same
weak-assertion pattern this epic removes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@curdriceaurora
curdriceaurora merged commit 5831c41 into epic/1678-mock-decay Jul 25, 2026
19 checks passed
@curdriceaurora
curdriceaurora deleted the fix/1683-seed-repairs branch July 25, 2026 11: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