Skip to content

refactor(schema): drop the declarations nothing has ever read - #562

Open
EtienneLescot wants to merge 2 commits into
mainfrom
claude/drop-dead-autotranscribe
Open

refactor(schema): drop the declarations nothing has ever read#562
EtienneLescot wants to merge 2 commits into
mainfrom
claude/drop-dead-autotranscribe

Conversation

@EtienneLescot

@EtienneLescot EtienneLescot commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Three removals in schema/index.ts, all of them declarations nothing ever read.

addAssetInputSchema.autoTranscribe — declared with a true default, one occurrence in the whole tree: its own line. Worse than clutter, because it reads like the switch that decides whether an imported asset gets transcribed. The next person working on transcription finds it, believes the decision already has a home, and wires their logic to a flag no code path consults. It surfaced while designing #560, which needs somewhere to express "transcribe only what can carry speech" — and this looked like it.

addAssetInputSchema itself, and the AddAssetInput it exported. No parse site, no import, no namespace import of the module. It named an IPC contract that no boundary validates against. It was also actively confusing: document-service.ts declares a same-named AddAssetInput interface (line 38) and that is the one every caller uses. Two types, one name, and the one that looked canonical was inert.

chatInputSchema and its ChatInput — same story, no shadowing twist.

What is NOT removed, and why it looked removable

createProjectInputSchema stays. It reads as dead by exactly the same grep — zero references outside schema/index.ts — but its inferred CreateProjectInput types createEmptyDocument, which has 50 call sites. The reference is one line below the type export, inside the same file, and is easy to miss.

Worth stating rather than quietly keeping: "no references outside its own module" is not a liveness test for a type that a function in that module consumes.

Related issue

Refs #560 — found while pinning down where automatic transcription should be decided.

Type of change

  • Refactor / maintenance

Release impact

  • No release note needed

Desktop impact

  • Not platform-specific

Screenshots / video

None — no user-visible change.

Testing

  • npm run test2236 passed, 4 skipped, 0 failed (187 files)
  • npx tsc --noEmit and npx tsc -p tsconfig.test.json --noEmit — clean
  • npm run lint (Biome) — clean (15 pre-existing warnings in untouched files)

No test asserted on any of the removed declarations, so none needed changing. The typecheck is the real proof here: had any of the three been reachable, both tsc passes would say so.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Removed previously available AI editing input validation schemas and their associated input types.

`addAssetInputSchema.autoTranscribe` was declared with a `true` default and
consumed by nobody: one occurrence in the whole tree, its own declaration.

That is worse than clutter. It reads like the switch that decides whether an
imported asset gets transcribed, so the next person to work on transcription
finds it, believes the decision already has a home, and wires their logic to a
flag no code path consults. It surfaced during the design of #560 for exactly
that reason.

The field goes; the schema keeps its shape otherwise. Nothing type-checks
against it — `document-service.ts` declares its own `AddAssetInput` interface
and uses that one, so the inferred type this schema exports was not in play
either.
`addAssetInputSchema` and `chatInputSchema` had no reference anywhere outside
their own declaration and their own `z.infer` line — no parse site, no import,
no namespace import of the module. They named an IPC contract that no boundary
actually validates against.

`addAssetInputSchema` was the worse of the two: the `AddAssetInput` it exported
is shadowed by a same-named interface declared in `document-service.ts`, and
that interface is the one every caller uses. Two types, one name, and the one
that looked canonical was inert.

`createProjectInputSchema` STAYS. It reads as dead by the same grep — no use
outside `schema/index.ts` — but its inferred `CreateProjectInput` types
`createEmptyDocument`, which has 50 call sites. Same file, one line down; the
reference is easy to miss and expensive to remove.
@EtienneLescot EtienneLescot changed the title refactor(schema): drop autoTranscribe, which nothing has ever read refactor(schema): drop the declarations nothing has ever read Sep 1, 2026
@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 20ec5abf-3326-47b1-9afc-d270d0ecd18d

📥 Commits

Reviewing files that changed from the base of the PR and between 3952454 and 01f69d4.

📒 Files selected for processing (1)
  • src/lib/ai-edition/schema/index.ts
💤 Files with no reviewable changes (1)
  • src/lib/ai-edition/schema/index.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The change removes addAssetInputSchema, chatInputSchema, AddAssetInput, and ChatInput from the AI edition schema module.

Changes

Cohort / File(s) Summary
AI edition schema removal
src/lib/ai-edition/schema/index.ts
Removes the two Zod schemas and their derived TypeScript types.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 01f69

This localized cleanup removes unused schema declarations without changing runtime behavior or validated application contracts. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies a schema refactor that removes unused declarations. It is concise and directly matches the primary change.
Description check ✅ Passed The description follows the repository template. It explains the removals, related issue, change type, release and desktop impact, absence of visual changes, and testing results.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files.

✨ 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 claude/drop-dead-autotranscribe

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.

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