You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(compile): validate link paths independently of #fragment and ?query - #3713
apm compile reported Referenced file not found for a relative Markdown
link whose target exists but carries a #fragment, ?query, or both. For
example, [template](references/standards.md#template) was checked as a file
literally named standards.md#template.
validate_link_targets now splits the target with UnifiedLinkResolver._split_link_target — the interpretation the rewrite path
already uses — and validates only the path component. Missing-file diagnostics
name that path without the suffix. Suffix values themselves are not validated:
the heading or query is not checked against the target document.
Emitted links, suffix preservation, inlining, install-time rewriting,
containment and invalid-path checks, and dry-run versus write semantics are
unchanged.
pytest tests/unit -q: 26,937 passed, 59 skipped. The 11 failures in this
shell are unrelated environment checks in test_governance_evidence.py and test_helpers.py that require node and a python executable on PATH;
they pass with node available, except the check for a literal python
binary, which this environment does not provide.
ruff check and ruff format --check on the changed files: clean.
Manual apm compile --dry-run in a scratch project: existing targets with #fragment, ?query, and combined suffixes produced no missing-file
warning; references/missing.md#template produced one warning naming references/missing.md. No preview files were written.
Spec conformance (OpenAPM v0.1)
N/A — this PR does not change OpenAPM-observable behaviour.
A markdown target such as references/standards.md#template names a file
plus a section address. validate_link_targets passed the whole target to
the filesystem check, so an existing file produced a false
'Referenced file not found' warning whenever the link carried a
#fragment, ?query, or both.
Split the target with UnifiedLinkResolver._split_link_target, the same
interpretation the rewrite path already uses, and validate only the path
component. Missing-file diagnostics now name that path without the
suffix. Suffix values are not validated, and link emission, inlining,
install-time rewriting and dry-run write semantics are unchanged.
Fixesmicrosoft#3255
The reason will be displayed to describe this comment to others. Learn more.
🟢 Approval recommended
No active review issues are reported for the change separating filesystem-path validation from link fragments and queries.
No open issues 🎉
What changed in this PR
Fixes #3255 by making apm compile validate the filesystem path separately from Markdown link fragments and queries, avoiding false missing-file warnings.
Changes:
Reuses the existing link-target splitter for path validation and diagnostics, without changing link rewriting or inlining.
Adds regression tests for existing and missing targets with suffixes, plus CLI dry-run coverage.
Documents that heading and query values are not validated.
This PR links #3255, which has a current maintainer scope record (#3255 (comment)), and the description maps the change to that scope.
Before human review, it needs a rebase on main:
Main consolidated duplicate unit tests (011445b), which removed tests/unit/compilation/test_link_resolver_phase3.py. Please move your new cases into the surviving link resolver test module.
Main redesigned the docs site (94382be), which removed docs/src/content/docs/producer/package-relative-links.md. Please re-apply the doc note to the page that now covers package-relative links, or drop it if no page fits.
… files
Main removed tests/unit/compilation/test_link_resolver_phase3.py and
docs/src/content/docs/producer/package-relative-links.md. Move the suffix
cases and the compile CLI case into tests/unit/compilation/test_link_resolver.py,
the doc note into producer/write-primitives.md, and replace the direct
CHANGELOG.md entry with changelog.d/3713.fixed.md.
Co-authored-by: Copilot App <[email protected]>
Thanks Sai krishna Bodapati (@bodapatisaikrishna). To keep this moving for 0.38.0 I merged main into your branch (your commit is unchanged) and resolved the conflicts the triage note listed:
The suffix cases and the apm compile --dry-run case now live in tests/unit/compilation/test_link_resolver.py (the phase3 module was removed on main).
The doc note moved to producer/write-primitives.md, section "Links between files".
The CHANGELOG line is now the fragment changelog.d/3713.fixed.md (main uses per-PR fragments).
The new cases fail on main's link_resolver.py (7 failed) and pass with your fix (79 passed). CI runs are approved.
This comment is AI-generated (P3 lead agent) and may contain errors.
…nit module
The return-value cases sat in a component module and tripped the AQ003
unobserved-outcome ratchet (72 > 70). The compile CLI case stays there.
Co-authored-by: Copilot App <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The tests lack the required installed-CLI regression coverage for normal and preview modes, all three suffix forms with existing and missing targets, and output-file behavior.
…icrosoft#3255)
Drive the installed apm compile in normal and --dry-run modes over
#fragment, ?query and combined suffixes: existing targets raise no
missing-file warning, missing targets are named without the suffix,
emitted links keep their suffix, and --dry-run writes nothing. Fails on
main's link_resolver (2 failed), passes with the fix. Answers the review
thread asking for the scope's installed-CLI done-when.
Co-authored-by: Copilot App <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The regression tests perform real filesystem I/O in a unit-marked module, violating the marker definitions and misclassifying them during marker-based selection.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Mark filesystem-I/O regressions as component tests
These regressions perform real filesystem I/O, but this module declares pytest.mark.unit at line 24. That conflicts with the behavioral definitions in pyproject.toml:201-202 (unit excludes filesystem access; component includes it) and misclassifies these cases during marker-based selection. Move this class into the existing component-marked test_link_resolver.py rather than adding a function-level behavioral marker to this pure-helper module.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pillar/producePillar: author, package, publish and patch with confidencetriage/recommendedAutomated advice completed; not human scope approval.type/bugSomething does not work as documented.
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
apm compilereportedReferenced file not foundfor a relative Markdownlink whose target exists but carries a
#fragment,?query, or both. Forexample,
[template](references/standards.md#template)was checked as a fileliterally named
standards.md#template.validate_link_targetsnow splits the target withUnifiedLinkResolver._split_link_target— the interpretation the rewrite pathalready uses — and validates only the path component. Missing-file diagnostics
name that path without the suffix. Suffix values themselves are not validated:
the heading or query is not checked against the target document.
Emitted links, suffix preservation, inlining, install-time rewriting,
containment and invalid-path checks, and dry-run versus write semantics are
unchanged.
Issue and approved scope
Issue: Fixes #3255
Human scope-approval comment:
#3255 (comment)
This PR completes the issue as scoped. It does not add heading-ID validation,
section extraction, a new Markdown parser, or any new flag or target.
Type of change
Testing
Local verification:
pytest tests/unit/compilation -q: 1514 passed, 1 skipped.pytest tests/unit -q: 26,937 passed, 59 skipped. The 11 failures in thisshell are unrelated environment checks in
test_governance_evidence.pyandtest_helpers.pythat requirenodeand apythonexecutable onPATH;they pass with
nodeavailable, except the check for a literalpythonbinary, which this environment does not provide.
ruff checkandruff format --checkon the changed files: clean.apm compile --dry-runin a scratch project: existing targets with#fragment,?query, and combined suffixes produced no missing-filewarning;
references/missing.md#templateproduced one warning namingreferences/missing.md. No preview files were written.Spec conformance (OpenAPM v0.1)