Repository navigation
fix(edit): make the test-weakening guard opt-in - #42
Merged
Merged
Conversation
…ACT_GUARD=1) Co-Authored-By: lemoncrow <302591943+lemoncrow-agent[bot]@users.noreply.github.com> LemonCrow-Session: 92cb5b4c-3e6f-4a9d-943c-7ce1c04bdb28 LemonCrow-Model: claude-opus-5-5
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.
Summary
The
edittool's test-weakening guard rolled back any test-only edit that net-removed assertion lines or added skip/xfail markers. In practice it mostly blocked legitimate work: pruning obsolete tests (/prune-tests), moving tests between files (each file is judged alone), consolidating several asserts into one, and edits to comments or helpers that merely contain the wordassert(\bassertalso matchesassert_called_once_with,assertEqual, ...).This flips
_test_contract_guard_enabled()from default-on (opt-out) to default-off (opt-in):LEMONCROW_TEST_CONTRACT_GUARDis0/false/no/off.LEMONCROW_TEST_CONTRACT_GUARDis1/true/yes/on.The detector itself is unchanged, so turning it back on is just the env var.
Tests
test_smart_edit_*intests/gateway/test_mcp_tool_handlers.py,test_owned_edit_blocks_test_weakeningintests/gateway/cli/test_runtime.py) now setLEMONCROW_TEST_CONTRACT_GUARD=1so they still exercise the detector.test_smart_edit_test_contract_guard_off_by_default: with the env var unset, a test-only assertion removal applies and is not rolled back.uv run pytest -q tests/gateway/test_mcp_tool_handlers.py tests/gateway/cli/test_runtime.py -k "smart_edit or owned_edit"-> 18 passed.make dev: a test-only assertion removal through the MCPedittool now applies.