Skip to content

feat(state): add deleteBulk method for batch state deletion#807

Open
madmecodes wants to merge 3 commits intodapr:mainfrom
madmecodes:feat/state-delete-bulk
Open

feat(state): add deleteBulk method for batch state deletion#807
madmecodes wants to merge 3 commits intodapr:mainfrom
madmecodes:feat/state-delete-bulk

Conversation

@madmecodes
Copy link
Copy Markdown

Summary

  • Add deleteBulk to IClientState interface accepting KeyValuePairType[] with per-item etag/metadata/options
  • gRPC implementation calls the DeleteBulkState RPC directly using DeleteBulkStateRequestSchema
  • HTTP implementation fans out to individual DELETE calls (no dedicated HTTP bulk-delete endpoint in Dapr)
  • Export new StateDeleteBulkOptions type from the package

Fixes #785

Test plan

  • e2e tests added for both HTTP and gRPC clients in test/e2e/common/client.test.ts
  • Verify bulk delete removes only specified keys, leaving others intact
  • TypeScript compiles cleanly (npx tsc --noEmit passes with no new errors)

@madmecodes madmecodes requested review from a team as code owners May 6, 2026 10:44
@WhitWaldo
Copy link
Copy Markdown
Contributor

@madmecodes First of all, thank you for taking the time to contribute something to this repository. Could you please make sure to sign your commits? I'm unable to accept any PRs that are not signed.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

Codecov Report

❌ Patch coverage is 0% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 25.84%. Comparing base (d1bf38a) to head (6f1ab56).
⚠️ Report is 78 commits behind head on main.

Files with missing lines Patch % Lines
src/implementation/Client/GRPCClient/state.ts 0.00% 10 Missing ⚠️
src/implementation/Client/HTTPClient/state.ts 0.00% 7 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              main     #807       +/-   ##
============================================
- Coverage   100.00%   25.84%   -74.16%     
============================================
  Files            1      138      +137     
  Lines            6     3742     +3736     
  Branches         1      568      +567     
============================================
+ Hits             6      967      +961     
- Misses           0     2731     +2731     
- Partials         0       44       +44     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: madmecodes <ayushguptadev1@gmail.com>
@madmecodes madmecodes force-pushed the feat/state-delete-bulk branch from 46cc311 to 862e40c Compare May 6, 2026 11:45
@WhitWaldo WhitWaldo requested a review from Copilot May 6, 2026 18:02
@WhitWaldo WhitWaldo requested review from Copilot and removed request for Copilot May 7, 2026 14:24
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Comment on lines +131 to +133
try {
await Promise.all(
items.map((item) =>
Comment on lines +134 to +138
this.delete(storeName, item.key, {
etag: item.etag,
concurrency: item.options?.concurrency,
consistency: item.options?.consistency,
}),
Comment on lines +135 to +148
async deleteBulk(
storeName: string,
items: KeyValuePairType[],
_options: StateDeleteBulkOptions = {},
): Promise<StateSaveResponseType> {
const states: StateItem[] = [];

for (const item of items) {
const si = create(StateItemSchema, {
key: item.key,
etag: item?.etag ? create(EtagSchema, { value: item.etag }) : undefined,
options: this._configureStateOptions(item?.options),
metadata: item.metadata ?? {},
});
Comment on lines +32 to +36
deleteBulk(
storeName: string,
items: KeyValuePairType[],
options?: StateDeleteBulkOptions,
): Promise<StateSaveResponseType>;
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.

feat(state): Implement deleteBulk method (DeleteBulkState RPC)

3 participants