Repository navigation
Make check reject Sources links to hidden paths - #321
Conversation
1539dfd to
4e55814
Compare
Review at 4e55814Verdict: Request changes. Fixes before merge
Optional
Landing
Decision for the maintainer
This PR came from the same PR swarm that reviewed it, so this is the author's review, not an independent one. It was a static review: no tests were run locally. CI at this head: all 7 checks pass, including the real-Lean jobs. Posted by PR swarm: PR Swarm Lead |
4e55814 to
e485c30
Compare
Review changes addressed at e485c30
Still open for you: whether CI is running on this head. Posted by PR swarm: PR Swarm Lead |
Render omits every blueprint path with a part starting with ".", but check tested a Sources target against the real vault, so a link to a committed hidden file such as .drafts/notes.md passed. Render then wrote the link to a page it never publishes, and the strict MkDocs build in the Pages workflow failed on the chapter page that absorbed the article. Audit reads the real vault too, so it reported nothing. local_target_issue now reports a target as hidden-<label>-target when the path the link spells, after its ".." steps, has a hidden part below the blueprint, and check rejects hidden-source-target with an error naming the article and the link. Render resolves links in a copy of the vault with no hidden paths or symbolic links, so that is the path it publishes: ../.x/../sources/paper.md still passes, and ../.link/paper.md, with .link a symlink to sources, fails although it reaches a published file. A hidden page may link to a hidden path, since render publishes neither. Because the rule lives in local_target_issue, audit reports every link that check rejects, and audit's coverage scan reports hidden-coverage-target too. Render already refused such a link in decomposition evidence, since its copy of the vault holds no hidden file; it now says the target is hidden, and audit's coverage contract check, which reads the real vault, refuses the link as well. Closes #304.
e485c30 to
46d90b3
Compare
Follow-up review at 46d90b3Verdict: Ready to merge. This pass rechecked the last round's fixes and the whole diff against Changed in this pass
Decision for the maintainer
This PR came from the same PR swarm that reviewed it, so this is the author's review, not an independent one. No tests ran under pytest locally. After the rebase, the changed check, Markdown and audit tests and #337's two new audit tests were called directly on this head and pass, and Posted by PR swarm: PR Swarm Lead |
Main brings #344, #320 and #321. graph.py conflicted: #320 moved link reading into markdown.link_targets with page-wide reference definitions and deleted _LINK and _INLINE_CODE, so the resolution takes main's reader and keeps this branch's _MARKDOWN_LINK_TEXT and _HTML_TAG, which only the article summary uses. Nothing outside the conflict needed a change: no caller here uses the capture defaults or the TreeCaptureLimitError attributes #344 deleted, coverage.py's link_targets calls keep working with the new optional references argument, and audit reports #321's hidden-source-target code as it reports every other source issue.
Closes #304.
Problem
Render omits every blueprint path with a part starting with
., butautoform checktested a## Sourcestarget against the real vault, so a link to a committed hidden file such asblueprint/.drafts/notes.mdpassed. Outsidesources/, render then rewrote the link to a page it never writes, andmkdocs build --strictin the Pages workflow failed on the chapter page that absorbed the article.autoform auditreads the real vault too, so nothing named the link before MkDocs did. The Roadmap and Formalize skills already say never to link a hidden implementation note from an article.Change
local_target_issuereports a target ashidden-<label>-targetwhen the path the link spells, once its..steps are applied, has a part below the blueprint starting with.(render's_is_hiddentest). Render resolves links in a copy of the vault that has neither hidden paths nor symbolic links, so that is the path it publishes:../.x/../sources/paper.mdpasses, and../.link/paper.md, with.linka symlink tosources, fails although it reaches a published file. The issue suggested judging the resolved path; the two differ only through a symbolic link. A hidden folder above the blueprint does not count, and a hidden page may link to a hidden path, since render publishes neither.checkrejectshidden-source-target, naming the article and the link:error: result: source target names a hidden path, which render omits: '../.drafts/notes.md'.local_target_issue,auditreports every Sources link that check rejects, as in Make check reject Sources links that name no file in the blueprint #287, and its coverage scan reportshidden-coverage-target. Render already refused such a link inDECOMPOSEDevidence, since its copy of the vault holds no hidden file; its message now says the target is hidden, and the audit's coverage contract check, which reads the real vault, now refuses the link too.sources/, as the issue recommends. Render is unchanged. Whether a hidden target undersources/should fail is still open; see below.A hidden note under
sources/On
main, an article that cites a committed hidden note such as../sources/.private/paper.mdpassescheck, and in CI render links the note to the repository at the verified commit, where the file exists, so the published link works. With this change,checkexits 1 on that link. Both generated workflows runcheckbefore render or the Lean build, so such a project stops publishing and every verify run fails until the note moves out of the hidden folder. That is the kind of break #325 undid: it madecheckwarn and keep its exit code for a Sources link that work and search leave out, because Autoform's tools must not break a codebase.The maintainer has not decided yet whether
checkshould fail on a hidden target undersources/. The review on #326 asks the same question from render's side, so the two are to be decided together:sources/would make whether the link works depend on repository coordinates thatcheckdoes not see; without them, as in a local render of uncommitted changes, the strict build already fails on such a link. After Rewrite angle-bracket and query links whole, and link only captured notes #326, which links asources/target to the repository only when render's capture holds it, the link fails the strict build in CI too, so under (a) this PR lands after Rewrite angle-bracket and query links whole, and link only captured notes #326.sources/, and print awarning:for a hidden target undersources/through the channel Let work and search omit what they can't represent, and have check warn #325 added. A link that deploys today keeps deploying, as Let work and search omit what they can't represent, and have check warn #325 asks, but this is consistent only if Rewrite angle-bracket and query links whole, and link only captured notes #326 also keeps linking hidden notes to the repository.Tests
test_check_rejects_sources_links_that_name_no_file_in_the_blueprintnow also checks that../.drafts/notes.mdand../sources/.private/paper.mdfail although both files exist, and that../.x/../sources/paper.mdpasses.test_audit_validates_local_source_links_without_network_accessnow also expectshidden-source-targetfor../../.drafts/notes.md.test_local_targets_are_resolved_against_the_boundarycovers the coverage label and a hidden page's link to its own heading, which passes. The newtest_a_link_through_a_hidden_symlink_is_hiddencovers a link through a hidden directory symlink, in a vault that itself sits inside a hidden folder.The test suite was not run locally; CI runs it. Called directly, outside pytest, these four tests pass on this commit, and each fails with
main'slocal_target_issueat d1ad2fb.ruff check autoform_cli servers testspasses.Landing
Rebased onto
mainat d1ad2fb and merges cleanly. #337, merged intomainafter the last rebase, conflicted in one hunk ofmarkdown.py: the rebase keeps this PR's hidden-target check right after the escape check and follows it with #337'sif not os.path.isfile(candidate):, without thetry.Checked with
git merge-tree --write-tree, merging each of these PR heads into this branch and intomain: #213, #214, #299, #320, #322, #324, #326, #327, #328, #329, #333, #334, #339 and #340 merge cleanly into both; #90, #195, #215, #216, #217, #219 and #284 conflict withmain, with the same conflict blocks with and without this PR. #320 makes the graph read Sources links with a code-only label or a reference, which then reach this rule throughnode.sourceswith no further change.Under (a) this PR lands after #326; under (b) no order is needed.