Skip to content

refactor: clean up design debt — deprecated APIs, arg validation, dead plugin code#1065

Merged
jackwener merged 1 commit intomainfrom
refactor/design-debt-cleanup
Apr 17, 2026
Merged

refactor: clean up design debt — deprecated APIs, arg validation, dead plugin code#1065
jackwener merged 1 commit intomainfrom
refactor/design-debt-cleanup

Conversation

@jackwener
Copy link
Copy Markdown
Owner

Summary

Addresses 3 items from the design debt audit:

1. Remove deprecated tabId field and getActiveTabId() method

  • The tab→page migration is now complete. All cross-layer communication uses page (targetId).
  • Removed from: DaemonCommand, Command (protocol), IPage, Page
  • Updated extension resolveCommandTabId() to remove legacy cmd.tabId fallback

2. Unify argument validation into single code path

  • Removed normalizeArgValue() from commanderAdapter.ts — it duplicated boolean coercion that coerceAndValidateArgs() in execution.ts already handles
  • Commander adapter now passes raw values to prepareCommandArgs(), which is the single validation entry point
  • Bug fixes only need to happen in one place now

3. Remove dead plugin filesystem wrappers

  • promoteDir() — never called in production, only test-exported
  • replaceDir() — thin wrapper over beginReplaceDir().finalize(), only test-exported
  • Removed their test-only exports and tests
  • Transaction infrastructure (runTransaction, beginReplaceDir, beginReplaceSymlink) retained — legitimately used by publishStandalonePlugin and publishMonorepoPlugins

Net: 9 files changed, 10 insertions, 126 deletions

Test plan

  • All 209 test files pass (1613 tests)
  • TypeScript typecheck clean (npx tsc --noEmit)
  • CI passes

…on, dead plugin wrappers

Three improvements from the design debt audit:

1. Remove deprecated `tabId` field and `getActiveTabId()` method
   - Delete `tabId` from DaemonCommand (daemon-client.ts) and Command (protocol.ts)
   - Delete `getActiveTabId()` from IPage interface (types.ts) and Page class (page.ts)
   - Update extension resolveCommandTabId() to remove legacy fallback
   - Update handleTabs select case to remove tabId check
   - The tab→page migration is now complete

2. Unify argument validation into single code path
   - Remove `normalizeArgValue()` from commanderAdapter.ts
   - Commander adapter now passes raw values to prepareCommandArgs()
   - All coercion (bool, int, number) and validation (required, choices)
     happens once in coerceAndValidateArgs() in execution.ts
   - Eliminates duplicated boolean normalization

3. Remove dead plugin filesystem wrappers
   - Delete `promoteDir()` — never called in production code
   - Delete `replaceDir()` — thin wrapper over beginReplaceDir, never called
   - Remove corresponding test-only exports and tests
   - Rename PromoteDirFsOps → ReplaceDirFsOps to match remaining usage
   - Transaction infrastructure (runTransaction, beginReplaceDir,
     beginReplaceSymlink) retained — used by publishStandalonePlugin
     and publishMonorepoPlugins for atomic multi-step operations
@jackwener jackwener merged commit 44d8787 into main Apr 17, 2026
12 of 14 checks passed
@jackwener jackwener deleted the refactor/design-debt-cleanup branch April 17, 2026 02:52
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