mirror of
https://github.com/hanzoai/commerce.git
synced 2026-11-23 11:28:44 +00:00
* The charge problem list keys on what resolves, and says which secret failed and why A policy whose accounts were seeded with secret paths that do not resolve left every processor unavailable while problems stayed empty, because it only checked that an account existed. - problems and routing.unchargeable now key on resolution: a processor that is on has no usable account unless its required secrets read from KMS and its required settings are set. Each failing secret is named by its path and why (not found, permission denied, empty value, no secret reader installed, or the reader's error), never its value. - the platform refresh re-reads an unchanged policy's secrets each cycle, so a secret sealed or rotated in KMS after boot reaches the processors without a restart, and the problem report is logged when it changes and when it clears. - secrets.Diagnose and the ErrNotFound / ErrDenied sentinels a host's reader wraps. Testing: go test ./api/billing ./secrets (each reason, one resolving account, no reader). Risk: a deployment whose secrets do not resolve now reports problems it did not before; nothing else changes. How to revert: git revert this commit. Co-authored-by: Hanzo Dev <[email protected]> * A secret that fails to read is reported with its ref and reason, and read again until it resolves secrets.String swallowed the reader's error and returned "", so one failed boot-time read looked like an empty secret and stuck. - secrets.Read returns the reason (not found, permission denied, timeout, parse error, empty value, no reader, or the reader's error), records it per ref and logs it when it changes or clears; String keeps its signature for fallbacks but no longer hides it. Values never appear in errors, logs or problems. - the platform refresh retries on a backoff (1s doubling to 15s) while any account fails to resolve, re-reading an unchanged policy's secrets each time. - a regression test: a reader that fails once ends available after the re-read; one that always fails ends in problems with ref and reason. Testing: go test ./api/billing ./secrets (non-live). Risk: none beyond logs for deployments with unreadable secrets. How to revert: git revert this commit. Co-authored-by: Hanzo Dev <[email protected]> * A seed derives every secret ref from the network's secret root A testnet seed (secrets under /cloud) named an unsealed secret under /commerce-secrets. kmsFolder now falls back to the root where any of the deployment's secrets resolves, and a test covers a testnet seed. Testing: go test ./api/billing (non-live). Risk: none. How to revert: git revert this commit. Co-authored-by: Hanzo Dev <[email protected]> * A missing webhook secret is a settlement problem, not an unchargeable one Stripe and Square stay available when only the webhook secret does not resolve; problems gain a settlement-kind entry with ref and reason, and routing.unsettleable is emitted instead of routing.unchargeable. Testing: go test ./api/billing (non-live). Risk: none. How to revert: git revert this commit. Co-authored-by: Hanzo Dev <[email protected]> * Seeded charge accounts take cards, a card-less on-processor is unchargeable, and a seed validates The seed wrote Stripe, Square and PayPal accounts with cards false, which the routing counts as unusable. Seeded charge accounts now take cards; problems flag an on-processor whose accounts all refuse cards as unchargeable; MPC and Kraken accounts an admin write would refuse (non-https endpoint, unresolved secretRef) are left out of the seed with a log line, so a seeded policy passes the same validation as an admin write. Testing: go test ./api/billing (non-live) incl. a testnet seed that takes cards and validates. Risk: seeded MPC/Kraken accounts with invalid config no longer stored. How to revert: git revert this commit. Co-authored-by: Hanzo Dev <[email protected]> * The top-up runs on any stored policy that holds no account, not only on one an older seed wrote Prod v3 and testnet v11 are admin-written policies with an empty accounts list; a policy flagged seeded at the current level returned before the top-up. The seed now tops up any stored policy without accounts and changes nothing the admin set. Testing: go test ./api/billing, including fixtures of the live shapes (with/without seeded and seedLevel) that end with card-taking Stripe, Square and PayPal accounts under the network's root that validate. Risk: a policy with no accounts is topped up at boot. How to revert: git revert this commit. Co-authored-by: Hanzo Dev <[email protected]> * The top-up test runs on the live prod v3 and testnet v11 policies as read from the admin routing GET Fixtures hold refs and paths only. Testing: go test ./api/billing -run AdminWritten (6 cases). Risk: none (test data). How to revert: git revert this commit. Co-authored-by: Hanzo Dev <[email protected]> * The live-policy top-up test covers accounts null and asserts crypto offers only the Stripe stablecoins Testing: go test ./api/billing -run AdminWritten (12 cases). Risk: none (test). How to revert: git revert this commit. Co-authored-by: Hanzo Dev <[email protected]> --------- Co-authored-by: Hanzo Dev <[email protected]>