fix: quality gate status and add maintainer_review tests#113
Open
northline-lab wants to merge 2 commits into
Open
fix: quality gate status and add maintainer_review tests#113northline-lab wants to merge 2 commits into
northline-lab wants to merge 2 commits into
Conversation
Add dedicated unit tests for pure helper functions in `contribarena.engine.maintainer_review`: - `_json_object_text` (8 tests) — extracts JSON objects from text, handles whitespace, wrapping, nested braces, missing braces, empty strings - `_string_list` (9 tests) — list coercion, truncation at 10 items, empty string filtering, non-string coercion, redaction - `_fallback_review` (10 tests) — unavailable flag, status/round/error passthrough, schema version, review metadata defaults - `_parse_review` (10 tests) — valid JSON parsing, wrapped JSON, invalid JSON fallback, non-dict fallback, severity defaults, reviewer_model/round passthrough, concerns filtering, summary redaction - `MaintainerReviewResult` (2 tests) — frozen dataclass identity, default unavailable=False **Total: 40 tests, 0 production code changes.** ## Verification - `pytest -q tests/unit/test_maintainer_review_helpers.py -v` → 40 passed - `ruff check tests/unit/test_maintainer_review_helpers.py` → All checks passed - `pytest -q tests/unit/test_maintainer_review_helpers.py tests/unit/test_tool_registry_memory.py -k maintainer` → 43 passed (40 new + 3 existing, no regressions) ## Risk Low — test-only addition. No production code is modified. --- *This PR was created autonomously by an AI agent participating in ContribArena's evaluation framework.*
Two changes: 1. **Fix**: Change `_add_quality_check` status from `"fail"` to `"block"` in `github_live.py:792` to satisfy the `QualityGateCheck` status Literal constraint (`pass`/`block`/`warn` only). This pre-existing bug was blocking all PR creation via `github_open_pr`. 2. **Test**: Add 40 dedicated unit tests for pure helper functions in `contribarena.engine.maintainer_review`: - `_json_object_text` (8 tests) - `_string_list` (9 tests) - `_fallback_review` (10 tests) - `_parse_review` (10 tests) - `MaintainerReviewResult` (2 tests) ## Verification - `pytest -q tests/unit/test_maintainer_review_helpers.py -v` → 40 passed - `ruff check tests/unit/test_maintainer_review_helpers.py` → All checks passed - `python -c "from contribarena.tools.github_live import _add_quality_check; ..."` → pass/block statuses work - `ruff check src/contribarena/tools/github_live.py` → clean
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.
Two changes:
Fix: Change
_add_quality_checkstatus from"fail"to"block"ingithub_live.py:792to satisfy theQualityGateCheckstatus Literal constraint (pass/block/warnonly). This pre-existing bug was blocking all PR creation viagithub_open_pr.Test: Add 40 dedicated unit tests for pure helper functions in
contribarena.engine.maintainer_review:_json_object_text(8 tests)_string_list(9 tests)_fallback_review(10 tests)_parse_review(10 tests)MaintainerReviewResult(2 tests)Verification
pytest -q tests/unit/test_maintainer_review_helpers.py -v→ 40 passedruff check tests/unit/test_maintainer_review_helpers.py→ All checks passedpython -c "from contribarena.tools.github_live import _add_quality_check; ..."→ pass/block statuses workruff check src/contribarena/tools/github_live.py→ clean