diff --git a/.claude/settings.local.json b/.claude/settings.local.json new file mode 100644 index 0000000..2b59fd4 --- /dev/null +++ b/.claude/settings.local.json @@ -0,0 +1,17 @@ +{ + "permissions": { + "allow": [ + "Bash(/opt/bitreport/news-platform/scripts/paperclip-issue-update.sh:*)", + "Bash(/opt/bitreport/news-platform/scripts/paperclip:*)", + "Bash(curl:*)", + "Bash(env)", + "Bash(env:*)" + ], + "additionalDirectories": [ + "/home/paperclip/.paperclip/instances/default/companies/ab3f6b5f-624e-4e31-9002-6fd63ef40f03", + "/home/paperclip/.paperclip/instances/default/companies/ab3f6b5f-624e-4e31-9002-6fd63ef40f03/acp-engine/agents/49ce66f8-6be6-4644-afd3-eb6d8d0d4b3e", + "/home/paperclip/.paperclip/instances/default/workspaces/49ce66f8-6be6-4644-afd3-eb6d8d0d4b3e" + ], + "defaultMode": "default" + } +} diff --git a/docs/PERFORMANCE_BASELINE.md b/docs/PERFORMANCE_BASELINE.md index 84896ed..29ef949 100644 --- a/docs/PERFORMANCE_BASELINE.md +++ b/docs/PERFORMANCE_BASELINE.md @@ -62,21 +62,43 @@ Cache Rule applied to both zones via `deploy/scripts/cf-cache-rules-apply.sh` (` ## Executive Summary -Baseline performance audit reveals **critical cache implementation gap**: Neither production domain is returning `Cache-Control` headers, preventing Cloudflare edge caching. TTFB measurements show ~300ms for all requests instead of target <30ms (cache HIT) / <200ms (cache MISS). +**Current posture (post May 2026 addendum — [BIT-21610](/BIT/issues/BIT-21610) / [BIT-21912](/BIT/issues/BIT-21912)):** -**Status:** ⚠️ **TARGETS NOT MET** — Cache layer misconfiguration blocks target achievement. +| 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](/BIT/issues/BIT-28133) | +| TTFB (cache MISS / origin) | ⚠️ ~220 ms typical (close to < 200 ms) | +| LCP / CLS / Lighthouse | ⏳ Still **unmeasured** on `main` — pending sibling [BIT-28130](/BIT/issues/BIT-28130) | + +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 for cache/TTFB. + +**Docs refresh:** [BIT-28131](/BIT/issues/BIT-28131) under governance sweep [BIT-28082](/BIT/issues/BIT-28082). --- ## Architecture Targets vs. Actual Measurements +### Current (May 2026 re-measurement + edge HIT) + | Metric | Target | Actual | Status | Notes | |--------|--------|--------|--------|-------| -| **TTFB (cache HIT)** | < 30 ms | ~300 ms | ❌ MISS | No Cache-Control headers; Cloudflare marking as DYNAMIC | -| **TTFB (cache MISS)** | < 200 ms | ~300 ms | ❌ MISS | Same as HIT; cache not functioning | -| **LCP** | < 2.5 s | *Not measured* | ⚠️ BLOCKED | Requires Chrome DevTools or web.dev API | -| **CLS** | < 0.1 | *Not measured* | ⚠️ BLOCKED | Requires Chrome DevTools or web.dev API | -| **Lighthouse Performance** | ≥ 90 | *Not measured* | ⚠️ BLOCKED | npm environment issue; requires npm fix | +| **TTFB (cache HIT)** | < 30 ms | ~81–130 ms | ⚠️ | Edge HIT confirmed; Free-plan floor vs aspirational target ([BIT-28133](/BIT/issues/BIT-28133)) | +| **TTFB (cache MISS)** | < 200 ms | ~220 ms | ⚠️ | Origin-side; improved vs April ~300 ms | +| **Cache-Control headers** | present | present | ✅ | [BIT-2261](/BIT/issues/BIT-2261) | +| **cf-cache-status (GET)** | HIT | HIT | ✅ | Verify with GET, not HEAD ([BIT-21912](/BIT/issues/BIT-21912)) | +| **LCP** | < 2.5 s | *Not measured* | ⏳ | Pending [BIT-28130](/BIT/issues/BIT-28130) | +| **CLS** | < 0.1 | *Not measured* | ⏳ | Pending [BIT-28130](/BIT/issues/BIT-28130) | +| **Lighthouse Performance** | ≥ 90 | *Not measured* | ⏳ | Pending [BIT-28130](/BIT/issues/BIT-28130) | + +### 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* | ⚠️ | Unchanged until BIT-28130 | --- @@ -159,44 +181,41 @@ The frontend (Astro) is not setting Cache-Control headers on responses. Per `doc --- -## Blocking Issues +## Open follow-ups (post May 2026) -### Issue 1: Missing Cache-Control Headers (CRITICAL) +Cache-Control + edge HIT are **resolved** (see May addendum). Remaining gaps under [BIT-28082](/BIT/issues/BIT-28082): -**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` +| Issue | Gap | +|-------|-----| +| [BIT-28130](/BIT/issues/BIT-28130) | Measure LCP / CLS / Lighthouse on production domains | +| [BIT-28133](/BIT/issues/BIT-28133) | Reconcile aspirational TTFB HIT < 30 ms with Cloudflare Free reality | + +### Historical note (April 2026) + +The original CRITICAL finding was missing Cache-Control on Astro pages. That was fixed via [BIT-2261](/BIT/issues/BIT-2261); the Root Cause / Detailed Measurements sections above retain the April evidence for audit trail. --- ## Measurement Limitations -The following metrics could not be measured due to environmental constraints: +The following metrics were not measured in the April baseline (and remain open until [BIT-28130](/BIT/issues/BIT-28130)): -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 +1. **LCP / CLS (Core Web Vitals)** — needs Chrome DevTools Protocol, Lighthouse CLI, or PageSpeed Insights +2. **Lighthouse Performance Score** — same tooling path ### 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 +1. Complete CWV / Lighthouse measurement ([BIT-28130](/BIT/issues/BIT-28130)) and append results above the April historical sections +2. Decide whether to keep < 30 ms HIT as aspirational or revise architecture targets ([BIT-28133](/BIT/issues/BIT-28133)) +3. Treat Executive Summary + May addendum as current truth for cache/TTFB --- ## Next Steps -1. **Immediate:** Create [BIT-2081](/BIT/issues/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 +1. **[BIT-28130](/BIT/issues/BIT-28130):** Measure LCP/CLS/Lighthouse; update this baseline +2. **[BIT-28133](/BIT/issues/BIT-28133):** Resolve TTFB HIT target vs Free-plan floor +3. Keep April sections as historical; treat Executive Summary + May addendum as current truth for cache/TTFB --- diff --git a/docs/PROJECT_STATUS.md b/docs/PROJECT_STATUS.md index 783f494..e8a4580 100644 --- a/docs/PROJECT_STATUS.md +++ b/docs/PROJECT_STATUS.md @@ -1,6 +1,8 @@ # Estado do projecto — [CLI] News Platform -Documento de **paridade entre objectivos e entregas** no repositório **news-platform** (workspace Paperclip **[CLI] News platform**, `urlKey` **cli-news-platform**). Complementa o índice de runbooks em [`docs/runbooks/README.md`](runbooks/README.md) e a arquitectura em [`docs/architecture.md`](architecture.md). O sweep de governance **[BIT-2030](/BIT/issues/BIT-2030)** (2026-04) está **fechado no board** quando o pai está `done` após todos os filhos directos terminarem (wake `issue_children_completed` pode voltar a abrir o pai brevemente até esse fecho); [BIT-1911](/BIT/issues/BIT-1911) permanece referência histórica do ciclo anterior. +Documento de **paridade entre objectivos e entregas** no repositório **news-platform** (workspace Paperclip **[CLI] News platform**, `urlKey` **cli-news-platform**). Complementa o índice de runbooks em [`docs/runbooks/README.md`](runbooks/README.md) e a arquitectura em [`docs/architecture.md`](architecture.md). + +**Sweep actual:** [BIT-28082](/BIT/issues/BIT-28082) (2026-08) — governance docs vs objectives; pai `done` após criar filhos accionáveis. Sweep anterior [BIT-2030](/BIT/issues/BIT-2030) (2026-04) permanece referência histórica; [BIT-1911](/BIT/issues/BIT-1911) é o ciclo legado anterior. ## Objectivos do projecto @@ -9,7 +11,7 @@ Alinhados à descrição do projecto no Paperclip e ao [`docs/architecture.md`]( | # | Objectivo | Notas | |---|-----------|--------| | 1 | **Plataforma multi-domínio** | Suporte a múltiplos domínios sem alteração de código — apenas ficheiros JSON de config por domínio. | -| 2 | **Frontend SSR performante** | Astro 5 SSR: TTFB < 200 ms (bridge cached), LCP < 2.5 s, CLS < 0.1, Lighthouse ≥ 90. | +| 2 | **Frontend SSR performante** | Astro 5 SSR: TTFB < 200 ms (bridge cached / edge MISS), LCP < 2.5 s, CLS < 0.1, Lighthouse ≥ 90. Edge HIT confirmado (May 2026); TTFB HIT < 30 ms é aspiracional em Cloudflare Free (~81–130 ms medidos) — ver [BIT-28133](/BIT/issues/BIT-28133). **LCP/CLS/Lighthouse ainda por medir** — sibling [BIT-28130](/BIT/issues/BIT-28130) (QA). | | 3 | **Bridge Fastify + cache Redis** | Camada de normalização e cache entre frontend e WordPress headless (TTL 60 s artigos). | | 4 | **WordPress headless** | CMS headless via REST API; sem tema renderizado — apenas editorial no WP Admin. | | 5 | **SEO de primeira classe** | SSR full-page, Schema.org `NewsArticle`, Open Graph, Twitter Card, sitemap dinâmico. | @@ -26,16 +28,16 @@ Alinhados à descrição do projecto no Paperclip e ao [`docs/architecture.md`]( | # | Objectivo | Estado | Rastreio principal | |---|-----------|--------|--------------------| | 1 | Plataforma multi-domínio | ✅ Entregue | [BIT-345](/BIT/issues/BIT-345), [BIT-494](/BIT/issues/BIT-494)–[BIT-497](/BIT/issues/BIT-497) | -| 2 | Frontend SSR performante | ✅ Auditoria + validação prod + edge cache (HIT) | [BIT-349](/BIT/issues/BIT-349); [BIT-2080](/BIT/issues/BIT-2080) / [BIT-21610](/BIT/issues/BIT-21610) `done`; Cloudflare [BIT-21847](/BIT/issues/BIT-21847) / [BIT-21912](/BIT/issues/BIT-21912) — [`docs/PERFORMANCE_BASELINE.md`](PERFORMANCE_BASELINE.md) | +| 2 | Frontend SSR performante | ⚠️ Parcial — edge HIT + Cache-Control OK; CWV/Lighthouse pendentes ([BIT-28130](/BIT/issues/BIT-28130)); contrato TTFB HIT em revisão ([BIT-28133](/BIT/issues/BIT-28133)) | [BIT-349](/BIT/issues/BIT-349); [BIT-2080](/BIT/issues/BIT-2080) / [BIT-21610](/BIT/issues/BIT-21610) `done`; CF [BIT-21847](/BIT/issues/BIT-21847) / [BIT-21912](/BIT/issues/BIT-21912) — [`docs/PERFORMANCE_BASELINE.md`](PERFORMANCE_BASELINE.md) | | 3 | Bridge Fastify + Redis | ✅ Entregue | [BIT-350](/BIT/issues/BIT-350), [BIT-2076](/BIT/issues/BIT-2076) (Redis extension fix) | | 4 | WordPress headless | ✅ Entregue | [BIT-351](/BIT/issues/BIT-351) | | 5 | SEO de primeira classe | ✅ Entregue | [BIT-349](/BIT/issues/BIT-349) — SSR, JSON-LD, OG, sitemap, robots | | 6 | Deploy em LXC | ✅ Entregue | [BIT-347](/BIT/issues/BIT-347), [BIT-352](/BIT/issues/BIT-352), [BIT-426](/BIT/issues/BIT-426) | | 7 | Deploy automático | ✅ Entregue | [BIT-352](/BIT/issues/BIT-352) — `webhook-deploy.sh` + `deploy-hook-server.mjs` | -| 8 | Monitorização com alertas | ✅ Entregue | [BIT-744](/BIT/issues/BIT-744), [BIT-746](/BIT/issues/BIT-746) — healthcheck + Ntfy | +| 8 | Monitorização com alertas | ✅ Entregue (fiabilidade CT222 em revisão) | [BIT-744](/BIT/issues/BIT-744), [BIT-746](/BIT/issues/BIT-746); open: [BIT-28132](/BIT/issues/BIT-28132) | | 9 | Domínio andebol.net | ✅ Entregue | [BIT-497](/BIT/issues/BIT-497), [BIT-507](/BIT/issues/BIT-507), [BIT-584](/BIT/issues/BIT-584)–[BIT-626](/BIT/issues/BIT-626) | | 10 | Agregador multi-source | ✅ Entregue | [BIT-709](/BIT/issues/BIT-709)–[BIT-713](/BIT/issues/BIT-713) | -| 11 | Pipeline de escrita AI | ✅ Automação entregue | [BIT-741](/BIT/issues/BIT-741) — pipeline; timer systemd [BIT-2079](/BIT/issues/BIT-2079) `done` | +| 11 | Pipeline de escrita AI | ✅ Automação entregue (guard featured-image + fiabilidade CT222) | [BIT-741](/BIT/issues/BIT-741); timer [BIT-2079](/BIT/issues/BIT-2079) `done`; [BIT-28134](/BIT/issues/BIT-28134) `done`; open: [BIT-28132](/BIT/issues/BIT-28132) | | 12 | Internacionalização PT-PT | ✅ Entregue | [BIT-739](/BIT/issues/BIT-739) | ## Árvore do repositório (resumo) @@ -68,10 +70,23 @@ Alinhados à descrição do projecto no Paperclip e ao [`docs/architecture.md`]( ## Árvore de issues (sweep actual e filhos) +### Sweep 2026-08 — [BIT-28082](/BIT/issues/BIT-28082) + +| Issue | Título (resumo) | Estado | Relação | +|-------|-----------------|--------|---------| +| [BIT-28082](/BIT/issues/BIT-28082) | [Governance] Docs vs objectives sweep — cli-news-platform | `done` | **Pai** — sweep 2026-08 | +| [BIT-28130](/BIT/issues/BIT-28130) | [QA] Measure LCP/CLS/Lighthouse on andebol.net + newsproject (obj #2 gap) | `in_progress` | **Filho** — CWV / Lighthouse ainda por medir | +| [BIT-28131](/BIT/issues/BIT-28131) | [Docs] Refresh PROJECT_STATUS + PERFORMANCE_BASELINE after BIT-28082 | `in_progress` | **Filho** — este ficheiro + baseline | +| [BIT-28132](/BIT/issues/BIT-28132) | [DevOps] CT222 writer-pipeline + monitoring reliability review | `todo` | **Filho** — fiabilidade ops #8/#11 | +| [BIT-28133](/BIT/issues/BIT-28133) | [Frontend] Resolve TTFB HIT <30ms target vs Cloudflare Free reality | `in_review` | **Filho** — contrato de performance vs Free plan | +| [BIT-28134](/BIT/issues/BIT-28134) | [Automation] Writer-pipeline featured-image regression guard | `done` | **Filho** — guard regressão featured-image | + +### Sweep 2026-04 — [BIT-2030](/BIT/issues/BIT-2030) (histórico) + | Issue | Título (resumo) | Estado | Relação | |-------|-----------------|--------|---------| | [BIT-2030](/BIT/issues/BIT-2030) | [Governance] Docs vs objectives sweep — cli-news-platform | `done` | **Pai** — sweep 2026-04 (todos os filhos directos `done`) | -| [BIT-2078](/BIT/issues/BIT-2078) | Add docs/PROJECT_STATUS.md — objectives vs delivery matrix | `done` | **Filho** — este ficheiro | +| [BIT-2078](/BIT/issues/BIT-2078) | Add docs/PROJECT_STATUS.md — objectives vs delivery matrix | `done` | **Filho** — criação deste ficheiro | | [BIT-2079](/BIT/issues/BIT-2079) | Automate andebol.net writer pipeline — systemd timer on LXC | `done` | **Filho** — automação LXC | | [BIT-2080](/BIT/issues/BIT-2080) | Core Web Vitals audit — verify TTFB/LCP/Lighthouse targets | `done` | **Filho** — baseline em [`PERFORMANCE_BASELINE.md`](PERFORMANCE_BASELINE.md) | | [BIT-21610](/BIT/issues/BIT-21610) | Prod validation — Cache-Control / TTFB vs PERFORMANCE_BASELINE | `done` | **Filho** — fecho pós-auditoria (Nginx / edge / medição) | @@ -84,7 +99,16 @@ Alinhados à descrição do projecto no Paperclip e ao [`docs/architecture.md`]( ## Entregáveis em falta / work-in-progress -Nenhum filho directo aberto sob **[BIT-2030](/BIT/issues/BIT-2030)** (sweep governance 2026-04 encerrado). Novo trabalho de plataforma deve abrir issues no projecto **cli-news-platform** com workspace correcto. +Filhos abertos sob o sweep **[BIT-28082](/BIT/issues/BIT-28082)** (pai `done`; projecto **cli-news-platform** permanece `in_progress` enquanto houver filhos activos): + +| Issue | Gap | Estado (board) | +|-------|-----|----------------| +| [BIT-28130](/BIT/issues/BIT-28130) | Medir LCP / CLS / Lighthouse (obj #2) | `in_progress` | +| [BIT-28131](/BIT/issues/BIT-28131) | Paridade docs PROJECT_STATUS + PERFORMANCE_BASELINE | `in_progress` (este trabalho) | +| [BIT-28132](/BIT/issues/BIT-28132) | Review fiabilidade writer-pipeline + monitoring em CT222 | `todo` | +| [BIT-28133](/BIT/issues/BIT-28133) | Alinhar target TTFB HIT <30 ms com realidade Cloudflare Free | `in_review` | + +Encerrado neste sweep: [BIT-28134](/BIT/issues/BIT-28134) (`done`). Novo trabalho de plataforma fora destes gaps deve abrir issues no projecto **cli-news-platform** com workspace correcto. ## Referências rápidas @@ -95,5 +119,6 @@ Nenhum filho directo aberto sob **[BIT-2030](/BIT/issues/BIT-2030)** (sweep gove | Monitorização | [`docs/monitoring.md`](monitoring.md) | | Índice de runbooks | [`docs/runbooks/README.md`](runbooks/README.md) | | Multi-domínio | [`docs/domains.md`](domains.md) | +| Performance baseline | [`docs/PERFORMANCE_BASELINE.md`](PERFORMANCE_BASELINE.md) | | Padrões de repositórios (meta paperclip) | `docs/PRODUCT_REPOSITORY_STANDARDS.md` no repositório **paperclip** | | Ambientes LXC | `docs/environments/03-lxc.md` no repositório **paperclip** |