Skip to content
SprecherEast
Issue 784

documentation: Knowledge note for the directory module (FAQ, resources, team members)

Back to our plan
Done
documentationcmstoolingpriority: medium

Type

documentation

Summary

Write the short note that explains the FAQ and resources pages: how entries are ordered and grouped, when an elected official's photo may show, what refreshes the pages, and that team members are stored but not shown anywhere yet.

Problem

The module is small, but its rules (the portrait permission, the category lists shared by the collections and the pages, the plain reads without a use case) are easy to break without knowing why they exist.

What the generated reference already shows, so the note doesn't repeat it: faq, opens in a new tab, resources, opens in a new tab and team-members, opens in a new tab list fields, access and hooks; routes.md lists /faq and /resources. They don't say how entries are grouped, the portrait rule, or that no page reads team members.

Proposed fix

Write src/modules/directory/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):

  • The category options of both collections are the same lists the pages head their sections with (FAQ_CATEGORIES, RESOURCE_CATEGORIES in domain/categories.ts), so stored values and headings can't drift.
  • order sorts each list, lower first (cms/orderField.ts, data/queries.ts).
  • photo shows only for the elected-officials category, must be an image, and requires photoCredit; the card draws it with the resource's own credit and source, not the media item's (domain/resourcePortrait.ts, cms/resources.ts).
  • FAQ answers load their linked pages and posts at depth 1 so links keep their address; a document the reader may not see stays an id and shows as plain text (data/queries.ts).
  • The queries return the stored shape without a mapper (domain/types.ts, architecture rule 8) and are exported straight from server.ts (decision 0016).

Behaviors and rules the note must cover (each with the file or test named):

  • Both pages list every published entry, grouped by category in the list's order; an entry with no or an unknown category goes under General (FAQ) or Other (resources) (domain/sections.ts).
  • Any save or delete refreshes the one listing page and its cache tag, drafts included (cms/revalidateListPage.ts).
  • Resource links must start with http:// or https://; up to three more links (domain/resourceUrl.ts, cms/resources.ts).
  • A note under some section headings, such as the officials' section, so photos don't read as an endorsement (RESOURCE_SECTION_NOTES, #393).
  • FAQ entries open without JavaScript (ui/FaqList.tsx through the kit's Disclosure) and emit schema.org FAQPage data (ui/faqJsonLd.ts).
  • Team members: a team member's email is staff-only to read (#140), and no page or query reads the collection yet (a known gap, see #755).

Tests to name under "Rules and the tests that protect them": cms/orderField.test.ts, data/queries.faq.test.ts, data/queries.resources.test.ts, domain/*.test.ts, ui/FaqList.test.tsx, ui/ResourceCard.test.tsx, ui/faqJsonLd.test.ts.

Map entry: { "note": "src/modules/directory/README.md", "paths": ["src/modules/directory/**"] }

Acceptance criteria

  • Not done: src/modules/directory/README.md follows docs/knowledge/note-template.md and 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.md gets one short line for the note (a few words after the link). It stays within the budget check.
  • Not done: docs/knowledge/map.json gets the entry above.
  • Not done: npm run agent-context -- --write has been run and its generated rule committed, and npm run agent-context passes. 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: #531 applies: this module's server.ts exports data/ reads directly. The note states what the code does and cites decision 0016; post a comment on #531 confirming the two policy files it names are still wrong, and leave the fix to #531 (its files are not touched here). #279, #158 and #366 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 Policy and Agent context pass.

Files likely touched

  • src/modules/directory/README.md
  • docs/knowledge/index.md (one line)
  • docs/knowledge/map.json (one entry)
  • .claude/rules/generated/src--modules--directory--README.md

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.md and 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).
  • docs/guidelines/nextjs-tailwind.md, .agents/skills/write-code/SKILL.md (#531 changes 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

See it on GitHub, opens in a new tab