Skip to content

fix(docs): resolve package paths when top-level github dir exists #7797

Done

Description

@dan-petty

Problem

Adding github/repository.yaml in dan-petty/devops-cli#7792 (devops repos onboard dan-petty/devops-cli --confirm) creates a top-level github/ directory in git (TrackedTree.top_entries in src/devops_cli/docs/path_collector.py).

Because docs/SELF_IMPROVEMENT.md:100 references `github/merge_readiness.py` without the src/devops_cli/ prefix, _missing_concrete_path matches seg0 == "github" in tree.top_entries instead of tree.package_suffixes and stops checking src/devops_cli/. That causes devops docs check, Static Analysis, and Tests & Coverage (tests/docs/test_docs.py::test_docs_cli_generate_and_check and tests/docs/test_docs_source_argv_collector.py::test_docs_check_reports_an_unresolved_source_argv) to fail on #7792:

docs/SELF_IMPROVEMENT.md:100: code-span path 'github/merge_readiness.py' does not exist in git (probable new path: src/devops_cli/github/merge_readiness.py)

Expected Behavior

Either update docs/SELF_IMPROVEMENT.md:100 to reference src/devops_cli/github/merge_readiness.py (or github/merge_readiness.py in path_collector.py should also check src/devops_cli/ when a top-level directory shares a name with a src/devops_cli/ subpackage) so adding github/repository.yaml passes Static Analysis and Tests & Coverage.

Proposed design

Problem statement

Adding github/repository.yaml creates a top-level github/ directory. The docs path checker then stops at the top-level path. It rejects the documented package path github/merge_readiness.py. The docs checks fail although src/devops_cli/github/merge_readiness.py exists.

Acceptance criteria

Requirement: Package path with shared top-level name

The path collector MUST check src/devops_cli/ for a code-span path when its first segment is a tracked top-level directory and the top-level path does not match.

Scenario: Shared top-level github directory

  • WHEN A TrackedTree holds github/repository.yaml and src/devops_cli/github/merge_readiness.py, and candidate is github/merge_readiness.py with ext='.py', has_glob=False and has_slash=False.
  • THEN _missing_concrete_path returns None.

Requirement: Missing package path still reports

The path collector MUST report a code-span path that resolves in neither the top-level directory nor src/devops_cli/.

Scenario: Missing module under shared top-level github directory

  • WHEN A TrackedTree holds github/repository.yaml and no src/devops_cli/github/absent.py, and candidate is github/absent.py with ext='.py', has_glob=False and has_slash=False.
  • THEN _missing_concrete_path returns github/absent.py.

Requirement: Docs check with top-level github directory

The docs check MUST pass when a top-level github/ directory and the documented package path github/merge_readiness.py both exist.

Scenario: Docs check on the shared-name tree

  • WHEN The tests tests/docs/test_docs.py::test_docs_cli_generate_and_check and tests/docs/test_docs_source_argv_collector.py::test_docs_check_reports_an_unresolved_source_argv run on a tree that tracks github/repository.yaml and src/devops_cli/github/merge_readiness.py.
  • THEN Both tests pass and report no code-span path 'github/merge_readiness.py' does not exist finding.

Existing Tool Considered

No alternatives check has run. No open, maintained tool covers this repository-specific path-resolution rule. The change keeps the resolver in src/devops_cli/docs/path_collector.py. Cost to build, keep and fix this code: about 2,000 tokens and about 1 hour.

Key questions

  • What does _missing_concrete_path do when the first path segment is a top-level entry?: It checks only the top-level path. It returns None when that path matches. It returns the candidate when that path does not match, and it does not check package_suffixes. [sources: src/devops_cli/docs/path_collector.py:206]
  • Should the fix change the document line or the path resolver?: Fix the resolver. After the top-level check fails, check src/devops_cli/<candidate> when seg0 is in package_suffixes. (best practice) [sources: AGENTS.md, src/devops_cli/docs/path_collector.py:206, docs/SELF_IMPROVEMENT.md:100]
    • Rejected: Change the document line to src/devops_cli/github/merge_readiness.py. It hides the resolver defect. A later top-level directory with a package name makes the same false finding.
    • Chosen: Check the package path after the top-level path in _missing_concrete_path. It fixes the cause and keeps the documented package-relative path valid.
    • Rejected: Special-case only github. It leaves the same defect for every other top-level directory that shares a package name.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. dan-petty commented on Nov 29, 2026

    @dan-petty
    OwnerAuthor
    • Priority: The bug causes Static Analysis and Tests & Coverage to fail on PR #7792, which is a CI failure.
    • Related: feat(docs): docs check refuses paths that do not exist #4904, which asks for a different change. #4904 added the docs path-check feature; this candidate fixes a resolution bug in that feature when a top-level directory shares a name with a subpackage.
  2. added
    type/bug
    scope/docs
    source/agent
    status/new
    effort/low
    value/high
    priority/p0-critical
    on Nov 29, 2026
  3. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

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

  4. added
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 29, 2026
  5. removed
    status/in-review
    on Nov 29, 2026
  6. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-29 18:59 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/lowpriority/p0-criticalscope/docssource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions