Unit B12 opens with $150 past due. A $50 fee and a $75 payment leave $125. In this example, an active dispute or missing certified-mail delivery proof blocks the supervisor release step even with that positive balance.

Replay the unit ledger in posting order

The ledger takes already-posted fees and payments, each with a stable ID and a positive amount in bigint cents. Apply the sign according to the posting type and carry the resulting balance to the next row. A duplicate ID fails the import before a second copy can change the balance.

Ledger row Change Running past-due balance
Opening balance $150
Fee FEE-01 +$50 $200
Payment PAY-01 −$75 $125

Check dispute status and delivery evidence independently

The fixture checks for a positive closing balance, a cleared dispute hold, and certified-mail delivery evidence tied to the same unit and current notice. A mailing record can carry a tracking ID while delivery is still pending. The delivered record in this example carries both a tracking ID and a separate evidence ID. Proof for a prior notice or a different unit leaves the delivery check open.

Dispute status Certified-mail evidence Supervisor release check
Active Matching delivery proof Blocked by dispute
Cleared Mailing record only Blocked by missing delivery proof
Active Missing Blocked by both reasons
Cleared Matching delivery proof Eligible for the supervisor step

The gate returns every active reason so a reviewer can see both problems in one pass. The ELIGIBLE result is scoped to the fixture's checks. Keep the facility's jurisdiction-specific auction requirements and the actual supervisor decision in the broader workflow.

Run the benchmark

Save the block as storagedelinq-benchmark.ts and run node --experimental-strip-types storagedelinq-benchmark.ts with Node.js 24. The script needs no packages. Node.js TypeScript documentation

