import Link from "next/link"; import { LedgerRow, type ReadoutCell } from "./LedgerRow"; import { NoticeState } from "./NoticeState"; import { ProvenanceChip } from "./ProvenanceChip"; import { STATUS_TONE_CLASSES, statusToneFor } from "./tokens"; import type { AarResult } from "@/lib/operations/surfaceQuery"; const headCell = "px-3 py-2 text-left font-mono text-[9px] uppercase tracking-widest text-white/50"; const cell = "px-3 py-2 align-middle text-xs"; function Section({ title, children }: { title: string; children: React.ReactNode }) { return (

{title}

{children}
); } function countsRow(aar: AarResult): ReadoutCell[] { return [ { label: "Events", value: String(aar.counts.events), mono: true }, { label: "Validated", value: String(aar.counts.validated), mono: true }, { label: "Rejected", value: String(aar.counts.rejected), mono: true }, { label: "Applied", value: String(aar.counts.applied), mono: true }, { label: "Failed", value: String(aar.counts.failed), mono: true }, { label: "Pending", value: String(aar.counts.pending), mono: true }, ]; } export function AarView({ aar }: { aar: AarResult }) { const failedEffects = aar.effects.filter((e) => e.status === "failed" || e.status === "reversed"); const appliedEffects = aar.effects.filter((e) => e.status === "applied"); return (
{aar.events.length === 0 ? ( ) : ( {aar.events.map((ev) => ( ))}
Event Type Status Occurred
{ev.eventId} {ev.type} {ev.status} {ev.errorCode && ( {ev.errorCode}: {ev.errorMessage ?? "see notes"} )} {ev.occurredAt}
)}
{appliedEffects.length === 0 ? ( ) : (
    {appliedEffects.map((eff) => (
  • {eff.effectKey} {eff.effectType}
  • ))}
)}
{failedEffects.length === 0 ? ( ) : (
    {failedEffects.map((eff) => (
  • {eff.effectKey}

    {eff.notes ?? "Effect did not apply; see the operations ledger for reconciliation state."}

  • ))}
)}
{aar.canSeePressure ? (
{aar.pressure.length === 0 ? ( ) : (
    {aar.pressure.map((p, i) => (
  • Zone {p.zoneId} = 0 ? "text-emerald-400" : "text-rose-400"}`} > {p.delta >= 0 ? `+${p.delta}` : p.delta}
  • ))}
)}
) : ( )}
{aar.reservations.length === 0 ? ( ) : (
    {aar.reservations.map((r) => (
  • {r.reservationKey} {r.status}
  • ))}
)}

Open the full operations ledger

); }