Skip to content

refactor(walletsolana): keyless Source construction; export RPC caller seam#1

Draft
sigma wants to merge 1 commit into
mainfrom
candidate6-source-seams
Draft

refactor(walletsolana): keyless Source construction; export RPC caller seam#1
sigma wants to merge 1 commit into
mainfrom
candidate6-source-seams

Conversation

@sigma

@sigma sigma commented Jul 18, 2026

Copy link
Copy Markdown
Member

What

Candidate #6 from the architecture review ("Split walletsolana.Source's four roles"), scoped down after a grilling session. No struct split — the consumer role interfaces (sessionLister, governor in cmd/mosey) already give read/governance callers small surfaces. Instead this fixes the two real defects the review surfaced:

  1. Keyless construction. Source.SessionKey is a read-path input (it selects which session's on-chain accounts Refresh watches). The write/dashboard methods — Build*, SubmitSigned, the local signers Grant/TransferOwnership/BumpEpoch, and SessionsByOwner — take the session per call and never read it. New no longer requires it:

    • validated only when present (a malformed non-32-byte key still fails fast at construction);
    • Snapshot/VerifyNow/Refresh return a new errNoSession when it's absent.
    • Drops the placeholder zero key mosey web fabricated for the multi-session dashboard (web.go), and the unused SessionKey the CLI signing path passed (session.go).
  2. Exported RPC seam. The JSON-RPC injection point is now the exported Caller type + Options.Call (was the unexported Options.call), so the risky account-layout wiring — PDA derivation, message compilation, getProgramAccounts decode — is testable from outside the package. dialWS stays unexported (read-path WS push, out of scope).

Tests

  • Migrated the four in-package call: test sites to Call:.
  • Added walletsolana/external_test.go (package walletsolana_test) proving both capabilities from outside the package: keyless construction + errNoSession, malformed-key fail-fast, and driving SessionsByOwner through the exported Call seam.
  • go build ./..., go test ./walletsolana/... ./cmd/..., and go vet all pass.

Not doing

No SnapshotSource/Signer/TxBuilder/Directory split, no facade, no dialWS export. No CONTEXT.md change (Caller is a technical seam, not domain vocabulary) and no ADR (the constructor change is trivially reversible and unsurprising).

🤖 Generated with Claude Code

…r seam

Source's SessionKey is only used by the read path (Snapshot/VerifyNow/
Refresh, which watch one session's accounts); the write and dashboard
methods (Build*, SubmitSigned, the local signers, SessionsByOwner) take
the session per call. New no longer requires a SessionKey: it is validated
only when present (a malformed key still fails fast), and the read methods
return errNoSession when it is absent. This drops the placeholder zero key
'mosey web' fabricated for the multi-session dashboard, and the unused
SessionKey the CLI signing path passed.

Export the RPC injection point as Caller / Options.Call (was the
unexported Options.call) so the risky account-layout wiring (PDA
derivation, message compilation, getProgramAccounts decode) is testable
from outside the package; add black-box tests exercising it. dialWS stays
unexported (read-path push, out of scope).

Candidate #6 from the architecture review, scoped down: no struct split —
the consumer role interfaces (sessionLister, governor) already give
callers small surfaces.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sigma pushed a commit that referenced this pull request Jul 18, 2026
…llet seam (candidate #5, ungrilled)" description="Hoist resolveCaps + the co-owner rule (rootIsOwner && caps==AllCaps, auth/wallet.go:235) and Fold orchestration behind the wallet seam. NOT yet grilled. Must build on the unified caps type -> depends on Epic #1."
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