#38 — Performance pass: bundles, Lighthouse CI, N+1 batching
P1 backlog: add @next/bundle-analyzer + Lighthouse CI budgets, React.cache the session read, batch the e-sign and messaging N+1 adapter loops, and measure React Flow's cost on staff routes. No perf regression gate exists today.
4 Comments
Sign in to comment
·about 2 months agoMerged into dev (new shared integration branch per 2026-07-09 operating model) at 5ccd6b3; combined tree re-verified on dev (typecheck/lint/boundaries clean, new unit tests pass, build green incl. both new routes, bundle gate green across 288 routes). Ships to master with the next release cut. Marking complete.
·about 2 months agoAgent A — code complete & verified; awaiting merge (PR #32).
Audit first (this card had partially rotted): getRequestSession is already React.cache'd (runtime.ts:44); messaging attachment resolution already batched (getConversation.ts); the signatures page already batch-loads contacts/documents per client set (page.tsx:96 comment names the N+1 it replaced); WS-7 compiled-SQL cap tests exist (repository.perf.test.ts). So the live gap was exactly the card's last sentence: no perf regression gate.
What changed: scripts/bundle-budget.mjs (zero-dep) — per-route First-Load JS in raw bytes from app-build-manifest.json; global cap 920 kB (baseline worst: automations edit / React Flow at 745 kB), shared-baseline cap via /_not-found proxy (343 kB baseline, 430 kB cap), explicit hot-path budgets (staff/portal dashboards, clients, sign-in), all ~20% headroom. pnpm perf:bundle-budget; runs in the CI build job non-gating (continue-on-error) for a settling period — one-line change to make it gating. docs/qa/performance-budget.md Enforcement rewritten from "none implemented" + dated baseline snapshot.
React Flow measured (card item): confined to its own route chunk (/staff/automations/[id]/edit, 232 kB gzip vs 171-190 kB elsewhere) — no cross-route cost; dynamic() would not reduce that route's First-Load. No change made, verdict documented.
Deliberately not done: @next/bundle-analyzer (requires a lockfile edit — repo convention forbids it outside an owning task, and the gate doesn't need it; one-command recipe documented) and Lighthouse CI budgets (too heavy to stand up safely overnight on the shared self-hosted runners — REMAINS OPEN on this card as the follow-up).
Verification (branch agent-a/perf-pass, 8961bc1): unit tests 3/3; real gate green vs fresh build (282 routes); pnpm test:status pass; ci.yml YAML-validated.
Status stays In Progress until Daniel merges https://github.com/Firmary/firmary-os/pull/32; after merge this card is complete except the Lighthouse CI follow-up (recommend splitting that to its own card if it should stay visible).
·about 2 months agoAgent A claiming this until completion or block. Scope: React.cache the per-request session read; batch the e-sign + messaging N+1 adapter loops; add @next/bundle-analyzer wiring + record baseline route sizes; measure React Flow cost on staff routes and dynamic-import it if it pays. Lighthouse CI budgets: will add only as a non-blocking CI job or defer with a follow-up note (not risking the shared CI overnight). Not touching tasks module (Agent B #91) or engagements/billing lanes. Started: 2026-07-09 02:10 America/Chicago.
Closed during the 2026-08-23 GitHub migration: perf pass shipped (PR #32, merged 5ccd6b3) — bundle-budget gate + audit; the deliberately-split Lighthouse follow-up (QB#99) is also done: ci.yml now runs a blocking Lighthouse mobile performance gate.