satmachineadmin/tests
Padreug 794d7e5395
Some checks failed
ci.yml / feat(v2): wire fee-config publish into machine + super-config triggers (#39 3/3) (pull_request) Failing after 0s
feat(v2): wire fee-config publish into machine + super-config triggers (#39 3/3)
Three trigger points wire fee_transport.publish_fee_config into the
satmachineadmin API endpoints per the #39 spec. All three soft-fail on
transport errors — the underlying CRUD operation (machine create /
update / super-config save) succeeds even when the publish couldn't
reach the relay or the signer, and the operator can re-trigger by
editing again.

views_api.py:
- api_create_machine — publishes always after create, even when
  operator fees default to 0/0 (the resulting super-only payload is
  what unblocks the ATM past its `awaiting-fees` maintenance gate).
  Reads super_config singleton; if absent (m001 should have inserted
  it, so this is an impossible state), skips the publish to avoid
  crashing create.
- api_update_machine — publishes only when either
  operator_cash_*_fee_fraction is in the patch payload. Skip on
  name/location/wallet_id/is_active/fiat_code edits since those don't
  affect the fee model the ATM enforces (avoids unnecessary relay
  churn).
- api_update_super_config — publishes to every active machine when
  either super fraction changes. Per-machine: that machine's
  operator_user_id is the signer (machines owned by different
  operators sign with different keys); each soft-fail is independent.
  Skip if only super_fee_wallet_id changed (no fee-model impact).

Tests (9 cases, all green):
- 3 create-machine triggers: default 0/0 operator fees still publishes
  super-only payload, nonzero operator fees publish full payload,
  None super_config short-circuits without crashing
- 4 update-machine triggers: publishes on cash_in change, publishes on
  cash_out change, skips on name-only, skips on is_active-only
- 2 super-config triggers: publishes per-active-machine signed by
  each machine's operator on fraction change, skips entirely on
  wallet-id-only change (with an assertion that list_all_active_machines
  is never called, proving the short-circuit path)

191/191 tests green. Layer 2 (#39) complete; ready for joint smoke
once bitspire fixes the three deploy gaps from coord-log §2026-06-01T18:30Z
(`relay.aiolabs.dev` default, `VITE_LNBITS_HTTP_URL` dead echo,
operator-fees subscriber not running in maintenance state).

Refs: aiolabs/satmachineadmin#37 (parent), #39 (closes Layer 2),
aiolabs/lamassu-next#57 (Layer 3 consumer — blocked on bitspire-side
gaps).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-01 20:07:56 +02:00
..
__init__.py feat: code quality 2024-08-13 08:20:45 +02:00
conftest.py feat(v2): record fee_mismatch_sats per settlement, Phase 1 (#38 4/5) 2026-06-01 14:34:25 +02:00
test_calculations.py refactor(v2): canonical sat-amount vocabulary + delete Lamassu-era reverse-derivation 2026-05-26 20:08:30 +02:00
test_cassette_configs.py chore(v2): lint pass — black + ruff auto-fix + mypy regressions (#29 v1.1) 2026-05-31 15:50:14 +02:00
test_cassette_state_consumer.py chore(v2): lint pass — black + ruff auto-fix + mypy regressions (#29 v1.1) 2026-05-31 15:50:14 +02:00
test_collision_guard.py feat(v2): collision guard — refuse machines whose npub matches an operator account (#32) 2026-05-31 18:45:56 +02:00
test_deposit_currency.py feat(v2): lock deposit currency to machine.fiat_code (closes #26) 2026-05-16 18:03:34 +02:00
test_fee_cap_validation.py feat(v2): CRUD + per-direction fee cap validation (#38 2/5) 2026-06-01 10:42:03 +02:00
test_fee_mismatch_recording.py feat(v2): record fee_mismatch_sats per settlement, Phase 1 (#38 4/5) 2026-06-01 14:34:25 +02:00
test_fee_publish_triggers.py feat(v2): wire fee-config publish into machine + super-config triggers (#39 3/3) 2026-06-01 20:07:56 +02:00
test_fee_transport.py feat(v2): fee_transport — kind-30078 publisher for operator fee config (#39 2/3) 2026-06-01 20:00:29 +02:00
test_nip44_v2.py chore(v2): lint pass — black + ruff auto-fix + mypy regressions (#29 v1.1) 2026-05-31 15:50:14 +02:00
test_nostr_attribution.py refactor(v2): canonical sat-amount vocabulary + delete Lamassu-era reverse-derivation 2026-05-26 20:08:30 +02:00
test_operator_split_legs.py feat(v2): principal-based fee split — fixes super under-payment (#38 3/5) 2026-06-01 11:24:09 +02:00
test_principal_based_fees.py feat(v2): principal-based fee split — fixes super under-payment (#38 3/5) 2026-06-01 11:24:09 +02:00
test_roster_resolver.py feat(v2): nostr-transport roster-resolver hook (#20 path-B) 2026-05-31 21:46:24 +02:00