test: add unit tests for external_lifecycle pure helpers#114
Open
northline-lab wants to merge 1 commit into
Open
test: add unit tests for external_lifecycle pure helpers#114northline-lab wants to merge 1 commit into
northline-lab wants to merge 1 commit into
Conversation
## Summary Add 48 dedicated unit tests for pure helper functions in `contribarena.engine.external_lifecycle` that previously had no dedicated test coverage. ## Test Coverage - **ParseTest** (6 tests) — ISO datetime parsing with Z suffix, UTC offset, positive/negative offsets, naive datetime assumes UTC, microseconds - **IsoTest** (4 tests) — UTC-aware, naive assumes UTC, positive/negative offset conversion to UTC - **GithubStateTest** (5 tests) — None/open, not-ok defaults to open, merged, closed not merged, open - **HasRequestedChangesTest** (6 tests) — changes_requested detection, case-insensitive, approved, empty list, multiple reviews, missing state attribute - **HasRejectionSignalTest** (6 tests) — rejection/opt_out/anti_ai_or_bot detection, positive exclusion, empty list, mixed signals - **SummaryForStatusTest** (7 tests) — all 6 known statuses plus unknown fallback - **ClassifyStatusTest** (10 tests) — full priority chain: not-ok → merged → rejection → closed → changes → CI failure → tracking, plus pr=None variants and merged-overrides-changes - **SignalsFromStatusTest** (4 tests) — non-needs_response returns empty, needs_response without changes returns empty, creates process_feedback signal, deduplicates existing signals ## Why This Matters These helpers are central to the external PR lifecycle tracking contract: - `_parse`/`_iso` handle GitHub's various timestamp formats consistently - `_classify_status` implements the priority-ordered lifecycle classification - `_github_state` maps PR API results to lifecycle states - `_signals_from_status` generates maintainer signals with deduplication ## Verification ``` pytest -q tests/unit/test_external_lifecycle.py -v # 48 passed in 0.30s ruff check tests/unit/test_external_lifecycle.py # All checks passed! ``` ## 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.*
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
Add 48 dedicated unit tests for pure helper functions in
contribarena.engine.external_lifecyclethat previously had no dedicated test coverage.Test Coverage
Why This Matters
These helpers are central to the external PR lifecycle tracking contract:
_parse/_isohandle GitHub's various timestamp formats consistently_classify_statusimplements the priority-ordered lifecycle classification_github_statemaps PR API results to lifecycle states_signals_from_statusgenerates maintainer signals with deduplicationVerification
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.