Skip to content

Friglet cleanup 5/6: simplify tray lifecycle and setup (SNB-661) - #71

Merged
setavenger merged 5 commits into
integrationfrom
snb-661-stack-05-tray
Oct 11, 2026
Merged

setavenger merged 5 commits into
integrationfrom
snb-661-stack-05-tray

Conversation

@setavenger

Copy link
Copy Markdown
Owner

Stacked on #70; review only this stage's commits and diff.

Purpose

Consolidate the tray cleanup into one stage. It removes dead commands, lifecycle wrappers, UI leftovers, duplicate fakes and duplicate tests; binds fake sockets before spawning to avoid races; and makes tray socket selection honor the daemon's control_socket config key and precedence.

The stage preserves the original reviewed commits and authorship, including #48's ancestry through foundation PR #45. It is cumulative with stages 1–4 for SNB-661.

Stack

  1. Predecessor: snb-661-stack-04-daemon (#70)
  2. This PR: snb-661-stack-05-tray → snb-661-stack-04-daemon
  3. Successor: snb-661-stack-06-docs

Included original PRs, in merge order: #48 (SNB-667), #51 (SNB-672), #54 (SNB-679), #58 (SNB-681).

Verification

Full accumulated debug gate on this exact head:

  • cargo check --workspace --all-targets --all-features: clean, 0 warnings.
  • cargo check -p blindbit-lib --no-default-features --all-targets: 5 baseline warnings, no growth.
  • cargo clippy --no-deps -p friglet -p friglet-ipc -p friglet-tray --all-targets -- -D warnings: clean.
  • cargo fmt -p friglet -p friglet-ipc -p friglet-tray -- --check: clean.
  • cargo test --workspace: 258 passed, 1 ignored, 0 failed. The cumulative count drops by the two duplicate tray tests deliberately removed in friglet-tray: remove dead commands, lifecycle API and UI leftovers (SNB-667) #48; 66 tray unit tests and 8 lifecycle e2e tests remain green.

Original #48 ran the tray against the fake daemon under Xvfb and captured the Status, Settings, and Wallet tabs; it did not exercise Save through a synthetic WebKit click. This grouped stage did not repeat that interactive check or build a local release bundle. Its PR packaging workflow is the source of truth for the accumulated bundle artifacts.

Landing

Merge the six grouped PRs in numeric order with merge commits. After #70 lands, retarget this PR to integration, verify its base and diff, and only then merge it. Preserve the predecessor branch until this PR has been retargeted if necessary. After this PR lands, apply the same process to stage 6. Never merge a child PR into its feature-branch base.

@setavenger
setavenger added this pull request to stack #77 October 11, 2026 12:17
@setavenger
setavenger force-pushed the snb-661-stack-05-tray branch 3 times, most recently from 2f5b848 to 5012017 Compare October 11, 2026 18:14
Base automatically changed from snb-661-stack-04-daemon to integration October 11, 2026 18:14
setavenger and others added 5 commits October 11, 2026 20:14
…NB-667)

Nothing here changes what the tray does:

- Tauri commands set_config and set_scan_key: registered, but the UI
  has saved settings through apply_settings since 8bf4c40 and never
  invokes them. The SetConfig / SetScanKey protocol requests stay
  (wire compatibility with separately installed daemons).
- lifecycle: decide/Action (used only by its own test), attach_or_spawn
  (no callers) and QuitAction/quit_action (an enum around one bool;
  perform_quit now tests the bool).
- show_settings_window / show_wallet_window were copies differing only
  in the tab: one show_window_tab(app, tab). The
  FRIGLET_TRAY_SHOW_ON_START parse is a pure function of the value, so
  its test no longer sets the process environment (the unsafe set_var's
  safety comment was false: tests run in parallel).
- get_config and send_with_note share one daemon_request helper
  (connect, request, map errors); the poller and the poll_once test
  helper share record_poll.
- ErrorBook::event returned "should be logged", which its only caller
  ignored; it returns nothing now. Doc links point at the constants
  that exist (STALL_GRACE_SECS, UNREACHABLE_GRACE_SECS).
- fake-daemon example: uses friglet_ipc's NETWORKS and one scan-key
  check instead of copies.
- UI: CSS rules already covered by `[hidden] { display: none
  !important; }`, a `.hint code` rule that matches nothing, and an
  unused id="recent-errors".
- tauri.conf.json: the bundle.linux.deb.depends block. The Tauri CLI
  adds libwebkit2gtk-4.1-0 and the appindicator package itself (with
  tauri's tray-icon feature on) and does not de-duplicate, so the .deb
  listed both packages twice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- lib.rs tests: spawn_fake_daemon / spawn_fake_daemon_owned were a
  second fake next to spawn_stoppable_fake_daemon, differing only in
  canned GetStatus fields no test reads. Their four users never send
  Shutdown or check the pid, so they now use the one fake.
- lifecycle_e2e: attaches_when_daemon_already_running is covered by
  attach_carries_daemons_self_reported_ownership, which attaches the
  same way (the locator panics if consulted) and also checks the
  carried ownership.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fake daemons in the lib tests and the lifecycle e2e tests bound
their socket inside the task they spawned, so every test slept a fixed
100 ms after starting one and hoped the bind had happened by then. The
helpers now bind (friglet_ipc::listen) before spawning the accept loop
and return with the socket up, and the eleven sleeps are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…681)

The daemon listens on FRIGLET_CONTROL_SOCKET, else the config file's
control_socket, else the platform default (its env layer is merged over
the file). The tray only looked at the env variable and the default, so
with control_socket set in config.toml it never reached the daemon: it
went into first-run setup mode when nothing answered at the default
path, or spawned a daemon, waited 30 s for a socket that came up
elsewhere, killed it and kept restarting it.

setup::control_socket_path resolves the path in the daemon's order from
the default config file, and the tray uses it at startup. A daemon the
tray spawns already reads the same config file and inherits the tray's
environment, so nothing is passed to it, and nothing new is written to
the user's config.toml.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…env (SNB-681)

Only the first lookup in control_socket_path goes through the injected
env; the final fallback, friglet_ipc::default_socket_path, reads the
real FRIGLET_CONTROL_SOCKET again. Say so in the doc comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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