Skip to content

refactor(sync): remove or justify remaining any usages in sync tests (Phase 1.9) - #216

Merged
h4yfans merged 1 commit into
mainfrom
debt/1.9-any-audit
Apr 15, 2026
Merged

refactor(sync): remove or justify remaining any usages in sync tests (Phase 1.9)#216
h4yfans merged 1 commit into
mainfrom
debt/1.9-any-audit

Conversation

@h4yfans

@h4yfans h4yfans commented Apr 15, 2026

Copy link
Copy Markdown
Collaborator

Closes Phase 1 §1.9 of .claude/plans/tech-debt-remediation.md.

Summary

Audit of : any / as any across apps/desktop/src/main/crypto/** and apps/desktop/src/main/sync/**. Crypto production code was already clean (0 hits). This PR removes 17+ as any uses in sync test files by introducing typed test helpers.

Changes

  • dirty-recovery.test.tslet db: anylet db: DataDb, use asClientDb() helper.
  • apply-item.test.tsqueue: null as any → real SyncQueueManager (cleaner than a null stub).
  • task-sync-gaps-e2e.test.ts — 14 hits of deviceX.db as any → typed asClientDb() + asSyncDb() helpers.
  • item-handlers/folder-config-handler.test.tsmockQueue as any (×2) → Pick<SyncQueueManager, 'enqueue'> + makeMockQueue() helper.
  • item-handlers/settings-handler.test.tsdb: {} as anydb: {} as unknown as DrizzleDb; removed invalid deviceId field, replaced with proper emit: vi.fn().

Verification (run locally by agent)

  • grep -rn ": any\|as any" apps/desktop/src/main/crypto apps/desktop/src/main/sync0 hits
  • npx tsc -p apps/desktop/tsconfig.node.json --noEmit — no errors
  • npx tsc -p apps/desktop/tsconfig.web.json --noEmit — no errors
  • vitest run on affected files → 59/59 passing
  • vitest run on full src/main/sync627/627 passing across 52 files

Test plan

  • typecheck:node clean
  • typecheck:web clean
  • all sync tests passing
  • CI lint passes

🤖 Generated with Claude Code

@h4yfans
h4yfans merged commit c27b1d7 into main Apr 15, 2026
2 checks passed
h4yfans added a commit that referenced this pull request May 6, 2026
@h4yfans
h4yfans deleted the debt/1.9-any-audit branch May 6, 2026 16:36
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