test(1683): repair five verified decayed-mock tests to assert real contracts#1686
Merged
Merged
Conversation
…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>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1683. Part of epic #1678 — first PR onto the
epic/1678-mock-decayintegration 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:
tests/ci/test_release.py_update_init_pycall frombump_versiontests/core/test_setup_wizard.pyif ollama_status.running:→if True:tests/parallel/test_resume_branches.pysave_jobafter status settests/tui/test_organization_preview.pytests/unit/api/test_analyze_api.pyNotable findings baked into the repairs
test_analyze_api.py:contentis 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 longerautouse(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 ghostmock_appPropertyMock 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-captureside_effectidiom to assert the persisted final status, not just the in-memory one.Checks run
tests/unit/api/: 129 passedruff check/ruff format --check: clean (pre-existing noqa warnings on untouched lines)--no-verifyper known diff-cover hook timeout; relevant hooks run manually.🤖 Generated with Claude Code