Skip to content

fix(platform-node): harden file storage - #70

Open
LukasParke wants to merge 1 commit into
mattapperson:mainfrom
LukasParke:lukeparke/openrouter-file-storage
Open

fix(platform-node): harden file storage#70
LukasParke wants to merge 1 commit into
mattapperson:mainfrom
LukasParke:lukeparke/openrouter-file-storage

Conversation

@LukasParke

Copy link
Copy Markdown
Collaborator

What

  • make file-storage key encoding bijective for underscores and __
  • move storage reads/writes to asynchronous filesystem operations with unique temp files and atomic rename
  • preserve legacy on-disk keys through guarded read migration
  • keep list() on an instance-local key index and batch getMany() reads

Why

The previous filename encoding decoded literal __ as percent escapes, which could make persisted keys disappear from enumeration. Synchronous checkpoint I/O also blocked the event loop. Changing the encoder alone would orphan files written by existing releases, so reads retain a collision-safe legacy fallback and migrate legacy files without overwriting a concurrent canonical write.

This semantically ports the file-storage portion of fork/port/openrouter-fixes commits b9905ac5 and 653b3986 onto current main after #67 and #68. It is not a cherry-pick.

createFileStorage remains single-writer-per-root for list() consistency; this pre-existing deployment assumption is now explicit in its JSDoc.

Test plan

  • cd packages/platform-node && bun test — 74 pass, 1 benchmark skipped
  • cd packages/platform-node && bun run typecheck
  • bun test — 2,058 pass, 6 integration/benchmark skips
  • bun run lint
  • sentrux check .
  • sentrux gate .
  • separate clean-context Pi review and re-review; confirmed races fixed, no remaining findings

Breaking behavior

None intended. Existing legacy files remain readable. Multiple live adapters pointing at the same root are not supported for list() coherence.

Port the file-storage portion of fork/port/openrouter-fixes commits b9905ac and 653b398 onto current main.

Signed-off-by: Luke Parke <5702154+LukasParke@users.noreply.github.com>
@vercel

vercel Bot commented Aug 13, 2026

Copy link
Copy Markdown

@LukasParke is attempting to deploy a commit to the Matt Apperson's projects Team on Vercel.

A member of the Team first needs to authorize it.

@LukasParke

Copy link
Copy Markdown
Collaborator Author

Agent: The compat check failed before exercising this change because the workflow received an empty OPENROUTER_API_KEY (OPENROUTER_API_KEY is not set). CI, DCO, and the structural gate passed. This requires the upstream repository secret/workflow configuration or a maintainer rerun with secrets available; there is no code failure to remediate in this PR.

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.

1 participant