Skip to content

feat(docs): check code-span paths in prompt documents #7652

Done

Description

@devops-cli-service

Split from #4904.

Prompt documents under src/devops_cli/ai/tasks/ hold illustrative paths such as src/app.py:12 and tests/roadmap/test_feature.py. These paths are examples and are not tracked files. The rule for hand-written documents would report them as stale paths. This part is deferred until the prompts define a marker for an illustrative path. The marker lets the rule skip an example and check a real path. Acceptance criteria: a prompt document marks an illustrative path with the marker; the rule reports no finding for a marked illustrative path; the rule reports a finding for an unmarked stale path in a prompt document; devops docs check runs the rule over the prompt class; the repository tree reports no finding.

Proposed design

Problem statement

Prompt documents under src/devops_cli/ai/tasks/ hold illustrative code-span paths such as src/app.py:12. These paths are not tracked files. The docs path rule of #4904 would report them as stale. This change defines an illustrative-path marker, skips marked spans in the prompt class, and marks the existing examples so the repository tree is clean.

Acceptance criteria

Requirement: Illustrative path marker

A prompt document SHALL mark an illustrative code-span path with the HTML comment <!-- devops-docs: illustrative-path --> immediately after the code span on the same line.

Scenario: Marked illustrative path

  • WHEN A test prompt document holds the code span src/app.py:12 followed by <!-- devops-docs: illustrative-path --> on the same line.
  • THEN The docs path check returns no finding for src/app.py:12.

Requirement: Unmarked stale path

The docs path checker MUST report an unmarked stale code-span path in a prompt document.

Scenario: Unmarked stale path

  • WHEN A test prompt document holds the code span src/missing.py:12 with no illustrative-path marker.
  • THEN The docs path check returns one finding that names the document path, the line and src/missing.py:12.

Requirement: Prompt class coverage

devops docs check SHALL run the code-span path rule over every document of the prompt class.

Scenario: Prompt class scan

  • WHEN A test tree holds src/devops_cli/ai/tasks/test.md with the unmarked code span src/missing.py:12.
  • THEN The docs path check returns an error that names src/devops_cli/ai/tasks/test.md and src/missing.py:12.

Requirement: Repository prompt tree clean

The repository MUST report no stale code-span path finding in a document of the prompt class.

Scenario: Clean prompt tree

  • WHEN uv run devops docs check runs on the repository.
  • THEN The command exits zero and reports no finding for a code-span path in a document of the prompt class.

Existing Tool Considered

No alternatives check has run. The open library markdown-it-py covers Markdown code-span parsing. The change reuses it through code_spans in src/devops_cli/roadmap/step_files.py and builds no parser. No open maintained tool covers a code-span path rule over prompt documents; lychee checks links only. The change extends the docs path checker that #4904 adds. Written cost: about 1,500 tokens to build, about 300 tokens a year to keep and fix, and about 20 minutes elapsed.

Key questions

  • Which marker syntax marks an illustrative path?: Use the HTML comment <!-- devops-docs: illustrative-path --> immediately after the code span on the same line. Add CONST_DOCS_ILLUSTRATIVE_PATH_MARKER in src/devops_cli/config/constants.py and read it in the docs path checker. The checker skips the code span that the marker follows. (best practice) [sources: src/devops_cli/config/constants.py:6219, src/devops_cli/config/constants.py:3804, src/devops_cli/openspec/gate.py:260, openspec/changes/archive/2026-11-06-3508-rule-docs-name-moved-files/design.md]
    • Chosen: HTML comment immediately after the code span. The project already reads HTML comment markers from a line. The comment renders as nothing. The marker names the one example on the line.
    • Rejected: Inline prefix example:. The prefix changes the visible path text and the text that the checker reads.
    • Rejected: Marker on the line before the code span. A block marker cannot tell which code span on the following line is the example.
    • Rejected: Per-file ignore list. A file-level entry hides every path in the file, including a stale real path.
  • Which documents form the prompt class?: The prompt class is the existing CONST_DOCS_CLASS_PROMPT entry of CONST_DOCS_INVENTORY: src/devops_cli/ai/personas/**/*.md and src/devops_cli/ai/tasks/**/*.md. It is already in CONST_DOCS_NAME_CHECKED_CLASSES, so the docs path rule reads it with documents_of_class(root, CONST_DOCS_CLASS_PROMPT) and adds no class or glob. [sources: src/devops_cli/config/constants.py:502, src/devops_cli/config/constants.py:505, src/devops_cli/config/constants.py:532, src/devops_cli/config/constants.py:543, src/devops_cli/config/constants.py:544, src/devops_cli/docs/inventory.py, src/devops_cli/docs/markdown_argv_collector.py:231]
  • How does the checker treat a marked stale path?: It skips the code span and reports no finding. The marker states that the path is an example, and the rule exists to find a real path that is stale. (best practice) [sources: openspec/changes/archive/2026-11-06-3508-rule-docs-name-moved-files/design.md, src/devops_cli/config/constants.py:6219]
    • Chosen: Skip the marked path. The marker states that the path is an example, and a warning would still report the example as a finding and fail devops docs check.
    • Rejected: Report a warning. devops docs check fails on a finding, so a warning would keep the example in the failure list.
    • Rejected: Check only tracked files. A real path that moved is no tracked file either, so this would hide the stale path that the rule exists to find.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#4904

Activity

  1. added
    type/feature
    scope/docs
    source/agent
    status/new
    on Nov 28, 2026
  2. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    ContributorAuthor
  3. added
    value/medium
    effort/medium
    priority/p2-medium
    on Nov 28, 2026
  4. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    ContributorAuthor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

  5. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    ContributorAuthor

    Next step: the alternatives check records a verdict. See the section Proposed design of the body.

  6. added
    owner/agent
    status/in-progress
    and removed
    status/new
    on Nov 30, 2026
  7. removed
    status/in-progress
    owner/agent
    on Nov 30, 2026
  8. devops-cli-service commented on Nov 30, 2026

    @devops-cli-service
    ContributorAuthor

    Live since 2026-11-30 22:54 UTC

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

    effort/mediumpriority/p2-mediumscope/docssource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions