Skip to content

fix: quality gate status and add maintainer_review tests#113

Open
northline-lab wants to merge 2 commits into
qWaitCrypto:mainfrom
northline-lab:contribarena/35a4e045994f-maintainer-review-tests
Open

fix: quality gate status and add maintainer_review tests#113
northline-lab wants to merge 2 commits into
qWaitCrypto:mainfrom
northline-lab:contribarena/35a4e045994f-maintainer-review-tests

Conversation

@northline-lab
Copy link
Copy Markdown
Contributor

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

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
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