Skip to content

feat(platform): mark incomplete PR data on compare and dashboard - #283

Merged
cpenaforte-clickbus merged 17 commits into
feat/pr-data-incomplete-badgefrom
feat/pr-data-incomplete-compare
Oct 8, 2026
Merged

cpenaforte-clickbus merged 17 commits into
feat/pr-data-incomplete-badgefrom
feat/pr-data-incomplete-compare

Conversation

@cpenaforte-clickbus

@cpenaforte-clickbus cpenaforte-clickbus commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Contexto e Motivação

O badge de dados de PR incompletos (#282) só aparece na página do repositório. Na tabela de comparação e no dashboard da organização, um run cuja leitura de PRs degradou aparece igual a um completo — e o dashboard agrega PR de todos os repositórios, então um só degradado distorce os números da organização sem aviso.

Há também uma dependência de ordem: com o passo reviews degradado, o engine vai deixar de emitir single_pass_rate e median_review_rounds nos grupos de acceptance_by_* (#284), e org-summary.ts e tool-comparison.ts multiplicam esses valores por peso — campo ausente viraria NaN% no dashboard.

Refs #236

Mudanças

  • Primeiro commit — tolerância: single_pass_rate e median_review_rounds passam a opcionais em AcceptanceMetrics, e org-summary.ts e tool-comparison.ts só somam um grupo quando o valor é número. É o que precisa estar em produção antes do fix(engine): omit review-derived metrics when the reviews read fails #284.
  • Comparação: cada repositório cujo último run degradou ganha um marcador âmbar, com texto para leitor de tela, e a tabela ganha uma legenda visível quando há algum marcado. O dado vem de payload->pr_enrichment_degraded na view repo_metric_summaries (migração 023), sem trazer o payload inteiro. Em banco sem essa coluna, a consulta repete sem ela e a tabela segue preenchida, sem marcador — o mesmo fallback que org-summary.ts já usa.
  • Dashboard: uma nota acima dos painéis de PR lista os repositórios cujo run mais recente tem dado de PR incompleto, a partir dos payloads que o dashboard já carrega. Some quando nenhum degradou.
  • Strings em en-US e pt-BR; o es-ES cai no en-US.

Plano de Teste

  • npx vitest run tests/pr-degraded-repos.test.ts tests/compare-pr-degraded.test.ts tests/org-summary.test.ts tests/tool-comparison.test.ts — a lista de repositórios degradados a partir dos payloads; o mapeamento da comparação com campo válido, ausente e lixo, inclusive o fallback sem payload; e as agregações com um grupo sem single_pass_rate, sem NaN e iguais às de quem não tem o grupo — rodado em 237e3b5: 29 passed
  • npm run lint, npx tsc --noEmit, npm run test:coverage, npm run build — os passos do job platform do CI — rodado em 237e3b5: lint 0 erros, tsc ok, test:coverage 417 passed, build ok
  • Manual: com um repositório degradado, ver o marcador e a legenda na comparação e a nota no dashboard; sem nenhum, nada aparece — verificado de ponta a ponta no topo da pilha (fix(platform): make the PR-data marker readable on touch and keyboard #293, em 4911e6d, com o rótulo corrigido conferido depois em 8e83ca4), que contém este PR: plataforma rodando sobre as migrações reais e um PostgREST, com payloads do engine em sete cenários de falha, no Playwright em desktop, celular (390 px), só teclado, leitor de tela, tema escuro, pt-BR, en-US e es-ES; marcador, legenda e nota do dashboard presentes nos 7 repositórios degradados e ausentes no limpo

A verificação roda fora da máquina de quem construiu: o job platform do CI (RFC 0029, PM-4).

Impacto e Risco

  • Áreas afetadas: a consulta e a tela de comparação, o dashboard da organização e as agregações de single-pass por origem e por ferramenta.
  • Compatibilidade: nada muda quando o campo está ausente. Payloads sem as chaves de review nos grupos de acceptance deixam de gerar NaN.
  • Performance: uma chave a mais lida da view; em banco sem a migração 023, uma segunda consulta, como no fallback existente.
  • Segurança: nenhuma rota nova, nenhuma migração; a leitura do campo passa por prDegradedSteps, que ignora o que não reconhece.
  • Acessibilidade: a nota do dashboard é texto visível com role="note"; o marcador da comparação tem texto para leitor de tela e uma legenda visível. Limitação conhecida: a lista em cards da comparação, no mobile, não mostra o marcador; ali o aviso fica no badge da página do repositório.
  • Custo AWS: N/A.

Sobre o tamanho (RFC 0028 §2.4): 424 linhas, faixa 251–500. A tolerância e as marcas formam a parte de plataforma da mesma mudança de engine; separar a tolerância deixaria a comparação e o dashboard sem o aviso que explica os números ausentes. Este PR já é a divisão do PR de plataforma original, que passava de 500.

Plano de Rollback

git revert do merge. Se o #284 já estiver em produção, reverter este PR traz de volta o NaN% para repositórios com reviews degradado — reverta os dois juntos.

Referências

Autoria Assistida

  • Agente: Claude Code — Claude Sonnet 5.5 nos commits e nas revisões por task; Claude Opus 5.5 na orquestração e na revisão final do conjunto
  • Escopo da assistência: desenho e implementação guiada por testes; a decisão de omitir as métricas de review foi do autor
  • Revisão humana: pendente — o autor revisa antes do merge

🤖 Generated with Claude Code

cpenaforte-clickbus and others added 3 commits October 5, 2026 15:39
When the PR reviews read degrades, the engine omits single_pass_rate and
median_review_rounds from each acceptance_by_origin / acceptance_by_tool
group. The org PR health and tool comparison aggregations multiplied those
fields by a weight, so a missing value would have become NaN and poisoned
the whole org-level number. Both fields are now optional and a group is
only summed when the values are numbers, so the result equals that of a
run without the group.

Refs #236

Assisted-by: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…hboard

The badge on the repo page was the only place a degraded PR read showed;
the compare table and the org dashboard rendered such a run like a
complete one. The compare table now shows an amber marker (with the same
tooltip text, also as screen-reader text) per repo, read through
prDegradedSteps from the repo_metric_summaries payload. The select falls
back to the pre-023 column list when the view has no payload, so the
table stays populated, just unmarked. The dashboard shows an amber note
above the PR-driven panels listing the affected repos, computed from the
payloads it already loads. es-ES falls back to en-US.

Refs #236

Assisted-by: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The amber dot on the compare table only had a `title` on a non-focusable
span, so keyboard and touch users could not learn what it meant. When at
least one visible row is marked, a one-line legend under the table now
shows the dot and the existing "PR data incomplete" text. The per-row
`title` is dropped since the sr-only text already carries the detail.

The pt-BR dashboard note said "no run mais recente"; every other pt-BR
string says "execução".

Refs #236

Assisted-by: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cpenaforte-clickbus cpenaforte-clickbus added type: tech-debt Código sub-ótimo conhecido, workaround, ou cleanup pendente ai-assisted PR gerado total ou parcialmente com auxílio de agente de IA (RFC 0028 §2.2.7) labels Oct 5, 2026
@vercel

vercel Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
clickbus-iris Ready Ready Preview Oct 8, 2026 1:24pm UTC

Request Review

cpenaforte-clickbus and others added 11 commits October 7, 2026 20:21
Selecting payload->pr_enrichment_degraded makes repo_metric_summaries
aggregate every run's payload, and it was requested by all callers
(repos, ai-exposure, dashboard, compare). It is now an option that only
the compare page turns on; other callers get pr_degraded_steps: [].

The retry without the field now happens only when the error says the
column is missing (code 42703, or a message naming payload), so a
timeout is logged and surfaced instead of being silently masked.

SummaryRow becomes an interface of the selected columns instead of
Record<string, any>.

Refs #236

Assisted-by: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Degraded steps showed as raw ids ("enrichment") in the repo badge and
the compare marker. They now go through a localized label
(repos.detail.prData.steps.*, en-US and pt-BR; es-ES falls back) via
formatPrSteps.

prDegradedSteps drops repeated steps, so a payload listing one twice no
longer prints it twice.

The dashboard note listed every degraded repo; it now names at most 5
and collapses the rest into "and N more" / "e mais N".

anyPrDataIncomplete was a one-line wrapper; the compare view checks
inline instead. The repo page comment claimed the flow and merge panels
are absent exactly when the read degraded, which is false when only
"basic" failed.

Refs #236

Assisted-by: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The amber marker and its legend only existed in the desktop table, so
the md:hidden card stack gave no sign a repo's PR read degraded. The
marker is now one component used by both layouts, and the legend sits
below both so either one explains it.

The dot gains a title (hover for sighted users) next to its sr-only
text; the legend keeps the meaning off colour and off the tooltip.

Refs #236

Assisted-by: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The amber dot is the only per-row cue on the compare page, and
amber-500 sits near 2.1:1 on the light card, below the 3:1 WCAG 1.4.11
asks of it. The dot and its legend now use amber-600 on light (about
3.2:1) and keep amber-500 on dark (well above 3:1).

The PR-data tooltip said merge strategy isn't classified "when
enrichment fails"; the engine only skips it when enrichment fails for
merged PRs, so the copy now says so, in both locales.

Refs #236

Assisted-by: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The failed PR-read steps lived only in a hover title and screen-reader
text, on the compare dot and on the repo-page badge, so touch and
keyboard users could see that the read was incomplete but not where.
The mobile compare card now shows the localized steps as muted text
next to the dot, and the repo page shows them next to the badge.

On the card the visible steps replace the dot's sr-only sentence, so
screen readers read them once, after a short sr-only "PR data
incomplete:" prefix. The card marker also drops its ml-2: the row
already spaces its items with gap-2. The desktop table is unchanged.

Refs #236

Assisted-by: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason for the `as unknown as` cast in getOrgReposSummary sat two
lines above the query, away from the cast it explains. The query
result is now bound first and the cast returned on its own line, with
the reason right above it. No behavior change.

Refs #236

Assisted-by: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Renders the compare view with one degraded and one clean repo and
checks what the last fixes changed: the mobile card shows the failed
steps as text after an sr-only prefix, the full sentence stays
screen-reader text only in the table, the card marker has no margin,
and the dot is amber-600 with amber-500 only on dark. All four fail
against the previous marker.

Refs #236

Assisted-by: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A failed open list, or a failed enrichment or reviews pass for open
PRs, leaves open-PR fields out of the run, and the engine's report
caveat now says so. The tooltip on the PR-data badge and marker listed
only flow, review and in-PR metrics; it now names open-PR metrics too,
in both locales.

Refs #236

Assisted-by: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A failed merged list omits the PR lifecycle fields (counts, time to
merge, cycle time), and a partial read skews them. The engine's report
caveat now says so; the PR-data tooltip mirrors it in both locales.

Refs #236

Assisted-by: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The repo-page badge now has the failed steps as visible text beside
it, yet kept a title with the same steps in a sentence. Screen readers
may read a title as a description, so the steps could be announced
twice. The title goes; the visible text carries the steps.

Refs #236

Assisted-by: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The desktop compare table kept the failed PR-read steps in a hover
title and screen-reader text only, so sighted keyboard users could not
see them, and on the mobile card the steps sat inline with the
truncating repo name, where a long list squeezed it.

Both layouts now put the amber dot and the localized steps on a line
of their own under the repo name. The dot and the steps are
aria-hidden, carrying the full sentence as their hover title, and
screen readers read that sentence once as sr-only text, in both
layouts alike (the card's short sr-only prefix gives way to it).

Refs #236

Assisted-by: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The label for the `fetch` step read "PR read" / "leitura de PRs", so the
step sentence said "This run's PR read failed at: PR read." It now says
"entire read" / "leitura inteira". Found in a manual end-to-end check.

Refs #236

Assisted-by: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
fix(platform): make the PR-data marker readable on touch and keyboard
fix(platform): make the PR-data query opt-in and localize its steps
@cpenaforte-clickbus
cpenaforte-clickbus merged commit 84386c6 into feat/pr-data-incomplete-badge Oct 8, 2026
3 of 4 checks passed
@cpenaforte-clickbus
cpenaforte-clickbus deleted the feat/pr-data-incomplete-compare branch October 8, 2026 14:37

This branch was successfully deployed

1 active deployment
Preview — e6b715bc Deployed Oct 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-assisted PR gerado total ou parcialmente com auxílio de agente de IA (RFC 0028 §2.2.7) type: tech-debt Código sub-ótimo conhecido, workaround, ou cleanup pendente

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant