feat(checkcmd): report media references that resolve to no file #312
No reviewers
Labels
No labels
bug
enhancement
needs-triage
ready-for-agent
ready-for-human
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/deckle!312
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "afk/300"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #300
What
harness checkmedia check (internal/checkcmd): every page and translation file, drafts included, gets acontentwarning on the file holding the reference, once per distinct reference:linkrefs.Destinations∩media.StoredLibraryRef: prose, string params at any depth, front matter;media/…and/media/…are one reference) whose file is missing underassets/media/. The message isreferences media/docs/gone.pdf, but the media library has no file assets/media/docs/gone.pdf.image-typed param (elemops.WalkRoles+ schema, items rows included) that is not a published file of the page's bundle. The messages are… but the bundle of /about/ has no such fileand… but the page is not a bundle, so it has no files of its own. A translation is resolved against its source page's bundle.media.LibraryFile(root, ref) (abs, found, err).handleLinkResolve's media branch,handleMediaInfo,mediaops.resolveFile, the publish pre-flight (with the exported site's media root) and the check all call it.regularFileAtis gone. NoResolvePath+stat orLibrarySitePath+stat pair is left.linkresolve.Resolver.BundleFile(page, sub)exposes the bundle rule, whichbundleDir/bundleFilestill evaluate in one place.docs/harness.md"Check" has a new Media. paragraph and a warnings-list entry.scaffold/site/AGENTS.mdchanges "Verifying a change" and the two media bullets. Theverify-site(steps 1 and 5),migrate-site(the after-each-section sentence and §6) andedit-contentskills are updated.Notes for review
/media/docs/gone.pdfare the same reference. The test asserts three and explains why in a comment..mdin a bundle. Following "never a.mdfile",image="notes.md"is reported even whennotes.mdexists in the bundle. A.mdfile merely sitting in a bundle draws nothing.mediaopsusedLstat, so a dangling symlink in the library counted as found; it is now not found./api/media/infonow takessizefrom the bytes it reads instead of a separate stat.PageRefs, which are alwaysStoredLibraryRef-clean, so droppingLibrarySitePaththere changes nothing..Resourcesdoes include files in subdirectories (sub/deep.jpg)..Resources.GetMatch "deep.jpg"still finds nothing, so this check is correct: a bare filename never names a nested file. Butlinkresolve's sub-path rule (and the docs' "a branch bundle's only directly in its directory") wrongly flags a link like/sec/sub/deep.jpgasNoFile. That needs a follow-up; it is out of scope here.TestHandAuthoredTitleIsCleangained one setup line, a library file itsimgreferences. Its assertions are unchanged.Verification
go test ./internal/... ./docs/ ./scaffold/passes.go test ./cmd/...andgo vet ./...pass when run with a placeholderweb/dist.gofmtis clean.c.media()disabled.🤖 Generated with Claude Code
[autoland] verdict: pass
PASS — validated by the autoland lander.
Signal:
labctl pr checks 312aggregate success on718b8c1(run 321, build-and-test green). The first run (320, on7c9b503) failed on runner infrastructure, not the diff:curl: (6) Could not resolve host: github.comin the Hugo install step, before any Go step ran. The lander merged main into the branch (clean, no conflicts; the branch overlaps #311 on internal/media/library.go, internal/server/{media,linktargets}.go, AGENTS.md and the edit-content skill) to re-run CI on the merged code. Locally verified too, on both the PR head and the merge: npm build/test, go vet, go test with Hugo 0.167.0, go build, gofmt.Conventions: Conventional Commits title;
Closes #300; AGENTS.md, docs/harness.md and the verify-site, migrate-site and edit-content skills updated as the issue requires; one owner (media.LibraryFile) for all four former ResolvePath/LibrarySitePath+stat callers plus the check, andlinkresolve.Resolver.BundleFilereuses bundleDir/bundleFile.Notes (not blocking):