feat(channels): remove a configured sidecar channel from the dashboard#6202
Merged
Conversation
Channels could only be added — removing one meant hand-editing config.toml, since the only mutating endpoint was POST /api/channels/sidecar/{name}/configure with no inverse.
Add remove_sidecar_block to rewrite config.toml with toml_edit (dropping the array key when the last block goes), plus a DELETE /api/channels/sidecar/{name} handler that runs it under the same config_write_lock that gates configure, then hot-reloads so the removed sidecar child is stopped rather than left running until restart.
The dashboard configured-channel cards gain a confirm-guarded Trash button wired to a dedicated useRemoveSidecarConfig mutation that invalidates channelKeys.all.
The channel's per-channel secret keys are deliberately left untouched, since purging them is a separable destructive action with no remove primitive yet.
Tests: remove_sidecar_block unit tests (named removal, absent no-op, last-block array drop), DELETE integration tests (removes then 404s on repeat, unknown 404), and a dashboard remove-flow test; the openapi and dead-route reflection guards cover the new route.
Closes #6186
… in channel-remove PR
…e response The sidecar-delete handler's bridge-restart failure path interpolated the raw error chain into the client response body. Keep the actionable partial-failure signal (the channel WAS removed from config.toml) as a static message and leave the full error to the existing server-side tracing::error! log.
houko
enabled auto-merge (squash)
June 18, 2026 15:39
# Conflicts: # .secrets.baseline
Deploying librefang with
|
| Latest commit: |
8c982d8
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://71eaf3e2.librefang-7oe.pages.dev |
| Branch Preview URL: | https://feat-6186-channel-remove.librefang-7oe.pages.dev |
added 2 commits
June 19, 2026 15:52
# Conflicts: # xtask/baselines/openapi.sha256
Deploying librefang-docs with
|
| Latest commit: |
8c982d8
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://23f23603.librefang-docs.pages.dev |
| Branch Preview URL: | https://feat-6186-channel-remove.librefang-docs.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #6186. Channels could only be added from the dashboard — the only mutating endpoint was
POST /api/channels/sidecar/{name}/configure, with no inverse, so removing a channel meant hand-editing~/.librefang/config.toml.Changes
Backend (
librefang-api)routes/sidecar_toml.rs— newremove_sidecar_block(path, name): removes the[[sidecar_channels]]block by name viatoml_edit(preserving every other section's formatting), drops thesidecar_channelsarray key entirely when the last block goes, and writes atomically (same tempfile+rename scheme asupsert_sidecar_block). Returns whether a block was removed.routes/channels.rs— newDELETE /api/channels/sidecar/{name}handler: rewritesconfig.tomlunder the sameconfig_write_lockthat gates configure andPOST /api/config/set, 404s when no matching block exists, thenreload_config()+ (onReloadChannels)reload_channels_from_diskso the removed sidecar child process is stopped, not just dropped from disk. Registered inrouter()andopenapi.rs.Frontend (dashboard)
api.ts/lib/http/client.ts—removeSidecarConfig(name)calling the DELETE endpoint.lib/mutations/channels.ts—useRemoveSidecarConfigwith colocatedchannelKeys.allinvalidation.pages/ChannelsPage.tsx— a confirm-guarded Trash button on each configured channel card.en/zh/uk.Scope decision
A removed channel's per-channel secret keys are deliberately left untouched: there is no
remove_secretprimitive today, and purging secrets is a separable destructive action. The confirm dialog states this. Wiring a secret-purge is a follow-up if wanted.Verification
sidecar_toml_test:remove_drops_named_block_and_keeps_others,remove_absent_name_is_noop_returning_false,remove_last_block_drops_the_array_key.channel_remove_test(TestServer):delete_removes_configured_sidecar_then_404s_on_repeat,delete_unknown_sidecar_404s.dead_route_audit+openapi_path_coverageconfirm the new route is wired and documented.