Repository navigation
test(gui): pin existing guards at their entry points - #32
SaulBuilds wants to merge 5 commits into
Conversation
… authority-url guards at their entry points Adds tests at the call sites (not only the helpers) for: the relay client's production constructor (token + loopback), send_sponsored's chain guard and value hand-off to the re-auth gate, the MCP dispatch origin/host guard, the CITRATE_AUTH_URL/BUNDLER_URL policy in CitrateLinkService::new, the relay calldata size cap on a canonical dynamic payload, and source-level pins for the AppCore chat wiring and the pinned-bootnode connect call. Tests only (plus a cfg(test) seam to age the re-auth clock). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KGMeatV8UjtCB4CTbWuAv4
… session/end Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KGMeatV8UjtCB4CTbWuAv4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KGMeatV8UjtCB4CTbWuAv4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KGMeatV8UjtCB4CTbWuAv4
…r call sites The UI callbacks are closures inside main(), so these are source-level pins on the production text (the test module is cut out first), by exact line, inside each handler and before the action it protects, each with a negative control: send-dialog password and recipient checks, the in-flight send flag, the unlocking flag, the seed-free verify-failure log, the faucet's testnet/selected-account checks, the chat send plan, and a stricter shape check that every contract-write confirmation gate is a plain refusal that returns before the write. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KGMeatV8UjtCB4CTbWuAv4
| )); | ||
| wallet.set_rpc_url(&stub); | ||
| wallet | ||
| .unlock(LINKED_EOA, "password123") |
BerryManifold
left a comment
There was a problem hiding this comment.
Automated Codex static review of 9a63f0fc1119127843b12c0b4b188351974643c3 is complete. Result: incomplete; details retained privately. Details and coverage limits are recorded in the project's private review log. No tests were executed by this reviewer. Both account submissions represent the same Codex review, not independent reviews.
Matr0xshka
left a comment
There was a problem hiding this comment.
Automated Codex static review of 9a63f0fc1119127843b12c0b4b188351974643c3 is complete. Result: incomplete; details retained privately. Details and coverage limits are recorded in the project's private review log. No tests were executed by this reviewer. Both account submissions represent the same Codex review, not independent reviews.
What
Tests only. These pin existing guards at their entry points, not only at the helper. For each guard listed below, I reverted the guard in place on
main@ 0656235, ran the package suite, and saw it stay green. Each new test fails on an assertion when that guard is reverted, and passes when it is restored.The production code is unchanged. The only non-test addition is a
#[cfg(test)]seam,WalletService::expire_reauth_window_for_test, which ages the re-auth clock.citrate-desktop-app
NodeAgentClient::try_newtests/relay_client_fail_closed.rs::try_new_fails_closed_on_missing_token_and_non_loopback_urlCitrateLinkService::send_sponsored(loopback JSON-RPC stub)send_sponsored_passes_the_real_value_to_the_reauth_gatesend_sponsoredsend_sponsored_refuses_off_the_aa_chainCITRATE_AUTH_URL/CITRATE_BUNDLER_URLpolicyCitrateLinkService::newnew_applies_the_authority_url_policy_to_env_overridesdispatchroutedispatch_refuses_cross_origin_and_foreign_host_before_routingRelayValidator::validatevalidator_refuses_canonical_submit_result_over_the_calldata_capct_eq,session/endct_eq_rejects_a_single_byte_difference_at_any_position,session_end_refuses_a_near_miss_owner_tokendefault_chat_endpointsAppCorewiring (source-level)appcore_chat_fallbacks_come_only_from_default_chat_endpointsconnect_to_trustedNodeService::startconnect loop (source-level)pinned_bootnode_identity_is_enforced_at_connectrev-pinned source per git crateCargo.locktests/lockfile_single_source.rs(2 tests)citrate-native
The UI callbacks are closures inside
main(), so they can't be driven without a window. These are source-level pins on the production text: the test module is cut out first, each guard is matched by its exact trimmed line, inside its own handler and before the action it protects, and each has a negative control.send_handler_requires_a_password_before_signingsend_handler_validates_the_recipient_before_signingsend_handler_disables_the_button_before_the_send_startsunlock_handler_marks_unlocking_before_the_attemptmnemonic_verify_failure_log_carries_no_seed_materialfaucet_handler_is_testnet_only_and_funds_the_selected_accountchat_send_plan_resolves_the_selected_account_and_validates_the_recipientif !confirm_tx_intent(that returns before the writenatb007_write_confirmation.rs: 3 new tests (main, app_binder, negative controls)Standard: met
cargo test -p <pkg>). Before these tests, every one of those reverts was green on the existing suites.cargo test -p citrate-desktop-app: 454 → 466 passed, 0 failed (1 ignored, unchanged).cargo test -p citrate-native --bins --tests: 192 → 202 passed, 0 failed. No window is opened and no display is needed.cargo fmt --all -- --checkpasses.cargo clippy -p citrate-desktop-app --all-targets -- -D warningsfails with the same 6 lints onmainand on this branch. The new code adds none.grant_ownersreap inhandle_initializecan never fire, because the grant store marks grants revoked and never drops them. It's worth deleting in a follow-up.🤖 Generated with Claude Code
https://claude.ai/code/session_01KGMeatV8UjtCB4CTbWuAv4