Skip to content

Add check_local_links cases for fragments, relative resolution, and skips - #157

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/check-local-links-cases
Oct 16, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feature/check-local-links-cases

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

  • Seven fixture cases are added to CheckLocalLinksTests in tests/test_check_docs.py, which previously had three (resolvable link, broken link, external/anchor-only links ignored). This continues the Stage B unit-test expansion begun in Add check_placeholders cases for conditionals, section bounds, and trimming #155 and Add check_readme_steps_sync cases for section bounds, ordering, and matching rules #156 for the other two checks.
  • New cases cover:
    • the #fragment is stripped before the path is resolved (TARGET.md#section passes)
    • the error message names the containing doc and the full original target (exact-string assertion)
    • links resolve relative to the containing doc, not the repo root (docs/UP.md → ../TARGET.md passes; docs/SAME.md → TARGET.md fails)
    • .md files under .git/ are skipped
    • every broken link in a doc is reported, not only the first
    • characterization: a link to an existing directory passes (exists(), not is_file())
    • characterization: ![alt](path) image links are checked too
  • No production code is changed. The two characterization cases record current behavior and do not assert it is intended.

No tracking issue: the coverage gap was found during triage. Every open issue was deferred this cycle because nearly all are template-rule changes to create-dev-loop.md that need a real /create-dev-loop validation run (see #109), and a headless dispatch cannot perform one. #106 edits CLAUDE.md, which is harness-blocked.

Test plan

  • python3 -m unittest discover -s tests -v: Ran 32 tests, OK (up from 25)
  • python3 scripts/check_docs.py: Doc consistency check passed
  • Mutation check: the .git skip and fragment stripping were removed from check_local_links and doc-relative resolution was replaced with root-relative resolution. The three targeted new tests failed (test_docs_under_dot_git_are_skipped, test_fragment_is_stripped_before_resolving, test_link_resolves_relative_to_containing_doc). Production code was then restored, and all 32 tests passed.
  • Template behavior is untouched, so no /create-dev-loop run applies.

This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).

🤖 Generated with Claude Code


drafted by Claude on behalf of Daniel Stephenson

…kips

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric (this review was performed inline during a Gardener session, https://github.com/Stephenson-Software/gardener, because no independent reviewer was available):

  • Scope: PASS. Only tests/test_check_docs.py is modified (+75 lines). No production code is touched and no unrelated churn is included.
  • Tests-new: PASS. No new public functions are added. Seven cases are added for the existing check_local_links.
  • Tests-fix: N/A. No bug fix is included. A mutation check was used as a substitute: check_local_links was mutated to remove the .git skip and fragment stripping and to resolve links from the repo root. The three targeted cases failed, and all 32 passed after restoration.
  • Sibling structure: PASS. The new cases follow the existing CheckLocalLinksTests pattern: a tempfile.TemporaryDirectory fixture, a REPO_ROOT swap restored in tearDown, and assertions on message content rather than count alone.
  • Sibling renames: N/A. Nothing is renamed.
  • Docs: PASS. The module docstring ("three checks", reset errors in setUp) still holds. No doc in the Phase 7 table describes check_local_links test coverage.
  • Issue resolution: N/A. No Closes #N is included. The gap was found during triage, and this is stated in the PR body.
  • CI: PASS. doc-consistency is green on the head commit (run 38870632307). Locally, 32 tests ran with OK, and check_docs.py passed.
  • Placeholder parity / README Step parity / fence escaping / phase numbering / version comments / gardener interface / retrofit note: N/A. create-dev-loop.md and README.md are untouched.
  • Research grounding: PASS. The PR does not touch the template, so the section is omitted per the PR template. Test expansion as regression guards aligns with RESEARCH.md §3.
  • Behavioral validation: N/A. The template is not changed.

Judgment notes:

  • tests/test_check_docs.py:258 (test_link_to_existing_directory_passes). This characterizes exists() accepting directories. Directory links render on GitHub as tree views, so this behavior is judged intentional and no bug issue was filed.
  • tests/test_check_docs.py:270 (test_image_links_are_checked). Image links are matched by the same regex. This is useful behavior, and the case is recorded as a characterization so that a regex change cannot silently drop it.
  • The repeated per-test import tempfile matches the three pre-existing cases. Hoisting it to module level would reduce noise but was left out to keep the diff additive.

Copilot could not be added as a reviewer (Could not resolve user with login 'copilot'), so this rubric serves as the review.


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit 447b68a into main Oct 16, 2026
1 check passed
@dmccoystephenson
dmccoystephenson deleted the feature/check-local-links-cases branch October 16, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant