refactor(channels): remove dead unguarded channel upsert path (#3503)#3508
Conversation
#3503 reported channel names silently blanked on SQLite via an upsert that lacked the #1567 blank-name guard. Verification showed the unguarded path is DEAD CODE, not a live bug: - ChannelsRepository.upsertChannelSync was called only by DatabaseService.upsertChannel. - DatabaseService.upsertChannel (the ~85-line facade) has zero callers. - Every real channel upsert goes through the async, #1567-guarded databaseService.channels.upsertChannel (which runs on all backends). So there was no data-loss bug. Remove both dead methods so the unguarded path can't be wired up by mistake later. No behavior change — full suite green (6527, unchanged), confirming the removed code was unreachable. Closes #3503. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Claude finished @Yeraze's task —— View job PR Review: refactor(channels): remove dead unguarded channel upsert path (#3503)
SummaryThis is a clean, well-motivated dead-code removal. The PR's core claims hold up under inspection. Dead-code verification ✅The reachability analysis is correct:
Code quality ✅The removal is surgical. The section header at One genuine issue: orphaned tests in
|
claude-pr review on #3508: database.test.ts had a TestDatabaseService fixture upsertChannel + create/update/retrieve tests that mirrored the now-removed DatabaseService.upsertChannel — misleading now that the production method is gone. Removed the fixture method and those 3 tests; kept the independent 'Primary channel by default' test. The live async path is covered by channels.test.ts (incl. the #1567 guard). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Claude finished @Yeraze's task —— View job PR Review: refactor(channels): remove dead unguarded channel upsert path (#3503)
SummaryThis is a clean, well-executed dead-code removal. The previous review's orphaned test concern has been addressed in the follow-up commit Dead-code verification ✅The reachability analysis holds:
Tombstone comment ✅
Orphaned test cleanup ✅The second commit (
Remaining sync methods — no action needed 🔍
|
Closes #3503.
Finding: not a live bug — dead code
#3503 (from the clobber audit) reported that channel names were silently blanked on SQLite because
ChannelsRepository.upsertChannelSynclacked the #1567 blank-name guard the async path has. Reachability verification overturned that premise:upsertChannelSyncis referenced only byDatabaseService.upsertChannel(the legacy facade).DatabaseService.upsertChannel(~85 lines) has zero callers anywhere insrc/.databaseService.channels.upsertChannel— the async repo method, which has the [BUG] After upgrading to 3.1.x all channels on Meshtastic app show as "Channel Name" #1567 guard and runs on all backends (no dbType branch diverts SQLite to the sync method).So the unguarded path is unreachable — there was no data-loss bug. (My initial audit confirmed the guard divergence but not reachability; the audit agent wrongly assumed the facade was the active SQLite path.)
Change
Remove both dead methods so the unguarded path can't be wired up by mistake later:
DatabaseService.upsertChannelandChannelsRepository.upsertChannelSync(−138 lines). The// Channel operationssection header stays, with a note pointing to the live guarded method.Validation
tsc --noEmit: clean (no dangling refs;DbChannel/getSqliteDbstill used elsewhere)🤖 Generated with Claude Code