feat: add engine and store snapshot/restore for restart resilience

This commit is contained in:
Codex
2026-02-18 12:57:25 +00:00
parent 76f673fe4c
commit 9b3cdbff1a
6 changed files with 117 additions and 15 deletions

View File

@@ -65,3 +65,13 @@ test("second unlock call is idempotent and does not double charge", () => {
assert.equal(wallet.getBalance("u2"), 7);
});
test("restores grant state from snapshot", () => {
const access = new AudioAccessStore();
access.grantAccess("a1", "u2");
const restored = new AudioAccessStore(access.exportState());
const canAccess = restored.canAccess({ audio, userId: "u2" });
assert.equal(canAccess.allowed, true);
assert.equal(canAccess.reason, "grant");
});