-
Notifications
You must be signed in to change notification settings - Fork 1
fix(fetch-hooks): extract binary data URLs from request.json to sidec… #207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ar files - Add createRequestFileKV() for requests that extracts/restores inline base64 data URLs (data:image/png;base64,...) to sidecar files like request.json.assets/0001.png - Add createTextFileKV() for response bodies with same binary extraction - Update createFilesystemStorage() to use new KV types for requests and response bodies - Update test helper findCachedResponse() to handle raw text format - Add tests verifying binary extraction/restoration for both requests and responses
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dfd626c3ac
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements automatic extraction of inline base64 data URLs (e.g., data:image/png;base64,...) from cached request and response JSON files to separate sidecar binary files, improving cache readability and reducing file bloat.
Key Changes:
- Introduces
createRequestFileKV()andcreateTextFileKV()functions that automatically extract/restore data URLs to sidecar files (e.g.,request.json.assets/0001.png) - Updates
createFilesystemStorage()to use these new KV implementations for requests and response bodies - Updates
findCachedResponse()test helper to handle both new (raw text) and old (JSON-wrapped) response formats
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
packages-native/fetch-hooks/src/filesystem-storage.ts |
Adds createRequestFileKV() and createTextFileKV() functions that integrate binary extraction/restoration using the existing binary-extractor module, and updates createFilesystemStorage() to use these new storage implementations |
packages-native/fetch-hooks/test/cache-manager.test.ts |
Updates findCachedResponse() helper to handle raw text response format and adds comprehensive integration tests verifying binary extraction/restoration for both requests and responses |
- Simplify variable handling in createRequestFileKV.set() and createTextFileKV.set() - Add comprehensive JSDoc documentation for createRequestFileKV and createTextFileKV - Add test for response body restoration round-trip - Add changeset for binary sidecar extraction feature
Feedback addressed in 003794fCopilot suggestions (all addressed):
Codex/chatgpt-codex-connector suggestion (not addressed):
Also added:
|
#207) * fix(fetch-hooks): extract binary data URLs from request.json to sidecar files - Add createRequestFileKV() for requests that extracts/restores inline base64 data URLs (data:image/png;base64,...) to sidecar files like request.json.assets/0001.png - Add createTextFileKV() for response bodies with same binary extraction - Update createFilesystemStorage() to use new KV types for requests and response bodies - Update test helper findCachedResponse() to handle raw text format - Add tests verifying binary extraction/restoration for both requests and responses * refactor(fetch-hooks): address PR feedback - simplify code and add docs - Simplify variable handling in createRequestFileKV.set() and createTextFileKV.set() - Add comprehensive JSDoc documentation for createRequestFileKV and createTextFileKV - Add test for response body restoration round-trip - Add changeset for binary sidecar extraction feature
#207) * fix(fetch-hooks): extract binary data URLs from request.json to sidecar files - Add createRequestFileKV() for requests that extracts/restores inline base64 data URLs (data:image/png;base64,...) to sidecar files like request.json.assets/0001.png - Add createTextFileKV() for response bodies with same binary extraction - Update createFilesystemStorage() to use new KV types for requests and response bodies - Update test helper findCachedResponse() to handle raw text format - Add tests verifying binary extraction/restoration for both requests and responses * refactor(fetch-hooks): address PR feedback - simplify code and add docs - Simplify variable handling in createRequestFileKV.set() and createTextFileKV.set() - Add comprehensive JSDoc documentation for createRequestFileKV and createTextFileKV - Add test for response body restoration round-trip - Add changeset for binary sidecar extraction feature
…ar files
Add createRequestFileKV() for requests that extracts/restores inline base64 data URLs (data:image/png;base64,...) to sidecar files like request.json.assets/0001.png
Add createTextFileKV() for response bodies with same binary extraction
Update createFilesystemStorage() to use new KV types for requests and response bodies
Update test helper findCachedResponse() to handle raw text format
Add tests verifying binary extraction/restoration for both requests and responses