Skip to content

fix: preserve UCI radio identity on shared PHY devices - #42

Merged
aiden0rchad merged 2 commits into
mainfrom
codex/issue-39-shared-wiphy
Sep 18, 2026
Merged

aiden0rchad merged 2 commits into
mainfrom
codex/issue-39-shared-wiphy

Conversation

@aiden0rchad

@aiden0rchad aiden0rchad commented Sep 17, 2026 •

Copy link
Copy Markdown
Owner

Summary

Addresses #39, based on @flubba's detailed diagnosis and proposed UCI-section preservation. Please keep the issue open pending verification on the reporter's BE12 Pro; this PR intentionally does not auto-close it.

  • Preserve the authoritative UCI radio section from luci-rpc.getWirelessDevices rather than deriving it from a shared PHY index.
  • Keep ordinary legacy records compatible, but reject ambiguous or invalid target identities with re-probe guidance before applying anything.
  • Reject duplicate desired ownership targets before router writes, including the already-matching path. Do not hide duplicates using a database upsert or deduplication.
  • Cover capability probing/comparison, rendering, reconciliation, and the recovery procedure with regressions and documentation.

Cause and upstream research

OpenWrt can create distinct wifi-device sections for multiple radio indices on one PHY. Its mac80211 configuration generator, LuCI RPC implementation, and multi-radio design discussion support treating the UCI section key—not phyN—as the configuration identity.

Previously both reported bands could render the same oowrt_wlanN_radio0. The router could confirm that collapsed configuration before ownership recording failed on its unique key. This PR corrects the target and adds pre-write rejection rather than weakening the ownership constraint.

Validation

  • Reproduced the old renderer accepting ambiguous shared-PHY records, including a request for only one band. Added regression cases for active/idle probing, authoritative/fallback identities, invalid/colliding targets, and distinct two-band rendering.
  • go test ./internal/capability ./internal/render ./internal/reconcile -count=1 — all passed after final review corrections, run outside the implementer's listener-restricted sandbox.
  • go vet ./internal/capability ./internal/render ./internal/reconcile — passed.
  • Mock-backed Apply test verifies both distinct sections are recorded and the next plan is idempotent. Duplicate-document tests verify no router requests, health checks, or ownership changes, including the empty-plan path.
  • Capability comparison regressions cover learning/losing Section metadata, missing evidence, ambiguous legacy shared-PHY inventories, real keyed-radio removal, and rename compatibility. Review found and corrected a mixed-inventory false loss/gain case before publication.
  • npm --prefix docs run build — passed, including all nine screenshot-validator tests and checks of 35 screenshots/48 documentation references.
  • Formatting, git diff --check, mock Python syntax validation, and independent final review — passed.

GitHub CI passed on commit b3b7adfec9549c901c72601f49bada8a1e96ec5e: full Go tests/vet/modules, race detector, UI tests/build/budget, release packaging, and secret scan. The Documentation workflow also passed build/validation; Pages deployment was correctly skipped for this PR. The PR does not publish a release or container image.

No physical-router verification is claimed. The local lab Ethernet link is inactive, and its reference routers are not the reporter's MT7996 hardware. The shared-PHY tests use reproducible fixtures and mock router operations. No actual router or controller data was changed.

Verification on affected hardware

The review build is commit b3b7adfec9549c901c72601f49bada8a1e96ec5e, not an official release. For a local container build from a new checkout:

git clone --branch codex/issue-39-shared-wiphy https://github.com/aiden0rchad/oonfeeWRT.git oonfeewrt-issue-39
cd oonfeewrt-issue-39
git checkout --detach b3b7adfec9549c901c72601f49bada8a1e96ec5e
docker build -f deploy/Dockerfile --build-arg VERSION=pr-42-b3b7adf -t oonfeewrt:pr-42 .

Building the image does not start it or touch controller data. Use your existing deployment's data directory and runtime passphrase only after taking the backup below; do not run two controllers against the same database.

  1. Run a build from this PR with your normal backup/recovery precautions. This patch adds no schema change beyond v0.1.7. If upgrading from v0.1.5, follow the documented upgrade and backup procedure and preserve the matching pre-upgrade recovery unit; do not assume the older binary can open a newer database.
  2. Open Devices → affected device → Re-probe capabilities. Existing saved capability records need fresh UCI section identities.
  3. Preview the desired WLAN again. Confirm distinct oowrt_wlanN_radio0 and oowrt_wlanN_radio1 sections with the corresponding device references before authorizing Apply.
  4. If that preview is correct and it is safe to change the router, Apply and verify both bands, then confirm the next Preview has no unintended changes.

The previous failed operation may already have changed the router. Do not reset the database, clear ownership records, or re-adopt to work around this error. Please report whether this exact PR build resolves the issue on the BE12 Pro; any remaining failure should include sanitized re-probe/preview output and the precise error, not credentials or wireless keys.

Copilot AI lite review requested due to automatic review settings September 17, 2026 01:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@aiden0rchad
aiden0rchad merged commit f27cc18 into main Sep 18, 2026
7 checks passed
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.

2 participants