Repository navigation
Description
Task
T-002b· Milestone M1 — Foundation · Size XS · Priority P0 · Epic #1Implements FR-API-003
Branch
feat/t-002b-core-errors-roboprobeerror-hierarchy-with— one task = one branch = one PR (doc 32 §6)
Summary
Implement the typed error hierarchy of doc 34 §5 with stable code, human message and structured context, used by API (problem+json), workers (INVALID mapping) and CLI (exit codes).
Context / motivation
Consistent errors are what let the API map exceptions to RFC 9457 responses and the CLI to exit codes (05 §11) without if isinstance chains spread across the code base.
Scope
In scope
RoboProbeError(code, message, context)base plusConfigError,ValidationError,NotFoundError,ConflictError,BackendError→EpisodeLaunchError,EpisodeTimeoutError,OracleError,StrategyError→ModelFitError,StoreError→QueueError,PluginError.- Module-level registry of stable codes used in doc 12 §1.1 (
VALIDATION_ERROR,NOT_FOUND,CAMPAIGN_INVALID_TRANSITION,SPACE_INVALID,BACKEND_UNSUPPORTED_PARAM,NO_WORKERS,PRECONDITION_FAILED,UNAUTHORIZED,INTERNAL). is_transient(exc)helper used by retry logic (34 §5).
Out of scope
- HTTP mapping (T-080b)
- CLI exit-code mapping (T-008)
Implementation guidance
- File
backend/src/roboprobe/core/errors.py. Codes as aStrEnum ErrorCode; each subclass has a default code but accepts an override. contextisMapping[str, JsonValue], never contains secrets (doc 34 §6).__str__returnsf"{code}: {message}"; keep__reduce__working so errors pickle across processes.- 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
- Hierarchy exactly as doc 34 §5.
- Every code in doc 12 §1.1 exists in
ErrorCode. - Errors are picklable and carry
context. - 100 % coverage.
- Tests listed below added and green in CI; coverage of new code meets the gate in doc 18 §3.
- Docs, config reference and CHANGELOG
Unreleasedupdated where behaviour, keys or interfaces changed. - Definition of Done (doc 32 §3) satisfied.
Tests required
tests/unit/core/test_errors.py(hierarchy, codes, pickling,is_transient).
Dependencies
Blocked by: #12 (T-001)
Blocks: #19 (T-003a), #20 (T-008), #33 (T-020b), #48 (T-035a), #79 (T-041c), #143 (T-080b)
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/errors.pybackend/tests/unit/core/test_errors.py
Independent single file; ideal first contribution.
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-002b (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 34 §5 · doc 12 §1.1 · doc 05 §11
Requirements: FR-API-003 (traceability: doc 28)
External:
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsDone
Activity
warehouse_v1.yaml#33CodewithJha commentedon Nov 19, 2026
Implemented in #230.
CodewithJha commentedon Nov 19, 2026
Reopened: my automation closed this by mistake before PR #230 merged (merge conflict in CHANGELOG). Resolving the conflict now.