Skip to content

Reduce reader startup work after merged Lighthouse improvements - #114

Merged
abhi1693 merged 2 commits into
masterfrom
perf/reader-lighthouse-followup
Oct 6, 2026
Merged

abhi1693 merged 2 commits into
masterfrom
perf/reader-lighthouse-followup

Conversation

@abhi1693

@abhi1693 abhi1693 commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

What changes and why?

Signed-out readers currently download authenticated reading tools, and the closed Dev Card invitation mounts its large SVG and requests artwork images during initial page load. Load Must Reads and the streak panel together after sign-in, and mount the invitation content when its existing dialog opens. Keep the current navigation, 30-second invitation delay, dialog coordination, editing, animation, and dismissal behavior.

Latest and article previews remain the first priorities from the production Faro sample used for the preceding performance work (137 and 121 normalized navigation events respectively over seven days; sampled events, not pageview counts). This follow-up measures against the newly merged master, 8b25ac2f, rather than the earlier feature branches. No API bottleneck was identified that requires a backend change for these improvements.

Validation

Hosted Lighthouse comparison: merged master 8b25ac2f (baseline run) → final PR f76300a1 (run and reports, automated Lighthouse comment). Three cold mobile loads per page, unchanged fixtures/targets, median timings, largest transfer sizes:

Page LCP before → after TBT before → after JS before → after Total before → after
Latest 2.74 → 2.58 s 215 → 107 ms 252 → 247 KiB 930 → 525 KiB
Article preview 4.39 → 2.58 s 266 → 116 ms 256 → 251 KiB 943 → 542 KiB
Topics 2.60 → 2.37 s 64 → 37 ms 267 → 231 KiB 403 → 361 KiB
Sources 2.96 → 2.53 s 64 → 38 ms 277 → 267 KiB 413 → 398 KiB
Public profile 2.54 → 2.23 s 60 → 31 ms 257 → 221 KiB 368 → 327 KiB
Leaderboard 2.22 → 1.97 s 182 → 69 ms 225 → 188 KiB 319 → 278 KiB

Hosted advisory warnings fall from seven to three, and every page passes the 200 ms TBT target. Sampled performance scores rise from 92 → 96 on Latest and 79 → 96 on article previews. Timings vary between runs, particularly the hosted article baseline; the local comparison below shows smaller paint/score improvements and mixed TBT. Transfer savings are consistent in both environments. Latest/article LCP remains 2.58 s and Sources 2.53 s against the 2.5-second target.

Local comparison against the same merged master, before the subsequent error-boundary fix, using the same three-load method:

Page LCP before → after JS before → after Total before → after
Latest 2.67 → 2.58 s 252 → 247 KiB 930 → 525 KiB
Article preview 2.72 → 2.57 s 256 → 251 KiB 943 → 542 KiB
Topics 2.59 → 2.32 s 267 → 231 KiB 403 → 361 KiB
Sources 2.72 → 2.60 s 277 → 267 KiB 413 → 398 KiB
Public profile 2.52 → 2.21 s 257 → 221 KiB 368 → 326 KiB
Leaderboard 2.21 → 2.04 s 225 → 187 KiB 319 → 278 KiB

Startup transfer falls 44% on Latest and 43% on article previews; both shed 437 DOM elements. Advisory LCP warnings fall from five to three. Median TBT remains under 200 ms on all six pages but is mixed: Latest 170 → 161, article 180 → 189, Topics 37 → 52, Sources 40 → 49, profile 40 → 37, leaderboard 109 → 129 ms. Latest, article previews, and Sources still exceed the 2.5-second LCP target. Deferred invitation assets load when the invitation opens.

  • npm run web:lint: passed.
  • npm run web:test: 1,171 tests passed on the final commit in hosted CI, including deferred content, account switching, and rejected-chunk regressions. Commit hooks also reran web lint, types, and unit tests.
  • npm run extension:check and npm run extension:test: passed, 29 tests.
  • npm run ci:browser-measure: passed; no fixture or budget changes.
  • npm run reader:test:parity: web and all five browser suites for each built Chrome/Edge extension passed, covering invitation timing/animation/editing, authenticated reading tools, responsive layouts, and accessibility. Hosted reader parity also passed on the final commit.
  • Fixed and resolved the review finding about rejected optional reading-tools downloads: a local error boundary now keeps the reader and other header actions available; a rejected-import regression passes.
  • Final commit f76300a1: CI required, CodeQL, SonarQube, hosted reader parity, backend checks, security scans, and ARM64 image checks all passed. No unresolved review conversations; auto-merge remains disabled.
  • Native GitHub attachment upload is unavailable in this environment. Browser screenshots stay local and untracked; no visible design changes are intended.

