fix(validation): directory links are valid navigational targets (#126)#130
Open
ejdutton wants to merge 1 commit into
Open
fix(validation): directory links are valid navigational targets (#126)#130ejdutton wants to merge 1 commit into
ejdutton wants to merge 1 commit into
Conversation
…rrows to typed slots (#126) A directory link is a legitimate navigational target. `[docs](docs/)` renders as a navigable tree on GitHub; making it a hard error pushed authors into awkward workarounds (repointing to `docs/README.md` to dodge the rule). The rule was mis-scoped, not wrong in spirit. A directory is only a problem for a typed single-file slot — a reference contractually one file (e.g. a packaging `files:` source entry). It leaked into the general link path. Implements D1–D7 from the issue: - D1+D2: Delete the directory-error branch in the resources link-validator. A resolved directory now passes existence-checking like any file. The misnamed LINK_BROKEN_FILE "Link target is a directory" is gone. - D3: The bundling link walk (`walk-link-graph`) silently skips directory targets — no exclusion record, no surfaced issue. `LINK_TARGETS_DIRECTORY` now fires only when a typed single-file slot resolves to a directory; net-new emission added in `packaging-validator.validateFilesConfig`. - D4: New `local_directory` value in the `LinkType` enum; `classifyLink` returns it for local hrefs ending in `/`. Diagnostic hint only — validation treats it identically to `local_file`. - D5: HTML inherits the corrected rule through the shared `classifyLink` → `validateLocalFileLink` path (PR #116 had shipped the strict behavior; this corrects it). - D6: Explicit test confirms external trailing-slash URLs never trigger directory determination — filesystem-only is locked in. - D7: `docs/validation-codes.md` records that GitHub-style index resolution (`docs/` → `docs/README.md`) is deliberately out of scope. Migration: `validation.allow` entries for `LINK_TARGETS_DIRECTORY` against navigational links no longer match any emitted issue and will surface as `ALLOW_UNUSED`. `allow` entries against `files:` source paths still apply. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #130 +/- ##
==========================================
+ Coverage 81.68% 81.72% +0.04%
==========================================
Files 225 225
Lines 17440 17430 -10
Branches 3405 3404 -1
==========================================
- Hits 14246 14245 -1
+ Misses 3194 3185 -9
🚀 New features to boost your workflow:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


Summary
Closes #126.
[docs](docs/)) are now valid — existence-checked like any other local link.LINK_TARGETS_DIRECTORYnarrows to fire only when a packagingfiles:source entry resolves to a directory (a typed single-file slot); net-new emission added inpackaging-validator.validateFilesConfig.validateLocalFileLinkpath — corrects the strict behavior that feat: first-class local HTML resources (#112) #116 shipped.See the
[Unreleased]section of CHANGELOG.md for the full D1–D7 breakdown and thevalidation.allowmigration note: existingallowentries targetingLINK_TARGETS_DIRECTORYfor navigational links will surface asALLOW_UNUSED.Test plan
classifyLink('docs/') === 'local_directory';classifyLink('docs') === 'local_file';classifyLink('https://example.com/docs/') === 'external'validateLinkreturns null for external trailing-slash URLs without any filesystem check/docs/,../,/docsall valid when target exists; missing/missing-dir/still emitsLINK_BROKEN_FILE(regression guard)[Concepts](./concepts/)no longer emitsLINK_TARGETS_DIRECTORYfiles: [{ source: 'scripts', dest: ... }](directory source) emitsLINK_TARGETS_DIRECTORYbun run validategreen locally: lint, typecheck, unit, integration, system, duplication (3 clones, baseline),vat resources validate, dogfoodvat build+vat verify🤖 Generated with Claude Code