Skip to content

Conversation

@bitmage
Copy link

@bitmage bitmage commented Jan 6, 2026

Summary

Fixes two bugs in the Durable Object Storage persister when using a non-empty storagePrefix:

  1. Prefix parsing bug (line 46): slice(key, storagePrefix.length, 1) returns empty string when prefix length > 1. Fixed to slice(key, storagePrefix.length, storagePrefix.length + 1).
  2. Empty storage handling (line 103-105): getPersisted() returned valid-but-empty content [[{}, '', 0], [{}, '', 0]] when storage was empty, causing load() to wipe existing store data. Now returns undefined when no data exists.

How did you test this change?

There were formerly no tests (!) for this persistence provider. I added a mock structure which allows it to be tested in a way that I believe is idiomatic with the other providers. Initially the first bug was my target, but I discovered the second when I got the test suite to run.

@jamesgpearce
Copy link
Contributor

👀 wow, thanks! I'll get these merged in this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants