Skip to content

perf(web): cold repo home within the S-1 request budget - #142

Merged
PastaPastaPasta merged 4 commits into
masterfrom
perf/cold-home-dapi-budget
Sep 29, 2026
Merged

PastaPastaPasta merged 4 commits into
masterfrom
perf/cold-home-dapi-budget

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Owner

Summary

S-1 (platform-parity-spec.md) budgets a cold repo page at ≤ 25 DAPI requests. The showcase mirrors' homes made 30–51, and dashpay/dash made 114. This PR brings every showcase home under 25, and the fixture home from 26 to 8, once the file list's commit-column walk is left out. That walk is being replaced by the push-time last-change index, owned by another agent. dash is the documented large-repo bound. The CI budget in repo-home-latency drops from 120 to 40 (60 for dash).

What changed

  1. One composite for the whole repo chrome (lib/repo/chrome.ts, new). The page is the repo document by ($ownerId, name), with 10 sub-queries bound $id → repoId:

    • counts of star, issue and patch;
    • the maintainer and writer lookups;
    • the first page of the append-only timelines config, refUpdate, protectedRefUpdate and packManifest;
    • the owner's DPNS domain.

    This replaces about 12 separate requests: resolve, config, the ref keyset scan, star, both counts, members, manifests and DPNS. A full page is continued with plain startAfter pages. The home now folds refs from the complete reflog timeline, which is the keyset scan's own trusted fallback, so no ref can be cut off at a page boundary.

  2. A per-repo timeline store. Those four types are documentsMutable: false and canBeDeleted: false, so a later read asks only for rows with $createdAt >= the newest one held, merged by $id. The browse context's pack list (readBrowseManifests) and the PR list's base refs and config come from the same store. A revalidation costs 1 request whatever the repo's size. The store is marked stale on this tab's writes (onRepoContentWritten), and a re-resolve after a miss reads fresh.

  3. Identical reads in flight are joined (lib/sdk/query.ts). This covers documents and counts, and only while a read is out.

  4. The protocol-13 boundary-tie probe is skipped on protocol 14. Drive's pads_cursor_page already continues a startAfter page within its tie. It is gated on non_primary_key_path_query >= 1, which protocol 14 first sets (compound_cursor_tests.rs).

  5. Deferred below the fold, with skeletons: the About card's LICENSE row and language bar (a tree walk that costs 47 requests on dash) and the Latest release card. They load once scrolled into view. The About card starts at y≈896 in a 900 px window.

  6. Smaller cuts:

    • The header's tab totals reuse the composite's proven counts, keeping the read-after-write floor.
    • The issue open-count fold runs before the PR fold, so the PR fold reuses the feed.
    • Member names are prefetched in one batch.
    • Concurrent chrome reads of one repo are joined.

Before / after (cold, fresh Chromium context, counted until network idle)

Before: forge.dashhq.org at master, which matched a local build of master request for request. After: this branch built locally against moutai (beta.6). The "walks" column is the history walks (the commit column and the count; 256 KiB read-ahead chunk reads).

Repo home Before After Walks (after) After, without walks
forge-v2-demo 26 8 0 8
dips 30 13 2 11
ripgrep 38 17 6 11
jq 38 17 7 10
requests 43 19 8 11
fd 45 21 8 13
preact 51 29 12 17
dashpay/dash 114 48 25 23
Other pages Before After
Issues list, cold: demo / dips / requests / preact / dash 14 / 12 / 21 / 20 / 24 6 / 4 / 6 / 10 / 12
Home, wait 35 s, open a file (revalidation), back: preact 14 7
Home, open a file, back (within 30 s) 0 0

Everything is in dash-forge-qa/evidence/impl/perf-cold-home-dapi-budget/PERF.md: every request decoded, per-feature attribution from call stacks, the bounds, and why preact needed 51 while dips needed 30 (ref updates, releases and history depth; pack count played no part).

Protocol shapes (none invented)

