Repository navigation
fix(doc-links): report references into a moved directory as missing (#2588) - #2602
Conversation
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
|
The This PR touches only |
…eusData#2588) A Markdown reference whose directory no longer exists counted as no reference to the repository: no MENTIONS edge and no unresolved row. After `git mv src/util src/helpers`, `src/util/rounding.py::clamp` simply disappeared, so a moved or renamed directory left no trace of the stale reference. The doc-rot rule required the path's own parent directory to be a Folder. It now also accepts any directory above it that the reference itself wrote: `src` for `src/util/rounding.py` read from the root, or for `../src/util/rounding.py` read from docs/. The directory a try is read from (the document's directory, or what its leading `./` and `../` reach) does not count, so a document's own directory never turns a foreign path into doc rot. A path none of whose written directories exists (a file a tutorial asks the reader to create in a new directory, a system path) stays no reference, as before. Test (tests/test_doc_links_md.c) indexes a document that references src/util/rounding.py both from the root and relatively, moves src/util to src/helpers, and re-indexes incrementally, requiring the same state as a full index. Without the fix it fails on the defect: the reference has no row ("" != "missing"). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Scott Beck <296871+bline@users.noreply.github.com>
cc8a93a to
6530142
Compare
|
Correction to my comment above: a re-run wouldn't have helped, since it checks the same merge commit. I've rebased the branch onto current |
|
Thanks for the moved-directory regression and for correcting the earlier rerun request. I have read your rebase update, so there is no outstanding request to rerun that old lint job. The missing-reference behavior and its tutorial-path tradeoff remain pending review. |
|
Merged as a49481d - thank you, Scott, for this fix and for the careful write-up. You were right that a reference into a moved or renamed directory should leave a trace instead of silently disappearing, and limiting the rule to directories the reference itself wrote, never the document's own directory, keeps foreign paths from turning into doc rot. Thank you as well for naming the tutorial-path trade-off up front: we are happy with that default, since such a path names this repository's own tree. The test that moves the directory, re-indexes incrementally and requires the same state as a full index is a particularly nice touch. Thanks again! |
What does this PR do?
Fixes #2588. A Markdown reference whose directory no longer exists counted as
no reference to the repository at all: no
MENTIONSedge and no unresolvedrow. After
git mv src/util src/helpers, a reference tosrc/util/rounding.py::clampdisappeared without a trace.The doc-rot rule in
mdr_resolve_pathrequired the path's own parentdirectory to be a Folder. It now also accepts any directory above it that the
reference itself wrote:
docs/notes.md, aftersrc/utilmoved)src/util/rounding.py::clampmissing[rounding](../src/util/rounding.py)missingscratch/new/thing.py(noscratch/in the repository)Only directories the reference wrote count, not the directory it is read from.
That is the document's directory, or wherever the reference's leading
./and../lead. So a document's own directory never turns a foreign path into docrot. A path with no directory in the repository still counts as no reference
(a file a tutorial asks the reader to create, or a system path).
This is the issue's suggestion, generalized. Its "top-level segment exists"
test is the root-relative case of this rule, and relative links get the same
treatment.
One tradeoff: a tutorial that asks the reader to create a file in a new
subdirectory of an existing directory (
src/newpkg/x.py) now gets amissingrow where it got none before. I think that is the right default:the path names this repository's tree. A narrower rule, such as requiring the
top-level segment only, would still have this case.
This is independent of #2601 (#2587). The two touch different parts of
mdr_resolve_pathand different spots in the test file.Evidence
doc_links_md_moved_directory_issue2588intests/test_doc_links_md.cindexes the fixture, moves
src/utiltosrc/helpers, and re-indexesincrementally.
dm_steprequires the incremental state to equal a fullindex. Without the source change it fails on the defect itself:
With it,
scripts/test.sh --suites doc_links_md,doc_links_rst,doc_links_adoc,doc_mentionsreports 96 passed, 0 failed.
Checklist
git commit -s) — required, CI rejectsunsigned commits (DCO, see CONTRIBUTING.md)
scripts/test.sh(the canonical leg), 9275 passed, 0 failed, 10 skipped,186 suites, Linux x86-64, gcc
scripts/lint.sh --ciintest-infrastructurelintcontainer(cppcheck + clang-format-20 + memory-core), "All linters passed"
Written with an AI agent (Claude); I reviewed the change and certify it via
the DCO sign-off.
🤖 Generated with Claude Code