Skip to content

chore(cms-190): remove apps/studio-review and audit-confirmed dead code#112

Merged
iipanda merged 4 commits into
mainfrom
chore/cms-190-dead-code
Apr 19, 2026
Merged

chore(cms-190): remove apps/studio-review and audit-confirmed dead code#112
iipanda merged 4 commits into
mainfrom
chore/cms-190-dead-code

Conversation

@iipanda
Copy link
Copy Markdown
Collaborator

@iipanda iipanda commented Apr 19, 2026

Summary

CMS-190: repo-wide dead code / unused file audit and safe cleanup.

Audit ran a fan-out of parallel Sonnet agents across every workspace (server, CLI, studio-example, studio, shared, sdk, modules, docs/specs/skills, root configs), followed by an Opus verification pass with direct grep against the monorepo before deletion. Only items with no remaining consumers and no behavior-visible side effects were removed.

  • Deletes apps/studio-review (app retired) and every tracked reference (root npm scripts, changeset ignore entry, AGENTS.md row, docs pages, SPEC-012).
  • Removes dead code paths that had zero callers anywhere in the repo:
    • apps/serverOwnerInvariant* helpers in rbac.ts (superseded by assertOwnerMutationAllowed) + matching tests.
    • apps/clicredentials.clearCredentialsFile (zero callers).
    • packages/studio — legacy lib/ui/{button,utils}.tsx (superseded by runtime-ui/); runtime-ui editor-sidebar.tsx, mock-data.ts, calendar.tsx, collapsible.tsx, checkbox.tsx; and the seven package.json deps that only served them (@radix-ui/react-checkbox, @radix-ui/react-collapsible, @tiptap/extension-image, @tiptap/extension-placeholder, @tiptap/extension-typography, react-day-picker, date-fns).
    • packages/sharedlib/shared.ts placeholder function and its re-export.
    • Root devDependencies@swc-node/register, @swc/core, @swc/helpers (no references; repo uses Bun + @nx/js/typescript).
  • Fixes docs/adrs/README.md: ADR-006 classification was out of sync with its own status: accepted frontmatter.
  • Indexes docs/specs/SPEC-013-mintlify-docs-site.md in docs/specs/README.md (missing entry was the bug — apps/docs is a live subsystem that needs an owning spec), and drops a stale /Users/blazity/... local path leak from the spec.

Scoped-out during review (kept after follow-up analysis)

Items the initial audit flagged as unused but kept after checking specs/tickets:

  • apps/cli/src/lib/action-catalog-adapter.ts + @elysiajs/eden / elysia deps. Only tests import it today, but /api/v1/actions* is a live server endpoint and ADR-005 (accepted) names both Studio and CLI as consumers. Studio is already wired onto its own adapter; CLI just hasn't been migrated yet. Production consumer is tracked as CMS-88 (Implement CLI generic action runner, Epic CMS-152). Audit context added as a comment on CMS-88.
  • packages/studio/src/lib/runtime-registry.{ts,test.ts}. Only the test imports buildStudioRuntimeRegistry today, but it is the spec-mandated Studio composition surface (routes, navItems, slotWidgets, fieldKinds, editorNodes, actionOverrides, settingsPanels). Delivered by CMS-60 as acceptance criterion chore(deps): update dependency @types/node to v20.19.41 #2, mandated by SPEC-002 and SPEC-006, and CMS-124 will register module-contributed routes/slots/fields into it. Audit context added as a comment on CMS-60.
  • docs/specs/SPEC-013-mintlify-docs-site.md. Audit flagged it as an orphan because it wasn't in the spec catalog README. The correct fix was to index it, not delete it — apps/docs is a live, maintained subsystem and by the repo's standalone-spec rule it needs an owning spec. Restored + indexed + stale local path cleaned up.

Out of scope (flagged, kept)