Each shape was checked against Platform 4.2.0-beta.6 source and with read-only probes on moutai:

  • at most 10 sub-queries and 100 bound values;
  • cross-contract sub-queries;
  • counts on a rangeCountable index;
  • a bound lookup's field must be the index's last or second-to-last property, so every lookup orders repoId first;
  • a fixed $createdAt >= on a bound lookup;
  • the composite's first page equals the plain query's page, and its counts equal the plain count.

Review

code-review-validator: approved with suggestions. All applied in fix(web): no read answers across this tab's write…:

  • M1: a write bumps the repo's write generation. In-flight chrome reads are joined only within one generation, and a read issued before a write is never stored.
  • M2: the facts placeholder shows only while a load is registered. A deep link or an empty repo shows nothing (e2e pb-3).
  • L1–L3: a membership generation; a per-SDK write epoch in the dedupe key; seeded totals stamped with the read's start time.
  • Lows: delta reads only on protocol 14; a counted, logged plain fallback; an LRU; bounded latches.
  • New live test: lib/repo/chrome.live.test.ts. It passes on moutai for forge-v2-demo and preact, and the delta composite is accepted with no fallback.

A focused re-review of that commit found four more, all fixed in fix(web): a config write stales the repo's caches…:

  • a config write now stales the chrome store;
  • a facts load left mid-read still publishes, so no placeholder lingers;
  • the issue and PR composites pass their membership generation, which is now required;
  • two small guards.

code-simplifier: applied as refactor(web): simplify….

Latency note (not a regression)

On the final run, rhl-1 and rhl-2 (the time-to-list checks) failed. The request budgets passed. At the time moutai answered every page about 4× slower than earlier in the day: the same 7-page refUpdate read in probe-reflog.mjs took 5.0 s, against 1.3 s earlier. forge.dashhq.org (master) took 7.7 s to first paint for preact in the same window. Earlier today, rhl-1 and rhl-2 passed against this branch, and the request counts are unchanged.

UX

Nothing on the home disappears. The deferred facts and latest release show a pulsing skeleton (role=status) until they are scrolled into view, then fill in, and the settled rail text matches master's. axe passes (a11y, v2-home), and so does mobile.spec.

Tests

  • Unit: lib/repo/chrome.test.ts covers the one-request chrome, continuation pages, deltas, the store serving the pack list, joining in-flight reads, staleness after writes, and a renamed repo. lib/sdk/query.test.ts covers dedupe and the tie probe per protocol. lib/view/repo-facts.test.ts covers the in-view gate. The full suite passes (2757).
  • e2e: new e2e/page-budget.spec.ts.
    • pb-1, the fixture: cold home ≤ 12 (8), cold issues ≤ 12 (4), a warm file-and-back ≤ 8 (0), and the deferred cards read on scroll.
    • pb-2, preact: ≤ 25 without the walks (17).
  • repo-home-latency rhl-1's budget drops from 120 to 40 (dash E2E_MAX_DAPI=60, measured 49).
  • Against the final build (7d37324) on moutai: 89 passed across page-budget, v2-home, rate-budget, code-browsing-parity, v2-reads, v2-issues, v2-pulls, repo-settings and a11y. repo-home-latency rhl-1/rhl-2 failed on time-to-list only, because moutai was about 4× slow; see the latency note. The live composite test passes (chrome.live.test.ts).

Out of scope, reported to the orchestrator

  • The commit-column walk: the last-change index work.
  • Blame's 272-request walk (FG-4).
  • L-54, the wasm size: the published wasm_sdk_bg.wasm is already optimised. wasm-opt -Oz saves nothing: 23.4 MB, 8.06 MB gzip, 5.2 MB brotli. The gain there is in shipping brotli and immutable caching (Pages serves max-age=14400, gzip).

🤖 Generated with Claude Code

PastaPastaPasta and others added 4 commits September 28, 2026 23:37
…es (S-1)

