caelum0x 972f70f6b9 feat(tui): add an interactive issue-card/adjust-limit form — Cards tab was read-only
PLAN-2026-10-23-DEEP.md's own "Remaining" note for the Cards tab was
still true: no in-TUI IssueCard/AdjustCardLimit form, CLI/API only.
Round 7 closed the CLI half of this gap; this closes the TUI half.

- New modal (services/tui/internal/model/cardform.go,
  internal/view/cardform.go): press `n` on the Cards tab to issue a
  card (tenant picker defaulting to the selected row's owner,
  cardholder/limit/interval/currency fields), `a` to adjust an
  existing card's limit (pre-filled from the selected row). Submits
  via two new client.Clients methods (IssueCard/AdjustCardLimit) that
  call the same gateway RPCs the CLI's `ration card` commands use.
  On success the form closes and triggers an immediate refresh; on
  failure (validation or a real RPC rejection) it stays open with the
  error shown and prior input preserved, so the operator can fix and
  retry without re-entering everything.
- Real bug found live, not by reading code: the field-typing handler
  only ever appended msg.Runes[0], assuming one KeyMsg per keystroke.
  bubbletea's input reader batches consecutive printable bytes read
  in one syscall into a single KeyMsg carrying multiple runes — typing
  (or pasting) a cardholder name arrived as one such batched message,
  so every character after the first was silently dropped. Fixed to
  append every rune in the batch; re-verified with multi-character
  names/limits typing correctly.

Verified live against the real bare-metal 7-service stack (audit-log,
ledger-core, auth, tenant-registry, card-issuance, webhook-ingestion,
gateway — started individually with inter-service delays, the same
round-6/7-documented workaround for this shared box's sibling-agent
load), driven through a real pty via tmux send-keys (not code reading):
seeded 3 tenants, opened the issue-card form, picked a tenant, typed
cardholder "Jane Operator", limit 250000, interval daily, submitted —
card appeared in the Cards tab and in `ration status`'s independent
CLI output (card_7816bf..., ACTIVE, $2,500.00, daily). Opened
adjust-limit on that card, backspaced/retyped the limit to 500000,
submitted — `ration status` confirmed $5,000.00 and the correct new
Held balance. Checked both error paths live: empty cardholder is
rejected client-side before any RPC; a limit request exceeding the
tenant's real reserve-floor headroom returns the actual
card-issuance rejection into the still-open form. `go build`/`go vet`/
`go test ./...` clean for services/tui; full `make build` (Rust+Go+SDK)
clean.

Also added scripts/start-individually.sh, a reusable version of the
manual individual-service-startup workaround rounds 6/7's build logs
already documented ad hoc for this box's contention — same PID-file
format as run-demo.sh, so scripts/stop-demo.sh tears it down too
(verified: it did).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-29 08:49:56 +03:00
..