Content: readiness for a second WordPress app
docs/audits/2026-10-09-content.md ยท read at 3b67d7f
- Open
- 0
- Fixed
- 8
- Won't fix
- 6
๐ Content: readiness for a second WordPress app
Context
A static read of packages/content, covering every non-spec file under src/. It also covers the
one consumer, apps/huella-legal/layers/articles, where the package's shape shows up as app code.
The question is whether the package works as a plug-and-play WordPress reader for the next app
rather than for Huella only. 0031 settled the
topology (one cached server useContent(event), no public route), and this audit takes it as
given: the findings are about the domain model and the cache contract.
A finding marked Confirmed was reproduced by feeding a hand-built WordPress post to toEntry
from a scratch spec (B1, Q2), or by grepping the tree (D1). Likely means reasoned from the code
and not reproduced. Line numbers are from the working tree at commit, which differs only by
deleted comments in useContent.ts.
Several findings are rows in the package README's deferred table. They are filed here because "more WordPress apps soon" is the trigger those rows were waiting for.
Bugs
| ID | Where | What goes wrong | Fix | Status |
|---|---|---|---|---|
| B1 | WordpressHelpers.ts:45-59 toEntry, toTerm, toAuthor | Confirmed. A post titled Ley “Orgánica” & c by J & M comes out of toEntry with both strings still entity-escaped. title, Term.name, Author.name and bio are typed string but hold WP-rendered HTML, so every app either decodes them or prints & | Decode to plain text in the WordPress mapper, so string means text. Huella's toText calls on these fields (D2) then go | fixed #405: toPlainText in the WordPress provider |
| B2 | config.ts:3-7, useContent.ts:16-48 readList, readItem | Likely. One post is cached twice: inside every list page (1 h window) and as an item (6 h window). After an edit, /publicaciones/ and the related band show the new title within the hour, while the article page serves the old one for up to 6 h | One window for both families, or let the purge in Q6 clear both on a post change | wont-fix โ huella refreshes by rebuilding, not by purging Nitro's cache (#236), so the two windows never meet a reader |
Duplication
| ID | Copies | Consolidate into | Status |
|---|---|---|---|
| D1 | Confirmed. The format === "blocks" branch for a format no provider produces (Q4): article.ts:18, articleSummary.ts:64, articleSummary.ts:77, testing/wordpress.ts:93 | Nowhere: narrowing RichText (Q4) deletes all four | fixed #405: RichText is HTML only |
| D2 | WordPress entity decoding, in the app: articleSummary.ts:71 toText, applied to title, name and bio. Every future WordPress app needs the same function | WordpressHelpers.ts, as part of B1 | fixed #405: huella reads the decoded fields as they come |
Quality
| ID | Where | Issue | Fix | Status |
|---|---|---|---|---|
| Q1 | content.ts:1-9 ENTRY_RESOURCES, TERM_RESOURCES | The resources are two closed unions holding WordPress's defaults. An app with a custom post type (events, products) can't read it without editing the shared package, and query.ts rejects its taxonomy with a 404. The package is generic over vendors, of which there is one, and hard-coded over each site's schema, which is what the next app will change | Declare resources in module options ({ events: { kind: "entry", path: "event" } }), keep today's four as the default, and infer the resource type from config | wont-fix โ no app reads more than WordPress's four defaults; the package README's deferred row says where to open the unions |
| Q2 | WordpressConfigs.ts:8-11 TAXONOMIES, WordpressHelpers.ts:62 toEmbeddedTerm | Confirmed. A post embedding a term from the custom taxonomy jurisdiccion comes out with that term gone from Entry.terms, and nothing logs it | Build the taxonomy map from the same config as Q1 | wont-fix โ goes with Q1, since Huella embeds no custom taxonomy |
| Q3 | content.ts:54-66 Entry | There is no slot for ACF or post meta. Huella already routes around it: articleSummary.ts:36 toFormat derives an article's format from magic tag slugs (trabajos-de-fin-de-grado, jurisprudencia-*) | fields?: Record<string, unknown> filled from acf / meta when the site exposes them, typed by each app at its mapper | fixed db5bf75 (#343) |
| Q4 | content.ts:19-21 RichText | markdown and blocks exist for vendors that don't exist, and the cost is paid by every consumer (D1) | { format: "html", value: string } until a second vendor ships, and widen it then | fixed #405 |
| Q5 | config.ts:3-7 | The cache windows are constants. A news-like app and an evergreen one can't tune them without forking the package | Module options, with the current values as defaults | fixed 2b58e9e (#304) |
| Q6 | useContent.ts:50-64 useContent | There is no purge, and only the package knows the key format, so an app can't write one either. A correction to a legal article takes up to 6 h to show (#236) | A secret-guarded purge handler or useContent(event).invalidate(resource, slug?) for a WP webhook, clearing the item key and the content-list group | wont-fix โ Nitro's cache is per instance and huella's pages are prerendered, so a rebuild is the refresh (#236) |
| Q7 | useContent.ts:50-64 useContent | Every read is cached and anonymous, so there is no way to preview a draft. That's the first thing an editor on a second WP site will ask for | An uncached, authenticated read (application password from env), enabled per request by the app | wont-fix โ no editor has asked, and a preview needs a runtime route and a credential next to a prerendered site; a deferred row in the package README |
| Q8 | WordpressProvider.ts:12-23 listEntries | Likely. A list fetches and caches full content.rendered for every item (about 53 KB a post on the 0027 corpus), which is mostly unused by a listing. Huella reads the body there only for readingMinutes | A _fields projection on lists, plus an optional wordCount on Entry computed in the provider | wont-fix โ #405 adds wordCount, and the provider needs the body on lists to count it, so lists keep fetching it |
| Q9 | useContent.ts:16-62 | One cached function serves both entries and terms, so its return is Page<Entry> | Page<Term>, and the four accessors cast it back with as | One cached function per kind, or a generic one, so the casts go | fixed #405: one cached reader per kind and shape |
| Q10 | pages/articles/index.vue:18-23 | WordPress answers a page past the end with a 400, which passes through as if the query were malformed. Each app has to learn that WP quirk and turn it into a 404 | The provider maps rest_post_invalid_page_number to NotFoundError | fixed #405: PageNotFoundError |
Order
- Q1, Q2 and Q3 first, together. They decide whether a second WordPress app can plug in without editing the package, and they share one config shape.
- B1 with D2. Decoding moves into the provider and the app's copy is deleted in the same change.
- Q4, which closes D1 for free.
- Q6, which also settles B2 if the purge clears both key families. Q5 belongs in the same change, since both touch the module options.
- Q7โQ10 are independent and can go in any order.