Files
news-platform/docs/PERFORMANCE_BASELINE.md
T
José Alves 968b8763bf
Tests / writer-pipeline tests (push) Successful in 2m3s
Tests / bridge tests (push) Successful in 1m52s
Tests / frontend lib tests (push) Successful in 3m2s
Tests / writer-pipeline tests (pull_request) Successful in 3m4s
Tests / bridge tests (pull_request) Successful in 2m11s
Tests / frontend lib tests (pull_request) Successful in 2m17s
docs(qa): measure LCP/CLS/Lighthouse on andebol.net + newsproject (BIT-28130)
Lighthouse CLI 13.4.0 against home + one article URL per domain,
2026-08-04. andebol.net fails LCP (~8s) and Performance (26/38) on
both pages; newsproject.bitreport.pt passes home (LCP 2.04s, score
97) but fails Performance on article (score 60, TBT 7.4s). CLS
passes 0 on all four URLs. Closes the measurement gap flagged by
BIT-28082 in docs/PERFORMANCE_BASELINE.md and updates the
objective #2 status pending markers in docs/PROJECT_STATUS.md.

Paperclip-Issue: BIT-28130
2026-08-04 20:45:29 +01:00

13 KiB
Raw Blame History

Performance Baseline — 2026-04-11

Audit Date: 2026-04-11T02:48:13+00:00 Auditor: Patrícia Santos (Agent) Reference: BIT-2080, docs/architecture.md § 6


Re-Measurement Addendum — 2026-05-12

Date: 2026-05-12T07:25:00+00:00 Auditor: Rosa Neves (COO Agent) Reference: BIT-21610

Cache-Control Headers — ✅ RESOLVED

BIT-2261 (Cache-Control on page responses) is done. Headers are now emitted on all Astro page routes:

cache-control: s-maxage=60, stale-while-revalidate=300

Confirmed on both domains (2026-05-12):

  • andebol.net — cache-control: s-maxage=60, stale-while-revalidate=300 ✓
  • newsproject.bitreport.pt — cache-control: s-maxage=60, stale-while-revalidate=300 ✓

TTFB Re-Measurement

Measurements repeated 2026-05-12T10:50 UTC (3 samples each):

Domain Min TTFB Median TTFB Max TTFB cf-cache-status
andebol.net 0.181s 0.233s 0.396s DYNAMIC
newsproject.bitreport.pt 0.229s 0.272s 0.295s DYNAMIC

Improvement: TTFB reduced from ~300ms (April baseline) to ~220ms typical (15–27% improvement from origin-side optimisations). Cache-Control headers confirmed present on every request.

Cloudflare HTML Cache Rule — ✅ APPLIED (2026-05-12)

Date: 2026-05-12T22:39 UTC Reference: BIT-21912 / BIT-21847

Cache Rule applied to both zones via deploy/scripts/cf-cache-rules-apply.sh (edge_ttl: override_origin, default: 60 s). Double-GET / verification:

Domain Pass cf-cache-status TTFB
andebol.net 1 HIT 0.090 s
andebol.net 2 HIT 0.081 s
newsproject.bitreport.pt 1 HIT 0.129 s
newsproject.bitreport.pt 2 HIT 0.101 s
Metric Target Actual Status
TTFB (cache HIT) < 30 ms ~81–130 ms ⚠️ Edge HIT confirmed; TTFB above < 30 ms target (Free plan, no Argo/Tiered Cache)
TTFB (cache MISS) < 200 ms ~220 ms ⚠️ Close; origin unchanged
Cache-Control headers present present ✅
cf-cache-status HIT HIT ✅

Operator trap: curl -I / HEAD can remain DYNAMIC while GET / is HIT — the live rule matches GET only (see deploy/scripts/cf-cache-rules-apply.sh). Always verify with GET (curl … -D - -o /dev/null).

Independent GET check (2026-05-12 ~23:02 UTC, CI runner): andebol.net pass1 EXPIRED / TTFB ~0.42 s, pass2 HIT / ~0.11 s; newsproject.bitreport.pt pass1–2 HIT / ~0.10–0.13 s — consistent with BIT-21912 closure evidence.

Re-Measurement Addendum — 2026-08-04 — LCP / CLS / Lighthouse Performance

Date: 2026-08-04T20:40:00Z Auditor: Peter Spark (CTO Agent) Reference: BIT-28130, parent BIT-28082

Method

Lighthouse CLI 13.4.0 (npx lighthouse), Chrome for Testing 149.0.7827.22, headless (--headless=new --no-sandbox --disable-gpu --disable-dev-shm-usage), default mobile config (simulated throttling), --only-categories=performance, one run per URL. Home page + one article URL per domain, per acceptance criteria.

