Repository navigation
Description
Problem
id(web/home): the home feed refresh shape-trusts the /api/home/feed response — a wrong-shape 200 response wipes the already-rendered home lists and leaves raw engine errors / bogus rows in place of the feed.
pkgs/id/web/src/home.ts:
:105—const feed = (await response.json()) as HomeFeed;is a bare cast; the result is dereferenced unvalidated at:107-110(feed.recent,feed.popular,feed.recent_tags,feed.popular_tags,feed.scope).:28/:55— both renderers (renderList,renderTagList) calllist.replaceChildren()FIRST and only then readdocuments.length/ iterate, so a malformed payload destroys the previously rendered (good) list before it throws.:114— the catch surfaces the raw exception text (error.message) as the status line, so a shape failure shows e.g. "null is not an object (evaluating 'tags.length')" to the user instead of a clean unavailable message.
Evidence (verified this run, laptop @ main 3bf18dc, home.ts md5 b3b0b3734c290dec5be5053834a871f4)
Probe ~/git/fleet/probe-home-feed/probe.ts (bun, minimal DOM stub, real module imported from the laptop tree):
- control (well-formed tag list): renders OK —
topic:rust — 4 documents renderTagList(list, null): THROWTypeError: null is not an object (evaluating 'tags.length')— list children after throw = 0 (previous good row wiped)renderTagList(list, {}): THROWTypeError: {} is not iterable— list wipedrenderTagList(list, [null]): THROWTypeError ... (evaluating 'tag.subject')— list wipedrenderTagList(list, [valid, null]): THROW on the second element — list left half-rendered (1 new row, previous content gone)renderTagList(list, "abc"): no throw — silently renders 3 bogus rows:undefined — undefined documents×3
renderList (documents) shares the same wipe-first shape (:28 then documents.length), and a null feed body throws at feed.recent itself. The refresh polls every 15s (home.ts poll loop), so one bad response (deploy skew, an error envelope returned with 200, a future server field change) blanks the home page's lists until a well-formed response arrives, with a raw TypeError as the only explanation.
The existing test file (pkgs/id/web/src/home.test.ts) covers only well-formed renderTagList inputs (XSS text rendering, occurrence counts) — no malformed-shape cases.
Why it matters
The home page is id's front door. Every other feed consumer in this repo that was audited in this class (projector, aggregator, atlas worker) validates the shape at the boundary before touching state; the home refresh instead mutates the DOM first and validates never. Failing closed here is cheap: keep the last good render and show the designed unavailable message.
Acceptance criteria
- A malformed feed payload (null body, non-object body, missing/non-array
recent/popular/recent_tags/popular_tags, null or wrong-typed elements/fields) does NOT clear or partially replace the currently rendered lists. - A malformed payload surfaces a clean user-facing message (e.g. "Feed is temporarily unavailable.") — never a raw TypeError/engine message.
- Well-formed feeds render exactly as today (existing home.test.ts cases unchanged and green).
- New regression tests in
pkgs/id/web/src/home.test.tscover the malformed cases above and fail pre-fix. - Web suite + typecheck green.
Activity
developing-today commentedon Nov 8, 2026
🤖 Agent note · filed
developing-today commentedon Nov 8, 2026
🤖 Agent note · handed off
opencode26 remaining items
developing-today commentedon Nov 9, 2026
🤖 Agent note · handed off
opencodedeveloping-today commentedon Nov 9, 2026
🤖 Agent note · handed off
opencodedeveloping-today commentedon Nov 9, 2026
🤖 Agent note · handed off
opencodeMerge pull request #7821 from developing-today/queue/13984-7811-home-…