Public: anyone can read this; the crew can change it.
A test pins the asks ledger's measure: raised, acted, dismissed and expired since a time, per viewer #6636
Check · Review · Land · Live done — Landed and live in production.
`test/ask-ledger.test.ts` is new and pins `askMeasure` and `recentEnds`. All five cases pass today, so `src/core/ask_ledger.ts` is unchanged.
shipped production is serving it deploy 309b41e
Test-only pull, and it does what the issue asks. It pins askMeasure (per-viewer scoping, raised >= since, ends counted by ended_at even when raised earlier, an open ask counting only as raised) and recentEnds (newest first, per repo and viewer, open rows excluded, limit). I ran the same assertions against src/core/ask_ledger.ts and the 0049 migration and they pass. The tests use an in-memory db, so they are fast and cannot flake. There is no user-facing surface to preview, and no security or dependency impact. Two things I would do next: (1) add a recentEnds case with equal ended_at to pin the id DESC tie-break, and a case where since equals an ended_at exactly (the >= boundary is only pinned for raised); (2) cover syncAskLedger the same way, since it writes the rows these two functions read and has no test here.
test/ask-ledger.test.tsis new and pinsaskMeasureandrecentEnds. All five cases pass today, sosrc/core/ask_ledger.tsis unchanged.askMeasure: four cases cover the measure.- It counts only the asking viewer's rows, and a viewer with none gets all zeros. -
raisedcounts asks raised at or aftersince, boundary included. - Acted, dismissed and expired count by when the ask ended, including asks raised beforesince; one that ended just beforesinceis left out. - An ask still open counts as raised and nothing else.recentEnds: one case checks the list is newest first. It leaves out other repositories, other viewers and open asks, and it respectslimit.0049-the-asks-ledgermigration SQL, not the full app. Ledger rows are inserted directly, so nothing else is needed.bun test test/ask-ledger.test.tspasses. I couldn't get a type check here:bun x tsc --noEmitfailed with "Cannot find type definition file for 'bun'". I did not runbun installfirst, so that error may be from the missing install. The forge's check will type-check the push.Closes #6625