Skip to content

Friglet cleanup 3/6: narrow IPC and harden key storage (SNB-661) - #69

Merged
setavenger merged 2 commits into
integrationfrom
snb-661-stack-03-ipc
Oct 11, 2026
Merged

setavenger merged 2 commits into
integrationfrom
snb-661-stack-03-ipc

Conversation

@setavenger

Copy link
Copy Markdown
Owner

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

Purpose

Narrow the IPC and CLI interfaces and make scan-key replacement crash-safe. The public protocol and on-disk key format stay the same; replacement now writes and syncs a private temporary file before renaming it into place.

The stage preserves the original reviewed commits and authorship. It is cumulative with stages 1–2 for SNB-661.

Stack

  1. Predecessor: snb-661-stack-02-library (#68)
  2. This PR: snb-661-stack-03-ipc → snb-661-stack-02-library
  3. Successor: snb-661-stack-04-daemon

Included original PRs, in merge order: #55 (SNB-676), #59 (SNB-683).

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: 257 passed, 1 ignored, 0 failed.

The combined suite includes the Unix reader/writer stress regression that allows only the old or new key during 200 replacements and checks the final 0600 mode. The original source PR did not run a Windows cross-check; this grouped stage adds no new Windows runtime evidence.

Landing

Merge the six grouped PRs in numeric order with merge commits. After #68 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 4. 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-03-ipc branch from 534cbc6 to 5778b1f Compare October 11, 2026 18:13
Base automatically changed from snb-661-stack-02-library to integration October 11, 2026 18:14
setavenger and others added 2 commits October 11, 2026 20:14
friglet-ipc items only its own module uses are private now:
write_message, read_message, SpDescriptor::scan_pubkey,
descriptor_checksum, the log-file constants and RotatingLog::with_limit.
No other crate in the workspace uses them, and neither does friglet-ui
(it uses Request/Response/StatusInfo, Client, listen, accept,
read_config_toml and DaemonConfig).

Comments: no frigletctl tool exists; state_file documents the per-wallet
file name; OkWithNote's example is what the daemon sends today;
oracle_connected describes the background poll, not a cache TTL. The
default oracle_url uses the same constant as hosted_oracle_url("bitcoin")
instead of repeating the URL. The roundtrip test sets scan_health twice;
blindbit-cli has four comments that restate the next line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
write_key_file(.., overwrite = true) truncated scan.key and then wrote
it. A crash between the two left an empty key file, and the daemon would
not start until the key was entered again. It now writes
`<name>.tmp` in the same directory (0600 from creation, enforced again
for a leftover temp file), syncs it and renames it over the key file,
like write_config_toml. The file format ("<hex>\n") and the 0600 mode
are unchanged; creating a new key (overwrite = false) still fails when
the file exists.

New test: a reader thread rereads the key while it is replaced 200
times and must only ever see the old or the new key. On the old code it
sees an empty file (failed 13 of 13 runs).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@setavenger
setavenger force-pushed the snb-661-stack-03-ipc branch from 5778b1f to f258866 Compare October 11, 2026 18:14
@setavenger
setavenger merged commit f97536b into integration Oct 11, 2026
1 check passed
@setavenger
setavenger deleted the snb-661-stack-03-ipc branch October 11, 2026 18:14
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