Skip to content

[T-025] Pins and sub-spaces (ScenarioSpace.with_pins) #38

Closed

Description

@CodewithJha

Task T-025 · Milestone M2 — Scenario + kinematic2d · Size XS · Priority P1 · Epic #2

Implements FR-SCN-007

Branch feat/t-025-pins-and-sub-spaces — one task = one branch = one PR (doc 32 §6)

Summary

Implement with_pins(pins) -> ScenarioSpace returning a reduced space whose to_unit/from_unit operate on the free dimensions while make_scenario re-inserts pinned values.

Context / motivation

Users search sub-spaces (wizard step 1, doc 13 §3.2). Strategies must never vary pinned parameters.

Scope

In scope

  • Pinned values validated against bounds; pinned ids disappear from params/dim.
  • Space id/version unchanged; pins recorded separately (campaign pins jsonb).

Implementation guidance

  • Implement as a thin wrapper/view to avoid duplicating normalisation logic.
  • 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

  • Pinned parameters never vary across 10 000 sampled scenarios.
  • dim decreases by number of pins; hashes include pinned values.
  • 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/scenario/test_pins.py.

Dependencies

Blocked by: #34 (T-021)

Blocks: #84 (T-050a)

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/scenario/pins.py
  • backend/src/roboprobe/scenario/space.py (one method)

Small; parallel with T-023/T-024.

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-025 (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 §3 · doc 02 §3.1 · doc 13 §3.2

Requirements: FR-SCN-007 (traceability: doc 28)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:scenarioScenario space, sampling, scenario filesgood first issueGood for newcomersmilestone:M2M2 — Scenario + kinematic2dpriority:P1Required for milestone exitsize:XS< 2 hourstaskChild task of a milestone epictype:featureNew functionality

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions