Uh oh!
There was an error while loading. Please reload this page.
fix(storage): close usage stores after lease revocation - #2365
Conversation
liugddx
commented
Aug 7, 2026
Astro-Han
left a comment
There was a problem hiding this comment.
Thanks — the fix is right and matches every sibling store (usage-stores.ts was the only store wrapping close in the lease; the probe-verified idempotency and the new tests all hold, 8/8 green).
One P2 on the concurrency form of the very scenario this PR fixes: an admitted in-flight write at revocation time still makes close reject — the in-flight op fails with invalid_lease, gets collected into failures, and close's throwDeduplicatedFailures (usage-stores.ts:381) upgrades that benign revocation into a shutdown failure (invalid_lease is itself classified as lifecycle/needsDrain:false at :165-167). Reproduced with a probe: close → StorageRootAuthorityError:invalid_lease, which in the host-kernel path becomes a 'did not cleanly close every resource' exit. Pre-existing, but it is the concurrent form of what this PR claims to fix, and it's a small change (fold lifecycle codes into the expected-failure predicate, or filter them before the aggregation). Happy to defer if you'd rather land this first. P3: writerByLease isn't cleaned on close (siblings delete it), and the new test could assert idempotent double-close.
Approving.
liugddx
commented
Aug 7, 2026
Added The failure was not another leaked SQLite lease: Windows rejects renaming a directory that contains the open
Windows target result: |
aa1fe4a to
bcb62c7Compareliugddx
commented
Aug 7, 2026
The failed required run was unrelated to this PR: the only storage failure was Rebased this branch onto current |
Uh oh!
There was an error while loading. Please reload this page.
Summary
Part of #2142.
Validation
npm --workspace @maka/core run buildnpm --workspace @maka/storage run buildnode --test packages/storage/dist/__tests__/usage-stores.test.js(8/8 pass)npx biome check packages/storage/src/usage-stores.ts packages/storage/src/__tests__/usage-stores.test.tspackage-import.testbecause the current Node process emits the experimentalnode:sqlitewarning; the failure reproduces in isolation and is unrelated to these files