feat(local-network): persist local devices + Settings surface (bridge now reachable) - #76
Merged
Conversation
…ettings Makes the LocalNetworkBridge user-reachable end to end: - LocalDeviceRecord (@model, schema V4 + lightweight V3->V4 migration stage): persisted authoring record that maps to the value-type LocalDeviceConfig. - LocalDeviceService (@observable @mainactor): owns record CRUD and keeps the bridge in sync. On any change it republishes a thread-safe LocalDeviceConfigProvider snapshot and re-registers the bridge through DeviceService, so added devices are discovered and removed ones pruned. Transport factory is injectable so the whole flow is testable off-network. - Settings -> Local Devices: LocalDeviceListView + LocalDeviceDetailView author name / address / kind (Shelly switch or dimmer) / channel, mirroring the Settings -> Remotes lane. - Wiring: LumenApp constructs and injects LocalDeviceService; RootView.bootstrap registers the bridge via reloadBridge() behind the same XCTest guard as HomeKit. - LocalDeviceServiceTests: CRUD -> bridge (re)registration vs a stub transport (add surfaces a device, delete prunes it, kind/address edits republish). Docs (CLAUDE.md/AGENTS.md) updated: local-network devices moved from scaffolded to wired, schema V4, new model/service/test rows. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
mohabbis
marked this pull request as ready for review
July 14, 2026 14:54
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to the merged
LocalNetworkBridgeengine (#75). Makes local-network device control reachable end to end — the "control devices Apple Home can't see" surface (Home Assistant / Homebridge parity) is now something a user can actually configure and use.What's new
Domain/Models/LocalNetwork/LocalDeviceRecord.swift@Model(schema V4) — persisted authoring record; maps to the value-typeLocalDeviceConfig, never reaching the integration layer.Services/LocalNetwork/LocalDeviceService.swift@Observable @MainActor— record CRUD + keeps the bridge in sync. On every change it republishes a thread-safeLocalDeviceConfigProvidersnapshot and re-registers the bridge throughDeviceService(add → discovered, delete → pruned). Transport factory is injectable for tests.Features/LocalNetwork/LocalDeviceListView.swift+LocalDeviceDetailView.swiftLumenTests/LocalDeviceServiceTests.swiftSchema
V3 → V4migration stage (additive table), following theExecutionEvent → V2precedent.PersistenceCoordinatornow uses V4.PersistenceTestsdon't pin a version, so they're unaffected.Wiring
LumenAppconstructs and injectsLocalDeviceService.RootView.bootstrapregisters the bridge viareloadBridge()behind the sameXCTestguard as HomeKit..pbxprojchanges.Design notes
actorwhose@Sendableconfig closure may run off the main actor, so the config snapshot lives behind a lock (LocalDeviceConfigProvider) rather than on the main-actor service.refreshAll) on change is deliberate:mergeDevicesupserts but doesn't prune, so unregister-then-register is what correctly removes a deleted device's live state.Verification
Can't compile Swift on Linux (macOS/Xcode only, per
CLAUDE.md); the new service/CRUD → bridge flow is covered byLocalDeviceServiceTests, and the surfaces mirror the proven Remote lane. Web CItestjob is unaffected (Swift + docs only).Still not built (awaiting your consent-boundary call): Tier 1.2 time/schedule triggers.
🤖 Generated with Claude Code
Generated by Claude Code