Skip to content

feat: error/empty states audit, indexer-lag notice (M3-21) - #32

Merged
YazarAyobami merged 1 commit into
mainfrom
feat/m3-21-indexer-lag-notice
Oct 8, 2026
Merged

YazarAyobami merged 1 commit into
mainfrom
feat/m3-21-indexer-lag-notice

Conversation

@YazarAyobami

Copy link
Copy Markdown
Contributor

What and why

M3-21 asks for clear guidance across five states: trustline failure, expired, revoked, suspended, indexer lag. Rather than assume these needed new code, audited each against the actual message keys and error-mapping logic first.

Changes

Audit findings (no code changes needed for four of the five):

  • Trustline failure: claim-logic.ts's CONTRACT_ERRORS map plus errorTx's plain-language "can't receive this asset yet" phrasing (release side); preflight.payout_trustline_authorized.* has a distinct message per failure mode, missing/not_authorized/limit (send side).
  • Expired: pages.claim.errorExpired, pages.lock.refundAvailable.Expired.
  • Revoked / Suspended: pages.claim.errorPayeeNotActive (the contract's single PayeeNotActive error, covering both), preflight.payee_active.revoked/.suspended, pages.lock.refundAvailable.Revoked/.SuspendedTimeout.
  • Per the SDK's own preflight.js doc comment, payee_active and payout_trustline_authorized are chain checks and block a send on failure; only recent_payout_change and duplicate_ref_hash are indexer-sourced, and those are already downgraded to warn severity. So none of the above is at risk from indexer lag in the first place.

The one real gap, fixed here:

  • lib/indexer/index.ts: new indexerLagging(), reading the indexer's own /health endpoint (status: "ok" | "lagging" | "unknown"), defaulting to "possibly stale" on any fetch/parse failure so a broken health check can never silently hide a real lag.
  • components/indexer/LagNotice.tsx: shared, shown on /send, /request, /payee when indexerLagging() is true. Purely informational.

Hard rules / invariants touched

None. Confirms, rather than changes, hard rule 3: every blocking decision already reads chain state; this notice only ever concerns list-browsing UX.

Tests

pnpm lint, pnpm typecheck, pnpm test (108/108, 5 new in lib/indexer/index.test.ts: ok → false, lagging → true, non-ok HTTP → true, network failure → true), pnpm build all green.

Ran locally against the real indexer (.env.local pointed at the live Railway instance): currently healthy (lagLedgers: 1, status: "ok"), and confirmed the notice correctly does not show, while /send, /request, /payee still list payees correctly with the added parallel /health fetch alongside the existing list fetch.

Docs / ADR

None needed.

Roadmap

M3-21 → DONE. Phase 4 App: 12→13 DONE, 8→7 TODO (46%→50%). All rows: 42→43 DONE, 119→118 TODO (24%, unchanged after rounding). Changelog entry added with the full audit trail.

Assumptions and open questions

Didn't artificially degrade the real production indexer just to screenshot the "lagging" banner; that branch is covered by the unit tests instead. If someone wants to see it live, the indexer's /health endpoint would need to actually report non-ok (e.g. during a real deploy or outage).

Audited each of M3-21's five named states against the actual
message-key and error-mapping code: trustline failure, expired,
revoked, and suspended were already clearly covered (claim-logic.ts's
CONTRACT_ERRORS, preflight's payee_active/payout_trustline_authorized
messages, lock refundAvailable messages), and per the SDK's own
preflight doc comment, the checks that matter are chain-backed and
blocking, never indexer-sourced.

Indexer lag was the one real gap: added indexerLagging() (reads the
indexer's /health status) and a shared LagNotice component, shown on
/send, /request, and /payee when the indexer reports anything other
than ok. Informational only; no money decision depends on it.
@YazarAyobami
YazarAyobami requested a review from a team as a code owner October 8, 2026 14:34
@YazarAyobami
YazarAyobami merged commit 035f66f into main Oct 8, 2026
4 checks passed
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