Skip to content

wallet.backend selection is not wired into the merchant service (OpenWallet seam bypassed) #1139

Open

Description

@Amperstrand

State (2026-10-29): the selection machinery is complete and merged — tollwallet.OpenWallet(WalletConfig{Backend,Socket,...}) (src/tollwallet/select.go:29) returns the gonuts or sidecar WalletPort, and the policy manifests default cdk on every target (#1007). But the service never uses it: src/merchant/merchant.go:509 calls tollwallet.NewWalletPort (the legacy gonuts constructor) directly, and config_manager has NO wallet.* keys at all. The cdk backend is therefore unreachable from a running module — the parity lane (PR #1137) and the in-process cdk_static lane (commit 7b3f6de) exercise the wallet layer only.

What Phase 4 (module e2e, wallet.backend=cdk) needs:

  1. config_schema.go: a wallet section — backend (enum default|cdk, default per policy) + socket (default /var/run/cdk-walletd.sock, the packaged daemon's path). Schema change → run the contract lints (js-schema-lint, build-purity, ssid-format) per AGENTS.
  2. merchant.go: route newFullMerchant's wallet construction through tollwallet.OpenWallet, incl. the degraded-mode factory path (DefaultWalletFactory). Keep the gonuts path byte-identical when backend=default.
  3. e2e leg in tests/cloud-lab: merchant service + cdk-walletd sidecar (the parity rig's daemon recipe), receive→session-grant through the FULL module, daemon-kill legs at the business boundaries (receive↔session, session↔gate-open), quote persistence across daemon restarts, ErrSidecarAmbiguous reconciliation path.

Prereqs already landed: cdk-walletd packages (Amperstrand/cdk-walletd, procd START=95, seed load-or-create), sidecar CheckTokenSpent wired (PR #1137 branch), three-backend WalletPort parity proven.

Activity

  1. Amperstrand commented on Nov 5, 2026

    @Amperstrand
    CollaboratorAuthor

    Progress on the module half, re-landed on current main as PR #1200 (the #1155 branch that carried this wiring is CONFLICTING with main after the mintUnits/#1040 merge, so the slice was extracted and re-based rather than re-reviewed as a 20-commit campaign).

    Done in #1200:

    1. config schema — wallet section: backend (enum default|cdk) + socket (default /var/run/cdk-walletd.sock). Schema fences green (js-schema-lint 115 entries, build-purity, ssid-format); legacy configs parse as Backend "" → in-process default (asserted).
    2. merchant.go — newFullMerchant routes through openServiceWallet → tollwallet.OpenWallet (forwarding mintUnits, so the default path is argument-identical to the replaced NewWalletPort call), and all three degrade paths route through walletFactoryForBackend — this also covers Degraded-mode wallet factory bypasses wallet.backend (gonuts wallet constructed under backend=cdk) #1157's degraded-factory bypass, mutation-proven red on pristine main.

    Still open (campaign work, intentionally out of #1200's slice):
    3. e2e leg in tests/cloud-lab — the full module on wallet.backend=cdk with the parity rig's daemon recipe, daemon-kill legs at the business boundaries, quote persistence across daemon restarts, ErrSidecarAmbiguous reconciliation at module level. This needs the e2e/conformance-matrix commits currently living on the #1155 branch (7778f22, 7a46baf, 7f28a82, 3f4660b) rebased onto #1200 — after #1200 lands, that branch's remaining unique value is exactly this leg plus the ambiguity-surfacing fixes.

    Suggested path: land #1200 (closes #1157, items 1+2 here), then rebase #1155's cloud-lab commits on it to finish item 3 and close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions