Repository navigation
refactor(#445): delete five "for tests" constructor seams no caller ever passes — production −41 lines - #446
Conversation
…ver passes Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
/agentic_review |
PR Summary by QodoRemove unused firmware, HID, and logging constructor seams
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can add REVIEW.md to your repo root and Qodo follows it on every PR |
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit 40bfef0 |
|
Qodo-clean, CI green — ready for review. R1 (⚖️ Balanced) is the only round that reviewed the code; R2 on the same head says "No changes from previous review". Not merging. |
Sweep: five-way merge of
|
|
Sweep update: the six-way merge of |
Closes #445. Not merging. This is for review.
What was wrong
Four production types took constructor parameters that were documented as existing "for tests". No test, no tool and no production code ever passed a value for them, so each one was a
x ?? productionDefaultthat always used the right-hand side. Three of the doc comments described tests that do not exist:FirmwareUpdateCoordinator: "tests inject a fake to assert WiFi sequencing"HidBootloaderDiscovery: "tests inject a fake"FirmwareDialogViewModel: "(tests pass mocks via the constructor args)"A comment like that gives the next reader a reason to leave the code alone without checking whether anything still uses it. This PR deletes the seams and the false comments. It has the same shape as #420.
What changed
The change only removes code. There is no behaviour change and no test change.
FirmwareUpdateCoordinatorwifiFirmwareUpdateServiceFactoryparameter, its field, its??line, 5 doc linesCreateWifiFirmwareUpdateService(...)directly. The local is still typedIFirmwareUpdateService, so the calls go through the same interface as before.DaqifiViewModelHidBootloaderDiscoverypollIntervalandfinderFactoryparameters, both fields, both??lines, 5 doc linesStart()buildsnew HidDeviceFinder()withDefaultPollInterval. It still creates a fresh finder on every Start, as the old factory did.FirmwareDialogViewModelfirmwareUpdateServiceandwatcherparameters, their??legs and docsAppLoggerLoggerProviderappLoggerparameter and the constructorAppLogger.Instance, at the same point in construction.Two parameters are kept because callers pass real values to them:
FirmwareDialogViewModel'sfirmwareDownloadService. AvaloniaCapture passes an offline stub. Its doc now says that instead of "for tests".targetDevicePath. The connection dialog passes it.Diffstat (
git diff --numstat origin/main...HEAD): raw +12 / −53 in 5 production files. Blank lines excluded and split by kind:Proof that nothing passes these parameters (on
origin/main@97be4df).cs,.axaml,tools/, tests, docs) forwifiFirmwareUpdateServiceFactory,finderFactory,pollInterval,HidBootloaderDiscoveryandAppLoggerLoggerProvider. Every hit is either the declaration or a single production construction:App.cs:149passes no arguments, andApp.cs:184passes only the logger.SerialPortPollingDeviceWatcher'spollInterval, which tests do pass.new T(, and separately for target-typednew(through a declaration or expression-bodied helper whose declared type isT.CreateCoordinator() => new(...)helpers forFirmwareUpdateCoordinator. All three pass six positional arguments and thenwifiUpdateModeSettleDelay:andcanFlashWifiModule:by name. None passes the factory.DaqifiViewModelarenew DaqifiViewModel(new NullDialogService()). The: this(...)chain passes four positional arguments and thenloggingContextFactory:by name.FirmwareDialogViewModelhas exactly two call sites:ConnectionDialogViewModel.cs:868(two positional arguments) andAvaloniaCapture/Program.cs:1068(hidDeviceName:andfirmwareDownloadService:).Activator.CreateInstance,GetConstructoror DI registration names any of the four types. The onlyActivatorsites are exception factories in tests,FirewallManager's COM types andDialogService's parameterlessWindows.AvaloniaCapture/Program.cs, but not theFirmwareDialogViewModelconstruction.Verification
build.1lock:dotnet build, green (0 errors)-r-r iossimulator-arm64 --no-restore: green (exit 0)dotnet test Daqifi.Avalonia.Tests: 1179 passed, 0 failed, 0 skipped (macOS, full suite)97be4dfagainst this PR's run 35653845541). I compared the distinct first-party warnings, keyed on file + code + message (line numbers left out because the touched files shift). The sets are identical in all four jobs: Android 109/109, Desktop-on-macOS 107/107, Library+Desktop 108/108, iOS 107/107. Those are distinct counts, not the printed totals.packages.lock.jsonis unchanged.Coverage, stated plainly:
FirmwareUpdateCoordinatoris covered byWifiFlashPlatformGateTests,FirmwareUpdateCancellationTestsandFirmwareUploadAffordanceTests. None of them constructs it with the factory, so they run exactly the path this PR keeps.HidBootloaderDiscoveryandAppLoggerLoggerProviderhave no covering tests. The change there only touches the constructor signature: each removed??always took its right-hand side, which is now written directly. The evidence is a green build plus the unchanged call sites inApp.cs.Qodo
40bfef0was graded⚖️ Balancedand came back clean: 0 bugs, 0 rule violations, 0 requirement gaps.Out of scope
SdCardSessionImporter's internaldownloadStallTimeout"test seam" has the same invariant shape: its one caller passes the production constant. It is not removed here. The stall watchdog has no test at all, and the right fix is to write that test using the seam. That is tracked separately (see SD import: ImportOptions has three settings and no production code path sets any of them — ~85 lines handle values the app never passes #444).VersionNotification, which fix(update): the version check queries daqifi-desktop, reads the wrong assembly, and Sentry-errors on any prerelease tag #345 rewritesConnectionDialogViewModelandDeviceLogsViewModel, which open PRs are editing and whose seams tests use🤖 Generated with Claude Code