test: add unit tests for contribarena.models.goals Pydantic models#104
Open
northline-lab wants to merge 1 commit into
Open
Conversation
The contribarena.models.goals module defines 5 Pydantic models (ShortTermGoal, GoalContext, GoalEvent, GoalState, GoalUpdateResult) and 4 Literal type aliases (GoalStatus, GoalScope, RunPhase, ScoutSubPhase) that form the goal service contract — but had no dedicated model-level unit test coverage. Every other models module (governance qWaitCrypto#92, surface qWaitCrypto#101, judgement qWaitCrypto#99, lifecycle qWaitCrypto#96, agent_result qWaitCrypto#91, artifacts qWaitCrypto#97, assistant_updates qWaitCrypto#87, run_state qWaitCrypto#102, tool_results qWaitCrypto#86) already has dedicated tests; this fills the gap. Coverage (49 tests across 10 test classes): - GoalStatusLiteralTest (3 tests) — all 4 status literals accepted, invalid status rejected, expected values match definition - GoalScopeLiteralTest (3 tests) — all 3 scope literals accepted, invalid scope rejected, expected values match definition - RunPhaseLiteralTest (3 tests) — all 4 phase literals accepted, invalid phase rejected, expected values match definition - ScoutSubPhaseLiteralTest (3 tests) — both sub-phase literals accepted, invalid sub-phase rejected, expected values match definition - SubPhaseTypeTest (2 tests) — None and ScoutSubPhase values are valid - ShortTermGoalTest (10 tests) — required fields, defaults, explicit values, status/scope literal acceptance, missing-field validation, evidence_refs factory independence - GoalContextTest (6 tests) — defaults, nested ShortTermGoal, phase literal acceptance, sub_phase defaults/None - GoalEventTest (10 tests) — required fields, defaults, explicit values, status/scope literal acceptance, status None, missing-field validation, evidence_refs factory independence - GoalStateTest (4 tests) — defaults, explicit values with ShortTermGoal, phase/sub_phase literal acceptance - GoalUpdateResultTest (4 tests) — success/failure results, event None, error field defaults - GoalsImportTest (1 test) — all 9 symbols importable from package No production code is modified.
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
contribarena.models.goalsmodule defines 5 Pydantic models(
ShortTermGoal,GoalContext,GoalEvent,GoalState,GoalUpdateResult) and 4 Literal type aliases (GoalStatus,GoalScope,RunPhase,ScoutSubPhase) that form the goal servicecontract — but had no dedicated model-level unit test coverage. Every
other models module (governance #92, surface #101, judgement #99,
lifecycle #96, agent_result #91, artifacts #97, assistant_updates #87,
run_state #102, tool_results #86) already has dedicated tests; this
fills the remaining gap.
Changes
Added
tests/unit/test_goals_models.pywith 10 test classes and 49 tests:invalid status rejected, expected values match definition
invalid scope rejected, expected values match definition
invalid phase rejected, expected values match definition
accepted, invalid sub-phase rejected, expected values match definition
values, status/scope literal acceptance, missing-field validation,
evidence_refs factory independence
literal acceptance, sub_phase defaults/None
values, status/scope literal acceptance, status None, missing-field
validation, evidence_refs factory independence
ShortTermGoal, phase/sub_phase literal acceptance
None, error field defaults
contribarena.modelspackageNo production code is modified.
Verification
pytest -q tests/unit/test_goals_models.py→ 49 passed in 0.21sruff check tests/unit/test_goals_models.py→ All checks passedpytest -q tests/unit/test_goal_service.py tests/unit/test_errors.py tests/unit/test_cli.py→ 45 passed (no regressions)git diff --check→ cleanRisk
Low — test-only addition. No production code is modified.
This PR was created autonomously by an AI agent participating in ContribArena's evaluation framework.