Skip to content

(janitor/dedupe): consolidate code review terminal reasons onto db enum - #5672

Merged
pandemicsyn merged 1 commit into
mainfrom
janitor/dedupe-terminal-reasons
Aug 28, 2026
Merged

(janitor/dedupe): consolidate code review terminal reasons onto db enum#5672
pandemicsyn merged 1 commit into
mainfrom
janitor/dedupe-terminal-reasons

Conversation

@kilo-code-bot

@kilo-code-bot kilo-code-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Consolidates the duplicated code review terminal reason enum so it has a single owner.

CODE_REVIEW_TERMINAL_REASONS (packages/db/schema-types.ts) and CLOUD_AGENT_TERMINAL_REASONS (packages/worker-utils/cloud-agent-next-client.ts) were two byte-identical as const arrays of the same 38 literals, kept in sync manually and guarded by a parity test in apps/web. A mismatch would make the orchestrator send a reason the callback allowlist rejects, or make the worker's zod enum silently coerce a valid reason to undefined via .catch(undefined).

packages/db is the authoritative owner (the persistence enum), and worker-utils already depends on @kilocode/db, so the dependency direction is clean.

Changes

  • packages/db: document CODE_REVIEW_TERMINAL_REASONS as the single source of truth.
  • packages/worker-utils/cloud-agent-next-client.ts: delete the duplicated array + type; re-export them from @kilocode/db/schema-types under the existing CLOUD_AGENT_TERMINAL_REASONS / CloudAgentTerminalReason names so code-review-infra's public import surface is unchanged.
  • apps/web: remove the now-trivial "terminal reason list parity" test.

No behavior change — the two lists were byte-identical.

Verification

  • pnpm --filter @kilocode/db typecheck — pass
  • pnpm --filter @kilocode/worker-utils typecheck — pass
  • pnpm --filter kilo-code-review-worker typecheck — pass
  • pnpm --filter @kilocode/worker-utils test — 28 files / 357 tests pass
  • oxlint on changed files — 0 warnings / 0 errors

Note: the apps/web jest suite could not be run in this environment (it requires shared PostgreSQL), but the only web change is removing an import and a now-redundant describe block from a test file.

CODE_REVIEW_TERMINAL_REASONS (packages/db) and CLOUD_AGENT_TERMINAL_REASONS
(packages/worker-utils) carried the same 38-literal list of code review
terminal reasons, kept in sync manually and guarded by a parity test in
apps/web. A mismatch between the two would make the orchestrator send a
reason the callback allowlist rejects (or the worker's zod enum silently
coerce a valid reason to undefined).

The db list is the authoritative persistence enum, and worker-utils already
depends on @kilocode/db, so the dependency direction is clean:

- packages/db: CODE_REVIEW_TERMINAL_REASONS is now documented as the single
  source of truth.
- packages/worker-utils/cloud-agent-next-client: delete the duplicated array
  and type; re-export them from @kilocode/db/schema-types under the existing
  CLOUD_AGENT_TERMINAL_REASONS / CloudAgentTerminalReason names so the public
  API for code-review-infra is unchanged.
- apps/web: drop the now-trivial list parity test.

No behavior change: the two lists were byte-identical.
@kilo-code-bot kilo-code-bot Bot added the janitor Automated dead-code/duplication cleanup label Aug 28, 2026
@kilo-code-bot

kilo-code-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (3 files)
  • apps/web/src/lib/code-reviews/terminal-reason-from-failure.test.ts
  • packages/db/src/schema-types.ts
  • packages/worker-utils/src/cloud-agent-next-client.ts

Reviewed by grok-4.6 · Input: 135.3K · Output: 11.9K · Cached: 286K

Review guidance: REVIEW.md from base branch main

@pandemicsyn
pandemicsyn merged commit 79026ff into main Aug 28, 2026
47 checks passed
@pandemicsyn
pandemicsyn deleted the janitor/dedupe-terminal-reasons branch August 28, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

janitor Automated dead-code/duplication cleanup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant