Skip to content

chore: remove AI-generated slop across repo#162

Merged
iipanda merged 1 commit into
mainfrom
chore/deslop-repo-wide
May 29, 2026
Merged

chore: remove AI-generated slop across repo#162
iipanda merged 1 commit into
mainfrom
chore/deslop-repo-wide

Conversation

@iipanda
Copy link
Copy Markdown
Collaborator

@iipanda iipanda commented May 29, 2026

What

Repo-wide deslop pass: removes AI-generated noise that a careful human reviewer would cut, with no behavior change. 58 edits across 35 source files (+43 / −149).

How it was produced

Audited all 332 non-test source files (~97k LOC) as a fan-out: each chunk reviewed for slop, then every finding independently re-verified by a separate skeptical agent (byte-exact/unique anchor + behavior-preservation check). Each code-changing edit was then read against the live file by hand before applying.

Breakdown

Category Count Examples
Redundant comments 42 // Check if user already exists over the obvious query; section-divider banners; an orphaned barycentric-triangle comment describing deleted code
Dead code 12 empty React return () => {} cleanups; a 22-line if block subsumed by the next guard; void-ed throwaway locals
Defensive slop 11 pure-rethrow try/catch; x !== null && x !== undefined on number | null fields; no-op catch reassignments restoring the default
Redundant as casts 7 as any, self-casts, casts already covered by a preceding type guard
Nesting / boilerplate 2 always-true guard removed; single-use intermediate var inlined

Verification

  • bun run typecheck — 7/7 projects
  • bun run unit — 690 pass / 0 fail
  • ✅ Studio embed smoke check
  • ✅ Prettier clean
  • ✅ Changeset gate (patch for @mdcms/cli, @mdcms/shared, @mdcms/studio)

Deliberately left out (judgment calls)

Not touched, to avoid overstepping into stylistic territory: the consistent 65-dash section-divider banners in users-page.tsx (just redesigned) and page-header.tsx, the intent-documenting // Debounced search, an as any→precise-cast in auth.ts, and two unused exported types in visual-composition-types.ts (possible intended API).

Tests (180 files) were out of scope for this pass.

Summary by CodeRabbit

  • Chores
    • Performed routine code cleanup including removal of redundant comments, unused type casts, and unnecessary defensive checks across the codebase. All changes are internal improvements with no impact to user-facing functionality or behavior.

Review Change Stack

Repo-wide audit (per-chunk review + adversarial verification) removing
redundant comments, dead code, gratuitous as-casts, and redundant
defensive guards. Strictly behavior-preserving.

Verified: typecheck 7/7, 690 unit tests pass, Studio embed smoke check,
Prettier clean.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fdaa4f9d-951e-4f79-bb60-184d89d0a91f

📥 Commits

Reviewing files that changed from the base of the PR and between 42340f2 and 401ac6b.

📒 Files selected for processing (36)
  • .changeset/deslop-repo-wide.md
  • apps/cli/src/lib/init.ts
  • apps/cli/src/lib/init/generate-config.ts
  • apps/cli/src/lib/pull.ts
  • apps/cli/src/lib/push.ts
  • apps/cli/src/lib/schema-sync.ts
  • apps/cli/src/lib/validate.ts
  • apps/server/src/lib/auth.ts
  • apps/server/src/lib/collaboration-auth.ts
  • apps/server/src/lib/config.ts
  • apps/server/src/lib/content-api/database-store.ts
  • apps/server/src/lib/content-api/in-memory-store.ts
  • apps/server/src/lib/content-api/responses.ts
  • apps/server/src/lib/runtime-with-modules.ts
  • apps/studio-example/app/admin/[[...path]]/page.tsx
  • packages/modules/core.ai/src/server/errors.ts
  • packages/modules/core.ai/src/server/routes.ts
  • packages/modules/core.system/src/server/index.ts
  • packages/modules/domain.content/src/server/index.ts
  • packages/shared/src/lib/mdx/extracted-props.ts
  • packages/shared/src/lib/runtime/health.ts
  • packages/studio/src/lib/runtime-ui/app/admin/content/[type]/page.tsx
  • packages/studio/src/lib/runtime-ui/app/admin/environments-page.tsx
  • packages/studio/src/lib/runtime-ui/app/admin/layout.tsx
  • packages/studio/src/lib/runtime-ui/app/admin/page.tsx
  • packages/studio/src/lib/runtime-ui/app/admin/trash-page.tsx
  • packages/studio/src/lib/runtime-ui/components/api-key-create-dialog.tsx
  • packages/studio/src/lib/runtime-ui/components/assistant/proposal-card.tsx
  • packages/studio/src/lib/runtime-ui/components/coming-soon.tsx
  • packages/studio/src/lib/runtime-ui/components/editor/inline-ai-bubble.tsx
  • packages/studio/src/lib/runtime-ui/components/editor/inline-ai-panel.tsx
  • packages/studio/src/lib/runtime-ui/pages/content-document-page-state.ts
  • packages/studio/src/lib/runtime-ui/pages/content-document-page.tsx
  • packages/studio/src/lib/runtime-ui/pages/content-page.tsx
  • packages/studio/src/lib/session-api.ts
  • packages/studio/src/lib/studio-loader.ts
💤 Files with no reviewable changes (17)
  • packages/studio/src/lib/studio-loader.ts
  • apps/cli/src/lib/pull.ts
  • apps/cli/src/lib/init.ts
  • packages/studio/src/lib/runtime-ui/app/admin/layout.tsx
  • packages/studio/src/lib/runtime-ui/app/admin/page.tsx
  • packages/studio/src/lib/runtime-ui/pages/content-document-page-state.ts
  • apps/cli/src/lib/push.ts
  • packages/studio/src/lib/runtime-ui/components/api-key-create-dialog.tsx
  • packages/shared/src/lib/mdx/extracted-props.ts
  • packages/studio/src/lib/runtime-ui/components/coming-soon.tsx
  • packages/studio/src/lib/runtime-ui/pages/content-page.tsx
  • packages/studio/src/lib/runtime-ui/app/admin/trash-page.tsx
  • apps/server/src/lib/auth.ts
  • packages/studio/src/lib/runtime-ui/pages/content-document-page.tsx
  • packages/studio/src/lib/runtime-ui/components/editor/inline-ai-bubble.tsx
  • packages/studio/src/lib/runtime-ui/app/admin/content/[type]/page.tsx
  • apps/cli/src/lib/init/generate-config.ts

📝 Walkthrough

Walkthrough

This PR removes AI-generated "slop"—redundant comments, dead code, unnecessary type casts, and defensive guards—across the CLI, server, and UI modules. Changes include simplifying schema nullability checks, eliminating type assertions where types are already correct, removing no-op cleanup functions from React effects, and cleaning up comment markers throughout the codebase. No runtime behavior is altered.

Changes

Slop removal and type safety improvements

Layer / File(s) Summary
Changeset and patch version bump
.changeset/deslop-repo-wide.md
Adds .changeset entry marking patch bumps for three packages and documenting removal of dead code and defensive guards with no behavior impact.
CLI configuration and init output
apps/cli/src/lib/init.ts, apps/cli/src/lib/init/generate-config.ts, apps/cli/src/lib/pull.ts
Removes section comment placeholders from config generation (// Imports, // Locales); reorders pull output guidance to appear after status loop; environments config now emitted directly after locales.
CLI schema preflight and sync
apps/cli/src/lib/push.ts, apps/cli/src/lib/schema-sync.ts
Non-interactive schema-drift handling now aborts with guidance when --sync-schema is not set; schema-sync payload construction removes redundant config type assertion.
CLI field validation simplification
apps/cli/src/lib/validate.ts
validateField returns validateKind result directly instead of intermediate variable.
Server auth and collaboration improvements
apps/server/src/lib/auth.ts, apps/server/src/lib/collaboration-auth.ts, packages/studio/src/lib/session-api.ts
Auth invite error handling cleanly throws on duplicate pending invites; origin validation uses falsy check; session response removes string type assertions from validated fields.
Server config, content API, and nullability
apps/server/src/lib/config.ts, apps/server/src/lib/content-api/database-store.ts, apps/server/src/lib/content-api/in-memory-store.ts, apps/server/src/lib/content-api/responses.ts, apps/server/src/lib/runtime-with-modules.ts
Config import removes try/catch wrapper; published-version checks simplified to treat only null as invalid; ISO string cast narrowed from any to `string
Type cast removal across modules
apps/studio-example/app/admin/[[...path]]/page.tsx, packages/modules/core.ai/src/server/errors.ts, packages/modules/core.ai/src/server/routes.ts, packages/modules/core.system/src/server/index.ts, packages/modules/domain.content/src/server/index.ts
Eliminates unnecessary type assertions: error codes, active-document published-version logic, schema hashes, and route-parse error handlers across studio and module code.
Studio UI component and page cleanup
packages/studio/src/lib/runtime-ui/app/admin/content/[type]/page.tsx, packages/studio/src/lib/runtime-ui/app/admin/environments-page.tsx, packages/studio/src/lib/runtime-ui/app/admin/layout.tsx, packages/studio/src/lib/runtime-ui/app/admin/page.tsx, packages/studio/src/lib/runtime-ui/app/admin/trash-page.tsx, packages/studio/src/lib/runtime-ui/components/assistant/proposal-card.tsx, packages/studio/src/lib/runtime-ui/components/coming-soon.tsx, packages/studio/src/lib/runtime-ui/components/editor/inline-ai-bubble.tsx, packages/studio/src/lib/runtime-ui/components/editor/inline-ai-panel.tsx, packages/studio/src/lib/runtime-ui/pages/content-document-page.tsx, packages/studio/src/lib/runtime-ui/pages/content-page.tsx
Removes section comment markers from admin pages, editor components, and utilities; strips no-op useEffect cleanup functions from layout effects; removes JSX placeholder comments; updates inline-AI-panel comment without logic changes.
Page state and loader validation
packages/studio/src/lib/runtime-ui/pages/content-document-page-state.ts, packages/studio/src/lib/studio-loader.ts
Select descriptor resolution consolidated by removing undefined value special case; environment field target validation tightened to require non-null record instead of only rejecting undefined.
Shared utilities and formatting
packages/shared/src/lib/mdx/extracted-props.ts, packages/shared/src/lib/runtime/health.ts
Enum filter callback multi-lined without behavior change; health endpoint comment removes CMS-2 reference.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • mdcms-ai/mdcms#51: Both PRs modify apps/cli/src/lib/push.ts's schema-drift preflight behavior in non-interactive mode to abort unless --sync-schema is set.
  • mdcms-ai/mdcms#142: Both PRs overlap in packages/studio/src/lib/runtime-ui/app/admin/environments-page.tsx, modifying handlePromoteExecute promote-execution logic.

Poem

🐰 Hopping through the code with a broom in paw,
Sweeping out the comments—no fluff, just raw,
Type casts gone, and guards that weren't needed,
Cleaner, sharper code is all we pleaded.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 21.74% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: removing AI-generated redundant content (comments, dead code, defensive slop, casts) repo-wide with no behavior changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/deslop-repo-wide

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@iipanda iipanda merged commit fe2cf74 into main May 29, 2026
6 checks passed
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.

1 participant