Skip to content

2026-07-17 — XP-137 unresolved-aging batch resolver

  • packages/service/src/sessions/unresolved-aging.ts — replaced the per-row Promise.all(rows.map(async → resolveSesiPriceEstimate)) with a single resolveSesiPriceEstimatesBatch(deps.db, rows.map(inputs)) call from XP-136’s packages/service/src/pricing/. Same swap XP-136 applied to list-sessions.ts, mirrored here. Response shape unchanged (items[].price_estimate, estimated_leak_idr, unpriced_count; age_hours still per-row in the assembly map).
  • This surface has no LIMIT — the unresolved set is unbounded, so the per-row resolver was the worst N+1 in the tree (grows with aging backlog). Constant-roundtrip batch resolver was the right target. No new abstraction: reused the already-shipped, integration-tested helper.
  • estimates[i] dereferenced under noUncheckedIndexedAccess (T | undefined) is asserted as SesiPriceEstimate, commented at the site — the batch contract guarantees one aligned result per input. Matches the XP-136 pattern for the other caller.
  • Freeze path intact: FROZEN sesi pass their stored amount_student_idr through; batch never re-reads price tables for a frozen sesi, degrades to UNPRICED, never persists — domain-pricing-snapshot.md walked line-by-line in review, OK.

None — no canonical/locked doc changed. Pure call-site swap onto an existing helper.