Skip to content

feat(server): delete segments command for http - #2804

Merged
hubcio merged 9 commits into
apache:masterfrom
dajneem23:feature/2722-delete-segments-command-for-http
Mar 6, 2026
Merged

hubcio merged 9 commits into
apache:masterfrom
dajneem23:feature/2722-delete-segments-command-for-http

Conversation

@dajneem23

@dajneem23 dajneem23 commented Feb 24, 2026 •

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #2722

Rationale

delete_segments already exists in binary/CLI/MCP and the HTTP SDK client already sends it, but the server HTTP API had no matching handler, so requests returned 404. This left HTTP behavior inconsistent with other transports.

What changed?

cargo fmt --all, cargo check -p server, cargo test -p integration --test mod --no-run cargo test --package integration --test mod -- server::general::authentication --nocapture

  • Added server-side HTTP support for delete_segments in core/server/src/http/segments.rs, following the same flow as partitions: parse path/query, validate, run permission check, -call delete_segments_base, and apply DeleteSegments state command.
  • Registered/kept the HTTP route wiring in the server HTTP router path for /streams/{stream_id}/topics/{topic_id}/partitions/{partition_id} with DELETE.
  • Enhanced core/integration/tests/server/scenarios/system_scenario.rs to call delete_segments at the end and verify partition segments_count before/after.
  • Updated web/docs/server-api.http with:
`DELETE {{url}}/streams/1/topics/1/partitions/1?segments_count=3`  
`Authorization: Bearer {{access_token}}`

(Path params: `stream_id`, `topic_id`, `partition_id`; query param: `segments_count`.)

Local Execution

  • Passed:

  • cargo fmt --all

  • cargo check -p server

  • cargo test -p integration --test mod --no-run

  • cargo test --package integration --test mod -- server::general::authentication --nocapture

  • Pre-commit hooks ran: ran

AI Usage

  1. Tool: ChatGPT (Codex)
  2. Scope: PR text drafting and test generation/updates system_scenario.rs
  3. Verification: Local formatting/check/test commands listed above
  4. Yes, every line can be explained if asked

@dajneem23 dajneem23 changed the title feat(server): delete segments command for http feat(server) (WIP): delete segments command for http Feb 24, 2026
@dajneem23
dajneem23 marked this pull request as draft February 24, 2026 08:16
@dajneem23 dajneem23 changed the title feat(server) (WIP): delete segments command for http feat(server): delete segments command for http Feb 24, 2026
@codecov

codecov Bot commented Feb 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.34%. Comparing base (6735eea) to head (8497ad6).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
core/server/src/http/segments.rs 82.35% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2804      +/-   ##
============================================
+ Coverage     68.33%   68.34%   +0.01%     
  Complexity      739      739              
============================================
  Files          1052     1053       +1     
  Lines         84745    84763      +18     
  Branches      61281    61308      +27     
============================================
+ Hits          57910    57933      +23     
+ Misses        24463    24452      -11     
- Partials       2372     2378       +6     
Flag Coverage Δ
csharp 67.43% <ø> (-0.19%) ⬇️
go 6.27% <ø> (ø)
java 54.83% <ø> (ø)
node 92.26% <ø> (-0.03%) ⬇️
python 81.57% <ø> (ø)
rust 70.05% <83.33%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
core/server/src/http/http_server.rs 48.30% <100.00%> (+0.21%) ⬆️
core/server/src/shard/system/segments.rs 89.60% <ø> (ø)
core/server/src/http/segments.rs 82.35% <82.35%> (ø)

... and 21 files with indirect coverage changes

🚀 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.

@dajneem23
dajneem23 force-pushed the feature/2722-delete-segments-command-for-http branch from caec235 to 94b141b Compare February 24, 2026 08:33
@dajneem23
dajneem23 marked this pull request as ready for review February 24, 2026 08:41
@dajneem23
dajneem23 marked this pull request as draft February 24, 2026 08:53
@dajneem23
dajneem23 force-pushed the feature/2722-delete-segments-command-for-http branch from 94b141b to 4625029 Compare February 24, 2026 08:55
@dajneem23
dajneem23 marked this pull request as ready for review February 24, 2026 09:08

@spetz spetz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, please update server.http file with example request in core/server and that should be it.

@dajneem23
dajneem23 force-pushed the feature/2722-delete-segments-command-for-http branch from 130fcb9 to 8497ad6 Compare March 6, 2026 01:57
@dajneem23
dajneem23 requested a review from spetz March 6, 2026 01:57
@hubcio
hubcio merged commit ecd7709 into apache:master Mar 6, 2026
76 checks passed
kriti-sc pushed a commit to kriti-sc/iggy that referenced this pull request Mar 6, 2026
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.

Implement delete segments command for http

3 participants