Skip to content

[T-002a] core.types: shared enums and frozen value objects (Scenario, Proposal, Observation, Trace, OracleResult, RunOutcome, TaskSpec, SutProfile) #15

Closed

Description

@CodewithJha

Task T-002a · Milestone M1 — Foundation · Size M · Priority P0 · Epic #1

Implements FR-ORC-002 · FR-RUN-004

Branch feat/t-002a-core-types-shared-enums-and — one task = one branch = one PR (doc 32 §6)

Summary

Implement roboprobe.core.types with the exact normative names and fields from doc 05 §1. These are the contracts every other module exchanges.

Context / motivation

Doc 05 marks these signatures as normative. Freezing them early is what allows the scenario, oracle, selection, storage and backend streams to be built in parallel (doc 22 §4).

Scope

In scope

  • Enums: ParamType, Verdict, FailureClass (values F-COL…F-INFRA), RunStatus, CampaignStatus (StrEnum).
  • Frozen pydantic v2 models: Scenario, Proposal, Observation, OracleResult, RunOutcome.
  • Trace as @dataclass(frozen=True, slots=True) with NumPy columns listed in doc 05 §1 plus __post_init__ validation (equal lengths, monotonic t, dtypes).
  • TaskSpec (start/goal pose, tolerances, time-limit spec, nominal path reference, injected obstacles) and SutProfile (id, backend, config, config_hash) as frozen models (fields per doc 06 §1, §7 and doc 11 sut_profiles).
  • Pose2D value object and JsonValue alias.

Out of scope

  • Loading TaskSpec from YAML (T-027)
  • Parquet serialisation of Trace (T-018)
  • ParameterSpec/ScenarioSpace (T-020b — they live in roboprobe.scenario)

Implementation guidance

  • File: backend/src/roboprobe/core/types.py (≤ 400 lines; if larger, split into core/types/ package re-exported from core/types/__init__.py).
  • Copy names/field order exactly from doc 05 §1. Proposal.phase values: warmup | falsify | mode_search | boundary | refine | explore | baseline | manual | confirm | replay (doc 11 runs.phase) — use a Literal alias Phase.
  • Observation.robustness is None iff verdict == INVALID — enforce with a model validator.
  • OracleResult.robustness and RunOutcome.robustness constrained to [-1, 1] (Field(ge=-1, le=1)).
  • Trace.duration_s and Trace.n_samples convenience properties; no I/O in this module.
  • Docstrings: Google style + Implements: line (doc 16 §3).
  • Standards: respect the layering contracts (doc 16 §2) and conventions in doc 34; no hard-coded tunables — thresholds/defaults come from typed settings (doc 27); no magic numbers (ruff PLR2004); public APIs typed (mypy strict) and documented.

Acceptance criteria

  • All names/fields match doc 05 §1 (reviewer diff-checks).
  • Models are immutable (assignment raises).
  • Invalid robustness (e.g. 1.5) and mismatched trace column lengths raise pydantic.ValidationError / ValueError with clear messages.
  • mypy --strict clean; 100 % line coverage of core/types.py.
  • Tests listed below added and green in CI; coverage of new code meets the gate in doc 18 §3.
  • Docs, config reference and CHANGELOG Unreleased updated where behaviour, keys or interfaces changed.
  • Definition of Done (doc 32 §3) satisfied.

Tests required

  • tests/unit/core/test_types.py: construction, immutability, validators, enum string values (FailureClass.COL == 'F-COL').
  • Hypothesis property: any valid Observation round-trips through model_dump_json/model_validate_json.

Dependencies

Blocked by: #12 (T-001)

Blocks: #25 (T-017), #59 (T-010a), #66 (T-013a), #33 (T-020b), #40 (T-027), #42 (T-016), #43 (T-030a), #45 (T-031a), #46 (T-031b), #47 (T-018), #48 (T-035a), #68 (T-036a), #79 (T-041c)

Parallelization notes

Files / paths owned by this task — avoid editing other paths; shared files (pyproject.toml entry points, cli/main.py, api/routers/__init__.py, router.tsx, docker/compose.yaml, ci.yml) are append-only:

  • backend/src/roboprobe/core/types.py
  • backend/tests/unit/core/test_types.py

Owns only core/types.py. Parallel with T-002b/c/d, T-003a, T-009. Interface freeze: after merge, changes require updating doc 05 (DoD).

Definition of Done

Per doc 32 §3 and AGENTS.md §5: lint, format, mypy strict and import-linter green; tests added and passing; docs updated; PR template completed with Closes #<this issue>; Conventional Commit messages referencing T-002a (doc 16 §6); commits authored only by the repository owner identity (AGENTS.md §4); CI green; reviewer checklist (doc 32 §5.1) satisfied.

References

Design docs: doc 05 §1 · doc 05 §0 · doc 06 §1 · doc 06 §7 · doc 11 §6.2 · doc 34 §7

Requirements: FR-ORC-002 · FR-RUN-004 (traceability: doc 28)

External:

Activity

  1. added this to the M1 — Foundation milestone on Nov 19, 2026
  2. added
    area:coreDomain core, plugin registry, shared types
    priority:P0Critical path / blocks others
    taskChild task of a milestone epic
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreDomain core, plugin registry, shared typesmilestone:M1M1 — Foundationpriority:P0Critical path / blocks otherssize:M1-3 daystaskChild task of a milestone epictype:featureNew functionality

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions