refactor(signing): extract async local event signer boundary - #7600
Closed
baxen wants to merge 2 commits into
Closed
refactor(signing): extract async local event signer boundary#7600baxen wants to merge 2 commits into
baxen wants to merge 2 commits into
Conversation
Signed-off-by: Bradley Axen <baxen@squareup.com>
🔐 Codex Security Review
|
… signing Signed-off-by: Bradley Axen <baxen@squareup.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extract an async event-signing boundary without adding a remote signer, login flow, or policy changes.
EventSigner/LocalEventSignercontracts over completed unsigned events. Construction (timestamps, tags, payload hashes), credentials, lifecycle and publication remain caller-owned.Validation
Initial extraction foundation (
59ad3ee6ce408fa71461475a2430b1b15648c44b): all listed lanes captured the same patch SHA-256 before and after execution:64b5200b5be9c306c9ee10c792b6e544b3f530ca2b67919ac8041d61c8d26707.cargo test --locked -p buzz-ws-clientflutter test --no-pub --concurrency=2buzz-terminalworkspace member teststsc --noEmitflutter analyze --no-pubThe supplemental terminal-member run initially hit
cooperative_child_exits_on_term_not_kill(KilledversusTerminated) under parallel load. A complete unchanged rerun passed. That member and its dependency graph do not use the signer extraction. No unrelated test or timeout was changed. Mobile's two transport-rotation tests now allow the signing future to complete before inspecting transport effects; their assertions are retained.The first normal pre-push run additionally passed 13 repository Rust test groups and the full mobile hook, but its second ACP invocation hit the unchanged
keepalive_resets_idle_past_deadlinetiming test (~101ms). The earlier full ACP invocation in the same hook passed. The complete normal pre-push retry passed withRUST_TEST_THREADS=4(repository Rust unit tests, another full mobile pass, file-size checks and publication guards); no unrelated tests or thresholds were changed. Only the Tauri wrapper hook is excluded because it touches shared sidecar symlink targets; direct Tauri validation is recorded above.Regression coverage includes exact legacy event IDs/fields and valid signatures, wrong-author rejection, delayed signing and failure propagation with no publication/local fallback, NIP-42 AUTH wire shape, cache success/failure behavior and cancellation during pending media auth.
This is not a claim that repository-wide
just ci, the optional Taurimesh-llmclippy variant, builds, or live-device workflows were exercised. Direct package commands avoid pnpm reinstalling reused dependencies and Tauri wrapper prerequisites touching read-only reused sidecar binaries. No UI feature or deployment is included.Async-preservation follow-up (independent review)
Additive signed-off commit:
d7a54a876d5ef139e6e991cb8435b688190fa23a(parent59ad3ee6ce408fa71461475a2430b1b15648c44b). Only mobile files changed. Final additive diff SHA-256:fa4fa4a6dbed257b145b1471aa30c1174705c0848136344d736275553b7deb74, identical before/after every final validation lane and after commit.RelaySessionNotifier.publishonto the recording B socket. The regression now passes with zero callbacks and zero B sends.flutter test --no-pub --concurrency=2— 2,145 passed (16 additional regressions). Full Dart format check,flutter analyze --no-pub, differential file-size checks and all 10 size-policy tests passed. Normal commit and push passed their mobile/publication hooks; the Tauri wrapper was excluded to avoid shared read-only sidecar mutation. Unchanged Rust/JS packages were not rerun for this mobile-only follow-up; their foundation evidence remains above.Platform.isAndroidproduction selection while allowing the Android path to be tested on the host. The new test-only platform interface dependency uses the already-locked version; no dependency upgrades.Adoption contract: capture
RelaySessionLeasebefore signing;publishandsendRawrequirelease:. Checklease.ensureCurrent()before scope-local post-await mutations.SignedEventRelaycaptures its lease at construction and must be recreated after session dependency rebuilds; ordinary reconnects retain the scope lease. Retired work throwsRelaySessionSupersededError(aStateError). Checks surround signing completion/callback and transport gate waits;RelaySocket.sendcallssink.addsynchronously with no intervening await or consumer callback after the final fence. Existing timeout, rate-limit and retry policies are unchanged.No live-device validation is claimed. Tests record actual production publish calls against a recording socket and actual video-controller calls against a fake platform, not a live relay/player. Typing was audited and migrated but has no standalone deferred-signer widget test. In-progress native initialization is cleaned up when its future settles; this patch adds no new initialization timeout.
Scope / review
The upstream base was checked as
block/buzz:mainat78618804ec86a014524ad7d1fb55928e8f5c3edf; no rebase or merge was needed. This is an extraction draft with bounded async-preservation fixes, intended as the committed foundation for a separate follow-up layer. Authentication/recovery checks stay at their existing call sites; rate-limit, request timeout and retry policies are unchanged.