The cold repo home made 27-51 DAPI requests on the showcase mirrors (114 on dashpay/dash) against the S-1 budget of 25. One composite now resolves the repo and reads star/issue/PR counts, members, the owner's DPNS name and the first page of the config, ref-update and pack-manifest timelines; those timelines are append-only, so a per-repo store keeps them and later reads ask only for the delta. The browse context's pack list and the PR list's base refs come from the same store. Identical reads in flight are joined, the protocol-13 boundary-tie probe is skipped on protocol 14 (Drive pads the cursor itself), and the below-the-fold About facts and latest release are read once in view, behind skeletons.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…l skeletons

Code-simplifier findings: one delta bound for the composite page and its continuation, a shared in-flight helper for query dedupe and the chrome read, a single latch per repo for the About facts, one Skeleton for the deferred rail cards, and a flatter request decoder in the e2e helpers. No behaviour change.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…der only while a load runs

Review findings on the S-1 chrome store. M1: a write bumps the repo's write generation; in-flight chrome reads are joined only within a generation and a read issued before the write is not kept, so the next reader always reads after it. M2: the About facts placeholder shows only while the home has a load of that tip registered; deep links, empty repos and failed loads show nothing, as before. L1/L2/L3: membership seeds skip reads that straddle a member change, query dedupe keys carry a per-SDK write epoch, and seeded tab totals are rejected when this browser created one after the read was issued. Also: delta reads only on protocol 14, a counted and logged plain-query fallback, a 20-repo LRU, bounded facts latches whose aborted waiters detach, and a live test of the delta composite.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…r the home is left

Re-review of the S-1 store: a config write (one of the four stored timelines) now calls repoContentWritten, so the chrome store, home and browse context read after it. A facts load left mid-read still publishes what it read, so another route of the tip does not keep a placeholder. The issue and PR page composites pass the membership generation they started at, and the parameter is required. The facts latch trim never drops the latch it just made, and a stored delta base is kept only for the same repo.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 3 minutes.

Check out review usage here.

View limit details

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

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

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: e400254f-272e-4560-84e1-1069891dc99c

📥 Commits

Reviewing files that changed from the base of the PR and between 6083367 and 7d37324.

📒 Files selected for processing (30)
  • forge-web/components/repo/repo-rail.tsx
  • forge-web/e2e/code-browsing-parity.spec.ts
  • forge-web/e2e/helpers.ts
  • forge-web/e2e/page-budget.spec.ts
  • forge-web/e2e/repo-home-latency.spec.ts
  • forge-web/e2e/v2-home.spec.ts
  • forge-web/hooks/use-in-view.ts
  • forge-web/hooks/use-repo-chrome.ts
  • forge-web/lib/repo/chrome.live.test.ts
  • forge-web/lib/repo/chrome.test.ts
  • forge-web/lib/repo/chrome.ts
  • forge-web/lib/repo/config.ts
  • forge-web/lib/repo/index.ts
  • forge-web/lib/repo/issues.ts
  • forge-web/lib/repo/members.ts
  • forge-web/lib/repo/packs.ts
  • forge-web/lib/repo/refs.ts
  • forge-web/lib/repo/settings.test.ts
  • forge-web/lib/repo/settings.ts
  • forge-web/lib/repo/social.ts
  • forge-web/lib/sdk/composite.ts
  • forge-web/lib/sdk/index.ts
  • forge-web/lib/sdk/query.test.ts
  • forge-web/lib/sdk/query.ts
  • forge-web/lib/sdk/write.ts
  • forge-web/lib/view/browse-source.ts
  • forge-web/lib/view/issues-view.ts
  • forge-web/lib/view/repo-facts.test.ts
  • forge-web/lib/view/repo-facts.ts
  • forge-web/lib/view/repo-view.ts

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

Comment @coderabbitai help to get the list of available commands.

@PastaPastaPasta

Copy link
Copy Markdown
Owner Author

@coderabbitai review


🤖 Posted autonomously by Claude on behalf of pasta.

@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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