Skip to content

Remove POST restart API server#714

Merged
epompeii merged 3 commits intodevelfrom
u/ep/post-restart
Mar 19, 2026
Merged

Remove POST restart API server#714
epompeii merged 3 commits intodevelfrom
u/ep/post-restart

Conversation

@epompeii
Copy link
Member

This changeset remove the POST restart API server endpoint.

@github-actions
Copy link

github-actions bot commented Mar 19, 2026

🤖 Claude Code Review

PR: #714
Base: devel
Head: u/ep/post-restart
Commit: cf66e6ed7a7e64147484c8180832a64281578007


Here's my review:


PR Review: Remove POST /v0/server/restart endpoint and replace select! with Race

Commits: rm_post_restart, rm_tokio_select, claude_1

Summary

This PR does two things:

  1. Removes the /v0/server/restart endpoint, CLI command, JSON type, and restart_tx channel from ApiContext
  2. Replaces tokio::select! with futures_concurrency::future::Race in the API server's run function

Positive

  • Clean removal across all layers (API, CLI, JSON types, OpenAPI spec, console docs, tests)
  • Changelog entry correctly marks it as a BREAKING CHANGE
  • Replacing select! with Race aligns with the CLAUDE.md guideline: "Avoid select! macros - use futures_concurrency::stream::Merge::merge"
  • Removes the restart_tx channel from ApiContext, simplifying the shared context struct
  • The loop {} with restart is gone, making the server lifecycle straightforward

Issues

1. Bug fix in backup.rs OPTIONS handler (good catch, but worth highlighting)

// Before: OPTIONS body type didn't match the POST endpoint
-    _body: TypedBody<JsonRestart>,
+    _body: TypedBody<JsonBackup>,

This was a pre-existing bug where the OPTIONS handler for /v0/server/backup used JsonRestart instead of JsonBackup. Good fix, but it's buried in the restart removal — consider calling it out in the PR description.

2. futures-concurrency and futures-util appear unused at the crate root (services/api/src/lib.rs:10-11)

use futures_concurrency as _;
use futures_util as _;

These deps are only used in main.rs (the binary), not in lib.rs. The use ... as _ lines suppress unused-crate warnings, but the dependencies are only needed by the binary target. This is fine for compilation but slightly misleading — a comment or moving these to main.rs would be cleaner. Since main.rs already has #![expect(unused_crate_dependencies)], these as _ imports in lib.rs are the workaround for the lib target. This is acceptable.

3. Race semantics — first future to complete wins, others are dropped

The Race tuple will resolve as soon as any future completes. If ctrl_c resolves first, the API server JoinHandle is dropped (which does NOT abort the spawned task — it just detaches it). This is the same behavior as the old select! so it's not a regression, but worth noting: the spawned API server task will continue running briefly after ctrl-c until the tokio runtime shuts down. This is fine.

4. The #[expect(clippy::too_many_arguments)] was removed from into_context (config_tx.rs:178)

Only clippy::too_many_lines remains. Verify this doesn't trigger a clippy warning now that the function has one fewer argument. With restart_tx removed, the arg count likely dropped below the threshold, so this is correct.

5. tokio moved to dev-dependency only in lib/api_server (lib.rs:6-7)

#[cfg(test)]
use tokio as _;

Good — tokio is no longer needed at runtime in api_server since the restart module (which used tokio::spawn and tokio::time::sleep) was removed. The #[cfg(test)] use tokio as _; suppresses the unused dev-dep warning.

6. Missing: cargo gen-types verification

Per CLAUDE.md: "When reviewing code, also check cargo gen-types (if the API changed at all)". The openapi.json diff shows the restart endpoint and JsonRestart schema were removed. Verify that the checked-in openapi.json matches what cargo gen-spec produces — it looks correct from the diff but should be confirmed.

7. Missing: bencher_client regeneration

Since the OpenAPI spec changed (removed /v0/server/restart), the auto-generated bencher_client should be regenerated. The CLI already removed its restart.rs module, but confirm bencher_client types are in sync.

Minor

  • The BodyParametersInner.astro cleanup correctly removes the delay default for the now-removed restart/config endpoints.
  • The server.mdx API docs correctly remove the restart endpoint entry.

Verdict

The changes are clean and well-scoped. The two action items are:

  1. Confirm cargo gen-types produces the same openapi.json that's checked in
  2. Confirm bencher_client is regenerated/consistent with the new spec

Model: claude-opus-4-6

@github-actions
Copy link

github-actions bot commented Mar 19, 2026

🐰 Bencher Report

Branchu/ep/post-restart
Testbedubuntu-22.04
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
microseconds (µs)
(Result Δ%)
Upper Boundary
microseconds (µs)
(Limit %)
Adapter::Json📈 view plot
🚷 view threshold
3.78 µs
(+7.66%)Baseline: 3.51 µs
4.64 µs
(81.36%)
Adapter::Magic (JSON)📈 view plot
🚷 view threshold
3.78 µs
(+8.43%)Baseline: 3.48 µs
4.56 µs
(82.89%)
Adapter::Magic (Rust)📈 view plot
🚷 view threshold
25.54 µs
(-0.01%)Baseline: 25.54 µs
31.38 µs
(81.37%)
Adapter::Rust📈 view plot
🚷 view threshold
2.79 µs
(-1.44%)Baseline: 2.83 µs
3.31 µs
(84.27%)
Adapter::RustBench📈 view plot
🚷 view threshold
2.79 µs
(-1.44%)Baseline: 2.83 µs
3.30 µs
(84.50%)
head_version_insert/batch/10📈 view plot
🚷 view threshold
99.44 µs
(-0.88%)Baseline: 100.32 µs
118.68 µs
(83.79%)
head_version_insert/batch/100📈 view plot
🚷 view threshold
238.71 µs
(+0.26%)Baseline: 238.08 µs
267.22 µs
(89.33%)
head_version_insert/batch/255📈 view plot
🚷 view threshold
459.48 µs
(-0.77%)Baseline: 463.03 µs
500.02 µs
(91.89%)
head_version_insert/batch/50📈 view plot
🚷 view threshold
160.84 µs
(-0.29%)Baseline: 161.30 µs
184.24 µs
(87.30%)
threshold_query/join/10📈 view plot
🚷 view threshold
143.67 µs
(-0.98%)Baseline: 145.09 µs
170.51 µs
(84.26%)
threshold_query/join/20📈 view plot
🚷 view threshold
158.88 µs
(-0.43%)Baseline: 159.57 µs
187.90 µs
(84.55%)
threshold_query/join/5📈 view plot
🚷 view threshold
136.07 µs
(-0.88%)Baseline: 137.28 µs
161.31 µs
(84.35%)
threshold_query/join/50📈 view plot
🚷 view threshold
199.60 µs
(-0.66%)Baseline: 200.93 µs
233.36 µs
(85.53%)
🐰 View full continuous benchmarking report in Bencher

@epompeii epompeii merged commit 2607ce6 into devel Mar 19, 2026
62 checks passed
@epompeii epompeii deleted the u/ep/post-restart branch March 19, 2026 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant