Skip to content

test: add unit tests for contribarena.models.goals Pydantic models#104

Open
northline-lab wants to merge 1 commit into
qWaitCrypto:mainfrom
northline-lab:contribarena/38a2a18f0ba3-goals-models-tests
Open

test: add unit tests for contribarena.models.goals Pydantic models#104
northline-lab wants to merge 1 commit into
qWaitCrypto:mainfrom
northline-lab:contribarena/38a2a18f0ba3-goals-models-tests

Conversation

@northline-lab
Copy link
Copy Markdown
Contributor

Summary

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 #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.py with 10 test classes and 49 tests:

  • 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 the
    contribarena.models package

No production code is modified.

Verification

  • pytest -q tests/unit/test_goals_models.py → 49 passed in 0.21s
  • ruff check tests/unit/test_goals_models.py → All checks passed
  • pytest -q tests/unit/test_goal_service.py tests/unit/test_errors.py tests/unit/test_cli.py → 45 passed (no regressions)
  • git diff --check → clean

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.

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