App relays get their own section, with add and remove #7
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/app-relays"
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?
Stacks on
release/0.12.0(#6) — merge that first.What this fixes
The settings screen already showed relays in sensible groups. Underneath it offered one newline-separated textarea over the whole working set, and that box had two real defects, not just a dated look:
kind:10002andseedRelaysFromNip65re-merged it at the next login (merged = prefs.relays + discovered). It came back, and nothing on screen explained why. A delete that silently reverts reads as the app lying rather than as the relay being published by your own key.hellowent into the working set, where it could only ever fail to connect — and it failed as "not connected", which reads as the relay's fault rather than the address's.What changed
AppRelayskeeps the two sets apart and combines them only at the point of use (workingRelays), so the delete-comes-back regression is structurally impossible rather than merely fixed:kind:10002. Shown and used, not edited here; editing it means republishing your relay list, which is a separate feature with a different blast radius.A bare host gets
wss://; an explicitws://is kept (a LAN or localhost relay legitimately has no TLS);https://is refused rather than guessed at, because when the guess is wrong you get a relay that never connects and no hint we rewrote what you typed.Existing installs migrate by subtracting the known NIP-65 list from the old merged blob. An unknown user list subtracts nothing — the safe direction, leaving you connected to exactly what you were connected to.
Verification
Mutation rows each assert the patch landed via
git diff --numstatfirst — two rows initially failed to apply and were reported as invalid rather than as a false green.One thing worth reading
The first device run of this branch came back 21 of 56 red, all "relay not connected". I ran
release/0.12.0as a control and it went 55/55, which looked like a clean verdict against my change.It was not. My red run had followed a hard
pkillof a half-booted emulator; the control ran after a graceful shutdown. Two variables moved, not one. Re-running the same code with a clean emulator lifecycle gives 56/56, and the relay log tells the same story — 225 lines against 47 in the poisoned run, where it simply went deaf partway through with no error and only 3 connections.So the red was the emulator, and a control that appeared to convict my code proved nothing because I had not held the environment fixed. Worth knowing before anyone reads a future red run here as a code defect.
Confirmed and fixed here — reported by @laoc42 from a real phone,
81f139e.After signing in with a
bunker://code, "Your relay list" stayed empty while the four relays from that account'skind:10002sat under App relays, labelled added by you.One cause, both halves
Of the three ways in, only the bunker path never called
seedRelaysFromNip65. Amber'slogin()does,initdoes, and theBunkerConnectResult.Connectedbranch went straight from connected torefresh().Everything the settings screen says about provenance is derived from that one set:
RelayInventory.sectionsdecides the label purely by membership offromUserListappRelaysis the pre-split blob minus that same setAn empty set matches nothing and subtracts nothing, so every relay the user published is re-described as one they typed. That is not just cosmetic — the App relays section carries a remove button, and editing anything there persists the wrong split.
The test
Red first: the login completed with the correct identity and
nip65Relaysempty.It drives the ViewModel, not the login screen. Three attempts through the screen failed on the button rather than on the defect — the soft keyboard covering it, a non-scrolling column, coordinate-based
performClick. The pairing already has a test against a realnak bunker(BunkerSignerE2ETest), so asserting it through the UI again bought nothing.Joining the login job covers the discovery it starts, because the seed is an
asyncchild of that same coroutine — and if it is never started the join returns just as cleanly, which is exactly what the red run showed.Fixture note: the relay list under test is signed by the bunker's own key and shaped like the real one behind the report — unmarked entries plus one explicit
write, with the trailing slashes a published list actually carries.