Skip to content

feat(api): config rejected and write-back failed are state, not only events - #181

Merged
fylorn merged 1 commit into
mainfrom
feat/notice-snapshot
Sep 24, 2026
Merged

fylorn merged 1 commit into
mainfrom
feat/notice-snapshot

Conversation

@fylorn

@fylorn fylorn commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

The desktop notices bridge subscribes to /events after core has already started (and again after reconnects). Anything core reported before that moment is lost: a credential that expired at startup, a config edit rejected while lite was restarting, a credential write-back that failed. Most of these are already current state in the API (OAuthView.needs_login/failure, ProviderView.auth_rejected, ProxyView.unreachable, Status.listen_error, /quota), so lite can reconcile from a snapshot. Two were event-only; this adds them:

  • Status.config_rejected: Option<ConfigRejection> {stage, message, line, excerpt, at_ms} — the last external edit that did not validate (the old config keeps serving). Cleared by the next successful apply. UI writes that fail validation never reach disk and aren't recorded.
  • Reverting a rejected edit to the version already in effect was swallowed by the loop guard ("this is our own write"), so nothing said the rejection was over; it now clears the state and emits ConfigReloaded (origin external).
  • ProviderView.writeback_failed: Option<Msg> — why a rotated credential could not be written back; cleared when a write-back succeeds.

CONTROL_API_VERSION 16 → 17. Both new fields are default + skip_serializing_if.

Tests: sync.rs (rejection stays until a good file; revert clears it and emits ConfigReloaded; a rejected UI write is not standing state), oauth.rs (write-back failure is visible and cleared on success). Local: fmt, clippy --all-targets/--lib -D warnings, cargo test --workspace, ts feature clippy + tests.

🤖 Generated with Claude Code

…led are state, not only events

A client that connects late (the desktop notices after a restart or a
reconnect) could only learn about a rejected config file or a failed
credential write-back from the event at that moment; if it missed the
event, the condition was invisible until it changed again.

- Status.config_rejected: the last external edit that did not validate,
  while the previous version keeps serving. Cleared by the next
  successful apply. A UI write that fails validation never reaches disk
  and is not recorded.
- Reverting a rejected edit to the version already in effect used to be
  swallowed as "our own write"; it now clears the rejection and emits
  ConfigReloaded, so the "did not validate" notice does not hang around.
- ProviderView.writeback_failed: the reason a rotated credential could
  not be written back, until a write-back succeeds.

CONTROL_API_VERSION 16 -> 17.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fylorn
fylorn force-pushed the feat/notice-snapshot branch from 4aefe41 to db7f062 Compare September 24, 2026 12:47
@fylorn
fylorn merged commit 94079e5 into main Sep 24, 2026
4 checks passed
@fylorn
fylorn deleted the feat/notice-snapshot branch September 24, 2026 12:55
@fylorn fylorn mentioned this pull request Sep 24, 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.

1 participant