Skip to content

feat(web): record whether a completed review published its summary - #6889

Merged
eshurakov merged 1 commit into
mainfrom
eshurakov/publication-record
Sep 29, 2026
Merged

eshurakov merged 1 commit into
mainfrom
eshurakov/publication-record

Conversation

@eshurakov

Copy link
Copy Markdown
Contributor

Summary

A code review can reach completed without a summary comment, and the status callback still returns success. This stores a server-observed publication outcome on the attempt so that miss can be emitted to Axiom later. It does not add a health-check alert.

On a completed callback, before the server appends history, footer, or the council block, it classifies the comment or note it already looks up:

  • published — a <!-- kilo-review --> summary is present and differs from the observed previous summary
  • unchanged — the visible summary matches the previous one after stripping a complete council block and the history footer
  • missing — the lookup succeeded and there is no Kilo summary
  • unknown — the lookup failed, the platform is Bitbucket, or the previous-summary baseline was not observed
  • not_applicable — Kilo mode, which does not publish to the provider

The status is write-once. A failed write does not change the callback result. Prepare records whether the previous-summary lookup succeeded, so a comment left behind by a failed snapshot is not treated as a new post.

Migration 0264_code_review_publication_status adds nullable cloud_agent_code_review_attempts.publication_status and cloud_agent_code_reviews.previous_summary_observed, plus a check constraint. No backfill and no index.

Verification

  • pnpm drizzle migrate applied the migration in the worktree database.
  • pnpm --filter web exec jest on the publication-status, code-reviews db, prepare-payload, and status-route suites: 4 suites, 232 passed.
  • packages/db schema freshness and enum tests: 2 passed.
  • @kilocode/db typecheck and scripts/typecheck-all.sh --changes-only: passed.

Reviewer Notes

  • This does not page or poll /api/code-reviews/up. The stored status is the value to emit to Axiom.
  • An identical republish of the same visible summary is unchanged, not published.
  • Null publication_status means the callback did not record an outcome. Existing rows stay null.

@kilo-code-bot

kilo-code-bot Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

Incremental re-review of the rebase (previous review at 09c1b802, current HEAD 26c5674): the application code is byte-identical to the previously reviewed revision, and only the migration was renumbered from 0264 to 0265 after main merged its own 0264. No new defects found in the changed lines.

Files Reviewed (15 files)
  • apps/web/src/app/api/internal/code-review-status/[reviewId]/route.ts
  • apps/web/src/app/api/internal/code-review-status/[reviewId]/route.test.ts
  • apps/web/src/lib/code-reviews/db/code-reviews.ts
  • apps/web/src/lib/code-reviews/db/code-reviews.test.ts
  • apps/web/src/lib/code-reviews/reap-stale-reviews.test.ts
  • apps/web/src/lib/code-reviews/summary/publication-status.ts
  • apps/web/src/lib/code-reviews/summary/publication-status.test.ts
  • apps/web/src/lib/code-reviews/triggers/prepare-review-payload.ts
  • apps/web/src/lib/code-reviews/triggers/prepare-review-payload.test.ts
  • packages/db/src/migrations/0265_dizzy_starhawk.sql
  • packages/db/src/migrations/meta/0265_snapshot.json (generated)
  • packages/db/src/migrations/meta/_journal.json
  • packages/db/src/schema-types.ts
  • packages/db/src/schema.test.ts
  • packages/db/src/schema.ts
Previous Review Summary (commit 09c1b80)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 09c1b80)

Status: No Issues Found | Recommendation: Merge

Executive Summary

Reviewed the publication-status recording feature end to end (route classification, prepare-time baseline capture, DB write-once helper, enum/migration) and found no correctness, security, or data-integrity defects in the changed lines.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 0

Notable checks that passed:

  • Classification order is correct: a null/marker-less summary returns missing even when the baseline is unavailable, so the primary miss signal is never masked by unknown.
  • recordCodeReviewAttemptPublicationStatus is write-once (isNull(publication_status)) and swallows failures, so a bad write cannot change the callback result; the route wrapper only adds a second layer of safety.
  • Summary classification runs before the server mutates the comment/note, matching the stored pre-update body semantics.
  • The prepare-time finally re-awaits the hoisted summaryLookup, so a resolved summary is still snapshotted when a sibling lookup rejects, and an unhandled rejection is avoided because Promise.all/.then attach handlers.
  • Migration 0264 is additive (two nullable columns plus a check constraint) with matching name/values in schema.ts, schema-types.ts, the snapshot, journal, and SCHEMA_CHECK_ENUMS.
  • No memory leaks, listeners, timers, or module-level mutable state introduced.
Files Reviewed (14 files)
  • apps/web/src/app/api/internal/code-review-status/[reviewId]/route.ts
  • apps/web/src/app/api/internal/code-review-status/[reviewId]/route.test.ts
  • apps/web/src/lib/code-reviews/db/code-reviews.ts
  • apps/web/src/lib/code-reviews/db/code-reviews.test.ts
  • apps/web/src/lib/code-reviews/reap-stale-reviews.test.ts
  • apps/web/src/lib/code-reviews/summary/publication-status.ts
  • apps/web/src/lib/code-reviews/summary/publication-status.test.ts
  • apps/web/src/lib/code-reviews/triggers/prepare-review-payload.ts
  • apps/web/src/lib/code-reviews/triggers/prepare-review-payload.test.ts
  • packages/db/src/migrations/0264_code_review_publication_status.sql
  • packages/db/src/migrations/meta/0264_snapshot.json
  • packages/db/src/migrations/meta/_journal.json
  • packages/db/src/schema-types.ts
  • packages/db/src/schema.test.ts
  • packages/db/src/schema.ts

Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0

Review guidance: REVIEW.md from base branch main

Store a write-once publication status on the attempt this callback completes, and whether the previous summary lookup succeeded, so a missing comment is not treated as a published one.
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