Repository navigation
Description
Task
T-028· Milestone M2 — Scenario + kinematic2d · Size S · Priority P1 · Epic #2Implements FR-SCN-005
Branch
feat/t-028-shared-materialisation-helpers-jinja2-strictundefined— one task = one branch = one PR (doc 32 §6)
Summary
Implement scenario/materialize.py with render_template(template, ctx) (Jinja2 StrictUndefined, sandboxed) and place_obstacle(path, along, clearance, side) -> Pose2D per doc 06 §3.2.
Context / motivation
Both backends materialise scenarios; sharing these helpers guarantees identical obstacle placement in kinematic2d and Gazebo (cross-backend parity, doc 08 §7).
Scope
In scope
- Polyline arc-length parametrisation; left normal
n(s); obstacle centrec = path(s) + side·n(s)·clearance, yaw aligned with path tangent. - Deterministic output; byte-identical renders for equal inputs.
Implementation guidance
- Use
jinja2.sandbox.SandboxedEnvironment(undefined=StrictUndefined, autoescape=False, keep_trailing_newline=True). - 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
- Analytic tests on straight and L-shaped paths.
- Missing template variable raises immediately.
- Rendering twice → identical bytes (FR-SCN-005).
- 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/scenario/test_materialize.py.
Dependencies
Blocked by: #40 (T-027)
Blocks: #54 (T-033d), #201 (T-096a)
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/materialize.py
Independent module.
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-028 (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 06 §3.2 · doc 10 §4 · doc 08 §7
Requirements: FR-SCN-005 (traceability: doc 28)
External:
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsIn progress
Activity
tasks/warehouse_delivery_v1.yaml(time-limit formula, TBD guard) #40