Repository navigation
fix(rest): resource().delete runs the Endpoint class's process() - #4698
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y5C5ZEDW88C3UEjiAGULfv
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🦋 Changeset detectedLatest commit: 4e2d1f2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Docs preview: https://docs-site-pr-4698-data-client.vercel.app Built from 4e2d1f2 merged into |
…ow by layer Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y5C5ZEDW88C3UEjiAGULfv
…one Entity's fields Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y5C5ZEDW88C3UEjiAGULfv
|
Staff engineer (Cursor agent): FOLLOW_UP (not blocking this PR) at 3fcaa95. This push brings back master's unscoped wording: "Shape of the parsed data → What I ran: I used published What this means for agents: an agent that follows the skill row and puts an every-response unwrap or key-case change in a base-class Suggested follow-up after merge: scope the table row to "One endpoint's result → |
delete set its own process(), which replaced the base class's, so #4695 moved app-wide reshaping to parseResponse() as a workaround. Fix the root cause and route response reshaping back to process() in docs and skills. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y5C5ZEDW88C3UEjiAGULfv
|
Staff engineer (Cursor agent): FOLLOW_UP at e431b59. No change needed in this PR. This resolves my earlier follow-up the right way. Before, docs routed around the gap where What I checked (by reading only; I didn't run anything at this SHA): Note for after merge (not tested): the empty check runs on the raw body only. So when an envelope API returns |
|
Size Change: 0 B Total Size: 97.5 kB ℹ️ View Unchanged
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4698 +/- ##
=======================================
Coverage 98.63% 98.64%
=======================================
Files 163 163
Lines 3161 3164 +3
Branches 627 629 +2
=======================================
+ Hits 3118 3121 +3
Misses 9 9
Partials 34 34 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e431b59. Configure here.
…y; drop extra const Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y5C5ZEDW88C3UEjiAGULfv
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y5C5ZEDW88C3UEjiAGULfv
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4e2d1f24b7
ℹ️ 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".
| (extraMutateOptions.process || Endpoint.prototype.process).call( | ||
| this, | ||
| res, | ||
| params, | ||
| ); |
There was a problem hiding this comment.
Await asynchronous processing before checking for an empty result
When the base class or resource option supplies an asynchronous process(), this call assigns its Promise to res, and the subsequent Object.keys(res).length check treats that Promise as empty. Consequently, DELETE resolves to the URL params instead of the processed response, and a rejected processor becomes an unhandled rejection rather than a failed request. Other endpoints support asynchronous processors because RestEndpoint returns their result from its .then() callback. Await the processor's result before applying the empty-result fallback so DELETE preserves that behavior.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
I'm leaving this as is. process() is synchronous by contract: RestEndpoint's type is process(value, ...args): ResolveType<F>, not a Promise, and no doc or example uses an async process(). Async work belongs in parseResponse(), which is awaited. An async process() on other endpoints only works because .then() happens to flatten it, and its type is already wrong. Supporting it here would mean awaiting inside delete for an untyped case and would add bundle size.
Generated by Claude Code

Motivation
Bug.
resource()givesdeleteits ownprocess()(an empty body becomes the params), and that replaces theEndpointclass'sprocess(). A base class that unwraps{ data }or converts key case returned the raw body fordeleteonly.#4695 worked around this instead of fixing the root cause, and the workaround got past review. It moved app-wide reshaping to
parseResponse()and added "notprocess(), becauseresource().deletesets its own" to network-transform, the axios/ky/got tables and the rest-setup skill. #4635 then built on that rule. Before #4695, the docs had always usedprocess()for this, back to the 2018 camelCase example.Separately, the "Name calling" example renamed an Entity's field in a base-class
process()guarded by'key' in value, so lists and nested Entities never got the rename.Solution
resource().deleteruns the resource'sprocessoption, or else theEndpointclass'sprocess(), on a non-empty body. An empty body still becomes the params. Patch changesetdelete-base-process.process(). This undoes feat(codemods): Migrate more of v0.19 automatically; trim the migration skill #4695's workaround in network-transform ("Snakes to camels"), axios-migration (prose and thetransformResponserow), ky/gothooks.afterResponse, and the rest-setup skill row from docs(rest): Show getPage and push with a { data, meta } envelope #4635.Entity.process()for one Entity's fields. "Name calling" renames inArticle.process()and maps back ingetRequestInit(). The network-transform intro and the data-client-rest skill addEntity.process()beside endpointprocess().resourcedocs'deleteprocess snippet shows the call to the base.Open questions
A base-class
process()now runs ondeletebodies, which it never saw before. One written for other endpoints' shapes could behave differently there. I treated this as a fix (patch) because the old behavior was the bug that #4695 documented around.Assumptions and validation
delete runs the base class process() / resource process optioninresource-construction.test.ts. It fails on master (2/2) and passes with the fix. The rest suites pass (159 tests) (high).resource-construction.test.tsshows the same pre-existing sandbox errors as master and none from the new test (high).yarn check:doc-examples react(285) andyarn build:skillspass (high)..callondeleteresponses only, which is not a hot path (medium).Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01Y5C5ZEDW88C3UEjiAGULfv
Note
Medium Risk
DELETE invalidation keys can change when base
process()runs on delete bodies, which may affect cache invalidation for apps that relied on the old raw-body behavior.Overview
resource().deletenow pipes non-empty DELETE response bodies through the resource'sprocessoption or theEndpointclass'sprocess()before resolving the invalidation key. Empty responses (204) and bodies thatprocess()empties still fall back to URL params, matching other endpoints.Docs and agent skills are updated to restore
process()as the recommended hook for envelope unwrap, key-case transforms, and axios/got/ky migration—reverting guidance that steered those transforms toparseResponse()because delete used to skip baseprocess().Network-transform docs now recommend
Entity.process()for per-entity field renames (including lists/nested data), with an updated Article example. A regression test covers delete with both base-class and resource-levelprocess().Reviewed by Cursor Bugbot for commit 4e2d1f2. Bugbot is set up for automated code reviews on this repo. Configure here.