Skip to content

friglet-tray: remove dead commands, lifecycle API and UI leftovers (SNB-667) - #48

Closed
setavenger wants to merge 2 commits into
integrationfrom
snb-667-tray-dead-code
Closed

setavenger wants to merge 2 commits into
integrationfrom
snb-667-tray-dead-code

Conversation

@setavenger

Copy link
Copy Markdown
Owner

Stacked on #45; review only the commits after it.

Implements SNB-667. Net −117 lines (81 added, 198 removed).

What was removed or merged, and why it was dead or duplicated

  • Tauri commands set_config and set_scan_key. They were registered, but the UI has saved settings through apply_settings since 8bf4c40 and never invokes them (grep over ui/ finds no caller). The Request::SetConfig / Request::SetScanKey protocol requests stay for wire compatibility with separately installed daemons. Only the Tauri commands go.
  • lifecycle: decide/Action (only its own test used it), attach_or_spawn (no callers; attach_or_spawn_with and attach_spawn_or_setup_with stay), and QuitAction/quit_action (an enum around one bool). perform_quit now tests the bool directly.
  • show_settings_window / show_wallet_window differed only in the tab name. They are now one function, show_window_tab(app, tab), which evals the same JS. The FRIGLET_TRAY_SHOW_ON_START parse is now a pure function of the value. Its test no longer calls unsafe std::env::set_var, whose safety comment was false because tests run in parallel.
  • get_config and send_with_note both repeated connect, request and error mapping. They now share one daemon_request helper with the same error strings, and Response::Error still becomes Err. The poller and the poll_once test helper now share record_poll instead of a copied block.
  • ErrorBook::event returned "should be logged", and its only caller ignored the value. It now returns nothing, and its test checks the entry count instead. The doc links now name the constants that exist (STALL_GRACE_SECS, UNREACHABLE_GRACE_SECS).
  • fake-daemon example: uses friglet_ipc::network::NETWORKS (the same five networks) and one scan-key check, instead of local copies.
  • UI: removed #view-…[hidden] and .col[hidden] (already covered by [hidden] { display: none !important; }), .hint code (no .hint element ever contains a <code>; hints are set with textContent), and the unused id="recent-errors" (JS and CSS use the class).
  • tauri.conf.json bundle.linux.deb.depends: a duplicate. The Tauri CLI pinned in release.yml (tauri-cli-v2.11.5, crates/tauri-cli/src/interface/rust.rs:1385-1444) starts from this list and then adds libayatana-appindicator3-1 itself (when tauri's tray-icon feature is on and pkg-config finds ayatana, which release.yml installs) plus libwebkit2gtk-4.1-0 and libgtk-3-0. tauri-bundler's debian.rs:204-207 writes the list joined, without de-duplication, so the .deb listed both packages twice. Without the block, the same packages are each listed once.

Why behaviour is unchanged

Every removed item either had no caller or is replaced by code that does the same thing. Error strings, the JS evaluated to switch tabs, the quit rule and the env values accepted by FRIGLET_TRAY_SHOW_ON_START are identical. The two removed tests covered only removed code: decide_attaches_when_probe_succeeds and quit_rule_single_boolean. The quit rule itself stays covered by the e2e test quit_shuts_daemon_down_only_when_spawned_by_tray.

Verification

  • cargo check --workspace --all-targets --all-features: 0 warnings.
  • 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: 252 passed, 1 ignored, 0 failed. That is the baseline of 254 minus the two tests named above.
  • UI: ran the built friglet-tray against fake-daemon on a private socket under Xvfb with dbus-run-session, with FRIGLET_TRAY_SHOW_ON_START set to status, settings and wallet, and took a screenshot of each. All three tabs render. Settings shows the config loaded from the fake daemon over get_config (signet, birthday 890000). The tray log shows it attached to the daemon, with no errors.
  • Not verified: pressing Save in Settings. Synthetic X11 clicks do not reach WebKitGTK under Xvfb (see AGENTS.md), and there is no other way to call the command from outside. apply_settings itself is unchanged; it goes through send_with_note, which now uses daemon_request.
  • .deb Depends: release.yml runs on this PR because tauri.conf.json changed. I will check dpkg-deb -f … Depends on its artifact and add the result in a comment.

Left out on purpose

  • features = [] on tauri-build in friglet-tray/Cargo.toml. Cargo manifests belong to the library track's manifest PR, which will take it.

setavenger and others added 2 commits October 3, 2026 08:46
Three lifecycle e2e tests wrote a shell script to a temp dir and then ran
it as the "daemon binary". The test harness runs tests on parallel
threads of one process, so another test's spawn could fork while the
script was still open for writing; the forked child holds that write
handle until it execs, and running the script in that window fails with
"Text file busy" (ETXTBSY, os error 26).

The scripts are now committed as executable fixtures under
friglet-tray/tests/fixtures/ and located via CARGO_MANIFEST_DIR, so
nothing is written while the tests run. The long-running fixture uses
`exec sleep 30`, so killing the spawned child no longer leaves a stray
sleep behind for 30 s.

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

Copy link
Copy Markdown
Owner Author

.deb Depends check on the CI-built bundles (dpkg-deb -f friglet-tray_0.1.0_amd64.deb Depends):

  • This PR (Release bundles run 37111322427): libayatana-appindicator3-1, libwebkit2gtk-4.1-0, libgtk-3-0. Each package once.
  • Without this change (ci: pin Tauri CLI 2.12.1 to match the locked tauri crate (SNB-684) #49, run 37111418621, integration plus CLI 2.12.1): libwebkit2gtk-4.1-0, libayatana-appindicator3-1, libayatana-appindicator3-1, libwebkit2gtk-4.1-0, libgtk-3-0.

Same set of packages; the duplicates are gone. CI is all green: test, Linux deb/AppImage, macOS dmg and Windows msi/nsis.

@setavenger

Copy link
Copy Markdown
Owner Author

Merged into integration through #71 on 2026-10-11 (the user live-tested the combined stack first). GitHub's stacked-PR merge rebased the stack, so this PR's commits landed with new IDs and GitHub can't mark it merged itself. The code is identical: integration now has the same tree as the tested branch friglet-deslop-live-test (08bf11d), which contains this PR's head. Closing as merged via #71.

@setavenger setavenger closed this Oct 11, 2026
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