Skip to content

feat: fail-on severity, step summary, richer known issues (rebase of #128) - #185

Open
alansikora wants to merge 10 commits into
mainfrom
feat/review-stack-rebased
Open

alansikora wants to merge 10 commits into
mainfrom
feat/review-stack-rebased

Conversation

@alansikora

@alansikora alansikora commented Sep 4, 2026 •

Copy link
Copy Markdown
Owner

Rebase da stack de @anderson-0 (#123–#128) sobre o main atual. Os seis PRs originais eram empilhados, cada um superset do anterior — #128 continha todos. Substitui aquela stack inteira.

O que entra

  • --fail-on <severity> — saída não-zero quando existem findings na severidade indicada ou acima, para CI poder barrar em cima do review. A contagem cobre tanto os findings novos quanto os que seguem abertos de reviews anteriores. A verificação roda depois de publicar/salvar estado/reportar uso, então um threshold estourado nunca custa ao PR seus comentários nem a telemetria.
  • Snippet de arquivo no TriageHasReply — a triagem agora mostra o estado atual do código ao avaliar a réplica do autor, para o LLM julgar se a refutação procede.
  • Resumo de custo no $GITHUB_STEP_SUMMARY — tabela por fase (modelo, tokens, custo) na página do job.
  • Remoção do BuildReevaluatePrompt — morto desde que a avaliação por thread migrou para triage.go.

O que ficou de fora

Dois commits da stack original foram descartados:

  • feat: filter rules by path in prompt builder — o main já implementa isso via writeRulesSection(&b, cfg, pr.Files), com um fallback melhor quando existem regras mas nenhuma casa com o diff.
  • feat: include title and severity in incremental prompt known issues — feat: enrich Known Issues section with finding context #179 reescreve a mesma seção com uma renderização estritamente mais rica (título, severidade e descrição completos, mais a instrução de sinalizar quando o diff incremental derruba a premissa de um finding aberto). Revertido aqui para que feat: enrich Known Issues section with finding context #179 seja dono da seção.

Ajustes na resolução dos conflitos

  • O cmd/review/cli/review.go foi reescrito sobre a estrutura nova do main (roteamento estrito GitHub/local), reaplicando só o --fail-on.
  • O PR original adicionava review.ValidSeverities, duplicando o severityLevels que o main já tem em formatter.go. Exportei review.ValidateSeverity() lendo a lista canônica. O ValidSeverities voltou pelo auto-merge de um commit posterior e ficou sem uso — removido depois, quando o próprio CodeCanary apontou.
  • writeStepSummary monta a tabela inteira num strings.Builder e escreve de uma vez, checando o erro. Também deixou de depender de GITHUB_ENV: cada caminho agora testa a sua própria variável.
  • docs/review-flow.md atualizado.

go build, go vet, go test ./... e golangci-lint run ./... passam limpos.

Fecha #128.

anderson-0 and others added 8 commits September 4, 2026 19:28
Exits non-zero when any new finding at or above the given severity level
is found. Valid values: critical, bug, warning, suggestion, nitpick.
Applies only to result.Findings (new findings) so CI gates don't fire on
pre-existing issues. Invalid values are rejected before the review runs.
When the LLM evaluates whether an author's reply is technically valid,
it now has visibility into the current state of the code around the
finding line. Uses maxLines=200 with no diffText, consistent with
TriageCrossFileChange. Also adds writeFileSnippet() call in
buildReplyPrompt() so the snippet is included in the prompt.
When $GITHUB_STEP_SUMMARY is set (GitHub Actions), WriteUsageEnv now
also appends a markdown table with per-phase and total token/cost data,
giving teams visibility into review costs directly in the Actions UI.
The function was superseded by per-thread evaluation in triage.go and
was not called anywhere in the codebase.
Each known issue in the "Known Issues (DO NOT DUPLICATE)" section now
shows severity icon, severity level, finding ID, and title when
available (extracted from the thread body's embedded JSON or parsed
markdown), falling back to file:line only for old-format threads.
…atInt and test glob typo; export ValidSeverities
Buffer the whole markdown table before writing so an interrupted write
cannot leave a half-formed table in the job summary, and surface the
write error instead of discarding it (errcheck).
Keeps docs/review-flow.md in sync with the runner, triage and prompt
changes in this branch, per the repo rule.
codecanary-bot[bot]

This comment was marked as resolved.

…issues"

PR #179 rewrites the same Known Issues section with a strictly richer
rendering — full title, severity and description per entry, plus an
instruction for spotting when the incremental diff undermines an open
finding. Keeping both would mean resolving a conflict in favour of #179
anyway, so drop this commit here and let #179 own the section.

This reverts commit 7dd98fc.
Three fixes from the review on this branch:

- --fail-on iterated only result.Findings, so a run that raised nothing
  new but left N unresolved findings above the threshold exited zero —
  defeating the CI gate the flag exists to provide. The threshold check
  now spans StillOpen as well, extracted into countAtOrAboveSeverity so
  it is testable without driving the whole pipeline.

- ValidSeverities came back through the rebase's auto-merge and sat
  there unused, a second copy of severityLevels free to drift.
  ValidateSeverity already exposes the canonical check; removed it.

- writeStepSummary was only reachable from inside WriteUsageEnv's
  GITHUB_ENV guard, so anywhere GITHUB_STEP_SUMMARY is set without
  GITHUB_ENV the table was silently never written. Each path now gates
  on its own env var.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Deploying codecanary with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8de5032
Status: ✅  Deploy successful!
Preview URL: https://f3ae684d.codecanary.pages.dev
Branch Preview URL: https://feat-review-stack-rebased.codecanary.pages.dev

View logs

@codecanary-bot codecanary-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐥 CodeCanary

✅ All previous findings have been addressed. No new issues found. ✨

Status

  • Resolved by code: 4

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.

2 participants