Skip to content

fix(aggregator): author pickers on demand — /program 44.3 MB → ~0.7 MB, /board 12.9 MB (#1179) - #3842

Merged
dezren39 merged 1 commit into
mainfrom
fix/aggregator-1179-author-picker
Nov 1, 2026
Merged

dezren39 merged 1 commit into
mainfrom
fix/aggregator-1179-author-picker

Conversation

@dezren39

@dezren39 dezren39 commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Problem (measured live 2026-11-01 ~10:54 CST, laptop loopback)

page before API twin
/program 44,276,707 B 25 KB
/board 12,932,555 B 1.78 MB

Byte composition (parsed from the actual HTML):

  • /program: <select> elements = 43,762,227 B (98.8%) — 703 selects, 246,767 options. Per card there is one Act as picker: 5 standing identities + one option per registry session (699 options, ~123 KB) — inlined 351 times. The per-item status forms themselves are only 0.26 MB total.
  • /board: the same picker inlined 94 times = 11,721,409 B of selects (90.6%); the giant <details> total is the same bytes nested.

So the pages were quadratic in cards x sessions, and the registry grows every day. The single-threaded server also stalled other pages behind these renders.

Fix

  • authorOptionsHtml() (new, shared by the three previously duplicated option builders — actbox Act as, comment form, card comment box) renders standing identities only; session identities are never inlined.
  • Pickers carry data-author-picker. A delegated pointerdown/focusin hook in the shared DASH_AFTER_JS fetches the new GET /api/author-identities once per page and fills every picker, preserving each picker's current value. Fragment re-renders arrive standing-only and re-hydrate from the cached list on first touch. If the fetch fails or JS is off, pickers keep the standing identities (the common case — Drew is the default). Submit handlers are unchanged: they read the same select[name=author].

Tests

  • New test/author-picker-1179.test.ts (6 tests): standing-only rendering for all three picker sites, a 200-card x 300-session size bound (pre-fix ~9 MB, now <0.4 MB), the endpoint serving the full standing+session list, and /sessions rendering pickers standing-only with the hydration hook present.
  • Full aggregator suite: 894 pass, 1 fail — the one failure (slice-3 routes > dns + sessions + pages routes serve, /api/registry.json claude-code record) fails identically on clean main; pre-existing, unrelated. Typecheck error count identical to main (12, none in touched files).

Smoke (worktree server against live stores)

  • /program: 716,762 B, 354 pickers, zero inlined session options (options on page: 246,767 → 3,173).
  • /api/author-identities: 699 identities, 160 KB pretty JSON, ~6 ms — fetched only when a picker is first touched.

Live post-merge before/after for /program and /board will be recorded on #1179.

Refs #1179


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

…, /board 12.9 MB (#1179)

Every card on the list pages inlined a full author picker: 5 standing identities plus one <option> per registry session (~700 sessions, ~123 KB). /program carried 351 copies (43.8 MB of its 44.3 MB), /board 94 copies (11.7 MB of 12.9 MB) — quadratic in cards x sessions, and the single-threaded render stalled other pages behind it.

Pickers now server-render the standing identities only and hydrate the full list on demand: a delegated pointerdown/focusin hook (in the shared DASH_AFTER_JS) fetches the new GET /api/author-identities once per page and fills every picker, preserving each pickers current value. Datastar fragment re-renders arrive standing-only and re-hydrate from the cached list on first touch. No-JS and fetch-failure paths keep the standing identities, which are the common case; the submit handlers are unchanged (they read the same select[name=author]).

The three duplicated option builders collapse into one exported authorOptionsHtml() that filters out session identities. Regression tests in test/author-picker-1179.test.ts pin standing-only rendering for the actbox/comment/card pickers, a 200-card size bound, and the endpoint serving the full list.

Measured live before: /program 44,276,707 B, /board 12,932,555 B. After (worktree server, live stores): /program 716,762 B with 354 pickers and zero inlined session options; identities endpoint serves all 699 identities in 160 KB, fetched only on demand.
@dezren39
dezren39 requested a review from a team as a code owner November 1, 2026 17:01
@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 55 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 70dcfc78-18e2-4dce-8e93-cc5f43c807e5
Commits

Reviewing files that changed from the base of the PR and between ec305bf and 40da0e2.

Files selected for processing: 3
  • pm-stack/aggregator/src/render.ts
  • pm-stack/aggregator/src/server.ts
  • pm-stack/aggregator/test/author-picker-1179.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T17:03:19.863716Z 40da0e2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant