Skip to content

[T-045a] CLI: db upgrade and space validate|register|list #89

Closed

Description

@CodewithJha

Task T-045a · Milestone M3 — Oracles + runner + store · Size S · Priority P0 · Epic #3

Implements FR-CLI-001 · FR-SCN-001

Branch feat/t-045a-cli-and — one task = one branch = one PR (doc 32 §6)

Summary

Add cli/db.py (Alembic upgrade head via API, not subprocess) and cli/space.py (validate exits 0/2 with path-to-error messages; register stores definition + version; list).

Context / motivation

FR-SCN-001 AC: roboprobe space validate configs/scenario_spaces/warehouse_v1.yaml exits 0; invalid exits 2 with a path-to-error message.

Scope

In scope

  • Switch compose migrate service command to roboprobe db upgrade (doc 17 §4).
  • space upgrade <yaml> stub documented for future schema versions (doc 05 §11).

Implementation guidance

  • Commands obtain services from roboprobe.bootstrap.cli once T-046 merges; until then construct via small factory functions in the CLI module (to be moved).
  • 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

  • Exit codes per doc 05 §11.
  • make up runs migrations automatically.
  • 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/integration/cli/test_db_space_cmds.py (CliRunner + Postgres).

Dependencies

Blocked by: #20 (T-008), #60 (T-010b), #33 (T-020b), #61 (T-011a)

Blocks: #91 (T-045b)

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/cli/db.py
  • backend/src/roboprobe/cli/space.py
  • docker/compose.yaml (migrate command)

Independent command modules.

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-045a (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 §11 · doc 02 §3.1 · doc 17 §4 · doc 03 §UC-01

Requirements: FR-CLI-001 · FR-SCN-001 (traceability: doc 28)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliCommand-line interfacearea:scenarioScenario space, sampling, scenario filesmilestone:M3M3 — Oracles + runner + storepriority:P0Critical path / blocks otherssize:S<= 1 daytaskChild task of a milestone epictype:featureNew functionality

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions