2026-07-17 — XP-137 unresolved-aging batch resolver
What shipped
Section titled “What shipped”packages/service/src/sessions/unresolved-aging.ts— replaced the per-rowPromise.all(rows.map(async → resolveSesiPriceEstimate))with a singleresolveSesiPriceEstimatesBatch(deps.db, rows.map(inputs))call from XP-136’spackages/service/src/pricing/. Same swap XP-136 applied tolist-sessions.ts, mirrored here. Response shape unchanged (items[].price_estimate,estimated_leak_idr,unpriced_count;age_hoursstill per-row in the assembly map).
Key decisions
Section titled “Key decisions”- 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 undernoUncheckedIndexedAccess(T | undefined) is assertedas SesiPriceEstimate, commented at the site — the batch contract guarantees one aligned result per input. Matches the XP-136 pattern for the other caller.
Gotchas / lessons
Section titled “Gotchas / lessons”- Freeze path intact: FROZEN sesi pass their stored
amount_student_idrthrough; batch never re-reads price tables for a frozen sesi, degrades to UNPRICED, never persists —domain-pricing-snapshot.mdwalked line-by-line in review, OK.
Reference changes
Section titled “Reference changes”None — no canonical/locked doc changed. Pure call-site swap onto an existing helper.