feat(sources): UniFi Network source (#55) #69
No reviewers
Labels
No labels
bug
docs
duplicate
enhancement
help wanted
invalid
nice-to-have
pre-1.0
question
security
wontfix
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jfro/lamplighter!69
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/55-unifi"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What changed
PR #69 @
9df19b7passes my review: real-browser checks at 390px and desktop against two fake consoles (C47), the full suite (1055) and green Forgejo CI, and the API fields match the 9.3.45, 10.0.162 and 11.0.97 specs.Fixes #55
Red, then green
export PATH=$HOME/.local/bin:$PATH && eval "$(mise activate bash --shims)" && unset $(env | grep -oE '^(FORGEJO|GITHUB_ISSUES)[A-Z_]*'); MIX_TEST_PARTITION=_55 mix test test/lamplighter/sources/unifi_test.exs4c4a400): exit 19df19b7): exit 0Checks
cd /home/peak/work/lamplighter-v1-2 && curl -s -o /dev/null -H 'x-api-key: k3y' http://127.0.0.1:4198/proxy/network/integration/v1/info && curl -s --noproxy '*' -o /dev/null localhost:4131/users/log-in && timeout 170 ~/.venvs/pw/bin/python checks/unifi_browser.py | tail -1 | grep -qx ok && psql -qtA postgresql://postgres:postgres@localhost/lamplighter_dev -c "delete from sources where type='unifi'" >/dev/null, exit 0export PATH=$HOME/.local/bin:$PATH && eval "$(mise activate bash --shims)" && unset $(env | grep -oE '^(FORGEJO|GITHUB_ISSUES)[A-Z_]*'); git rev-parse --short HEAD && MIX_TEST_PARTITION=_55 mix precommit 2>&1 | tail -2 && git diff --exit-code, exit 09df19b7, in real Chromium at 390px and desktop, a UniFi source's down Garage AP groups under its down uplink Core switch ("+ 1 affected", "Caused by"), stays a Warning from its per-device rule, and nothing overflows; UniFi, settings form and full suite pass. (Nye):bash -c 'cd /home/peak/work/lamplighter-v1-2/lamplighter-58 && test "$(git rev-parse --short HEAD)" = 9df19b7 && source ../env.sh && unset FORGEJO_TOKEN FORGEJO_URL GITHUB_ISSUES_TOKEN && MIX_TEST_PARTITION=_n55 mix test test/lamplighter/sources/unifi_test.exs test/lamplighter_web/live/source_live/form_test.exs && cd ../review55 && python3 nye_unifi_pages.py 25 26', exit 09df19b7in my own worktree I read unifi.ex against the source contract and re-ran the UniFi tests plus all source and source-form tests (433 pass); I found no blocker. Untested: a real console, and the nits already named (interfaces as a list, blank lookups matching everything). (Prover):bash -c 'cd /tmp/prov55 && source /home/peak/work/lamplighter-v1-2/env.sh && unset FORGEJO_TOKEN FORGEJO_URL GITHUB_ISSUES_TOKEN && MIX_TEST_PARTITION=_pv55 mix test test/lamplighter/sources test/lamplighter_web/live/source_live', exit 0Risks
Not tried against a real UniFi console, only fakes built from the OpenAPI specs. Two non-blocking nits: the device lookup crashes if a console's device details ever return interfaces as a list (the spec says object), and a blank client lookup matches every client. When a whole switch goes down, each poll reads details for every down device behind it (one call each).
Prover
Passed (Sonnet): At
9df19b7in my own worktree I read unifi.ex against the source contract and re-ran the UniFi tests plus all source and source-form tests (433 pass); I found no blocker. Untested: a real console, and the nits already named (interfaces as a list, blank lookups matching everything).Every command above was run by Fortysix's Basecamp itself, on the branch named.
Effects show collapsed under their root on the dashboard and in history ("+ N affected"). A root's report page lists what it affects, an effect's says what caused it, and reports that opened within a minute without a link are shown as probably related. Settings → Dependencies adds links between sources with the item picker, and lists suggested links to confirm or dismiss: Find suggestions matches hosts across sources, and a diagnosis can suggest links with "Link: report X depends on report Y" lines, which are kept out of its text.Screenshots at
9df19b7against a fake console (checks/fake_unifi.py,checks/unifi_browser.py):390-type
desktop-type
390-picker
desktop-picker
390-device-rule
desktop-device-rule
9df19b77ea51521a28f2Rebased onto main
1d67708after #64 (relay agent) merged, now at51521a2. The only conflicts were where both added to the same list: the Settings tabs (Agents now sits after Sources), the settings routes, the server's supervision tree (silence sweeper added to server_children), and the API auth test's route check. No feature code changed.mix precommitpasses on every branch in the stack and CI is green.