import assert from "node:assert/strict"; type Posting = { id: string; kind: "fee" | "payment"; amountCents: bigint; }; type UnitLedger = { unitId: string; openingCents: bigint; postings: readonly Posting[]; }; type CertifiedMail = { unitId: string; noticeId: string; trackingId?: string; } & ({ status: "mailed" } | { status: "delivered"; deliveryEvidenceId?: string }); type NoticeReview = { noticeId: string; disputeHold: boolean; certifiedMail?: CertifiedMail; }; function rollForward({ unitId, openingCents, postings }: UnitLedger) { const seen = new Set<string>(); let balanceCents = openingCents; const rows = postings.map(({ id, kind, amountCents }) => { const postingId = id.trim(); assert(postingId, "Posting ID is required"); assert(!seen.has(postingId), `Duplicate posting ID: ${postingId}`); assert(amountCents > 0n, "Posting amount must be positive"); seen.add(postingId); const deltaCents = kind === "fee" ? amountCents : -amountCents; balanceCents += deltaCents; return { id: postingId, deltaCents, balanceCents }; }); return { unitId, openingCents, rows, closingCents: balanceCents }; } function evaluateRelease( ledger: ReturnType<typeof rollForward>, { noticeId, disputeHold, certifiedMail }: NoticeReview, ) { assert(noticeId.trim(), "Current notice ID is required"); const reasons: string[] = []; if (ledger.closingCents <= 0n) reasons.push("NO_PAST_DUE_BALANCE"); if (disputeHold) reasons.push("ACTIVE_DISPUTE_HOLD"); if (certifiedMail?.status !== "delivered" || certifiedMail.unitId !== ledger.unitId || certifiedMail.noticeId !== noticeId || !certifiedMail.trackingId?.trim() || !certifiedMail.deliveryEvidenceId?.trim()) { reasons.push("MISSING_CERTIFIED_MAIL_DELIVERY_PROOF"); } return { supervisorReleaseEligible: reasons.length === 0, reasons }; } const unit: UnitLedger = { unitId: "UNIT-B12", openingCents: 15_000n, postings: [ { id: "FEE-01", kind: "fee", amountCents: 5_000n }, { id: "PAY-01", kind: "payment", amountCents: 7_500n }, ], }; const ledger = rollForward(unit); assert.deepEqual(ledger.rows, [ { id: "FEE-01", deltaCents: 5_000n, balanceCents: 20_000n }, { id: "PAY-01", deltaCents: -7_500n, balanceCents: 12_500n }, ]); assert.equal(ledger.closingCents, 12_500n); assert.throws(() => rollForward({ ...unit, postings: [...unit.postings, { ...unit.postings[1], id: " PAY-01 " }, ] }), /Duplicate posting ID/); const mail = { unitId: unit.unitId, noticeId: "NOTICE-02", trackingId: "TRACK-02" }; const review = { noticeId: mail.noticeId, disputeHold: false }; const delivered = { ...mail, status: "delivered", deliveryEvidenceId: "POD-02" } as const; const scenarios = [ { label: "Active dispute + delivery proof", review: { ...review, disputeHold: true, certifiedMail: delivered } }, { label: "Cleared dispute + mailing record", review: { ...review, certifiedMail: { ...mail, status: "mailed" } } }, { label: "Active dispute + no proof", review: { ...review, disputeHold: true } }, { label: "Cleared dispute + matching delivery proof", review: { ...review, certifiedMail: delivered } }, ] satisfies { label: string; review: NoticeReview }[]; const decisions = scenarios.map((scenario) => evaluateRelease(ledger, scenario.review)); const missingProof = "MISSING_CERTIFIED_MAIL_DELIVERY_PROOF"; assert.deepEqual(decisions, [ { supervisorReleaseEligible: false, reasons: ["ACTIVE_DISPUTE_HOLD"] }, { supervisorReleaseEligible: false, reasons: [missingProof] }, { supervisorReleaseEligible: false, reasons: ["ACTIVE_DISPUTE_HOLD", missingProof] }, { supervisorReleaseEligible: true, reasons: [] }, ]); for (const certifiedMail of [ { ...delivered, noticeId: "NOTICE-01" }, { ...delivered, unitId: "UNIT-B13" }, { ...delivered, deliveryEvidenceId: " " }, { unitId: mail.unitId, noticeId: mail.noticeId, status: "delivered", deliveryEvidenceId: "POD-02" }, { ...mail, status: "delivered" }, ] satisfies CertifiedMail[]) { assert.deepEqual(evaluateRelease(ledger, { ...review, certifiedMail }), { supervisorReleaseEligible: false, reasons: [missingProof] }); } const paid = rollForward({ ...unit, postings: [...unit.postings, { id: "PAY-02", kind: "payment", amountCents: 12_500n }, ] }); assert.equal(paid.closingCents, 0n); assert.deepEqual(evaluateRelease(paid, { ...review, certifiedMail: delivered }), { supervisorReleaseEligible: false, reasons: ["NO_PAST_DUE_BALANCE"] }); const [fee, payment] = ledger.rows; console.log(`${ledger.unitId} opening + fee - payment (cents): ${ledger.openingCents} + ${fee.deltaCents} - ${-payment.deltaCents} = ${ledger.closingCents}`); for (const [index, { label }] of scenarios.entries()) { const { supervisorReleaseEligible, reasons } = decisions[index]; const outcome = supervisorReleaseEligible ? "ELIGIBLE" : `BLOCKED (${reasons.join(", ")})`; console.log(`${label}: ${outcome}`); } 

Verified Node output

UNIT-B12 opening + fee - payment (cents): 15000 + 5000 - 7500 = 12500 Active dispute + delivery proof: BLOCKED (ACTIVE_DISPUTE_HOLD) Cleared dispute + mailing record: BLOCKED (MISSING_CERTIFIED_MAIL_DELIVERY_PROOF) Active dispute + no proof: BLOCKED (ACTIVE_DISPUTE_HOLD, MISSING_CERTIFIED_MAIL_DELIVERY_PROOF) Cleared dispute + matching delivery proof: ELIGIBLE 

Save the ledger cutoff, notice ID, dispute state, and evidence reference used in each review. Replay the checks against current records before recording the supervisor's decision.

StorageDelinq past-due unit workflow · B2B Ops and FinOps Benchmarks