Skip to content

[Phase 2] Grounding check: verify references/target_surface paths resolve #602

Description

@github-actions

Story

As a maintainer trusting Bob's Dev Notes,
I want validation to confirm every references and target_surface path in the plan resolves in the checkout, flagging hallucinated anchors,
so that stories can't ship citing files that don't exist, so dev-lead never chases a phantom path.

Acceptance Criteria

  1. A grounding check (in validate-plan.py or a sibling script invoked alongside it) strips any #anchor suffix and verifies each references/target_surface entry that looks like a repo path resolves against the repo root.
  2. A path that does not resolve fails the check with a message naming the story id and the missing path, exiting non-zero (consistent with validate-plan.py's fail() contract).
  3. Entries that are clearly not file paths (a bare discussion #593, a URL) are not treated as paths and do not cause false failures; the heuristic is documented in code.
  4. The repo root is resolved explicitly (e.g. git rev-parse --show-toplevel or the script location), not from the current working directory.
  5. Existing fixtures (which cite real paths) still pass; a new bats case adds a story citing a nonexistent path and asserts the failure.

Tasks / Subtasks

Dev Notes

  • references/target_surface are free-form strings in plan.schema.json; the schema example uses scripts/engine.sh#tier-routing (with anchor) and the fixture uses scripts/engine.sh. Split on the first # for the file-existence test.
  • validate-plan.py runs in the workflow checkout (.github/workflows/initiative-planner.yml:147-156 runs it after gather-context with the repo checked out), so relative paths resolve against the repo root — establish that root explicitly rather than relying on cwd.
  • Document the heuristic for path vs prose: e.g. only enforce entries containing / or ending in a known extension, and skip anything starting with http/discussion/# — see open_questions.
  • Keep it a HARD validation failure consistent with validate-plan.py's fail() at validate-plan.py:23-27, so the workflow stops before apply-plan runs.
  • Testing: extend tests/test_initiative_planner.bats with a fabricated-path fixture variant; the suite already drives validate-plan.py directly.

Project Structure Notes

Fits cleanly into validate-plan.py (the existing semantic-gate home) or a sibling invoked from the same workflow step. Prefer extending validate-plan.py to keep one validation entry point.

References

  • scripts/initiative-planner/validate-plan.py#L23-L70
  • scripts/initiative-planner/plan.schema.json
  • .github/workflows/initiative-planner.yml#L147-L156
  • tests/test_initiative_planner.bats

Likely target surface

  • scripts/initiative-planner/validate-plan.py
  • tests/test_initiative_planner.bats

Story prepared by the BMAD Scrum Master (Bob) for epic #597. Status: ready-for-dev.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    dev-leadFor dev-lead agent pickupinitiativeEpic / initiative tracking issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions