Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit f42f4a64fe84b584655c1bdad78818b14219a31a
parent c56cc3f70588dee30f0bdc267dd3ab5551ac21a0
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 30 Sep 2026 09:24:12 -0400

common: review L4 — a timeout on no known location names the budget the call ran against, not the one in force when it throws. Test

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

Diffstat:
Mcommon/lib/storageHealth.test.ts | 13+++++++++++++
Mcommon/lib/storageHealth.ts | 7++++++-
2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/common/lib/storageHealth.test.ts b/common/lib/storageHealth.test.ts @@ -668,3 +668,16 @@ test("DT: the test seam's budget wins over the applied one, and the timings surv resetStorageHealth(); assert.equal(healthTimings().inFlightPerLocation, 6, "configuration, not health"); }); + +test("DT review L4: a timeout on no known location names the budget the call ran against", async () => { + setDriveCallBudget(80); + const refused = onDrive("/hand/typed/ch/data", never).then( + () => "answered", + (err: Error) => err.message, + ); + // Changed once the call is out (it reads its budget after taking a slot): + // its words keep the budget it was given. + await new Promise((r) => setImmediate(r)); + setDriveCallBudget(5_000); + assert.equal(await refused, "drive not answering (a read did not answer within 0.08 s)"); +}); diff --git a/common/lib/storageHealth.ts b/common/lib/storageHealth.ts @@ -795,7 +795,12 @@ export async function onDrive<T>(where: Where, call: () => Promise<T>): Promise< throw new DriveNotAnsweringError(stalledLocation(r.loc)); } refuseWaiters(r.key, null); - throw new DriveNotAnsweringError(null); + // The budget this call ran against, not the one in force now: a save during + // the call must not rewrite what it was given. + throw new DriveNotAnsweringError( + null, + `${NOT_ANSWERING} (a read did not answer within ${secondsText(budget)})`, + ); } // ---------------------------------------------------------------------------