feat(mediaops): count library links in body prose and name referencing places #311
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!311
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "afk/310"
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 #310
What changes
A library reference in body prose (a markdown link
[x](/media/docs/a.pdf)or an inline<a href="/media/docs/a.pdf">, in a text body, a rich-text param or a front-matter string) now counts everywhere the media operations care.linkrefs.RewritePagecalled with media pairs; there is no second rewriter in mediaops.linkrefs.Pairgains anExactform for single files, so/media/docs/a.pdfnever claimsa.pdf.bak. The trailing-slash prefix contract for page links is unchanged.422 media.pageRefUnrewritablebefore anything moves.409 media.referenced.PageRefsandReferencingPagessee prose links, so the file is carried with the page, and the pre-flight refuses withpublish.mediaMissingwhen the file is missing.mediaops.pageLibraryRefsreads link positions through the newlinkrefs.DestinationsIn, which gives each destination with the shortcode holding it. The whole-value rule (StoredLibraryRefover params and front matter) stays in mediaops.keep[]andGET /api/media/refsnow carryplaces: [{path, lang, uid?}]instead ofpages.uidis the innermost element or items row holding the reference, decided byelemops.WalkRoles. Front matter and page-level prose name only the page.GET /api/media/refsanswers a library ref withmediaops.References, the same answer the refusal gives. Bundle refs keep the best-effort warning.DeleteMediaConfirm,DeleteFileDialog, the folder-delete dialog, the details panel) render each place as a link toelementEditRoute, or to the page when there is no uid.Docs
docs/api.md: the place shape, and the new shapes of refs, delete, folder delete-plan and folder delete. The rename/move routes now say prose links are rewritten. The new 422 code is listed.docs/architecture.md"Media gate".scaffold/site/AGENTS.md"Library media publishes with the pages that use it".Verification
go test ./...,go vet ./internal/... ./cmd/...andgofmtare clean.web/:npm test(3324 tests) andnpm run buildpass, andtsc --noEmitis clean..bakneighbour stay untouched. Delete and the folder plan refuse or keep with places. Place attribution is covered. The honest refusal is covered.DestinationsIn.media_prose_test.gocovers places on an en/de site, refs agreeing with the refusal, and rename. Two publish tests cover a prose-only file being carried and the refusal when it is missing.🤖 Generated with Claude Code
A markdown link or inline anchor to /media/<folder>/<name> in a text body, a rich-text param or a front-matter string is now a library reference everywhere the media operations care: - rename/move of a file or folder rewrites it in the same operation, through linkrefs.RewritePage with media pairs (a new exact-file linkrefs.Pair form; the trailing-slash prefix contract for page links is unchanged), and refuses honestly (media.pageRefUnrewritable) when a link survives where the editor cannot rewrite it; - delete and the folder-delete plan refuse/keep while one exists; - publish (PageRefs, ReferencingPages) carries the file and its pre-flight refuses when it is missing. One per-page detection in mediaops reads link positions through the new linkrefs.DestinationsIn and keeps the whole-value notion its own. The delete 409 body, the folder plan's keep entries and GET /api/media/refs now carry places ({path, lang, uid?}); /api/media/refs answers a library ref with the engine's verdict, so the dialog's pre-check list is exactly what blocks the delete. The editor's delete dialogs render each place as a link to the element's edit page, or to the page. Docs: api.md, architecture.md "Media gate", AGENTS.md and the edit-content skill name prose links among the reference shapes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>[autoland] verdict: pass
PASS — relied on CI aggregate
success(ci / build-and-test, run 318: web npm ci/build/test, go vet ./..., go test ./... incl. docs/scaffold/element/route drift tests). Conventions: Conventional Commits title,Closes #310present, single commit on main's tip (no conflict). Scope matches #310: one detection (mediaops.pageLibraryRefs over linkrefs.DestinationsIn), rewrites via linkrefs.RewritePage with new Pair.Exact (prefix contract unchanged for pages), honest residual refusal (media.pageRefUnrewritable), places {path, lang, uid?} in 409/plan/refs with refs answered by mediaops.References, delete dialogs link via elementEditRoute; api.md, architecture.md, AGENTS.md, edit-content skill and package docs updated; acceptance cases tested in mediaops, linkrefs, server and web.