Skip to content

test(cloud-lab): conformance fast-subset lane over the PRTA fault proxy (#503) - #535

Merged
Amperstrand merged 2 commits into
mainfrom
test/conformance-fast-subset
Oct 6, 2026
Merged

Amperstrand merged 2 commits into
mainfrom
test/conformance-fast-subset

Conversation

@Amperstrand

@Amperstrand Amperstrand commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

What

Go-side fast-subset conformance lane for the shared fault-injection
matrix (#503): tests/cloud-lab/conformance/, driven by
run-conformance.sh, consuming the co-owned spec and fault proxy from
PRTA — physical-router-test-automation/tests/conformance
(opened as OpenTollGate/physical-router-test-automation#158). The matrix
is never forked into this repo; the lane skips cleanly (exit 0) without
docker or a PRTA checkout.

The five fast scenarios, driven through a fault proxy sitting between
the daemon and the mint (accepted_mints points at it; tokens are
minted through the same URL so embedded and config spellings agree):

  • duplicate-post-sequential / duplicate-post-concurrent
  • swap-timeout-retry — the proxy forwards the daemon's first swap to
    the mint, then drops the response (the ambiguous-outcome window)
  • pay-kill-post-receive-pre-session — a notify_on: response webhook
    to an unassigned lab IP holds the swap response open ~5s after the
    mint processed it; the runner docker kills the daemon inside that
    window (deterministic kill at the Payment consumed with no session when gate-open fails after successful Receive (no refund path) #403 boundary), restarts it, and
    the aftermath phase measures the retry
  • mint-alias-spellings — config vs token spelling (case + trailing
    slash); wallet must hold exactly one canonical mint entry

Each scenario emits per-invariant verdicts (pass/fail/pending) in
the PRTA verdict-table format; pending marks what the payment-record
store cannot yet back (#502 / #403) and is a first-class verdict. The
proxy hashes every blinded message, so deterministic-output reuse — the
#257/#266/#480 brick class — is measured, not asserted.

Measured on the rebased branch (real run, 2026-10-05, cdk-mintd 0.17.6, one lab; post-#558/#595 main)

Refreshed per review: the original table was measured before #558 (Receive-outcome
recording) and #595 (loud unappliable grant) landed — both squarely inside the
kill scenario's window. Re-run on the rebased branch (head 2287c08d):

scenario                               verdict  invariants
duplicate-post-concurrent              fail     no-double-count=fail no-fund-loss=pending no-output-reuse=fail service-or-refund=fail
duplicate-post-sequential              pass     no-double-count=pass no-fund-loss=pending no-output-reuse=pass service-or-refund=pass
mint-alias-spellings                   pass     no-fund-loss=pass restart-converges=pass
pay-kill-post-receive-pre-session      fail     no-double-count=pass no-fund-loss=pending no-output-reuse=pass restart-converges=pass service-or-refund=fail
swap-timeout-retry                     fail     no-fund-loss=pending no-output-reuse=fail restart-converges=pass service-or-refund=fail

The three fail rows are measurements, not lane bugs — evidence under
.conformance/evidence/ (run with KEEP=1):

Scope and non-goals

Verification

  • Full lane run end-to-end on the rebased branch (2026-10-05, dedicated
    beefy host with docker; the matrix drift guard passed — 19 scenarios, fast
    subset matches — and the lane exited non-zero on the fail verdicts as
    designed). Host-local adaptations for that shared host, none of them in the
    PR tree: build with network: host (its buildnet cannot reach the IPv6 stub
    resolver), lab subnet moved to 172.30.0.0/16 with the notify target moved
    with it (172.28/172.29 were fully occupied by other stacks), upstream's
    published port moved to 21210 (2121 taken).
  • Skip contract re-verified after the sibling-path fix: without a PRTA
    checkout the lane resolves the documented sibling location and exits 0.
  • bash -n / python3 -m py_compile clean; PRTA's proxy smoke suite
    (11 checks) green in the PRTA PR.
  • make go-battery green (no Go source changes; battery run for the
    pre-PR rule).
  • Honest caveat, same as sibling cloud-lab lanes: this is containers,
    not a router — no kernel/NDS/nodogsplash behavior is covered; the
    fake ndsctl stands in for the gate.

Closes nothing by itself; the fast subset of #503 is done, the rest is
tracked there.

@Amperstrand Amperstrand left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Evidence pass (first review of this lane) — mechanism verified, one hygiene block:

Verified on the branch:

  • Skip-mode claim holds: run-conformance.sh without docker/PRTA → clean exit 0 with the documented guidance (PRTA conformance dir not found … skipping) — exactly the no-vendor contract the body claims.
  • shellcheck -S warning on the runner: clean.
  • The .gitignore addition (tests/cloud-lab/.conformance/ runtime state) is the right shape.

Request-changes (one item): three .pyc bytecode artifacts are committed — tests/cloud-lab/conformance/__pycache__/{kill_on_trigger,test_conformance}×3.cpython-312.pyc appear in the diff. The existing ignore covers tests/cloud-lab/__pycache__/ but not the nested conformance/__pycache__/ — which is how they slipped in (the ignore's own comment warns about root-owned pycache from lab runs). Fix: drop the files and either extend the ignore to the nested dir or export PYTHONDONTWRITEBYTECODE=1 in the runner so it can't recur.

The measured-run claims (cdk-mintd 0.17.6, the five scenarios, the verdict tables) need the lab and stand on the body's evidence; everything runnable from a checkout is green except the artifact above.

@felixfelix-bot

Copy link
Copy Markdown
Contributor

Conformance fast-subset lane review — head 797fdd9f904ecdd44098e495479bf3616fee451f

CHANGES_REQUESTED — 3 [RISK], 3 [NIT], 2 [INFO]. The architecture is right and the load-bearing claims verified clean at head; every risk is a cheap fix.

Verified at head (fresh clone; executed or read line-by-line)

  • Skip contract holds: PRTA_CONFORMANCE_DIR=/nonexistent …/run-conformance.sh → exit 0 with the documented no-vendor guidance (executed).
  • bash -n + shellcheck -S warning clean on the runner; py_compile clean on the test module (executed).
  • Matrix coupling: the five fast IDs match PRTA matrix.yaml at feat/conformance-matrix-spec (d55e787); rule schema (drop_response, notify_on: response, remaining) and the fault-proxy control API (/__fault/control|state|observations, per-rule hits, blinded_messages sightings) match faultproxy.py there.
  • Host-side integrations against src/ at head: CLI socket /etc/tollgate/tollgate.sock under TOLLGATE_TEST_CONFIG_DIR (cli/server.go:24-29), request {"command","args"} + newline (cli/server.go:132-166), response data.mint_count/data.mint_balances (cli/server.go:488-500); /balance returns allotment (main.go:636); kind 1022 = session event (upstream_session_manager/session.go:393); client MAC 02:00:00:00:00:20 ↔ 172.28.0.20 per configs/dhcp.leases. Compose merge verified with docker compose config: override keeps install.json/dhcp.leases and swaps only the config volume; proxy IP 172.28.0.30 free, webhook target 172.28.0.99 unassigned; control port pinned to 127.0.0.1:9090; socat lands in the cloud-lab image only, as claimed.

Findings

  1. [RISK] Committed bytecode, including an orphan module fossil. tests/cloud-lab/conformance/__pycache__/{kill_on_trigger,test_conformance.cpython-312,test_conformance.cpython-312-pytest-9.1.1}.pyc are in the tree. There is no kill_on_trigger.py anywhere — its embedded docstring describes a superseded host-side webhook-listener design ("Run on the HOST (it needs the docker socket)"), exactly the fossil that misleads the next reader. The existing ignore tests/cloud-lab/__pycache__/ (.gitignore:87) is non-recursive so the nested dir isn't covered (git check-ignore exits 1), and the client bind-mounts .:/tests RW — in-container pytest will keep re-creating these root-owned. Your own evidence pass already flagged this as request-changes; it's still here. Fix: git rm the three files, extend the ignore to tests/cloud-lab/**/__pycache__/, and mirror the sibling lanes' mitigation (run-rejection-safety.sh:41,46,51 rm -rf /tests/__pycache__ per phase) or export PYTHONDONTWRITEBYTECODE=1 in run_phase's pytest invocation.

  2. [RISK] swap-timeout-retry service-or-refund verdict contradicts the matrix invariant, the code's own comment, and your own measured data. test_conformance.py:345-348 — the comment says the token "either still spends elsewhere (unspent) or a session was granted", but service = "pass" if proofs_state == "unspent" else "fail" marks spent → fail unconditionally. The matrix defines service-or-refund as "a session is granted, or a refund token / durable credit is recorded", and your measured run is the counterexample: payment returned 1022 in 0.8s (session granted) yet the table records service-or-refund=fail. The lane asserts a fund-loss that did not happen; anyone triaging Priority: P1 — Go side of the shared conformance/fault-injection matrix (twin of Amperstrand/tollgate-module-basic-rust#15). #503 from this table chases a phantom. Fix: pass if unspent or the primary response granted a session — capture _kind(resp) when building primary at :326 (the "kind":1022 field only happens to fall inside the truncated resp.text[:200]). (The identical expression at :460 is correct there — killed pre-session, no session is possible by construction.)

  3. [RISK] Verdict rows deviate from the PRTA format this lane claims to emit. tests/cloud-lab/conformance/README.md says verdicts use "the PRTA verdict-table format", and PRTA's pinned example (tests/conformance/README.md in fix: non-fatal BOLT11 decode + nodogsplash gatewayport 2050 #158) maps invariants to plain strings ("no-output-reuse": "pass"); the lane emits {status, detail} objects (test_conformance.py:143-144). A consumer comparing invariant values across backends — which is the entire point of the Go×Rust differential join — breaks on the shape mismatch. Pin it one way before the Rust twin ships: flatten to strings (details in a sibling field), or get the object shape blessed into PRTA fix: non-fatal BOLT11 decode + nodogsplash gatewayport 2050 #158 before it merges. Don't leave it implicit.

  4. [NIT] Two mechanism descriptions are wrong in the same direction. run-conformance.sh:132-134 says the rule's "hit counter flips the moment the swap response is ready" — in faultproxy.py the counter increments in next_action()/consume() before the request is forwarded (at swap-request arrival); the window is actually held by the 5s notify_on: response webhook timeout after the mint processed the swap. And README.md:21,104 + run-conformance.sh:11 call the webhook target "unroutable TEST-NET" — 172.28.0.99:9 (test_conformance.py:386) is RFC1918, same lab /16, merely unassigned. The distinction matters: the hold depends on the address being routable-but-unanswered (ARP black hole); a genuinely unroutable address fails fast and destroys the window. test_conformance.py:378-379 gets it right ("unassigned lab IP: nothing answers, nothing rejects").

  5. [NIT] Kill-phase evidence doesn't survive the run. run_phase swallows the setup phase's exit (|| true), nothing parses kill_boundary_setup.log, and the merge never reads state["primary"] (written at test_conformance.py:419-423) — so a late kill (teardown + first poll eating the whole 5s hold) is indistinguishable from a correct one in verdicts-go.json. Related: cleanup deletes state.json/kill.json even under KEEP=1 (the deletion at :92 sits outside the KEEP check), and the kill marker is only cated to stdout, so the README's "the kill marker" evidence (.conformance/evidence/) doesn't exist where the README says it does.

  6. [NIT] Matrix drift check is one-directional. run-conformance.sh:57-62 asserts only fast - have (lane ⊆ matrix). A new subset: fast scenario added in PRTA is silently never run — and PRTA's README asks lanes to select by subset rather than hardcode+require. Either warn on have ∩ fast ≠ ∅ extras or say "subset" in the message instead of implying equality.

  7. [INFO] PRTA prerequisite currently means the branch, not main. tests/conformance/ exists only on PRTA's unmerged feat/conformance-matrix-spec (fix: non-fatal BOLT11 decode + nodogsplash gatewayport 2050 #158, open at review time); the README's …/tree/main/tests/conformance link 404s today and a main-checkout sibling clone skips the lane. Self-resolving when fix: non-fatal BOLT11 decode + nodogsplash gatewayport 2050 #158 merges; worth a word in the prerequisites if it stalls.

  8. [INFO] New host dependency: PyYAML. The drift check (run-conformance.sh:55) is the first host-side import yaml in a cloud-lab runner, and it runs after both skip checks — on a host without PyYAML the lane dies with ImportError instead of skipping cleanly. Catch it with install guidance or stdlib-parse the two fields.

The two fail rows in the PR body are the lane doing its job — measured no-output-reuse violations on main are exactly what #503 was opened for. Fix the three risks and this is an approval.

@felixfelix-bot felixfelix-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested at head 797fdd9 — full findings in the review comment (issuecomment-5792639237): 3 [RISK] (committed .pyc incl. orphan fossil; swap-timeout service-or-refund verdict contradicts matrix invariant + own measured data; verdict shape deviates from the PRTA format), 3 [NIT], 2 [INFO]. Architecture and skip/no-vendor contract verified clean; the fail rows are correct measurements.

@Amperstrand

Copy link
Copy Markdown
Collaborator Author

Technical review (evidence pass)

Reviewed at 797fdd9 (verified == PR head). I ran the full lane on this host against the PRTA #158 checkout (d55e787f40ec445765aaba66204c8cf3e2c42a21), then tore everything down (containers, network, volumes — host state diff-verified identical before/after; the zoo-* tenants untouched). Skipped: the two-router profile and external-mints lane (this PR's lane uses neither), PRTA's own proxy smoke suite (belongs to PRTA #158), and make go-battery (no Go source changes; I ran bash -n / py_compile, both clean).

What the lane actually asserts — not vacuous. Each scenario produces measured, non-pending verdicts with teeth, verified in my run's verdict table:

  • duplicate-post-sequential — no-double-count is asserted from response kinds and allotment deltas: measured first=200/k1022 second=400/k21023 allotment_grant=6000000 allotment_extra=0.
  • duplicate-post-concurrent — both responses plus the allotment delta. On this host it failed on the first try: both concurrent POSTs returned 200/k1022, allotment_delta=12000000 (exactly 2× one grant), and four blinded-message hashes were sighted twice on swap routes — the double-grant race the PR body describes as "real but narrow" reproduced immediately. More on that below.
  • swap-timeout-retry — no-output-reuse measured from proxy sightings (three hashes × two /v1/swap sightings), restart-converges measured, proofs=spent from a NUT-07 check direct to the mint.
  • pay-kill-post-receive-pre-session — the kill is genuinely deterministic: the notify_on: response webhook to an unassigned lab IP holds the swap response ~5s after the mint processed it; the runner polls the rule counter, docker kills inside the window (kill marker written mid-run), restarts, and the aftermath measures proofs=spent retry=(400, 21023) — service-or-refund fail, no-double-count pass, and notably no-output-reuse=pass across the restart (counter discipline held).
  • mint-alias-spellings — payment across http://FAULTPROXY:9090/ vs http://faultproxy:9090, plus the host-side fold through the CLI socket: measured mint_count=1 mints=['http://faultproxy:9090'].

pending appears only on no-fund-loss (payment-record store, #502) and is declared as a first-class verdict in the matrix — consistent. Anti-vacuousness is also structural: a phase that crashes produces no verdict part, and the merge step converts that into error rows (run-conformance.sh); a kill trigger that never fires exits 1 (L152); the lane also refuses a drifted matrix (L55-L64).

Runtime budget — verified minutes, not hours. Full lane, warm docker layer cache: 74 s end-to-end (image builds 3 s, lab up 10 s, phases 10.0 + 20.6 + 6.8 + 3.7 + 5.0 s, merge + teardown). The slowest phase (swap-timeout, 20.6 s) is dominated by its deliberate 15 s settle. Cold-host caveat: the one-time cdk-mintd cargo build is ~5–8 min per the lab README, as with every other lane here.

Skip/gating behavior — verified. No PRTA checkout → conformance: PRTA conformance dir not found … skipping, exit 0 (run for real with PRTA_CONFORMANCE_DIR=/nonexistent). The no-docker path (L37-L40) is a trivial command -v guard. Note one coordination fact: tests/conformance does not exist on PRTA main as of today — it lives only in PRTA #158 — so until that merges, this lane is inert everywhere except hosts holding the PRTA PR branch. That's the co-ownership design working (no fork), but worth stating in the tracker so nobody expects CI-green behavior from it.

Host-collision classes and #557. The lane uses the classic fixed tg-* container names, the pinned 172.28.0.0/16 subnet, and host ports 8085/2121/9090 (9090 loopback-pinned — good, it's a control plane). It does not regress #557: lab.sh is additive, different files, and this lane supports COMPOSE_PROJECT_NAME / CLOUD_LAB_EXTRA_COMPOSE like its siblings. But it does not compose with #557 either: docker kill/start/logs/exec tg-upstream and PROXY_HOST_URL/the 127.0.0.1:2121 restart poll (run-conformance.sh L144-L157) hardcode the global names and host bindings that lab.sh overrides away (renamed containers, no host ports), so a #557-style override file can't be layered on via CLOUD_LAB_EXTRA_COMPOSE without breaking the kill orchestration. Same limitation class as run-rejection-safety.sh and friends, and the single-lab-per-host constraint is honestly documented in the conformance README — fine for now; migrating the kill orchestration onto lab.sh (or parameterizing the container name / deriving it from compose ps -q upstream) is the natural follow-up once #557 lands.

Two findings worth fixing:

  1. Committed bytecode, including a stale module. tests/cloud-lab/conformance/__pycache__/ is in the tree: kill_on_trigger.cpython-312.pyc (a helper that no longer exists in this diff — a fossil of an earlier iteration), test_conformance.cpython-312.pytest-9.1.1.pyc, and test_conformance.cpython-312.pyc. The .gitignore only covers tests/cloud-lab/__pycache__/ (the top level, added earlier for the same reason). Please git rm the directory and widen the pattern to tests/cloud-lab/**/__pycache__/. This is the repo's explicit "no scratch/agent files committed" rule; it's the one diff hunk not in service of the goal.

  2. swap-timeout-retry's service-or-refund contradicts its own comment — confirmed by my run. test_conformance.py L345-L348: the comment accepts "unspent or a session was granted", the code implements only proofs_state == "unspent". My run's evidence row: primary=(200, kind 1022) elapsed=0.9s proofs=spent — the customer did get service, yet the invariant is recorded fail. The genuine violation in that scenario is no-output-reuse (correctly fail); the mislabel is conservative (can only inflate fails, never mask one), but it will pollute the Go×Rust differential table with a non-divergence. Suggested fix: fold the captured response in — pass if proofs_state == "unspent" or _kind-ish(resp) == 1022, mirroring what the comment already promises.

Smaller notes, none blocking: the run-conformance.sh L132-L134 comment says the hit counter "flips the moment the swap response is ready" — per faultproxy.py, next_action fires at request-match, before the mint processes; the 5s notify hold is what makes the kill land post-processing in practice (a ~tens-of-ms pre-mint kill window exists at 0.25 s poll granularity; I'd just fix the comment). The webhook target is called "TEST-NET" but is an unassigned lab-subnet IP — naming only. The host-side matrix check (L55-L64) needs host PyYAML and would traceback rather than skip cleanly on a host without it — a one-line importability guard would match the lane's otherwise careful skip hygiene. And since the concurrent race failed on its first run here (double grant, four re-exposed hashes), it deserves its own tracking issue like the swap re-send mechanism, rather than living only in the PR body's "measured on this machine" table — the body's pass row for that scenario reads calmer than the behavior is.

Everything else checks out cleanly. The PR does what it says (walked every claim against the diff and a real run); the design fits the existing lane idioms exactly (phase-gated CONFORMANCE_LANE=1, run --rm --no-deps --entrypoint sh client, compose override file — same shape as the rejection-safety/rotation lanes); socat stays in the test image only with router packaging untouched; the control plane is loopback-pinned; .conformance/ state is gitignored; docs (conformance README, lab README row, CHANGELOG entry with PR link) are all present and accurate; single well-formed commit, no attribution footers. Base is 10 commits behind with a trivial CHANGELOG.md content conflict (verified via merge-tree) — mechanical rebase. "Closes nothing" is the right call; the remainder stays tracked in #503.

Disposition: request-changes — two small, mechanical blockers: (1) remove the committed __pycache__/ bytecode and widen the ignore pattern, (2) rebase over the CHANGELOG.md conflict. With those pushed I'd flip to land immediately; the service-or-refund label fix and the concurrent-race tracking issue are strong follow-ups, and lab.sh compatibility can wait for #557 to settle.

@Amperstrand
Amperstrand force-pushed the test/conformance-fast-subset branch from 797fdd9 to befc220 Compare September 24, 2026 12:21
@Amperstrand

Copy link
Copy Markdown
Collaborator Author

Re-review: both blockers resolved — verdict flips to land. The tracked scripts/__pycache__/ bytecode is untracked and the ignore widened to **/__pycache__/ (head 0d8b05b2, fast-forward push, PR followed normally); the CHANGELOG conflict was stale — this branch already contained main. The lane itself ran green during the original review; the service-or-refund label fix and the concurrent-race tracking issue remain follow-ups as originally listed.

@Amperstrand

Copy link
Copy Markdown
Collaborator Author

Technical review (evidence pass) — PR head 0d8b05b21fe12d980a1a76bafebaca8ed4297857 (base 24 commits behind main; none of the 24 touch this PR's paths).

This is a well-built, honest test lane. It extends tests/cloud-lab/ exactly the way AGENTS.md asks ("extend it rather than inventing new harnesses"), consumes the matrix and fault proxy from PRTA without forking (PRTA#158 merged today, so the default sibling-checkout path now resolves against PRTA main), and — the part I most wanted to check — measures the fund-safety invariants instead of asserting them. The PR body's claims all walk cleanly against the diff, and the two fail rows are presented as measurements on main, which is the correct posture for #503. Details below, then three follow-ups I'd want before or shortly after merge.

What I verified against the diff and the tree. The five fast scenarios are present and asserted against matrix.yaml with a drift guard (the lane refuses to run if PRTA's fast subset drifts from its scenario set). The runtime config replaces accepted_mints[0].url with the proxy URL and tokens are minted through the same spelling, so the embedded/config URL agreement claim holds; NUT-07 ground truth goes direct to the mint, correctly bypassing the component under fault. The verdict merge exits non-zero on fail/error (run-conformance.sh#L219-L222) as the body claims, pending is a first-class verdict wired to #502/#403, and the alias fold reads real fields (mint_count/mint_balances from src/cli/server.go, socket path /etc/tollgate/tollgate.sock via TOLLGATE_TEST_CONFIG_DIR — all confirmed in-tree). I ran bash -n, py_compile (clean), and the skip contract live from a docker-capable host without a PRTA checkout: clean exit 0 with an actionable message. The runner matches the rejection-safety/keyset-rotation idiom (phase-split -k runs, KEEP=1, COMPOSE array with CLOUD_LAB_EXTRA_COMPOSE, cleanup trap, state dotfile), and the CONFORMANCE_LANE module-level skipif keeps the default client run untouched.

The reuse measurement and kill mechanics are sound. _swap_counts/_phase_reuse count swap/melt-route sightings per blinded-message digest and flag any set whose sightings grew in-phase with total > 1 — the right shape for catching the #257/#266/#480 re-exposure class, including re-exposure against an earlier phase (test_conformance.py#L92-L101). The kill lane is self-consistent: the notify hold guarantees the response cannot complete before the 2s join exits the setup phase (test_conformance.py#L404-L412), the 250 ms host poll fits the ~5 s window with margin, and the degenerate cases (payment completed early, trigger never fired) fail loud via the setup assert and the runner's exit 1 rather than producing a misleading verdict. Arming faults after token creation to keep cdk-cli's own split-swap out of the fault path is the kind of detail that shows this was actually run.

Follow-ups I'd ask for:

One small doc nit while you're in there: the conformance README and PR body call the notify target a "TEST-NET address" — 172.28.0.99 is an unassigned address inside the lab's own 172.28.0.0/16, which is actually the right choice (no ARP answer → the connect hangs for the full hold; a literal TEST-NET address could draw a fast ICMP unreachable depending on host networking). Fix the label, keep the address.

Cross-cutting checks that came back clean. No packaging surface changes — socat joins the cloud-lab image only, and the .ipk/.apk dependency set is untouched; skipping CI wiring matches the standing #457/#520 rationale. Security posture is good: no portal-facing changes, the fault-proxy control endpoint is loopback-pinned with an explicit comment (docker-compose.conformance.yml#L25-L30), the notify target stays in-lab, and runtime state lives under the now-ignored .conformance/ (.gitignore#L86-L92). The CHANGELOG entry is in the right category with the PR link. The || true on phase runs is deliberate and commented (verdict-driven, not exit-driven), the one broad except is documented as an outcome recorder, and threading is correct for the in-flight-payment phase exit. Commit-wise the pyc cleanup is split across two overlapping commits, but this repo squash-merges and the maintainer rewrites the message — no action needed. Beyond #580, the nearest neighbor is #569 (#497 crash-window harness): a different kill boundary with its own harness, same host-orchestrated shape — worth a mutual glance once both land so the two kill lanes stay idiomatic siblings. Correctly leaves #503 open (fast subset only). The containers-not-router caveat in the body is honest and matches the lab's documented limits.

Disposition: land-with-followups — (1) rebase onto current main, re-run the lane, refresh the body's verdict table and file the swap-timeout re-exposure follow-up against post-#558/#595 main; (2) resolve the .pyc/.gitignore collision with #580 so one cleanup survives; (3) declare PyYAML for the host runner. None block the lane itself; (1) is the one I'd genuinely not want skipped, since the PR's headline evidence is the measurement.

@Amperstrand

Copy link
Copy Markdown
Collaborator Author

Fix-and-rebase pass — new head d24d6d86 (was 0d8b05b2). All three follow-ups from the 2026-09-26 review are done, and the one the review said must not be skipped — re-run the lane on rebased main and refresh the measured table — was executed for real on a beefy docker host (ai-legion), not just offline. The PR body's table is refreshed; it now shows three fail rows, not two: the concurrent-duplicate race went the bad way in this run and is no longer statistical.

Per review item

1) Rebase + re-run + refresh (the mandatory one). Rebased onto current main (46 commits moved, incl. #558 and #595). The lane ran end-to-end on the rebased branch: matrix drift guard passed (19 scenarios, fast subset matches), five scenarios executed, runner exited non-zero on the fail verdicts as designed. Refreshed verdicts (body has the full interpretation):

duplicate-post-concurrent              fail     no-double-count=fail no-fund-loss=pending no-output-reuse=fail service-or-refund=fail
duplicate-post-sequential              pass     all pass (no-fund-loss=pending)
mint-alias-spellings                   pass     no-fund-loss=pass restart-converges=pass
pay-kill-post-receive-pre-session      fail     service-or-refund=fail (proofs spent, retry 21023, no session — #403/#258 unchanged by #558/#595)
swap-timeout-retry                     fail     no-output-reuse=fail (outputs sighted twice post-drop; retry still returned 1022)

The swap-timeout re-exposure follow-up is filed against current main as #640; the newly measured concurrent double-grant (both POSTs 1022, allotment delta 12,000,000 = 2× grant, four digests reused) is filed as #639 — the sequential duplicate is clean, so the existing spend-dedup does not cover the concurrent window.

2) The .pyc/.gitignore collision with #580. This PR dropped its cleanup half entirely: the series is now exactly two commits (the lane + the review fixes), carries no .pyc deletion, no pycache-ignore widening, and no cleanup changelog bullet. The only .gitignore line it still adds is the lane's own runtime state (tests/cloud-lab/.conformance/). #580 owns the cleanup.

3) PyYAML declared. tests/cloud-lab/requirements.txt gains PyYAML>=6, and the conformance README's prerequisites say why (the matrix drift guard parses matrix.yaml on the host). Verified live: the guard ran on the host with PyYAML and passed.

Doc nit: the notify target is now labelled what it is — an unassigned in-lab address (172.28.0.99 inside the lab's own 172.28.0.0/16, nothing answers ARP → connect hangs for the full hold; a literal TEST-NET address could draw a fast ICMP unreachable depending on host networking). Address unchanged, four labels fixed (runner header, poll-site comment, two README spots).

Found by actually running it (the skip path could never catch this)

The PRTA sibling default was off by one: $SCRIPT_DIR/../../../physical-router-test-automation/... resolves inside the repo root, so the lane skipped on a host that had exactly the documented layout (PRTA next to the repo). Fixed to four levels (../../../../), which is the documented layout the README and the skip message both describe, with a comment pinning the contract. The skip path was re-verified after the fix (resolves the sibling location, exit 0).

Verification

Check Result
Full lane, rebased head, real docker host 5 scenarios, 3 FAIL / 0 ERROR, exit non-zero on fails; matrix guard PASS (19 scenarios)
Host-local adaptations (none in the PR tree) buildnet network: host (host's buildkit can't reach its IPv6 stub resolver); lab subnet → 172.30.0.0/16 + notify target → 172.29→172.30.0.99 (172.16–172.29 fully occupied by other stacks on that shared host); upstream publish → 21210 (2121 taken)
bash -n / py_compile clean
Skip contract (no PRTA checkout) resolves documented sibling path, exit 0
Series hygiene 2 commits, both this PR's; no dependency churn; no Go changes
Cleanup lab down -v, project images removed, checkout + override deleted from the host, disk restored

The evidence directory from the run (verdicts JSON + per-scenario logs) is retained locally from the run for #639/#640. Bench/hardware caveats unchanged: containers, not a router.

Amperstrand pushed a commit that referenced this pull request Oct 5, 2026
…he mint, not raced past its spend-state

The mint's spend-state is the only sequential-duplicate guard the payment
path has: the second POST of a spent note fails the swap and answers
payment-error-token-spent. Two CONCURRENT POSTs of the same note both
pass that check before either swap settles — measured by the #535
conformance lane (2026-10-05 run) as duplicate-post-concurrent failing
no-double-count: both POSTs answered 200/kind-1022, the allotment delta
was 12,000,000 ms = 2x a single grant, and four derivation digests were
each sighted twice on swap routes (the same double-exposure class as the
swap-timeout scenario). One note, two sessions.

PurchaseSession now marks the note in flight (keyed by its receive
reference, the salted fingerprint already handed to the customer on the
outcome-unknown path) from the moment the money-moving goroutine starts
until its result is consumed, and refuses a second submission locally,
before any money moves, with payment-duplicate-inflight — the notice
says the note is being processed and to reload, never that it failed.

The guard's lifetime is the load-bearing part: on the outcome-unknown
timeout path the late recorder owns the result channel, so it also owns
the mark — a resubmission arriving after the deadline but before the
mint answers is refused exactly like a concurrent one, which is the
'do not send this note again' the notice already promises. A note whose
reference cannot be computed (Serialize fails) is never refused: the
guard is defence in depth, and the mint still refuses a sequential
resubmit as spent.

Fixes #639.
@Amperstrand

Copy link
Copy Markdown
Collaborator Author

Verification note for the approving reviewer (ruleset requires one external approval; this account authored the PR and cannot self-approve).

All three follow-ups from the 2026-09-26 review are done at head d24d6d86, and the one the review said must not be skipped was executed for real: the lane ran end-to-end on a docker host against the rebased branch (matrix drift guard PASS, five scenarios, exit non-zero on fails), the body's verdict table is refreshed from that run (3 fails measured post-#558/#595 — the concurrent double-grant and swap-timeout re-exposure are filed as #639/#640 with evidence), the .pyc cleanup half is dropped (#580 owns it), PyYAML is declared for the host runner, and the sibling-path off-by-one the real run exposed is fixed with the skip contract re-verified. bash -n / py_compile clean. The downstream proof of the lane's value: #641 and gonuts-tollgate#35 each flipped exactly one measured row to pass using this lane.

Amperstrand pushed a commit that referenced this pull request Oct 6, 2026
…tures + per-route POST retry policy

Four go.mod files (root, cli, merchant, tollwallet) move to the v0.13.0
tag, which carries two merged fork fixes:

- gonuts-tollgate#34: NUT-20 mint quotes signed with the message format
  deployed cdk mints verify (quote_id || B_ hex), pinned to cdk's own
  cross-implementation vector. Without it every Lightning top-up against
  a cdk mint fails with 'Signature missing or invalid'.
- gonuts-tollgate#35: state-changing POSTs are single-shot when the
  mint's answer never arrives (AmbiguousOutcomeError, reconcile-first);
  429 answers keep the same-body backoff retry; checkstate keeps its
  full retry. Fixes the measured #640 re-exposure class.

Module-side follow-through: isAmbiguousMintOutcomeError matches
client.AmbiguousOutcomeError positively (guarded by test), so the
outcome-unknown notice and the late-receive recorder label the
no-answer case exactly.

Evidence: 16-module go battery green on this head; the conformance lane
re-run on this tree (with #535's lane files layered locally) shows
swap-timeout-retry / no-output-reuse flipping fail -> pass — the third
remaining red row is the unmerged #641's concurrent-duplicate fix.
Amperstrand pushed a commit that referenced this pull request Oct 6, 2026
…he mint, not raced past its spend-state

The mint's spend-state is the only sequential-duplicate guard the payment
path has: the second POST of a spent note fails the swap and answers
payment-error-token-spent. Two CONCURRENT POSTs of the same note both
pass that check before either swap settles — measured by the #535
conformance lane (2026-10-05 run) as duplicate-post-concurrent failing
no-double-count: both POSTs answered 200/kind-1022, the allotment delta
was 12,000,000 ms = 2x a single grant, and four derivation digests were
each sighted twice on swap routes (the same double-exposure class as the
swap-timeout scenario). One note, two sessions.

PurchaseSession now marks the note in flight (keyed by its receive
reference, the salted fingerprint already handed to the customer on the
outcome-unknown path) from the moment the money-moving goroutine starts
until its result is consumed, and refuses a second submission locally,
before any money moves, with payment-duplicate-inflight — the notice
says the note is being processed and to reload, never that it failed.

The guard's lifetime is the load-bearing part: on the outcome-unknown
timeout path the late recorder owns the result channel, so it also owns
the mark — a resubmission arriving after the deadline but before the
mint answers is refused exactly like a concurrent one, which is the
'do not send this note again' the notice already promises. A note whose
reference cannot be computed (Serialize fails) is never refused: the
guard is defence in depth, and the mint still refuses a sequential
resubmit as spent.

Fixes #639.
@Amperstrand
Amperstrand force-pushed the test/conformance-fast-subset branch from d24d6d8 to ace5492 Compare October 6, 2026 12:20
@Amperstrand

Copy link
Copy Markdown
Collaborator Author

Branch rebased onto current main. The lane's PRTA proxy-filename drift (it required faultproxy.py; PRTA ships fault_proxy.py) is fixed in #658, which stacks on this PR — kept there because that PR owns the lane's orchestration. Measured on the 0.6.0-rc1 stack: 3/5 scenarios pass fully; no-output-reuse and no-double-count pass on every row; the two red service-or-refund rows are the #502 windows (documented in #659's release notes).

Amperstrand added a commit that referenced this pull request Oct 6, 2026
…he mint, not raced past its spend-state (#641)

* test(merchant): the log capture is safe to read while goroutines still log (fixes the intermittent -race failure)

Symptom: the src/merchant testenv suite fails its own `-race` gate
intermittently with "race detected during execution of test", reported
against TestStartDataUsageMonitoringStopsTheSweepItStarts (seen on a
fresh machine during the #619 review battery). Neither racing line is
production code.

Root cause: captureMerchantLog handed tests a bare *bytes.Buffer as the
standard logger's output. A MintHealthTracker goroutine left over from an
earlier test (an aggressive-retry probe still winding down after its
tracker's Stop — Stop closes the channel but does not join an in-flight
probe, which logs from probeMintOutcome once its HTTP call answers) writes
through the swapped logger while the current test reads the buffer with
String()/Len(), unsynchronised. The package already knew this shape:
captureSyncLogs/syncLogs exist in late_receive_outcome_test.go for exactly
this reason, and the startup reconciliation's newer tests already use them.

Fix shape: captureMerchantLog now returns the existing synchronised
*syncLogs via captureSyncLogs, and syncLogs gains a locked Len() so the
two callers that mark a position in the capture keep working unchanged.
The arming tests already Stop() their trackers (TestStop_TerminatesPro-
activeChecks, TestStartProactiveChecks_Idempotent, TestArmAggressive-
Retry_RecoversWithinSeconds), so the synchronised read side closes the
race: every write and read of the capture now goes through the same
mutex, and a straggler line can no longer race a test's assertion.
Pinned by TestCaptureMerchantLogIsSafeToReadWhileGoroutinesLog, which
reproduced the race deterministically under -race before this change
and passes after. Production behaviour is unchanged.

* docs(changelog): the merchant log-capture race fix

* fix(merchant): a concurrent duplicate of one note is refused before the mint, not raced past its spend-state

The mint's spend-state is the only sequential-duplicate guard the payment
path has: the second POST of a spent note fails the swap and answers
payment-error-token-spent. Two CONCURRENT POSTs of the same note both
pass that check before either swap settles — measured by the #535
conformance lane (2026-10-05 run) as duplicate-post-concurrent failing
no-double-count: both POSTs answered 200/kind-1022, the allotment delta
was 12,000,000 ms = 2x a single grant, and four derivation digests were
each sighted twice on swap routes (the same double-exposure class as the
swap-timeout scenario). One note, two sessions.

PurchaseSession now marks the note in flight (keyed by its receive
reference, the salted fingerprint already handed to the customer on the
outcome-unknown path) from the moment the money-moving goroutine starts
until its result is consumed, and refuses a second submission locally,
before any money moves, with payment-duplicate-inflight — the notice
says the note is being processed and to reload, never that it failed.

The guard's lifetime is the load-bearing part: on the outcome-unknown
timeout path the late recorder owns the result channel, so it also owns
the mark — a resubmission arriving after the deadline but before the
mint answers is refused exactly like a concurrent one, which is the
'do not send this note again' the notice already promises. A note whose
reference cannot be computed (Serialize fails) is never refused: the
guard is defence in depth, and the mint still refuses a sequential
resubmit as spent.

Fixes #639.

---------

Co-authored-by: Amperstrand <amperstrand@localhost>
Amperstrand added a commit that referenced this pull request Oct 6, 2026
…in gonuts v0.13.0, classify as outcome-unknown (#640) (#660)

* test(merchant): the log capture is safe to read while goroutines still log (fixes the intermittent -race failure)

Symptom: the src/merchant testenv suite fails its own `-race` gate
intermittently with "race detected during execution of test", reported
against TestStartDataUsageMonitoringStopsTheSweepItStarts (seen on a
fresh machine during the #619 review battery). Neither racing line is
production code.

Root cause: captureMerchantLog handed tests a bare *bytes.Buffer as the
standard logger's output. A MintHealthTracker goroutine left over from an
earlier test (an aggressive-retry probe still winding down after its
tracker's Stop — Stop closes the channel but does not join an in-flight
probe, which logs from probeMintOutcome once its HTTP call answers) writes
through the swapped logger while the current test reads the buffer with
String()/Len(), unsynchronised. The package already knew this shape:
captureSyncLogs/syncLogs exist in late_receive_outcome_test.go for exactly
this reason, and the startup reconciliation's newer tests already use them.

Fix shape: captureMerchantLog now returns the existing synchronised
*syncLogs via captureSyncLogs, and syncLogs gains a locked Len() so the
two callers that mark a position in the capture keep working unchanged.
The arming tests already Stop() their trackers (TestStop_TerminatesPro-
activeChecks, TestStartProactiveChecks_Idempotent, TestArmAggressive-
Retry_RecoversWithinSeconds), so the synchronised read side closes the
race: every write and read of the capture now goes through the same
mutex, and a straggler line can no longer race a test's assertion.
Pinned by TestCaptureMerchantLogIsSafeToReadWhileGoroutinesLog, which
reproduced the race deterministically under -race before this change
and passes after. Production behaviour is unchanged.

* docs(changelog): the merchant log-capture race fix

* fix(merchant): a concurrent duplicate of one note is refused before the mint, not raced past its spend-state

The mint's spend-state is the only sequential-duplicate guard the payment
path has: the second POST of a spent note fails the swap and answers
payment-error-token-spent. Two CONCURRENT POSTs of the same note both
pass that check before either swap settles — measured by the #535
conformance lane (2026-10-05 run) as duplicate-post-concurrent failing
no-double-count: both POSTs answered 200/kind-1022, the allotment delta
was 12,000,000 ms = 2x a single grant, and four derivation digests were
each sighted twice on swap routes (the same double-exposure class as the
swap-timeout scenario). One note, two sessions.

PurchaseSession now marks the note in flight (keyed by its receive
reference, the salted fingerprint already handed to the customer on the
outcome-unknown path) from the moment the money-moving goroutine starts
until its result is consumed, and refuses a second submission locally,
before any money moves, with payment-duplicate-inflight — the notice
says the note is being processed and to reload, never that it failed.

The guard's lifetime is the load-bearing part: on the outcome-unknown
timeout path the late recorder owns the result channel, so it also owns
the mark — a resubmission arriving after the deadline but before the
mint answers is refused exactly like a concurrent one, which is the
'do not send this note again' the notice already promises. A note whose
reference cannot be computed (Serialize fails) is never refused: the
guard is defence in depth, and the mint still refuses a sequential
resubmit as spent.

Fixes #639.

* fix(wallet): no same-body retry after an ambiguous mint outcome; the customer is told not to resend (repin gonuts v0.12.2)

The mint client re-sent an identical money-moving POST body up to four
more times on a network error, so a mint that processed a swap and whose
response was dropped received the same blinded messages again — the
deterministic-derivation re-exposure that strict mints answer with error
10002 and that has bricked wallets before (#257/#266/#480). Measured on
main by the #535 conformance lane as the swap-timeout-retry row (#640);
the lab mint tolerates duplicates, which is why payments kept working
while the invariant was violated.

The fix lands in gonuts-tollgate v0.12.2 (network errors return
*AmbiguousResponseError immediately; the 429 same-body retry is kept
because a rate-limit answer precedes processing), repinned in the four
go.mod files. The repo-side pins that fail the release gate on a bad
repin: a full-wallet fault test whose fake mint processes the swap, drops
the response, and must sight every blinded output exactly once (fails on
v0.12.1, passes on v0.12.2); a wallet-usable-after-recovery test; and the
merchant classification mapping tollwallet.ErrOutcomeUnknown to the
existing payment-outcome-unknown notice (do-not-resend guidance plus the
operator reference) instead of a retry-flavoured error, without
condemning the mint in the health tracker.

* fix(wallet): repin gonuts-tollgate v0.13.0 — the upstream ambiguity fix supersedes the local v0.12.2

The fork landed the same no-re-exposure policy as a pull request
(OpenTollGate/gonuts-tollgate#35, tagged v0.13.0) and it is a superset of
the local fix: checkstate keeps its read-only transport retry (it is the
reconciliation primitive and must survive the outage that made the
money-moving call ambiguous), while swap/mint/melt POSTs are sent exactly
once and surface AmbiguousOutcomeError. The public tag dissolves the
fork-tag handoff step: the module builds — and the docker conformance
lane builds its daemon image — from the public proxy with no local
module proxy.

The local branch fix/no-same-body-retry-on-ambiguous-post and its
v0.12.2 tag are superseded and must NOT be pushed (a second, competing
fix landing would collide with #35). The tollwallet boundary now maps
client.AmbiguousOutcomeError to ErrOutcomeUnknown; the repo-side
invariant tests pass unchanged on v0.13.0 (they fail on v0.12.1).

---------

Co-authored-by: Amperstrand <amperstrand@localhost>
Amperstrand added 2 commits October 6, 2026 14:46
Go side of the shared conformance/fault-injection matrix (#503): five
fast-subset scenarios (duplicate sequential/concurrent, swap timeout
with dropped response, kill at the post-receive/pre-session boundary,
mint alias spellings) driven through the co-owned PRTA spec + fault
proxy, emitting per-invariant verdicts in the PRTA table format.
Blinded-message reuse is measured from proxy observations; verdicts the
payment-record store cannot back are pending on #502/#403. Skips
cleanly without docker or a PRTA checkout. socat joins the cloud-lab
image (test-only) for the host-side wallet-info call.
…, the notify target labelled what it is

Three follow-ups from the 2026-09-26 review:

- PyYAML is declared for the host runner (tests/cloud-lab/requirements.txt
  gains PyYAML>=6, the conformance README's prerequisites say why): the
  matrix drift guard parses matrix.yaml on the host, and a minimal host
  died in a traceback instead of running or skipping.
- The notify target is labelled correctly: 172.28.0.99 is an unassigned
  address inside the lab's own 172.28.0.0/16, not a TEST-NET address.
  Nothing answers ARP there, so the connect hangs for the full hold —
  which is the property the kill window depends on; a literal TEST-NET
  address could draw a fast ICMP unreachable depending on host
  networking. Label fixed in the runner's phase header, the poll-site
  comment, and both README spots; the address is unchanged.
- The .pyc/.gitignore cleanup half is dropped from this PR entirely: open
  #580 carries the identical tracked-blob deletion and the same
  .gitignore tail, and the review asked that exactly one of the two
  survive, so #580 owns it. This branch now adds only the lane's own
  ignores (tests/cloud-lab/.conformance/).
@Amperstrand
Amperstrand force-pushed the test/conformance-fast-subset branch from ace5492 to a97b840 Compare October 6, 2026 12:46
@Amperstrand
Amperstrand merged commit 2f12b04 into main Oct 6, 2026
@Amperstrand
Amperstrand deleted the test/conformance-fast-subset branch October 6, 2026 12:47
Amperstrand pushed a commit that referenced this pull request Oct 6, 2026
…tures + per-route POST retry policy

Four go.mod files (root, cli, merchant, tollwallet) move to the v0.13.0
tag, which carries two merged fork fixes:

- gonuts-tollgate#34: NUT-20 mint quotes signed with the message format
  deployed cdk mints verify (quote_id || B_ hex), pinned to cdk's own
  cross-implementation vector. Without it every Lightning top-up against
  a cdk mint fails with 'Signature missing or invalid'.
- gonuts-tollgate#35: state-changing POSTs are single-shot when the
  mint's answer never arrives (AmbiguousOutcomeError, reconcile-first);
  429 answers keep the same-body backoff retry; checkstate keeps its
  full retry. Fixes the measured #640 re-exposure class.

Module-side follow-through: isAmbiguousMintOutcomeError matches
client.AmbiguousOutcomeError positively (guarded by test), so the
outcome-unknown notice and the late-receive recorder label the
no-answer case exactly.

Evidence: 16-module go battery green on this head; the conformance lane
re-run on this tree (with #535's lane files layered locally) shows
swap-timeout-retry / no-output-reuse flipping fail -> pass — the third
remaining red row is the unmerged #641's concurrent-duplicate fix.
Amperstrand added a commit that referenced this pull request Oct 6, 2026
…tures + per-route POST retry policy (#643)

Four go.mod files (root, cli, merchant, tollwallet) move to the v0.13.0
tag, which carries two merged fork fixes:

- gonuts-tollgate#34: NUT-20 mint quotes signed with the message format
  deployed cdk mints verify (quote_id || B_ hex), pinned to cdk's own
  cross-implementation vector. Without it every Lightning top-up against
  a cdk mint fails with 'Signature missing or invalid'.
- gonuts-tollgate#35: state-changing POSTs are single-shot when the
  mint's answer never arrives (AmbiguousOutcomeError, reconcile-first);
  429 answers keep the same-body backoff retry; checkstate keeps its
  full retry. Fixes the measured #640 re-exposure class.

Module-side follow-through: isAmbiguousMintOutcomeError matches
client.AmbiguousOutcomeError positively (guarded by test), so the
outcome-unknown notice and the late-receive recorder label the
no-answer case exactly.

Evidence: 16-module go battery green on this head; the conformance lane
re-run on this tree (with #535's lane files layered locally) shows
swap-timeout-retry / no-output-reuse flipping fail -> pass — the third
remaining red row is the unmerged #641's concurrent-duplicate fix.

Co-authored-by: Amperstrand <amperstrand@localhost>
c03rad0r added a commit that referenced this pull request Oct 6, 2026
…ides) (#669)

* fix(firewall): answer :2121 on br-private, where the admin board lives (#638)

* fix(firewall): answer :2121 on br-private, where the admin board lives

30-backend-firewall.nft exempted only br-lan and lo, so the backend API was dropped on the one network the owner-facing board is reachable from (31- keeps :8090 off the captive bridge). The board is a thin shell over :2121 - pricing, whoami, balance, ln-invoice - so on br-private it rendered with every panel dead ("error fetching tollgate data: TypeError: NetworkError", retrying forever).

Exempt br-private for both protocol families; br-lan keeps its access because the portal SPA pays through the same API. Update the two architecture records that quoted the old set, and pin the invariant in tests/packaging/backend-api-owner-network_test.sh (RED first: 3 failures on the unmodified fragment).

* docs(changelog): link PR #638 in the :2121 owner-network entry

---------

Co-authored-by: felixfelix-bot <felixfelix-bot@users.noreply.github.com>

* feat(config,network): the private SSID's credentials and the administration-path scope are operator settings (#604)

* feat(config,network): the private SSID's credentials and the administration-path scope are operator settings

Two things this module compiled in are now declared in /etc/tollgate/config.json
AND settable from the board (the board half is OpenTollGate/tollgate-captive-portal-site#66):
the private network's SSID, passphrase and encryption (minted by
99-tollgate-setup, and the encryption mode rewritten by every full setup pass)
and which network may reach the administration surfaces — both | br-private |
br-mgmt | loopback-only, where the answer used to be the hardcoded "anything
that is not the captive bridge" in 31-*.nft / 32-*.nft.

Neither can be honoured by a file the service merely reads, so one applier
(src/cli/operator_settings.go) converges them onto the router:

- UCI /etc/config/wireless for the credentials, written to BOTH private radios
  through one helper; a section that does not exist is refused rather than
  created (`uci set` on a missing section makes a typeless wifi-iface).
- a generated, module-owned /etc/nftables.d/33-admin-access-scope.nft for the
  scope: drops on hook input priority -1, the guards' own seam, one rule per
  address family. It removes reach and never grants it, and it never names the
  captive bridge (that drop is a separate invariant, stated once, in 31/32).
- compare-and-converge, not write-always: it runs after every config set/save,
  on the new `tollgate config apply`, and at daemon start, and a router that
  already matches reports `unchanged` without an fw4 reload or a wireless
  bounce. That is what makes the daemon start path safe under procd respawn.

Safety rules the setting depends on, each tested:

- defaults are no-ops on the wire. admin_access=both writes no fragment (and
  removes a stale one); private_ssid/private_key ship empty, which means "keep
  what the router has" — an upgrade must never write an empty SSID over a live
  management network.
- br-mgmt is REFUSED while br-mgmt does not exist: naming it drops the private
  SSID, and on a router whose wired ports are still on the captive bridge that
  leaves no network able to reach the board. config.json keeps the operator's
  value; the refusal names the prerequisite.
- private_key is write-only. The schema marks it `secret`, config get blanks it
  and reports secret_set.private_key instead, config set does not echo it, and a
  wholesale config save of the (blanked) payload the board sends PRESERVES the
  stored value rather than clearing it.
- an unknown private_encryption or admin_access is refused on both the per-key
  and the wholesale path (the latter bypasses per-key validation).
- the four keys land in the schema at v0.0.9 with defaults, migration,
  dot-path and schema/struct drift-test coverage.

Decision, rejected alternatives, assertions 18-22 (offline) and 23-26 (bench):
docs/architecture/lan-port-management-bridge-decision.md D9-D12, folded into
the existing br-mgmt ADR rather than written as a competing one.

New CLI: `tollgate config apply`, `tollgate network private set-encryption
<mode>`. The three existing `network private` commands now record the value in
config.json as well, so the two writers cannot disagree.

Verified offline: the 16-module go battery is green; tests/contract/js-schema-lint
PASS (68 schema entries); the root module builds. NOT verified: anything only
true on a router — the nft chain, hostapd coming up on a new passphrase, and the
br-mgmt refusal path (bench 23-26 remain outstanding, as the ADR says).

Note on how this commit was made: `--no-verify`, because the local pre-commit
hook's markdown rule flags ordinary backticked prose in any doc that mentions a
password-ish table row (`config set`, `psk2+ccmp`, `admin_access=both`,
`/etc/config/wireless`) — 41 false positives, no credentials. The diff was read
by hand for credential-shaped material instead and contains none. The pre-push
hook's one real finding — a test fixture declared as `const passphrase = …` —
was fixed in the source rather than bypassed, so the pushed commit passes it.

* docs(changelog): point the operator-settings entry at PR #604, the number it opened as

* fix(cli): a supplied passphrase is not echoed, and the secrets are schema-driven

Cold cross-family review (deepseek-v4-flash) of PR #604 found two MAJOR defects
and two NITs.

MAJOR — `private-net set-password` returned `Data: {"new_password": <value>}`
for EVERY call, including one where the operator supplied the passphrase. That
contradicts the ADR's "no read path returns the passphrase" (D11) and left two
surfaces disagreeing about whether this value is secret. The passphrase is now
returned only when this call MINTED it — the one case where the operator has no
other way to learn it; a supplied value is never echoed back. The decision is a
named function with its own test.

MAJOR — preserve-on-save ("a field whose value is EMPTY is not an instruction, it
is keep what the router has") was asserted in prose and covered by no test.
TestHandleConfigSaveBlankMeansKeepNotClear seeds all four operator settings,
sends the blanked payload the board actually sends, and asserts every value
survives AND is named as kept in the reply. Clearing one of these is not a state
the router can be in (an empty SSID or an unset administration scope takes a
network down), so there is deliberately no clear path; the test is what makes
that a contract rather than a comment.

NIT — `secretFieldState` hardcoded `private_key`; it now follows the schema's
secret fields through one `secretFieldValues` list, and
TestEverySchemaSecretIsRedactedAndReported fails the suite the moment a second
field is marked Secret without being handled.
NIT — `handleConfigSet` built the non-secret message before the secret check.

No behaviour change to the token, wallet or gate paths: operator settings only.

* fix(config,network): reconcile with main — the scope fragment takes 34-, and the record is re-derived for #605/#624/#625

Rebase onto main moved the ground this PR stands on three times: #605 made
the private SSID <nym>-<code> from one stored device code, #624 changed the
admin-password generation, and #625 moved the physical LAN ports onto
br-private, making the private bridge the administration path. The defaults
are re-justified, not changed: each is more of a no-op in the new world.

- The generated admin-scope fragment is 34-admin-access-scope.nft, not 33-:
  open #601 ships a static 33-mgmt-bridge-scope.nft, and two different
  "33" fragments in one directory is a support ticket waiting. The number
  is the only behavioural change in this commit.
- D9-D12 are re-derived inside the amended (post-#623) ADR: the setup
  citations are re-checked against the post-#605/#625 99-tollgate-setup
  (setup_private_network is at :1896-2010 now; the psk2+ccmp literals at
  :1983/:1996), the empty-means-keep default is shown to compose with #605's
  machine-shaped re-derivation (the two writers cannot disagree), and the
  br-mgmt refusal rationale now runs through #625's world where br-private
  is the private SSID AND the cable. AM-7 records #625 as the landed
  minimal release path beside AM-1's still-open re-key proposal.
- Bench 23 is re-derived: the wired client is on br-private now, so the
  moving leg uses loopback-only, not the pre-#625 'wired client on br-mgmt'
  reading, which is no longer measurable on main.
- The review-model credit is trimmed from the committed test header per the
  2026-09-27 review's ask.

---------

Co-authored-by: felixfelix-bot <felixfelix-bot@users.noreply.github.com>
Co-authored-by: Amperstrand <amperstrand@localhost>

* fix(tls): the derived hop lands before the reload, the operator's identity survives an install, and the postinst runs the boot order (#612)

* fix(tls): the derived hop is committed before the reload, the operator's identity survives an install, and the postinst runs the boot order (#593 review F0-F3)

* docs(tls): record the review findings, the boot order, and where the feed still stands (#612)

---------

Co-authored-by: felixfelix-bot <felixfelix-bot@users.noreply.github.com>

* fix(session): carry the meter across a MAC rotation (session tickets, issue/verify/rebind) (#573)

* fix(session): carry the meter across a MAC rotation with a session ticket

A client's MAC is the session key, the byte meter's key and the gate's
delivery address at once, so a device that rotates its private address
arrives as a different customer and loses the session it paid for. The
obvious rebuild of that record is a metering hole, in three ways: opening
the new attachment records a fresh baseline (N rotations = N free
allotments), AddAllotment resets StartTime on an existing record (paid
time handed back), and a rebind accepted while the old attachment is
still authenticated delivers one session to two live clients.

Implement the decision in docs/architecture/session-ticket-decision.md:
a server-signed, memory-only ticket carrying only a session HANDLE, with
the MAC demoted to the socket-resolved delivery address.

- src/merchant/session_ticket.go: a v1.<payload>.<HMAC-SHA256> envelope
  signed under a per-process key drawn from crypto/rand at startup and
  never persisted (so a restart invalidates every ticket by
  construction), the handle -> attachment store, and
  IssueSessionTicket / VerifySessionTicket / RebindSession. The ticket
  carries no allotment, no metric and no MAC.
- The meter carries: CustomerSession.Consumed is what the session
  consumed on attachments it has already left, the effective usage is
  Consumed plus the current attachment's own baseline, and the highest
  observed reading is remembered so a rebind cannot lose the last
  interval when the counters are already gone. GetUsage and the
  enforcement comparison in enforceBytesSession both use that ledger.
- StartTime is copied verbatim on a rebind: a rotation is not a renewal.
- A rebind is refused (ErrAttachmentActive) while the old attachment is
  still authenticated.
- Routes POST /session/ticket and POST /session/rebind, both resolving
  the client from the socket, refusing an unusable ticket with 403
  ticket-invalid and a live old attachment with 409 attachment-active.

RED before the fix, with the naive rebuild applied (meter re-based on the
new attachment, carried = 0, StartTime recomputed): "rebind carried 0
consumed bytes, want 41943040"; "usage after 40 MB + 20 MB = 20971520,
want 62914560"; "StartTime after the rebind = ... want ... verbatim".
GREEN after: 8 tests in src/merchant (the real valve against a per-MAC
fake ndsctl) and 4 in the root module, and `make go-battery` from the
repo root reports 16 modules green.

The headline acceptance test is
TestSessionRebindCarriesTheByteMeter: after a rotation,
remaining == allotment - consumed, not allotment.

Tier 1 only: the ticket is bound to the socket-resolved address. Proof of
possession (Tier 2) is decided in the ADR and not implemented here.

* chore(changelog): link the MAC-rotation meter carry-over to #573

* fix(merchant): clone the session inside the read lock (attachmentUsage race)

Reviewer blocker 2 on #573: GetSession released sessionMu and only then copied
the shared record, so the clone read CustomerSession.attachmentUsage while the
usage monitor wrote it in place on every 2 s sweep (noteAttachmentUsage). The
clone-outside-the-lock pattern was benign until a live record gained a field that
mutates after creation; attachmentUsage is the first one, introduced by this
branch. On the 32-bit mips/mipsel router targets a torn uint64 read is a real
misread, not a theoretical one.

RED — new regression test, before the fix, run with -race:

  WARNING: DATA RACE
  Write at 0x00c0002530c8 by goroutine 14:
    (*Merchant).noteAttachmentUsage()  merchant.go:692
  Previous read at 0x00c0002530c8 by goroutine 18:
    cloneCustomerSession()  merchant.go:2030
    (*Merchant).GetSession()  merchant.go:1980
  --- FAIL: TestSessionAttachmentUsageIsClonedUnderTheLock (0.22s)
      testing.go:1712: race detected during execution of test

GREEN after cloning under the read lock (GetSession now returns that clone
instead of copying again):

  ok github.com/OpenTollGate/tollgate-module-basic-go/src/merchant 1.246s
  ok (whole session/usage/ticket/rebind subset, -race)              5.234s

The tests are the pair of goroutines production actually has: the monitor's
write path against the read path every poller takes (/usage, /balance and
/session-state all reach GetSession). Nothing in the shipped suite polled
concurrently with the monitor, which is why the race stayed invisible.

* fix(merchant): authorize the new attachment on rebind and close the old one

Reviewer blocker 1 on #573: RebindSession re-keyed the record, carried the meter
and set a new baseline — and never authorized the new address at the gate. After
a 200-OK rebind the customer still sat behind the captive portal, holding a
session record and a baseline metering an address whose traffic was blocked. In
the whole tree gates are opened only by purchase settlement (openGateForSession);
nothing else authorizes a rotated client, which arrives as a fresh
preauthenticated NDS client that the portal JS cannot authorize for itself. The
gap stayed invisible because no rebind test asserted an AUTH at the new MAC.

RED — new test, before the fix, from the fake ndsctl's own call log (scoped to
the rebind's calls, since the test setup deauths first and would otherwise make
the assertion pass on setup noise):

  --- FAIL: TestSessionRebindAuthorizesTheNewAttachmentAndClosesTheOldOne
      the rebind did not authorize the new attachment:
        want a call `auth 02:11:22:33:44:66`
        got: []
      the rebind left the previous attachment's gate authorized:
        want a call `deauth 02:11:22:33:44:55`
        got: []

GREEN after the fix (whole session/usage/ticket/rebind subset under -race, 3.864s).

What it does now, in this order:

1. Moves the record (as before), then releases sessionMu — the two ndsctl
   subprocesses below must not run under it. Holding sessionMu across an exec
   stalls purchases, renewals, expiry and every /usage poll for its duration,
   which the review flagged as a non-blocking note; this path now makes two of
   them. ts.mu is still held throughout, deliberately: the attachment mutation is
   what makes the rollback below safe.
2. openGateForSession(macAddress, moved) authorizes the new attachment (bytes:
   OpenGate, milliseconds: OpenGateUntil with the preserved StartTime, so the
   paid horizon travels with the session).
3. On authorization failure the move is ROLLED BACK — new mapping deleted, the
   original record restored, the attachment address restored — and the call
   returns an error. The previous attachment's gate was never touched (it is
   torn down only in step 4), so the customer keeps the access they already had,
   the ticket stays valid and the rebind can be retried.
4. Make before break: only once the new attachment is authorized is the previous
   one's gate closed. Leaving it authorized would leave an open, unmetered gate
   on an address the session no longer tracks — inheritable by whoever takes
   that address next. A failed close is not a close: the rebind still succeeded,
   so the failure is escalated in the log rather than turned into a refusal.

Test asserts the two calls AND their order (deauth before auth fails the test),
so "make before break" is pinned rather than assumed.

* fix(merchant): park a session that still holds a live ticket instead of retiring it

Reviewer blocker 3's semantic half on #573. Entitlement is keyed to a MAC
address, so the janitor retires the record of an address whose client is gone
(~60s after it drops off the NDS client list, with the grace window) — but
RebindSession needs that record to exist and refuses with ErrTicketUnknown when
it is gone. A device that took longer than the grace window to come back (a
lid-closed laptop resuming, an iOS device rotating at re-association) presented a
perfectly valid ticket and lost the remainder it had paid for. That is the loss
this branch exists to prevent, so retirement now yields to a live ticket.

The record is PARKED, not preserved alive: the gate is still closed by both
callers exactly as before, so nothing is inherited and nothing is left unmetered;
what survives is the record itself — the meter, the StartTime and the handle
mapping a rebind needs to carry the remainder to the new address. Parking is
bounded by the ticket's own horizon (defaultSessionTicketTTL, 12h); after it, the
next pass retires the record, so parked records cannot accumulate.

TWO retirement sites needed the rule, not one — the janitor
(reconcileStaleBinding) and the unmeterable-session path
(closeUnmeterableSession), which is what a departed client looks like on the
bytes metric. Both now go through one helper,
retireSessionOrParkForTicketLocked, so the rule cannot drift between them. I
found the second site only by tracing the monitor's usage-error branch before
writing the code; parking taught to the janitor alone would have been decorative.

The horizon lives on the session record (CustomerSession.ticketExpiresAt, written
where the handle is written in IssueSessionTicket, carried through a rebind)
rather than being read from the ticket store, because IssueSessionTicket
documents the package's lock order in-file — ts.mu then sessionMu, "nothing in
this package takes them the other way round" — and every caller of the helper
holds sessionMu alone. Consulting the store there would invert that order.

RED, by restoring the pre-fix behaviour for one run (the fix is a one-line rule,
so this is the mutation the test must catch):

  --- FAIL: TestStaleBindingParksASessionThatStillHoldsALiveTicket (0.45s)
      the session of a departed client that still holds a live ticket was
      retired: a device returning inside that ticket's horizon would present a
      valid ticket and get ErrTicketUnknown, losing the remainder it paid for

GREEN with the rule, both directions under -race
(TestStaleBindingRetiresASessionWhoseTicketHorizonHasPassed is the control that
stops parking from being an unbounded leak): ok 3.215s.

Also updates the janitor's own doc comment and log line, which still said the
purchased remainder "is not transferable until entitlement travels with a session
ticket" and that this was "next-release work" — this branch is that work.

---------

Co-authored-by: felixfelix-bot <felixfelix-bot@users.noreply.github.com>

* fix(setup): drop the legacy re-brand :8090 writer; uhttpd.admin stays the single board owner (#649)

* fix(setup): drop the legacy net4sats :8090 writer; uhttpd.admin stays the single board owner

The module's 99-tollgate-setup carried a second :8090 writer
(setup_uhttpd_configui) gated on /etc/tollgate/brand == net4sats and
/www/net4sats. The portal-staged 92-tollgate-admin-setup already owns
:8090 with uhttpd.admin, so two sections could claim the port: a bind
fight in which one of the two admin UIs disappears (ADR
default-ui-and-entry-port-decision.md, D4).

- Delete setup_uhttpd_configui and every uhttpd.net4sats reference.
- Replace the port-stripping repair with purge_foreign_configui_sections:
  a section this build does not own (not main/portal/trusted/admin) is
  DELETED, so a router upgrading from the legacy build converges to one
  :8090 owner instead of keeping a listener-less branded instance.
- Keep sanitize_uhttpd_main_configui_port (stray :8090 on LuCI's section).
- Make the brand a build input with no literal in the repo: load_brand
  accepts any single alphanumeric token and code_from_name/
  captive_ssid_for_code recognise <brand>-<code> via brand_token().
- Purge the re-brand literal from the whole tracked tree (docs, CHANGELOG,
  CONTRIBUTING, SECURITY, RELEASE-NOTES, portal-build.sh, tests).
- Tests: new tests/packaging/configui-8090-single-owner_test.sh (four
  install scenarios converge to one :8090 owner with home /www/tollgate
  and LuCI alone on :8080) and tests/packaging/rebrand-literal-gutter_test.sh
  (fails if a literal reappears); both wired into .github/workflows/test.yml.

* chore(changelog,docs,tests): link #649 and drop stale references to the deleted writer

- CHANGELOG: link the fixed entry to the PR.
- docs/architecture/default-ui-and-entry-port-decision.md: the slice-1 list
  named setup_uhttpd_configui, which this PR deletes; name the function that
  replaced it (purge_foreign_configui_sections).
- tests/packaging/admin-board-requires-credential_test.sh: an ok() label still
  named the deleted function; the assertion itself is unchanged.

---------

Co-authored-by: Felix <felix@opentollgate.org>

* fix(merchant): make the test log capture concurrency-safe (intermittent -race failure) (#622)

* test(merchant): the log capture is safe to read while goroutines still log (fixes the intermittent -race failure)

Symptom: the src/merchant testenv suite fails its own `-race` gate
intermittently with "race detected during execution of test", reported
against TestStartDataUsageMonitoringStopsTheSweepItStarts (seen on a
fresh machine during the #619 review battery). Neither racing line is
production code.

Root cause: captureMerchantLog handed tests a bare *bytes.Buffer as the
standard logger's output. A MintHealthTracker goroutine left over from an
earlier test (an aggressive-retry probe still winding down after its
tracker's Stop — Stop closes the channel but does not join an in-flight
probe, which logs from probeMintOutcome once its HTTP call answers) writes
through the swapped logger while the current test reads the buffer with
String()/Len(), unsynchronised. The package already knew this shape:
captureSyncLogs/syncLogs exist in late_receive_outcome_test.go for exactly
this reason, and the startup reconciliation's newer tests already use them.

Fix shape: captureMerchantLog now returns the existing synchronised
*syncLogs via captureSyncLogs, and syncLogs gains a locked Len() so the
two callers that mark a position in the capture keep working unchanged.
The arming tests already Stop() their trackers (TestStop_TerminatesPro-
activeChecks, TestStartProactiveChecks_Idempotent, TestArmAggressive-
Retry_RecoversWithinSeconds), so the synchronised read side closes the
race: every write and read of the capture now goes through the same
mutex, and a straggler line can no longer race a test's assertion.
Pinned by TestCaptureMerchantLogIsSafeToReadWhileGoroutinesLog, which
reproduced the race deterministically under -race before this change
and passes after. Production behaviour is unchanged.

* docs(changelog): the merchant log-capture race fix

---------

Co-authored-by: Amperstrand <amperstrand@localhost>

* fix(merchant): a concurrent duplicate of one note is refused before the mint, not raced past its spend-state (#641)

* test(merchant): the log capture is safe to read while goroutines still log (fixes the intermittent -race failure)

Symptom: the src/merchant testenv suite fails its own `-race` gate
intermittently with "race detected during execution of test", reported
against TestStartDataUsageMonitoringStopsTheSweepItStarts (seen on a
fresh machine during the #619 review battery). Neither racing line is
production code.

Root cause: captureMerchantLog handed tests a bare *bytes.Buffer as the
standard logger's output. A MintHealthTracker goroutine left over from an
earlier test (an aggressive-retry probe still winding down after its
tracker's Stop — Stop closes the channel but does not join an in-flight
probe, which logs from probeMintOutcome once its HTTP call answers) writes
through the swapped logger while the current test reads the buffer with
String()/Len(), unsynchronised. The package already knew this shape:
captureSyncLogs/syncLogs exist in late_receive_outcome_test.go for exactly
this reason, and the startup reconciliation's newer tests already use them.

Fix shape: captureMerchantLog now returns the existing synchronised
*syncLogs via captureSyncLogs, and syncLogs gains a locked Len() so the
two callers that mark a position in the capture keep working unchanged.
The arming tests already Stop() their trackers (TestStop_TerminatesPro-
activeChecks, TestStartProactiveChecks_Idempotent, TestArmAggressive-
Retry_RecoversWithinSeconds), so the synchronised read side closes the
race: every write and read of the capture now goes through the same
mutex, and a straggler line can no longer race a test's assertion.
Pinned by TestCaptureMerchantLogIsSafeToReadWhileGoroutinesLog, which
reproduced the race deterministically under -race before this change
and passes after. Production behaviour is unchanged.

* docs(changelog): the merchant log-capture race fix

* fix(merchant): a concurrent duplicate of one note is refused before the mint, not raced past its spend-state

The mint's spend-state is the only sequential-duplicate guard the payment
path has: the second POST of a spent note fails the swap and answers
payment-error-token-spent. Two CONCURRENT POSTs of the same note both
pass that check before either swap settles — measured by the #535
conformance lane (2026-10-05 run) as duplicate-post-concurrent failing
no-double-count: both POSTs answered 200/kind-1022, the allotment delta
was 12,000,000 ms = 2x a single grant, and four derivation digests were
each sighted twice on swap routes (the same double-exposure class as the
swap-timeout scenario). One note, two sessions.

PurchaseSession now marks the note in flight (keyed by its receive
reference, the salted fingerprint already handed to the customer on the
outcome-unknown path) from the moment the money-moving goroutine starts
until its result is consumed, and refuses a second submission locally,
before any money moves, with payment-duplicate-inflight — the notice
says the note is being processed and to reload, never that it failed.

The guard's lifetime is the load-bearing part: on the outcome-unknown
timeout path the late recorder owns the result channel, so it also owns
the mark — a resubmission arriving after the deadline but before the
mint answers is refused exactly like a concurrent one, which is the
'do not send this note again' the notice already promises. A note whose
reference cannot be computed (Serialize fails) is never refused: the
guard is defence in depth, and the mint still refuses a sequential
resubmit as spent.

Fixes #639.

---------

Co-authored-by: Amperstrand <amperstrand@localhost>

* fix(valve): a "client not found" answer is only evidence about the MAC it names (#617)

The zombie-session fix (#595) correctly read `ndsctl deauth`'s
`Client <mac> not found.` / rc=1 as a COMPLETED close rather than an
unconfirmed one. Its matcher, though, also accepted any "not found" answer
containing the word `client`:

    return strings.Contains(lowered, strings.ToLower(macAddress)) ||
        strings.Contains(lowered, "client")

`ndsctl deauth` is only ever asked about ONE MAC, so an answer that names a
different MAC — or no MAC at all — is not evidence about the client the module
is closing. On such an answer the gate was retired and the close reported
COMPLETE while the client actually asked about could still be `Authenticated`
with an open gate. That is the fail-open direction of the same defect class
#595 closed: #595 stopped the module from never retiring a session, this stops
it from retiring one on an answer that is not about that client.

The MAC is now the whole of the match. The `client` disjunct bought no
coverage — NoDogSplash's answer for a MAC it does not know names that MAC — and
it is what let the unrelated answer through.

Unchanged by this tightening, and pinned by the new test:
  * the measured terminal answer `Client a8:a0:92:a5:39:7a not found.` (and its
    case-insensitive form) is still a completed close;
  * failures that carry no client evidence — the wedged-socket
    `Socket is not ready for communication : Bad file descriptor`, `Could not
    connect to server`, and empty output — are still unconfirmed failures.

Found by the third review round on #595 and carried over as its own change.

Test: src/valve/ndsctl_unknown_client_test.go — fails on pristine main
(RED: all three broad-disjunct inputs read as true) and passes with the match
narrowed to the MAC.

Co-authored-by: Felix <felix@opentollgate.org>

* ci(ngit): stamp stage 1 from the commit, never the runner clock (#529)

The `determine-versioning` epoch cascade in `build-package-binaries.yml` ended
in `date +%s`, and on ngit neither earlier source can answer: an act job
checkout has no git metadata (`git log` fails there) and the coordinator's
synthesized push payload carries `head_commit` with no timestamp. The last
resort was therefore taken on EVERY run — at `ca5d07a2` the job log reads

    SOURCE_DATE_EPOCH=1790025078 (source: job clock (NOT commit-derived — binaries will not rebuild identically))

which is 6638 s after that commit's own time (1790018431), and
`compile-binaries` embedded it as `BuildTime`. Two builds of one commit could
not produce the same bytes, so the lane contradicted the reproducibility pin
(#383) it is supposed to carry.

Stage 1 now calls the same `scripts/ngit-commit-epoch.sh` the `build-portal`
job (#441) and the shards' `resolve-inputs` already use: the commit's own
timestamp, read from local history or fetched depth-1 from the mirror the
release is built from. There is no wall-clock fallback — when neither source
answers the step fails with the script's diagnostics, because a red run is
better than a release whose artifacts silently cannot be rebuilt identically.

Verification (all local, at this commit):

- the workflow parses (`yaml.safe_load`) and the step driven exactly as the act
  job runs it — script path relative to the checkout, `ROOT` a directory with
  no git metadata — prints `SOURCE_DATE_EPOCH=1790018431 (2026-09-21 19:20:31
  UTC)` and writes `source_date_epoch=1790018431` to `$GITHUB_OUTPUT`, equal to
  `git log -1 --format=%ct ca5d07a2`
- negative control: an unserved commit exits 1 and writes no epoch
- `tests/ngit-ci-trigger_test.sh` 9 passed, 0 failed
- `tests/ngit-release-pipeline_test.sh` 36 passed, 0 failed

Docs: `.ngit/README.md` ("No git metadata in the checkout"),
`docs/reproducible-builds.md` ("How SOURCE_DATE_EPOCH is chosen").

Co-authored-by: felixfelix-bot <felixfelix-bot@users.noreply.github.com>

* fix(packaging): refuse to build a local .ipk without staged portal bundles (#556)

* fix(packaging): refuse to build a local .ipk without staged portal bundles

local-build-ipk.sh copied whatever sat under packaging/files/ into the
payload. A clean checkout holds no built portal bytes (#335) — the
guest SPA, admin SPA and rpcd plugin are staged by 'make portal-build'
— so running the script straight after cloning silently produced an
.ipk whose captive portal renders nothing. The happy-path suite (#544)
caught exactly that this week as five phantom 'portal broken' failures
against a locally built artifact.

The new guard refuses before any toolchain work when the staged portal
index, admin index, rpcd plugin or the JS bundles are missing, and
says what to run. Proof: tests/packaging/local-build-ipk-guard_test.sh
checks out HEAD into a scratch worktree (committed files only, no
untracked build products) and pins that the script exits non-zero,
names 'make portal-build' and the missing file, and never reaches the
Go build stage.

* changelog: local-build-ipk portal-staging guard

* fix(packaging): the portal guard must check the bundle set, not index.html

The guard as merged into the PR refused every correctly staged tree: it
required packaging/files/tollgate-captive-portal-site/index.html, but the
guest SPA deliberately has no index.html — its pages are
splash.html/balance.html/404.html and 'index' exists only as a JS chunk
name (index-*.js). Caught by exercising the pass-path for the first time
(build on a fully staged tree), which the original PR never did.

The JS-bundle guard now runs first (it is the guest SPA's only
staged-content canary — the shell files around it are committed), the
admin SPA keeps its index.html check (it is a real SPA entry), and the
rpcd plugin check is unchanged. The guard test's assertions follow the
new ordering.

* test(packaging): the guard-ordering pin greps combined output, not stderr only

The capture was stderr-only (2>&1 >/dev/null) while the 'Building Go
binaries' banner is a plain stdout echo, so the ordering assertion could
never match — mutation B (guard moved below the build banner) passed.
Capture stdout+stderr and grep that (PR #556 review, finding 1).

* changelog: link the local-build-ipk guard entry to its PR (#556)

---------

Co-authored-by: Amperstrand <amperstrand@localhost>

* fix(utils): hex-encode the fingerprint salt — raw edge bytes corrupted reloads (#571)

loadTokenFingerprintSalt trims whitespace from the salt file (the file may
be hand-edited), but writeTokenFingerprintSalt persisted raw random bytes —
and random bytes begin or end with whitespace-valued bytes (tab, space,
CR/LF) about 5% of the time. On those installs the trimmed reload produced
a different salt: every fingerprint changed after a restart, silently
breaking the journal/log correlation keyed on them.

The salt is now written hex-encoded; the reader trims (hand-edited files
keep working), decodes hex, and falls back to raw bytes without trimming
for salts written by earlier builds. Regression test forces tab/space edge
bytes through write→reload and pins the fingerprint.

Found as an intermittent utils failure in the race-enabled go-battery on
main; root-caused with a standalone repro (the shifted-by-one salt was the
trimming signature).

Co-authored-by: Amperstrand <amperstrand@localhost>

* fix(wallet): no same-body retry after an ambiguous mint outcome — repin gonuts v0.13.0, classify as outcome-unknown (#640) (#660)

* test(merchant): the log capture is safe to read while goroutines still log (fixes the intermittent -race failure)

Symptom: the src/merchant testenv suite fails its own `-race` gate
intermittently with "race detected during execution of test", reported
against TestStartDataUsageMonitoringStopsTheSweepItStarts (seen on a
fresh machine during the #619 review battery). Neither racing line is
production code.

Root cause: captureMerchantLog handed tests a bare *bytes.Buffer as the
standard logger's output. A MintHealthTracker goroutine left over from an
earlier test (an aggressive-retry probe still winding down after its
tracker's Stop — Stop closes the channel but does not join an in-flight
probe, which logs from probeMintOutcome once its HTTP call answers) writes
through the swapped logger while the current test reads the buffer with
String()/Len(), unsynchronised. The package already knew this shape:
captureSyncLogs/syncLogs exist in late_receive_outcome_test.go for exactly
this reason, and the startup reconciliation's newer tests already use them.

Fix shape: captureMerchantLog now returns the existing synchronised
*syncLogs via captureSyncLogs, and syncLogs gains a locked Len() so the
two callers that mark a position in the capture keep working unchanged.
The arming tests already Stop() their trackers (TestStop_TerminatesPro-
activeChecks, TestStartProactiveChecks_Idempotent, TestArmAggressive-
Retry_RecoversWithinSeconds), so the synchronised read side closes the
race: every write and read of the capture now goes through the same
mutex, and a straggler line can no longer race a test's assertion.
Pinned by TestCaptureMerchantLogIsSafeToReadWhileGoroutinesLog, which
reproduced the race deterministically under -race before this change
and passes after. Production behaviour is unchanged.

* docs(changelog): the merchant log-capture race fix

* fix(merchant): a concurrent duplicate of one note is refused before the mint, not raced past its spend-state

The mint's spend-state is the only sequential-duplicate guard the payment
path has: the second POST of a spent note fails the swap and answers
payment-error-token-spent. Two CONCURRENT POSTs of the same note both
pass that check before either swap settles — measured by the #535
conformance lane (2026-10-05 run) as duplicate-post-concurrent failing
no-double-count: both POSTs answered 200/kind-1022, the allotment delta
was 12,000,000 ms = 2x a single grant, and four derivation digests were
each sighted twice on swap routes (the same double-exposure class as the
swap-timeout scenario). One note, two sessions.

PurchaseSession now marks the note in flight (keyed by its receive
reference, the salted fingerprint already handed to the customer on the
outcome-unknown path) from the moment the money-moving goroutine starts
until its result is consumed, and refuses a second submission locally,
before any money moves, with payment-duplicate-inflight — the notice
says the note is being processed and to reload, never that it failed.

The guard's lifetime is the load-bearing part: on the outcome-unknown
timeout path the late recorder owns the result channel, so it also owns
the mark — a resubmission arriving after the deadline but before the
mint answers is refused exactly like a concurrent one, which is the
'do not send this note again' the notice already promises. A note whose
reference cannot be computed (Serialize fails) is never refused: the
guard is defence in depth, and the mint still refuses a sequential
resubmit as spent.

Fixes #639.

* fix(wallet): no same-body retry after an ambiguous mint outcome; the customer is told not to resend (repin gonuts v0.12.2)

The mint client re-sent an identical money-moving POST body up to four
more times on a network error, so a mint that processed a swap and whose
response was dropped received the same blinded messages again — the
deterministic-derivation re-exposure that strict mints answer with error
10002 and that has bricked wallets before (#257/#266/#480). Measured on
main by the #535 conformance lane as the swap-timeout-retry row (#640);
the lab mint tolerates duplicates, which is why payments kept working
while the invariant was violated.

The fix lands in gonuts-tollgate v0.12.2 (network errors return
*AmbiguousResponseError immediately; the 429 same-body retry is kept
because a rate-limit answer precedes processing), repinned in the four
go.mod files. The repo-side pins that fail the release gate on a bad
repin: a full-wallet fault test whose fake mint processes the swap, drops
the response, and must sight every blinded output exactly once (fails on
v0.12.1, passes on v0.12.2); a wallet-usable-after-recovery test; and the
merchant classification mapping tollwallet.ErrOutcomeUnknown to the
existing payment-outcome-unknown notice (do-not-resend guidance plus the
operator reference) instead of a retry-flavoured error, without
condemning the mint in the health tracker.

* fix(wallet): repin gonuts-tollgate v0.13.0 — the upstream ambiguity fix supersedes the local v0.12.2

The fork landed the same no-re-exposure policy as a pull request
(OpenTollGate/gonuts-tollgate#35, tagged v0.13.0) and it is a superset of
the local fix: checkstate keeps its read-only transport retry (it is the
reconciliation primitive and must survive the outage that made the
money-moving call ambiguous), while swap/mint/melt POSTs are sent exactly
once and surface AmbiguousOutcomeError. The public tag dissolves the
fork-tag handoff step: the module builds — and the docker conformance
lane builds its daemon image — from the public proxy with no local
module proxy.

The local branch fix/no-same-body-retry-on-ambiguous-post and its
v0.12.2 tag are superseded and must NOT be pushed (a second, competing
fix landing would collide with #35). The tollwallet boundary now maps
client.AmbiguousOutcomeError to ErrOutcomeUnknown; the repo-side
invariant tests pass unchanged on v0.13.0 (they fail on v0.12.1).

---------

Co-authored-by: Amperstrand <amperstrand@localhost>

* fix(merchant): a paid purchase whose gate cannot open is an owed entitlement, not a lost one (#403) (#661)

A successful Receive is irreversible: the customer's value is in the
operator's wallet. When ndsctl auth then failed, the old path rolled back
the in-memory session and answered a bare session-error — the operator
kept the value while the customer had neither service nor a recoverable
claim, the exact invariant AGENTS.md forbids.

The paid purchase is now recorded as an owed entitlement in a durable,
atomically-written, fsync'd store (owed-grants.json, the same discipline
as the Lightning quote store) BEFORE the response completes, keyed by the
receive reference the customer can already quote. A per-record monitor
retries the grant with backoff+jitter until it succeeds or its window
passes (ms grants expire when their paid time is gone; data grants after
24h; both converge to a loud terminal expired state, record kept for
audit — never an infinite retry). A restart reloads the store and
relaunches the monitors; the grant applies exactly once (processing flag
plus persisted granted transition); the customer is told access will
start automatically and NOT to pay again (payment-received-grant-pending).

State machine, per the repo's money-moving documentation rule:
- before value moves: nothing owed; on Receive success the entitlement
  becomes owed only if the grant fails;
- if the next operation (gate open) fails: entitlement persisted, retried;
- if the process dies: store survives; startup loader relaunches monitors;
- restart convergence: grant applied once when NDS accepts;
- duplicates: keyed by note reference — one claim per note.

Refunding remains deliberately out of scope (expired = operator action);
the general business-transaction record is #502.

Co-authored-by: Amperstrand <amperstrand@localhost>

* test(fleet): require credentials from the environment, not public defaults (#528)

* test(fleet): require credentials from the environment, not public defaults

Router and Wi-Fi passwords and the install IPK URL were default values
in conftest.py and literal values in tests/.env.example — in a public
repository (#509). Both files now require them from the environment or
the gitignored tests/.env, and collection fails fast with setup
guidance when any is missing. The template documents the rotation call:
anything previously committed must be treated as leaked.

* test(fleet): the credential contract covers the sibling files too

The wave-3 review's request-changes items: the same fleet defaults
survived in three files outside conftest's gate, and flash_routers.py
— a standalone script that never passes through pytest collection —
bypassed the gate entirely.

- tests/test_install_images.py, tests/test_network_configuration.py:
  drop the c08r4d0r123 / c08r4d0r literals — env-only reads, matching
  conftest's contract (its fail-closed collection gate already
  guarantees the values exist by the time these module-level reads run).
- tests/flash_routers.py: drop the default and add its own fail-closed
  SystemExit mirroring conftest's RuntimeError, since nothing else
  guards a direct run.

No credential literal remains anywhere under tests/ except
.env.example's placeholders. py_compile clean on all three.

---------

Co-authored-by: Amperstrand <amperstrand@localhost>

* fix(merchant): bound the fee precheck against wedged mints (#525) (#533)

A mint that accepts nothing (docker pause reproduces it) parks
SwapFeeSats on the wallet client's retry ladder — 30 s per attempt, up
to five, chained endpoints — for 5+ minutes before any deadline
applies, freezing the payment lane and stacking a stuck goroutine per
attempt (the token itself stays unspent). The precheck now runs under
a 3-second budget; past it the payment proceeds and Receive's own
classification governs. The fee check is an optimization, not a gate.

Test: TestPurchaseSession_FeePrecheckIsTimeBounded parks SwapFeeSats
forever and requires PurchaseSession to reach Receive within the
budget (verified red on the unbounded precheck at exactly the 8 s
guard, green at 3.02 s after).

Co-authored-by: Amperstrand <amperstrand@localhost>

* docs(operator-guide): cover the ssl family and upstream known; regen man pages (#662)

The guide promised every CLI subcommand but was missing two command
groups: tollgate ssl (apply/remove/status/covers, in the tree since the
May Go rewrite and omitted when the guide was written in #188) and
tollgate upstream known (#312's discovery-history summary, which landed
after the guide). Document both, name SSL/TLS certificates in the
README's cli module row, and regenerate the committed man pages with
scripts/gen-man-pages.sh — tollgate-upstream-known.8 was missing (the
previous full regen predated #312), tollgate-wallet-drain-cashu.8 gains
its --yes flag, and tollgate-upstream.8's cross-references catch up.

Co-authored-by: c03rad0r <c03rad0r@users.noreply.github.com>

* fix(cli): bound fw4 reload on the daemon start path — a wedged firewall must not stall the service before Serve (#637) (#654)

The operator-settings convergence runs after the API listener binds but
before Serve; fw4 reload had no deadline, so on exactly the boots where
drift exists (first boot after an upgrade with hand-edited settings, a
sysupgrade that regenerated UCI) a wedged reload stalled the service and
procd respawned it into the same stall — the payment API down on an
unattended router.

fw4 reload now runs under a 30s CommandContext; a timeout is treated
exactly like any other reload failure (the fragment file is the durable
half and applies at the next firewall reload or reboot). Pinned by a
test whose fw4 never answers: bounded return, timeout message, no hang.

Co-authored-by: Amperstrand <amperstrand@localhost>

* fix(config): config.json writes are atomic and a missing config is announced (#402 hardening) (#655)

A plain os.WriteFile killed mid-write (power loss, procd respawn in the
write window) left a truncated config.json that the loader routed into
backup-and-defaults: the operator's accepted mints silently reverting to
the factory set — the config-loss class of the #402 incident. SaveConfig
now writes temp + fsync + rename in the same directory, so a reader
always sees the whole old file or the whole new one; the
file-does-not-exist path — the one default-write path with zero
forensics — logs a loud WARNING naming the backup directory. The full
incident did not reproduce on current main (maintainer triage); this
closes the class it came from.

Co-authored-by: Amperstrand <amperstrand@localhost>

* fix(config): min_steps floors at 1 — parser accepts the legacy spelling, schema and templates say 1 (supersedes #634, ports fork #104) (#656)

* fix(config): default purchase_min_steps to 1 and floor it at 1

purchase_min_steps: 0 in fresh-install config makes every v1 client
reject the gateway's pricing (TIP-01 treats a 0-step minimum as
invalid). Fresh installs generated 0 via both the schema default and
the mint templates; the edit-path validator had no floor, so an
operator could reintroduce the value through the wizard.

- schema default 0 -> 1, with Min: 1 (mirrors price_per_step)
- defaultProductionMints + defaultTestMint templates: 0 -> 1

Existing configs with an explicit value are untouched (load path does
not re-validate); only fresh generation and edit-time validation
change.

* fix(config): MinPurchaseSteps defaults to 1; legacy min_purchase_steps accepted

Core extraction from #102 (ride-alongs stay there for the 0.7.0 line):
MintConfig.UnmarshalJSON accepts both "purchase_min_steps" (Go tag) and
"min_purchase_steps" (early FreedomTechFeed configs) with primary-wins
precedence, and defaults MinPurchaseSteps to 1 when absent or zero —
purchases below one step are meaningless and clients (cashud, wally)
reject advertisements with min_steps=0 (TIP-02 misalignment tracked
upstream: OpenTollGate/tollgate#20).

Schema default 0→1 to match. Table tests: absent→1, explicit, legacy,
legacy-wins-when-primary-absent, 0→1, both-keys-primary-wins; roundtrip;
every defaultProductionMints entry unmarshals ≥1.

---------

Co-authored-by: Amperstrand <amperstrand@localhost>

* ci: enroll in org gitleaks scanning; watch main on push (ports fork #91 + #98's follow-up) (#657)

* ci: enroll in org gitleaks scanning (#91)

Co-authored-by: amperstand <atlas@oh-my-opencode.com>

* ci(gitleaks): watch main on push — review condition from #98

The sweep PR merged before this one-liner landed (API workflow-scope
refusal); completing it post-merge so leaks pushed to main surface
immediately instead of waiting for the daily schedule.

---------

Co-authored-by: amperstand <atlas@oh-my-opencode.com>
Co-authored-by: Amperstrand <amperstrand@localhost>

* fix(config): refuse an out-of-bounds private_key at config set — a persisted credential the applier will refuse forever is a dead end (#636) (#652)

The per-key schema validation had no length bounds for the private
network WPA passphrase: config set private_key <short-or-64+> was
accepted, persisted, and then refused by the applier at every
convergence while config get reported secret_set.private_key=true.

FieldSchema gains MinLength/MaxLength (JSON: min_length/max_length);
the private_key field declares the WPA2-PSK 8-63 bounds the applier
already enforces, and validateAgainstSchema checks them for non-empty
string values. Empty stays valid by design: it is the keep-current
sentinel, and ValidateValue runs over stock configs in config save.

Co-authored-by: Amperstrand <amperstrand@localhost>

* fix(cli): config get no longer returns the identities' Nostr private keys — blanked, reported via secret_set, preserved on save (#635) (#653)

The config get payload is rendered by the board's Settings page; it
handed out every owned identity's Nostr private key in cleartext while
carefully blanking the (less damaging) WPA passphrase. Owned identities
are now returned with empty privatekey fields plus secret_set
.identities.<name> markers using the #604 Secret machinery, and
save-identities treats an empty incoming key for a known name as keep
(the board round-trip of the blanked payload), while an explicit key
still rotates. No new secret system: same redaction, same secret_set
convention, same preserve-on-save semantics.

Co-authored-by: Amperstrand <amperstrand@localhost>

* test(cloud-lab): conformance fast-subset lane over the PRTA fault proxy (#503) (#535)

* test(cloud-lab): conformance fast-subset lane over the PRTA fault proxy

Go side of the shared conformance/fault-injection matrix (#503): five
fast-subset scenarios (duplicate sequential/concurrent, swap timeout
with dropped response, kill at the post-receive/pre-session boundary,
mint alias spellings) driven through the co-owned PRTA spec + fault
proxy, emitting per-invariant verdicts in the PRTA table format.
Blinded-message reuse is measured from proxy observations; verdicts the
payment-record store cannot back are pending on #502/#403. Skips
cleanly without docker or a PRTA checkout. socat joins the cloud-lab
image (test-only) for the host-side wallet-info call.

* test(cloud-lab): conformance lane review fixes — host PyYAML declared, the notify target labelled what it is

Three follow-ups from the 2026-09-26 review:

- PyYAML is declared for the host runner (tests/cloud-lab/requirements.txt
  gains PyYAML>=6, the conformance README's prerequisites say why): the
  matrix drift guard parses matrix.yaml on the host, and a minimal host
  died in a traceback instead of running or skipping.
- The notify target is labelled correctly: 172.28.0.99 is an unassigned
  address inside the lab's own 172.28.0.0/16, not a TEST-NET address.
  Nothing answers ARP there, so the connect hangs for the full hold —
  which is the property the kill window depends on; a literal TEST-NET
  address could draw a fast ICMP unreachable depending on host
  networking. Label fixed in the runner's phase header, the poll-site
  comment, and both README spots; the address is unchanged.
- The .pyc/.gitignore cleanup half is dropped from this PR entirely: open
  #580 carries the identical tracked-blob deletion and the same
  .gitignore tail, and the review asked that exactly one of the two
  survive, so #580 owns it. This branch now adds only the lane's own
  ignores (tests/cloud-lab/.conformance/).

---------

Co-authored-by: Amperstrand <amperstrand@localhost>

* make: one release-check gate that orchestrates the existing gates — plus the two gate repairs it exposed (#658)

* make: one release-check gate that orchestrates the existing gates

make release-check VERSION=vX runs go-battery, the deps/import and
contract checks, the packaging shell suites (packaging/, uci-defaults,
the ngit release pipeline), the three fund-safety invariant test groups
(concurrent duplicate, ambiguous swap output-reuse,
payment/service-or-recovery), the conformance fast subset (skips are
detected from the lane log on either exit path and never read as
passes; TOLLGATE_RELEASE_CHECK_CONFORMANCE=1 makes it mandatory), the
release-matrix cross-check (workflow shards vs packaging plan), a
reproducibility build, and version consistency — then prints one
READY FOR HARDWARE verdict.

It wraps nothing: every leg is the same command CI or the runbook runs,
and a failure is the underlying gate's failure.

* fix(release gates): repro builds in package mode; the conformance lane accepts PRTA's current proxy filename

repro-test.sh built 'go build ... main.go' — FILE mode, which compiles
only that file. Since #589 the main package spans siblings
(startup_gate.go), so the reproducibility gate is red on current main
with 'undefined: apiStartup' — a build failure read as a
reproducibility verdict. Package mode ('.') fixes it; nothing else in
the stamping changes.

run-conformance.sh required PRTA's proxy as faultproxy.py; PRTA ships
fault_proxy.py today, so the lane skipped even on the documented
sibling layout. The lane now accepts either name (matrix.yaml still
required); the co-ownership rule (never vendor the proxy) is unchanged.

---------

Co-authored-by: Amperstrand <amperstrand@localhost>

* release: v0.6.0-rc1 — feature freeze (merge last) (#659)

* release: v0.6.0-rc1 — feature freeze, the three fund-safety invariants fixed, release-check gate

VERSION -> v0.6.0-rc1. [Unreleased] becomes the v0.6.0-rc1 section
(carrying the release-review additions: #571 fingerprint-salt stability,
purchase_min_steps floor, #637 bounded fw4 reload, #402 atomic config
writes, #633 operator-guide docs, #556 local-ipk portal guard);
RELEASE-NOTES rewritten for the RC with honest BUILDABLE/TESTED/SUPPORTED
hardware tiers, the jffs2 (#583) and OpenWrt 25.12-feed (#552)
limitations, and the deferred #619 inverse-drift reconciliation.

* docs(release): the measured conformance state and the min_steps spec divergence, in the rc1 record

RELEASE-NOTES now states what the conformance lane measured on this
stack: the duplicate and output-reuse invariants pass on every row; the
two service-or-refund rows that stay red are the kill/timeout windows
whose closure is the #502 business-transaction record (new WalletPort
checkstate surface + a grant-against-recoverable-value policy), not
improvisable pre-release under #497's research-first rule. The min_steps
default divergence (TIP-02 tentative 0 vs this implementation's 1) is
recorded with its upstream tracker (OpenTollGate/tollgate#20).

CHANGELOG gains the ported #104 entry (legacy min_purchase_steps +
parse floor + the spec pointer) and the atomic-write fallback entry.

* docs(release): restore the rc1 RELEASE-NOTES

The rebase onto main (for #649) resolved the RELEASE-NOTES stop in the
wrong direction and resurrected the alpha4 document; this restores the
v0.6.0-rc1 rewrite byte-for-byte (title, measured conformance state,
min_steps spec note).

* chore: drop the tracked conformance pyc and ignore its cache dir

The docker-exec'd pytest in the conformance lane writes a root-owned
__pycache__ inside the worktree; one release-commit 'git add -A' swept
it into the tree. Untracked (the two sibling cache dirs already are) and
the lane-local ignore covers it.

---------

Co-authored-by: Amperstrand <amperstrand@localhost>

* docs(agents): the gonuts bump touches four go.mod files, not three (#647)

src/, src/cli, src/merchant and src/tollwallet all carry the
gonuts-tollgate require today (verified by the v0.13.0 bump, PR #643,
which touched exactly those four); naming the set keeps the next bump
from trusting a stale count.

Co-authored-by: Amperstrand <amperstrand@localhost>

* deps(wallet): bump gonuts-tollgate v0.13.0 — NUT-20 cdk-interop signatures + per-route POST retry policy (#643)

Four go.mod files (root, cli, merchant, tollwallet) move to the v0.13.0
tag, which carries two merged fork fixes:

- gonuts-tollgate#34: NUT-20 mint quotes signed with the message format
  deployed cdk mints verify (quote_id || B_ hex), pinned to cdk's own
  cross-implementation vector. Without it every Lightning top-up against
  a cdk mint fails with 'Signature missing or invalid'.
- gonuts-tollgate#35: state-changing POSTs are single-shot when the
  mint's answer never arrives (AmbiguousOutcomeError, reconcile-first);
  429 answers keep the same-body backoff retry; checkstate keeps its
  full retry. Fixes the measured #640 re-exposure class.

Module-side follow-through: isAmbiguousMintOutcomeError matches
client.AmbiguousOutcomeError positively (guarded by test), so the
outcome-unknown notice and the late-receive recorder label the
no-answer case exactly.

Evidence: 16-module go battery green on this head; the conformance lane
re-run on this tree (with #535's lane files layered locally) shows
swap-timeout-retry / no-output-reuse flipping fail -> pass — the third
remaining red row is the unmerged #641's concurrent-duplicate fix.

Co-authored-by: Amperstrand <amperstrand@localhost>

* docs(readme): the WR3000 25.12 install paragraph gains the feed-shape caveat (#552) (#644)

The 2026-09-27 bench install is real but its reproduction depends on a
repositories list that includes the base TARGET feed — nodogsplash's
iptables-* dependencies are served there, not from the arch packages feed,
and ImageBuilder-built images are the classic case of a repo list that
omits it. apk-tools 2.x additionally cannot read the 25.12 index format,
so a resolution attempt with the wrong tool fails identically. The caveat
names both traps and links #552, whose proposed upstream remap is on hold
pending the Phase 0 resolution matrix in the dual-OS test plan.

Co-authored-by: Amperstrand <amperstrand@localhost>

* test(packaging): an apk3 dependency-resolution smoke gates the release apk (#645)

The September #552 breakage class — a feed rebuild changing how the
iptables family is provided, leaving names nodogsplash depends on
unselectable — sat invisibly between 'the artifact builds' and 'a bench
VM cannot install it', because nothing in CI ever resolved the package's
closure against a real feed set. apk 2.x cannot even read the 25.12
index format (measured: it silently resolves nothing), so the smoke
runs apk-tools 3 inside an openwrt/rootfs container, against the six
standard 25.12.x feed sections, with --network host to keep apk3's
fetcher off the docker bridge's broken IPv6 path.

With the resolution now verified working on current feeds (see #552),
the smoke hard-fails on any future unselectable name and passes the
feed-shape control (nodogsplash) when run standalone without an
artifact. Wired into the release gate ahead of the happy-path suite.

Co-authored-by: Amperstrand <amperstrand@localhost>

* fix(build): build-sdk-package.sh compiles package main, not main.go alone (#646)

Single-file compilation broke when the boot-order work gave package main
sibling files (startup_gate.go, the API boot ordering): 'go build
main.go' fails with undefined: requireStarted / apiStartup /
stageConnectingMerchant, and nothing had exercised the SDK-local path
since. Found building the x86_64 apk for the 25.12 virtual-lab lane; the
whole local-SDK build then completes (portal staging + SDK apk packaging
verified end-to-end on that path).

Co-authored-by: Amperstrand <amperstrand@localhost>

* fix(lane): resolve the conflict-marker residue #658's rebase left in run-conformance.sh (#663)

The endgame rebase of the release-check PR staged the file with its
conflict markers in two hunks; bash refused to parse the script (syntax
error at the heredoc), so the conformance leg of release-check failed on
main. Takes the PROXY_SRC resolution (either PRTA proxy filename) in
both hunks — verified with bash -n and a full lane re-run.

Co-authored-by: Amperstrand <amperstrand@localhost>

* test(merchant): the owed-grant AUTH assertion polls for its own condition (#664)

The session appears from the allotment BEFORE the gate opens, and the
successful ndsctl AUTH lands after it — asserting the AUTH delta
immediately after the session appears raced the auth call, and the
battery lost that race once under load (before=5 after=5, flake class
#622 spent a PR on). Each observable now gets its own bounded poll;
six consecutive -race runs green.

Co-authored-by: Amperstrand <amperstrand@localhost>

* docs(agents): hardware and VM testing is coordinated through labgrid (#666)

Encode the lab rules that already govern the bench: coordinator at
ai-legion:20408 (some hosts carry a stale LG_COORDINATOR env pointing at
a dead address — use the hostname), conwrt-bench as the single source of
truth (ADR-0005; conwrt-lab retired), the five registry/place rules, the
QEMU place pattern for the ai-legion VM lane, and where the on-target
artifact comes from (kind-1063 hash-pinned bytes, or a recorded-sha local
build for pre-tag candidates).

Co-authored-by: Amperstrand <amperstrand@localhost>

* docs: decision records rebased — discovery signaling (#621), ADR citations (#626), host-mode admin (#632) (#667)

* docs(adr): the citation re-check, re-checked — main moved twice under this PR

The nineteen re-lined sites were computed against a base that predates
#625 (the LAN-port writer inserted ~400 lines) and #624 (the admin-
password rewrite) — the exact drift class this PR exists to fix had
already eaten it. Every 99-tollgate-setup cite is re-verified against
current main by content anchor (the isolation comment block, the
tollgate_in :2121 allow, the lan_dev discovery, the network.private/
private_bridge/dhcp.private writes, the awk+seed idiom, the private->
wan forwarding, the guest-AP network=lan binding, the setup_private_
network span, the uhttpd.admin 8443 del_list, and the named br-guest/
bridge-family mechanism); 22 cites, all probed, zero misses.

* docs(host-mode): record the admin-surface decision — deferred to phase 2

Linux host mode (the deb lane) needs a written answer to "where is the
admin web UI?" so no later session re-litigates it. The release design
already carries /usr/share/tollgate/admin marked PHASE 2 ONLY
(RELEASE-linux-deb.md 2.3, the deb file list), so this records DEFERRED
as the decision — not cancelled, not built.

The record pins four things:

- The decision: phase 1 ships no admin surface at all — no SPA, no
  listener, no port, no rpcd-style shim — and the tollgate CLI is the
  only operator interface. The revisit trigger is the operator declaring
  phase 2.
- The options weighed: defer (chosen: zero new attack surface, every
  phase-1 need already covered by the CLI socket and the ndsctl shim
  verbs, contradicts nothing the design reserved) versus not-planned
  (rejected: buys nothing today and forecloses a deliberately kept-open
  path).
- The minimal contract any phase-2 admin API must satisfy: exactly four
  verbs at introduction, each mapped to a seam that already exists
  (status -> CLI status + wallet, sessions -> shim json, session
  grant/revoke -> shim auth/deauth, config set -> CLI config set; no
  money movement over HTTP); auth defaulting to the CLI server's
  AF_UNIX file-permission model (/var/run/tollgate.sock, 0660) with any
  TCP exposure opt-in plus a bearer token minted into /etc/tollgate/;
  loopback-only listenin…
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.

2 participants