Documentation does not need an update: public behavior, configuration, and API contracts remain the same; this description records the performance measurements and remaining gaps.

Ready for review

  • The description explains the change and the validation results, including any gaps.
  • Relevant documentation and regression tests are updated, or the description explains why they aren't needed.

Comment thread apps/web/src/components/reading-tools.tsx
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

PR reader API performance

Base 8b25ac2 → PR f76300a

Not measured: public API inputs are unchanged. This PR changes only recognized frontend or browser-test files.

Full HTML/CSV reports and logs · attempt 1

@gitar-bot

gitar-bot Bot commented Oct 6, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 closed / 1 findings

🟡 Medium risk · Defers authenticated reading tools and invitation artwork until account or dialog activation.

Reduces reader startup work by deferring hidden reader tools and invitation artwork until needed, and contains optional reading-tools chunk download failures. Median total transfer size drops 44% on Latest and 43% on article previews; LCP warnings fall from five to three across cold mobile Lighthouse loads.

✅ 1 closed
✅ Edge Case: Lazy reading-tools chunk failure can take down the whole shell

📄 apps/web/src/components/reading-tools.tsx:6-16
AccountReadingTools used to be a static import. It now loads through React.lazy, wrapped only in Suspense. If the chunk fails to load (flaky network, or a deploy that removes old chunk hashes while a tab is open), the rejected import throws during render and goes to the nearest error boundary. That replaces the page or header with the error UI, when the only loss should be the optional Must Reads and streak buttons. Wrapping the lazy component in a small error boundary that renders null keeps the failure contained.

Review coverage

📋 Rules No rules evaluated

🧪 Functional validation Not enabled · Set up

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Counting what did not apply, without listing it.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

Backend unit coverage

PASS · minimum combined coverage 67.60%.

Tests: 3508 passed, 0 failed, 0 skipped. Source files: 276.

Workspace Lines Branches Combined
All backend code 72.17% 54.31% 68.33%
apps/admin-api 65.12% 36.07% 60.29%
apps/aggregator 73.94% 57.18% 70.13%
apps/api 72.77% 58.45% 70.13%
apps/article-enrichment-worker 80.00% 50.00% 71.43%
apps/cli 68.76% 42.93% 64.81%
apps/images-worker 80.00% 50.00% 71.43%
apps/mcp 82.99% 73.88% 81.28%
apps/notifications 83.33% 76.67% 81.75%
apps/search-indexer 85.48% 85.71% 85.53%
apps/source-discovery-worker 80.00% 50.00% 71.43%
apps/user-api 59.37% 33.33% 54.50%
packages/core 74.09% 57.12% 70.06%
packages/http 94.94% 87.77% 93.29%

Unit coverage includes every backend workspace. PostgreSQL/Redis integration tests run separately.

Commit: f76300a · HTML, JSON, XML reports and job logs · attempt 1

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

Lighthouse · ⚠️ Targets exceeded

⚠️ 3 target warnings · Bold values need attention.

Page FCP LCP CLS TBT JS Total
Latest (/latest) 1.07 s 2.58 s 0.001 107 ms 247 KiB 525 KiB
Article preview (/articles/…) 1.06 s 2.58 s 0.005 116 ms 251 KiB 542 KiB
Topics (/topics) 1.06 s 2.37 s 0.000 37 ms 231 KiB 361 KiB
Sources (/sources) 1.07 s 2.53 s 0.000 38 ms 267 KiB 398 KiB
Public profile (/users/…) 1.06 s 2.23 s 0.000 31 ms 221 KiB 327 KiB
Leaderboard (/leaderboard) 0.91 s 1.97 s 0.000 69 ms 188 KiB 278 KiB

Mobile reader · Three cold loads per page · Median timings · Largest transfer size.

Needs attention

Page Finding Measured Target / limit
Latest (/latest) ⚠️ Target · LCP 2.58 s 2.50 s
Article preview (/articles/…) ⚠️ Target · LCP 2.58 s 2.50 s
Sources (/sources) ⚠️ Target · LCP 2.53 s 2.50 s

Full reports and logs · f76300a · Attempt 1

@sonarqubecloud

sonarqubecloud Bot commented Oct 6, 2026

Copy link
Copy Markdown

@abhi1693
abhi1693 merged commit 16f9671 into master Oct 6, 2026
56 checks passed
@abhi1693
abhi1693 deleted the perf/reader-lighthouse-followup branch October 6, 2026 12:02
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