Skip to content

(janitor/comments) remove narration and redundant comments from deploy-infra builder - #6777

Merged
kilo-code-bot[bot] merged 1 commit into
mainfrom
janitor/comments-deploy-infra-builder
Sep 28, 2026
Merged

kilo-code-bot[bot] merged 1 commit into
mainfrom
janitor/comments-deploy-infra-builder

Conversation

@kilo-code-bot

@kilo-code-bot kilo-code-bot Bot commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

(janitor/comments) Comment cleanup — services/deploy-infra/builder

Package or topic area cleaned

services/deploy-infra/builder — the Cloudflare Worker builder service for user deployments (Durable Objects, Cloudflare API client, sandbox readers, webhook delivery, event store, and its unit tests).

Files touched (16)

  • src/index.ts
  • src/types.ts
  • src/event-store.ts
  • src/events-manager.ts
  • src/webhook-delivery.ts
  • src/deployment-orchestrator.ts
  • src/cloudflare-api.ts
  • src/deployer.ts
  • src/sandbox-file-reader.ts
  • src/sandbox-artifact-reader.ts
  • src/env-decryptor.ts
  • src/sanitize-git-error.ts
  • src/utils.ts
  • scripts/deploy-local.ts
  • src/tests/webhook-delivery.test.ts
  • src/tests/sanitize-git-error.test.ts

Comment lines removed

632 comment lines (636 deleted lines total; 4 of them are code lines that only lost a trailing comment). No behavior, types, or APIs changed.

Categories of noise removed

  • Narration of the next statement ("Get Durable Object stub", "Validate slug format", "Return 202 Accepted with job details", "// Persist changes", "// Decrypt env vars")
  • Method/type JSDoc restating names, parameters, and return values (/** Save current state to durable storage. */, @param/@returns blocks that mirror signatures)
  • File and class headers that repeat the module's purpose ("EventsManager Durable Object — Responsibilities: …" feature lists)
  • Test noise narrating setup, execution, and assertions ("// Add some events", "// Mock successful response", "// Verify delivery", "// First attempt: fail with 503")
  • Step banners and lookup-table separators ("// Step 1: Detect project type", mime-map // Text / // Images separators)
  • Stale documentation (env-var defaults said 50/3000 where the code uses 100/2000; supportedProjectTypeSchema doc missing astro; doc referencing a removed batchSize parameter)
  • Apology/deferral comments ("Hardcoded for now")

Important comments intentionally retained

  • Security rationale: hiding the git clone error from logs and sanitizing the token before Sentry; replaceAll instead of regex in sanitizeGitError; "Environment variables (only non-secret)" contract on deployWorker
  • External Cloudflare API behavior: 32-char manifest hash, leading-slash manifest paths, asset-upload 201/200 semantics, hash used as field name and filename, empty-buckets dedup, empty assets config defaults, DO-class-exists error 10074, script-not-found 10007, "Assets are automatically cleaned up when the script is deleted"
  • Platform/vendor constraints: sandbox.readFileStream 10MB workaround, alarm usage rationale, in-memory reentrancy guard safe because requests are cancelled on sleep, COPYFILE_DISABLE for macOS tar
  • Invariants: at-least-once delivery-aware ring-buffer trimming, -1 / 0 sentinel values, "All events have been processed", exit-code decode for the Git LFS probe, "no backend URL → skip sending", backup buffer cleanup "may not have been extracted yet"
  • Test-friendly COPYFILE_DISABLE exclusion-list annotations and the sandbox-exec hang TODO (documents a live platform limitation; the disabled script is retained as-is)

Follow-up refactor candidates

  • WebhookDelivery.scheduleFlush — the retry/overflow/batch-timing phases rely on comment labels; extracting named phases would remove the need for them.
  • EventStore.getFirstUnprocessedEventIndex — index arithmetic (lastProcessedId - firstEventId + 1) is subtle; a helper or named computation would make the remaining comments unnecessary.

Validation performed

  • pnpm typecheck (tsgo --noEmit) — pass
  • pnpm lint (oxlint, 34 files) — 0 warnings, 0 errors
  • pnpm test (jest) — 9 suites, 103 tests, all pass
  • git diff --check — clean
  • Diff reviewed: only comment deletions and directly resulting whitespace; no lint/type directives touched

@kilo-code-bot kilo-code-bot Bot added the janitor Automated dead-code/duplication cleanup label Sep 27, 2026
@kilo-code-bot
kilo-code-bot Bot enabled auto-merge (squash) September 27, 2026 08:46
@kilo-code-bot

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

Copy link
Copy Markdown
Contributor Author

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

This PR removes narration and redundant comments (636 deletions, 4 trailing-comment-only line edits) across the deploy-infra builder service, and verification shows no behavior, type, or API changes.

Verification

  • Extracted every non-comment deleted line and every added line from the diff: the only code-line changes are four lines that lost a trailing comment (setAlarm(Date.now() + 50), dispatchNamespace = 'kilo-deploy', and two test env literals). No logic, condition, or signature changed.
  • No lint/type/test directives (eslint, ts-ignore, ts-expect-error, prettier, etc.) were removed.
  • No markdown/docs files changed, so the image-format rule does not apply; comment-only edits introduce no new runtime paths and no memory-leak surface.
Files Reviewed (16 files)
  • services/deploy-infra/builder/scripts/deploy-local.ts
  • services/deploy-infra/builder/src/cloudflare-api.ts
  • services/deploy-infra/builder/src/deployer.ts
  • services/deploy-infra/builder/src/deployment-orchestrator.ts
  • services/deploy-infra/builder/src/env-decryptor.ts
  • services/deploy-infra/builder/src/event-store.ts
  • services/deploy-infra/builder/src/events-manager.ts
  • services/deploy-infra/builder/src/index.ts
  • services/deploy-infra/builder/src/sandbox-artifact-reader.ts
  • services/deploy-infra/builder/src/sandbox-file-reader.ts
  • services/deploy-infra/builder/src/sanitize-git-error.ts
  • services/deploy-infra/builder/src/tests/sanitize-git-error.test.ts
  • services/deploy-infra/builder/src/tests/webhook-delivery.test.ts
  • services/deploy-infra/builder/src/types.ts
  • services/deploy-infra/builder/src/utils.ts
  • services/deploy-infra/builder/src/webhook-delivery.ts

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

Review guidance: REVIEW.md from base branch main

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