Tasks · 001-find-the-shortest-path-between-two

Least-weight shortest path

Ordered, parallelizable work. Tests precede implementation. Drive through with /spectastic.implement — one task per invocation.

Status Draft Spec 001-find-the-shortest-path-between-two Design design Branch 001-find-the-shortest-path-between-two Created Read time

Restored from a tracer-bullet graduation. This task list is the refactor-to-comply path (not a clean rebuild): the build was kept. Source archive: explorations/archive/001-find-the-shortest-path-between-two/. The classification was read from that frozen marker, not re-chosen — so the kept code is moved into place and brought under the gates, and no prototype-deletion task appears (that is the spike path).

Seven tasks. Setup → Foundational (move the kept build) → US1 (tests fail first, then refactor to comply) → Restore gates. Tasks marked [P] can run in parallel. The US1 tests MUST be written and failing before the kept code is moved to satisfy them.

1 · Execution strategy

US1 is the whole MVP: the least-weight finder. Land it end-to-end, then close the restore gates.

Setup → Foundational → US1 → Restore gates. The kept build only counts as complied once its tests pass green.

Single module — no parallel-team split. The [P] tasks are file-independent within one pair of hands.

2 · Phase 1 — Setup

Create the module layout — empty src/pathfinding/ and tests/ dirs so the move and the suite have a home. src/pathfinding/ · tests/

3 · Phase 2 — Foundational

Bring the kept build out of the archive. Behaviour-preserving — no logic changes in this phase.

Move graph.ts to the module — the Graph/Edge types and cost(), unchanged from the archived spike. src/pathfinding/graph.ts
Move dijkstra.ts to the module — the kept dijkstraPath(), unchanged. src/pathfinding/dijkstra.ts

4 · Phase 3 — US1 · The cheapest route, not the shortest-looking one

Tests (write & fail first)

Pin the divergence and the exact answer — cases asserting shortest A→E is A→B→C→D→E at cost 6 (SC-001), an unreachable goal returns null (SC-002), and a hop-count path is strictly more expensive than Dijkstra's on the sample (NFR-001). tests/pathfinding.test.ts

Implementation

Refactor the kept build to comply — wire dijkstraPath + cost to the moved module so the failing suite passes green, covering FR-001, FR-002, FR-003, FR-004. src/pathfinding/dijkstra.ts

Closes FR-001, FR-002, FR-003, FR-004, SC-001, SC-002, NFR-001.

5 · Phase 4 — Restore the gates

Re-impose the SDD rigor the exploration relaxed. The build is kept; these tasks make it accountable to the spec.

Restore requirement-ID traceability — confirm every FR/SC/NFR maps to a named case in the suite, so nothing the spec promises is untested. tests/pathfinding.test.ts
Restore the INVEST + principles gates — run spectastic validate over the spec/design/tasks bundle and clear it at the standard profile. specs/001-find-the-shortest-path-between-two/
Restore estimability & grounding — confirm the design's §3 verified rows still cite the archived run, so the kept build's evidence survives the move. specs/001-find-the-shortest-path-between-two/design.html

6 · Dependencies

Setup         → Foundational (move the kept build)
Foundational  → US1 tests (fail) → US1 refactor-to-comply (green)
US1           → Restore gates

7 · Change log

  1. Restored via /spectastic.tasks --restore on the tracer-bullet graduation. Refactor-to-comply path.