Items surfaced by the audit that are technically unreferenced today but preserved for safety:

  • Many type-only re-exports in @mdcms/shared (public API surface for downstream consumers).
  • packages/sdk types (MdcmsListInput, MdcmsGetInput, MdcmsClientOptions) — scaffolded public API.
  • packages/studio package.json exports (/action-catalog-adapter, /markdown-pipeline, /document-shell) — no in-repo consumer but part of the published surface.
  • Module actionAliases / outputFormatters on core.system and domain.content — data is collected and asserted by tests but never read in production. Removing would need a coordinated extensibility-contract refactor, out of scope here.
  • packages/modules first-party preflight hooks that are functionally redundant with earlier framework validation — live runtime paths, removing would change the execution trace.
  • @playwright/test + playwright.config.ts + e2e/*.spec.ts — valid against the surviving studio-example app but no CI runner is wired up. Not dead; worth wiring up separately.

Test plan

  • bun run check (build + typecheck, all 6 projects): passes
  • bun run unit (514 tests across 58 files + studio embed smoke): passes
  • bun run format:check: passes
  • CI ci:required gate (build + typecheck + unit + integration)

Linked issues

  • Closes CMS-190
  • Relates to CMS-88 (existing ticket that will consume the CLI adapter)
  • Relates to CMS-60 (delivered the Studio runtime-registry composition surface)

Repo-wide dead-code audit. Removes the retired studio-review app and
other code paths with no remaining consumers, then prunes the
supporting scripts, deps, docs, and specs so the repo still builds and
tests cleanly.

Removed
- apps/studio-review (entire app) + root studio:review npm scripts,
  .changeset/config.json ignore entry, AGENTS.md row, apps/docs pages
  that described it, and docs/specs/SPEC-012.
- docs/specs/SPEC-013 (orphan planning brief not in the spec catalog).
- apps/server OwnerInvariant* helpers in rbac.ts (superseded by
  assertOwnerMutationAllowed).
- apps/cli action-catalog-adapter.ts plus its two tests and the
  @elysiajs/eden / elysia deps that only existed to serve it.
- apps/cli credentials.clearCredentialsFile (zero callers).
- packages/studio legacy lib/ui/{button,utils}.tsx (superseded by
  runtime-ui/), runtime-registry.{ts,test.ts} (never wired), and the
  runtime-ui components editor-sidebar.tsx, mock-data.ts, calendar.tsx,
  collapsible.tsx, checkbox.tsx plus the @radix-ui/react-checkbox,
  @radix-ui/react-collapsible, @tiptap/extension-image,
  @tiptap/extension-placeholder, @tiptap/extension-typography,
  react-day-picker, and date-fns deps that only served them.
- packages/shared lib/shared.ts placeholder function + its index
  re-export.
- Root devDeps @swc-node/register, @swc/core, @swc/helpers (no
  references anywhere; repo uses Bun native + tsc).

Fixed
- docs/adrs/README.md moved ADR-006 from "Proposed" to "Accepted"
  to match its own status: accepted frontmatter.

Verification
- bun run check (build + typecheck): passes
- bun run unit (514 tests across 58 files + studio embed smoke): passes
- bun run format:check: passes
@mintlify
Copy link
Copy Markdown

mintlify Bot commented Apr 19, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
mdcms 🟢 Ready View Preview Apr 19, 2026, 3:07 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 19, 2026

📝 Walkthrough

Walkthrough

The pull request removes the apps/studio-review application and its runtime/build infra, deletes many Studio UI components and mock/runtime helpers, updates docs/specs/ADRs to remove references to the review app, removes some studio-related dependencies and scripts, and deletes a small CLI helper and some RBAC owner-invariant utilities.

Changes

Cohort / File(s) Summary
Studio-review app (full removal)
apps/studio-review/*
Entire app directory removed: README, package.json, mdcms.config.ts, next.config.mjs, tsconfig.json, Next.js pages/layouts, middleware, API routes (content, actions, environments, schema, auth, assets, bootstrap), review fixtures (scenarios, content-documents, environments, actions), runtime build/watch scripts, runtime artifacts/build utilities, and many component modules.
Studio-review tests
apps/studio-review/**/*.{test,tests}.ts*
Many test suites for review app (actions, environments, content-documents, runtime-artifacts, scenarios, admin pages, route tests) removed.
Studio package: runtime & UI removals
packages/studio/src/lib/runtime-registry.ts, packages/studio/src/lib/runtime-ui/**, packages/studio/src/lib/ui/*
Deleted runtime registry implementation, numerous runtime-UI components (editor sidebar, calendar, checkbox, collapsible, button), mock-data, utility cn, related tests and type exports.
Packages: small API/utility removals
packages/shared/src/lib/shared.ts, packages/shared/src/index.ts
Removed shared() export and its re-export from package barrel.
Docs & specs updates
AGENTS.md, apps/docs/architecture/overview.mdx, apps/docs/development/packages.mdx, apps/docs/development/setup.mdx, docs/specs/README.md, docs/specs/SPEC-012-studio-review-app-and-preview-workflow.md, docs/specs/SPEC-013-mintlify-docs-site.md, docs/adrs/README.md
Removed references and documentation for the studio-review app and preview workflow, deleted SPEC-012, added/updated SPEC-013, and moved ADR-006 to accepted.
Root config & scripts
.changeset/config.json, package.json
Removed @mdcms/studio-review from changeset ignore and deleted studio:review:runtime / studio:review:dev npm scripts; removed SWC dev dependencies.
Server RBAC tests/utilities
apps/server/src/lib/rbac.ts, apps/server/src/lib/rbac.test.ts
Removed owner-invariant types and assertion helpers (OwnerInvariantSnapshot, assertOwnerInvariant, OwnerInvariantStore, assertOwnerInvariantFromStore); corresponding tests removed.
CLI credentials helper
apps/cli/src/lib/credentials.ts
Removed unused rm import and exported clearCredentialsFile() helper.
Studio package.json deps
packages/studio/package.json
Removed several UI/editor dependencies (Radix, Tiptap extensions, react-day-picker, date-fns) from dependencies.
Minor test formatting/cleanups
packages/studio/src/lib/markdown-pipeline.test.ts, packages/studio/src/lib/runtime-ui/components/editor/code-block-languages.test.ts, packages/studio/src/lib/runtime-ui/components/editor/mdx-props-panel.test.tsx
Formatting and minor whitespace adjustments in a few tests.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

v0

Poem

🐰
I hopped through code on springtime nights,
Found routes and demos, tiny lights.
One gentle prune — the garden cleared,
New paths ahead, bright and endeared.
A carrot cheer for tidy sights!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main changes: removal of the studio-review app and dead code audit across the codebase. It is concise, directly related to the changeset, and provides meaningful context.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ 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/cms-190-dead-code

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

iipanda added 3 commits April 19, 2026 17:10
Reverts the CLI-side removal from the previous commit. The adapter
looked dead (only tests imported it) but it is the planned plumbing
for CLI adoption of the action catalog contract described in ADR-005,
which names both Studio and CLI as consumers of /api/v1/actions*.

The endpoint is implemented and Studio is already wired onto its own
adapter; CLI just hadn't been migrated yet. Removing the scaffolding
would have deepened the drift from ADR-005.

Restores
- apps/cli/src/lib/action-catalog-adapter.ts
- The two createCliActionCatalogAdapter tests in cli.test.ts
- @elysiajs/eden and elysia in apps/cli/package.json

Follow-up tracked in CMS-208 (Wire CLI onto the Eden action-catalog
adapter — ADR-005 alignment).
…spec

The CMS-190 audit flagged SPEC-013 as an orphan because it wasn't in
docs/specs/README.md. That framing was wrong: apps/docs is a live,
maintained subsystem and by the repo's own standalone-spec rule it
needs an owning spec. The missing index entry was the bug, not the
spec.

- Restores docs/specs/SPEC-013-mintlify-docs-site.md.
- Adds it to docs/specs/README.md so the spec catalog reflects reality.
- Drops the stale /Users/blazity/... local path leak from the overview
  and design-system sections. The spec now stands as generic product
  documentation instead of a construction brief.
…urface)

The CMS-190 audit flagged runtime-registry.ts as dead because no
production code imported buildStudioRuntimeRegistry — only its test.
That was wrong.

The registry is the spec-mandated Studio composition surface for
routes, navItems, slotWidgets, fieldKinds, editorNodes, actionOverrides,
and settingsPanels. It was delivered by CMS-60 (Done) as acceptance
criterion #2 and is explicitly required by SPEC-002 ("Implement the
remote Studio app and runtime composition registry in `module` mode.")
and SPEC-006 ("Remote Studio runtime builds its internal composition
registry and validates it before first render."). Downstream work in
CMS-124 will register module-contributed routes/slots/fields into it.

The absence of a production importer today means it isn't consumed by
remote-studio-app.tsx yet — not that it is dead. Restoring it keeps the
repo aligned with SPEC-002/SPEC-006 and preserves the CMS-60
deliverable.
@iipanda iipanda merged commit 4aa3401 into main Apr 19, 2026
5 checks passed
@iipanda iipanda deleted the chore/cms-190-dead-code branch April 19, 2026 15:28
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