Skip to content

Add putByUniqueKey to ReadOnlyTabularStorage - #383

Merged
sroussey merged 1 commit into
mainfrom
claude/focused-fermi-f0fu4s
Sep 28, 2026
Merged

sroussey merged 1 commit into
mainfrom
claude/focused-fermi-f0fu4s

Conversation

@sroussey

Copy link
Copy Markdown
Contributor

Summary

Implements the putByUniqueKey method in ReadOnlyTabularStorage to properly handle write attempts on read-only storage by reporting them as overwrites rather than inserts.

Changes

  • Added putByUniqueKey implementation in ReadOnlyTabularStorage: Returns { entity, inserted: false } to indicate the write was not persisted. This prevents callers from assuming rows can be keyed by the result, which would cause them to skip reading back rows that the underlying storage actually holds.
  • Added import of UniqueKeyPutResult type from workglow
  • Added comprehensive test (ReadOnlyTabularStorage.test.ts) verifying that:
    • putByUniqueKey reports inserted: false
    • The underlying storage is not modified
    • The read-only wrapper correctly reflects the actual storage state

Implementation Details

The method signature matches the interface contract but intentionally does not persist changes. By returning inserted: false, it signals to callers that the entity cannot yet be keyed by the row, preventing logic errors where a caller might skip reading back data that actually exists in the underlying storage.

https://claude.ai/code/session_014X8ZuuuzKx9jryN5ndaVcb

@workglow/storage 0.6.8 made putByUniqueKey a required ITabularStorage
member, so the dry-run wrapper no longer implemented the interface and
typecheck failed on main. The new method no-ops like put(), and reports
inserted: false so a caller does not skip reading back rows the
underlying storage holds.

Fixes #382

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014X8ZuuuzKx9jryN5ndaVcb
@sroussey
sroussey merged commit c84d8a7 into main Sep 28, 2026
1 check passed
@sroussey
sroussey deleted the claude/focused-fermi-f0fu4s branch September 28, 2026 20:15
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