Skip to content

fix: imaging DI lifetime + wizard scan-button consistency - #56

Merged
bilbospocketses merged 3 commits into
masterfrom
fix/imaging-di-scoped-lifetime
Jun 12, 2026
Merged

fix: imaging DI lifetime + wizard scan-button consistency#56
bilbospocketses merged 3 commits into
masterfrom
fix/imaging-di-scoped-lifetime

Conversation

@bilbospocketses

Copy link
Copy Markdown
Owner

Summary

Two fixes from a dev session.

1. DI lifetime bug (the important one). IImageService and ITracingService were registered Singleton but depend on the scoped IDependencyPathResolver - a captive dependency that aborts dotnet run in Development via ValidateOnBuild (exit 82). It slipped past 444 green tests + CI because bUnit never builds the real container and the packaged app runs with scope validation off. Both services are stateless per-call CLI wrappers consumed only by scoped Blazor pages, so Scoped is correct and matches every other resolver consumer.

2. Wizard button consistency. The setup wizard's Devices and Cameras "Scan Network" buttons looked completely different (btn-secondary/refresh-icon vs btn-primary/broadcast-icon). Both now use btn-secondary + the broadcast icon.

Test plan

  • dotnet run starts clean in Development (was exit 82)
  • full dotnet test green (444, 0 failed)
  • wizard Devices/Cameras steps visually confirmed consistent

IImageService and ITracingService were registered Singleton but depend on the
scoped IDependencyPathResolver (-> scoped IConfigurationService), a captive
dependency that aborts Dev startup via ValidateOnBuild. They are stateless
per-call CLI wrappers consumed only by scoped Blazor pages, so Scoped is correct
and matches every other resolver consumer. Tests/CI missed it because bUnit never
builds the real container and the packaged app runs with scope validation off.
Both wizard Scan Network buttons now use btn-secondary + the bi-broadcast icon.
Previously the Devices button was btn-secondary/bi-arrow-clockwise and the Cameras
button was btn-primary/bi-broadcast, so the two steps looked inconsistent.
@bilbospocketses
bilbospocketses enabled auto-merge (squash) June 12, 2026 18:11
@bilbospocketses
bilbospocketses merged commit c7db6ff into master Jun 12, 2026
8 checks passed
@bilbospocketses
bilbospocketses deleted the fix/imaging-di-scoped-lifetime branch June 12, 2026 18:13
bilbospocketses added a commit that referenced this pull request Jun 24, 2026
…eanup (Item 45) (#77)

* fix(backend): audit MINOR cleanup #38/#40/#48/#54/#55/#56 + #39/#49 + imaging temp cleanup

- #38 clearing a device PIN deletes the secret row (was writing an empty plaintext setting)
- #54 DeviceForm guards double-submit (disable + re-entrancy guard while a save is in flight)
- #40 OperationLogger.GetDefaultBackupDirectory is pure (no directory-creation side effect)
- #48 SubnetParser octet validation via byte.TryParse (was a regex + int-range pair)
- #55 DependencyManagerService.BuildVersionedDownloadUrl honours dep.AssetPattern (was a hardcoded sqlite literal)
- #56 remove dead appsettings ConnectionStrings:DefaultConnection (the live path comes from the resolver)
- #39 clarifying comment on the AddTypedDeviceFieldsRemoveMetadata migration (renames, not removes; do not rename)
- #49 collapse the no-op IsWindows?"go2rtc":"go2rtc" ternary
- Item 45: MagicWand/ImageResize/FormatConverter implement IDisposable to delete their /temp
  web-copies on navigate-away; ImageResize/FormatConverter also replace the prior copy per conversion

Tests +8 (SubnetParser edges, BuildVersionedDownloadUrl AssetPattern, OperationLogger purity,
MagicWand no-accumulation + dispose-cleanup, DeviceForm double-submit). 690 green.

* fix(backend): review polish — sqlite-host doc note (#55) + DeleteWebCopy nulls _downloadUrl (Item 45)

Whole-branch review follow-ups (both Minor, no behavior change):
- #55 BuildVersionedDownloadUrl: XML-doc note that the URL reconstruction is sqlite.org-scheme
  specific (AssetPattern generalises only the filename match), to prevent future misuse.
- Item 45: ImageResize/FormatConverter DeleteWebCopy now also nulls _downloadUrl, matching
  MagicWand's cleanup helpers.
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