documentation: Knowledge note for the news module (posts, categories, search, top issues)
Back to our planType
documentation
Summary
Write the short note that explains how news posts work: what a post card shows and where its text comes from, how authors appear when accounts are private, what a save refreshes, how search and the shared category tree work, and the "top issues" block.
Problem
Several values a reader sees on a post are copied or derived from other fields (byline, publish date, card summary and image, source, search entries), and two other modules depend on the categories collection this module owns. None of that is visible from the field list.
What the generated reference already shows, so the note doesn't repeat it: posts, opens in a new tab, categories, opens in a new tab and search, opens in a new tab list fields, relationships (authors → users, categories, relatedPosts), access and hook names; routes.md lists /posts, its numbered pages, /posts/[slug] and /search. Missing: what each copied value is for, and the refresh and search rules.
Proposed fix
Write src/modules/news/README.md from the template. Owner's direction for every note (2026-11-06, Claude session, recorded on #712 and #719): a note explains the behavior and logic of its content types and code (what shows, where, when, who publishes or changes it, and the special rules), never a list of fields; and every link between fields is stated near the top, so no agent has to work it out from the code.
Links between fields the note states up front (each one checked in the code first):
authors(users, private) →populatedAuthors(name only), filled on every read bycms/populateAuthors.ts; the byline joins them "Ana, Ben and Cy" (domain/authors.ts).publishedAtis set to now when a post is first published without one (field hook incms/posts.ts).- A card's summary is the post's search-engine description and its picture the share image (
domain/types.ts,data/mappers.ts). sourceNameandsourceUrl→ the card's plain-text source and the page's link, kept only when absolute http(s); a link without a name is named by its host (data/mappers.ts, #483).- Search entries copy the title, slug, search-engine fields, categories, the source, and an event's
cancelled(cms/searchFields.ts,cms/searchSync.ts); the plugin indexes posts and events, chosen insrc/payload.config.ts. relatedPostscan't name the post itself (filterOptions), and "You May Also Like" leaves out the post and its related posts (domain/related.ts).- Categories form a tree (nested-docs plugin, breadcrumbs from the parent chain,
src/payload.config.ts); events use the same tree, anddefaultImageis the image agents' suggestions get (cms/categories.ts).
Behaviors and rules the note must cover (each with the file or test named):
- Listing: newest first, 12 a page, numbered pages for no-JavaScript, "Load more" by cursor (
data/queries.ts,actions.ts, decision 0014). - Saving or deleting a published post refreshes its page,
/posts, the numbered pages,/and every CMS page, and the posts sitemap tag (cms/revalidatePost.ts, #484). - Agents' and non-staff posts are held as
suggesteddrafts (holdSuggestionsincms/posts.ts). - Search matches title, slug and search-engine title or description; spaces don't matter; an empty query lists everything (
data/filters.ts,domain/search.ts); the box follows typing after a pause (ui/SearchBox.client.tsx). - "Top issues" block: editor bounds in
TOP_ISSUES_LIMITS, the day it was last reviewed, and nothing drawn when no item can be shown (domain/topIssues.ts,ui/TopIssuesBlock.tsx). - The archive block's posts (newest, by category, or picked) are loaded here and joined by the block registry in
src/app/(use-cases/findArchivePosts.ts). - The post page emits schema.org
Article, naming the original source withisBasedOn(ui/postJsonLd.ts).
Tests to name under "Rules and the tests that protect them": cms/revalidatePost.test.ts, cms/searchSync.test.ts, data/*.test.ts (keyset, filters, mappers, source), domain/*.test.ts, ui/*.test.tsx, actions.test.ts, and src/payload.config.sharedCategoriesMigration.test.ts, src/payload.config.reviewQueue.test.ts.
Map entry: { "note": "src/modules/news/README.md", "paths": ["src/modules/news/**"] }
Acceptance criteria
- Not done:
src/modules/news/README.mdfollowsdocs/knowledge/note-template.mdand is at most 80 lines. - Not done: It explains behavior and logic, not fields: no field lists, props tables or route lists. It links the generated pages named above for those.
- Not done: Right after its opening sentences, a short list states every link between fields named above (relationships, values copied or derived, mapper inputs and the props they become, hooks that copy a value), each with its file.
- Not done: Every behavior listed above is covered or, if the code turns out different, the note says what the code does and this issue gets a comment saying what changed.
- Not done: Every statement names the file or test it comes from, checked against the code at the branch's base.
- Not done:
docs/knowledge/index.mdgets one short line for the note (a few words after the link). It stays within the budget check. - Not done:
docs/knowledge/map.jsongets the entry above. - Not done:
npm run agent-context -- --writehas been run and its generated rule committed, andnpm run agent-contextpasses. If the budget check fails, this issue is not done; trimming other always-loaded files is not part of this issue. - Not done: Known contradictions: #366 applies:
docs/roles/events-mgr.mdstill lists the old fixed event categories; events now use this module's shared category tree. Fix that line (policy file: the PR says so) and close #366 with this PR. For #158, also checkdocs/roles/content-lead.mdagainst this note and fix only statements of fact the code contradicts; a rule change goes to #158 as a question. #279 and #531 don't apply. - Not done: No code changes. A bug or gap found in the code goes under the note's "Known gaps" and is filed as its own issue (labeled
scope-creep, linked here). - Not done:
Prettier,Knowledge sync,PR PolicyandAgent contextpass.
Files likely touched
src/modules/news/README.mddocs/knowledge/index.md(one line)docs/knowledge/map.json(one entry).claude/rules/generated/src--modules--news--README.mddocs/roles/events-mgr.md(the category line, #366)docs/roles/content-lead.md(only if a fact is wrong)
Must not touch
- Code under
src/(the note itself excepted): this issue documents behavior and changes none. - Other notes, their generated rules, and the files the other note issues under #712 list.
docs/knowledge/note-template.mdand the session-start set (CLAUDE.md,AGENTS.md,docs/guidelines/guard-rails.md).docs/architecture/data-model.md,docs/ui/data-types.md,docs/ui/component-set-modules.md: read them and fold this area's facts into the note (decision 0019, section 7); report any drift in them in a comment on #712 instead of editing them, since every note issue reads them.src/modules/README.md,src/platform/README.md,docs/project.md(#725 owns them).
Open questions
- Session-start room. The index line needs room at session start, which #799 makes. This issue is blocked by #799 and is not Ready until it lands; the line then stays within the budget check.
- Dead code first. #728 (the audit, waiting for the owner's keep-or-drop marks) removes unused or unwanted code before a note describes it. This issue is marked blocked by #728; it can start once #728 has settled this area, even if other areas are still open there.
- Size: not set; a cloud session can't read the board. Suggested: M.
Area
tooling, cms
Priority
medium
Generated by Claude Code, opens in a new tab