Methodology caveat: Lighthouse emitted "The tested device appears to have a slower CPU than Lighthouse expects" on every run — the CTO agent's compute host is CPU-constrained relative to Lighthouse's calibration target, which inflates simulated-throttling metrics (TBT especially) versus a reference desktop. Directionally the results below are trustworthy (the andebol.net vs. newsproject.bitreport.pt gap is large and consistent across two page types), but absolute scores should be cross-checked against PageSpeed Insights (Google-hosted, calibrated infra) before being treated as authoritative for SLA/gating purposes. Raw Lighthouse JSON reports retained at /tmp/lhreports/*.json on the audit host (not committed — regenerate via the command above if needed).

Results

URL LCP CLS Lighthouse Performance LCP Target (<2.5s) CLS Target (<0.1) Perf Target (≥90)
https://andebol.net/ (home) 7.93 s 0 26 ❌ FAIL ✅ PASS ❌ FAIL
https://andebol.net/article/betclic-e-a-nova-patrocinadora-oficial-da-federacao-de-andebol-de-portugal 8.13 s 0 38 ❌ FAIL ✅ PASS ❌ FAIL
https://newsproject.bitreport.pt/ (home) 2.04 s 0 97 ✅ PASS ✅ PASS ✅ PASS
https://newsproject.bitreport.pt/article/betclic-sorteia-campeonatos-2026-27-calendarios-definidos-para-22-clubes 2.02 s 0 60 ✅ PASS ✅ PASS ❌ FAIL

Supporting figures: andebol.net home Total Blocking Time 5874 ms, main-thread work 19.5 s (666 tasks, 4.88 s total task time on the main document alone — no render-blocking scripts detected, so the cost is concentrated in style/layout work, consistent with the CPU-throttling caveat above but still a real outlier vs. newsproject). andebol.net article TBT 778 ms. newsproject.bitreport.pt article TBT 7416 ms (this is what drops its performance score to 60 despite LCP passing — worth its own investigation, likely third-party/embed script on article template).

Verdict vs. Architecture Targets (docs/architecture.md § performance targets)

Overall: ❌ TARGETS NOT MET. 2 of 4 URLs fail LCP + Performance outright (andebol.net, both pages). newsproject.bitreport.pt passes on home but fails Performance on article pages (TBT-driven). CLS passes on all 4 URLs measured (0 in every run — no layout-shift regressions detected, though this Lighthouse config uses simulated throttling, not field CrUX data).

Follow-ups Opened

  • andebol.net (home + article) LCP ~8s / Performance ~30: needs investigation by the owning frontend engineer — this domain was not previously suspected as the weak one (May addendum's TTFB numbers were comparable to newsproject.bitreport.pt), so the regression is likely render-path/CSS or third-party, not network. See child issue created against this ticket.
  • newsproject.bitreport.pt article template TBT 7.4s (score 60, LCP still fine): main-thread blocking work on article pages specifically, not home — flag to owning engineer for main-thread profiling (likely a heavy embed/widget script scoped to the article template).

Executive Summary

Current posture (post May 2026 addendum — BIT-21610 / BIT-21912):

Area Status
Cache-Control on Astro pages ✅ Present (s-maxage=60, stale-while-revalidate=300)
Cloudflare edge HTML cache ✅ HIT confirmed on GET / for andebol.net + newsproject.bitreport.pt
TTFB (cache HIT) ⚠️ ~81–130 ms on Cloudflare Free (no Argo / Tiered Cache). Architecture aspirational target remains < 30 ms — contract reconciliation tracked in BIT-28133
TTFB (cache MISS / origin) ⚠️ ~220 ms typical (close to < 200 ms)
LCP / CLS / Lighthouse ❌ Measured 2026-08-04 (BIT-28130) — andebol.net fails LCP + Performance on both pages; newsproject.bitreport.pt passes home, fails Performance on article (TBT). See addendum below.

The April 2026 sections below are the historical baseline (Cache-Control missing, all requests ~300 ms DYNAMIC). Do not treat the April “TARGETS NOT MET” lead as current production state.

Docs refresh: BIT-28131 under governance sweep BIT-28082.


Architecture Targets vs. Actual Measurements

Current (May 2026 re-measurement + edge HIT)

Metric Target Actual Status Notes
TTFB (cache HIT) < 30 ms ~81–130 ms ⚠️ Edge HIT confirmed; Free-plan floor vs aspirational target (BIT-28133)
TTFB (cache MISS) < 200 ms ~220 ms ⚠️ Origin-side; improved vs April ~300 ms
Cache-Control headers present present ✅ BIT-2261
cf-cache-status (GET) HIT HIT ✅ Verify with GET, not HEAD (BIT-21912)
LCP < 2.5 s 7.93–8.13 s (andebol.net); 2.02–2.04 s (newsproject.bitreport.pt) ⚠️ mixed andebol.net fails both pages; newsproject.bitreport.pt passes both — see 2026-08-04 addendum
CLS < 0.1 0 (all 4 URLs) ✅ See 2026-08-04 addendum
Lighthouse Performance ≥ 90 26 / 38 (andebol.net); 97 / 60 (newsproject.bitreport.pt) ❌ Only newsproject.bitreport.pt home passes; see 2026-08-04 addendum

Historical (April 2026 baseline — superseded for cache/TTFB)

Metric Target Actual (2026-04-11) Status Notes
TTFB (cache HIT) < 30 ms ~300 ms ❌ then No Cache-Control; DYNAMIC
TTFB (cache MISS) < 200 ms ~300 ms ❌ then Cache not functioning
LCP / CLS / Lighthouse see above Not measured ⚠️ Measured 2026-08-04, see addendum above

Detailed Measurements

TTFB Analysis

andebol.net (Homepage)

URL: https://andebol.net
Response Size: 82 KB

Request 1 (warm cache):
  Time to First Byte: 0.309 s
  Total Time: 0.292 s

Request 2 (expected cache HIT):
  Time to First Byte: 0.302 s
  Total Time: 0.323 s

Response Headers:
  Cache-Control: [MISSING]
  cf-cache-status: DYNAMIC
  vary: accept-encoding
  Server: cloudflare

newsproject.bitreport.pt (Homepage)

URL: https://newsproject.bitreport.pt
Response Size: 33 KB

Request 1 (warm cache):
  Time to First Byte: 0.314 s
  Total Time: 0.308 s

Request 2 (expected cache HIT):
  Time to First Byte: 0.303 s
  Total Time: 0.342 s

Response Headers:
  Cache-Control: [MISSING]
  cf-cache-status: DYNAMIC
  vary: accept-encoding
  Server: cloudflare

Key Finding: Cache-Control Headers

Expected (per architecture):

Cache-Control: s-maxage=60, stale-while-revalidate=300

Actual:

Cache-Control: [NOT PRESENT]

This prevents:

  • ✗ Cloudflare from caching responses (status: DYNAMIC instead of HIT)
  • ✗ Browser from reusing cached pages
  • ✗ Achieving <30 ms TTFB target
  • ✗ Achieving <200 ms cache MISS target

Root Cause Analysis

The frontend (Astro) is not setting Cache-Control headers on responses. Per docs/architecture.md § 7 (Caching Strategy):

"HTTP Cache-Control: s-maxage + stale-while-revalidate — Set per route — Instructs CDN"

Missing Implementation:

  • No Astro.response.headers.set() calls in page components
  • No middleware setting cache headers
  • No Astro adapter configuration enabling response header management

Blocking Issues

Issue 1: Missing Cache-Control Headers (CRITICAL)

Impact: Prevents all TTFB target achievement Scope: Frontend (Astro pages) Action Required: Implement Cache-Control: s-maxage=60, stale-while-revalidate=300 on all page routes Files to Review: frontend/src/pages/*.astro


Measurement Limitations

The following metrics could not be measured due to environmental constraints:

  1. LCP / CLS (Core Web Vitals)

    • Requires Chrome DevTools Protocol or lighthouse CLI
    • npm environment has tsx dependency issue preventing lighthouse installation
    • Alternative: Use web.dev PageSpeed Insights API (requires key)
  2. Lighthouse Performance Score

    • Same npm issue prevents CLI invocation
    • Could be obtained via web.dev PageSpeed Insights or Chrome User Experience Report

Recommendation

Once Cache-Control headers are implemented:

  1. Run Lighthouse audit again (should see improvement from reduced TTFB)
  2. Measure LCP/CLS with web.dev or Chrome DevTools
  3. Update baseline with full metrics

Next Steps

  1. Immediate: Create BIT-2081 — Implement Cache-Control headers in Astro frontend
  2. After fix merged: Re-run full audit to validate target achievement
  3. Archive: Update this baseline document with complete measurements

Test Environment

  • LXC Container: news-project-test (CT 222), Ubuntu 24.04
  • Nginx: TLS termination, reverse proxy to Astro :4321
  • Cloudflare: Global CDN, account-level cache rules
  • Astro: SSR mode, Node.js adapter (standalone)
  • Test Client: curl (TTFB), standard HTTP/2

Appendix: Raw Measurement Data

Timestamp: 2026-04-11T02:48:13+00:00

andebol.net:
  Response: HTTP/2 200 OK, 82737 bytes
  Headers: [none cache-related]
  TTFB measurements: 0.309s, 0.302s (consistency across requests confirms no caching)

newsproject.bitreport.pt:
  Response: HTTP/2 200 OK, 33643 bytes
  Headers: [none cache-related]
  TTFB measurements: 0.314s, 0.303s (consistency across requests confirms no caching)