Skip to content

feat: choose per category whether a notice interrupts, and report unreachable upstreams - #42

Merged
fylorn merged 1 commit into
devfrom
feat/notice-prefs
Sep 18, 2026
Merged

fylorn merged 1 commit into
devfrom
feat/notice-prefs

Conversation

@fylorn

@fylorn fylorn commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #41. That PR deliberately left out per-category switches.

Per-category switches

  • Settings → 提醒 lists every category of notice. Each one can be set to 系统通知, 仅在应用内 or 关闭.
  • A notice that interrupted also offers 不再弹出此类 in the bell's list. It keeps that category in the app from then on.
  • The setting is per category, not per notice. The same kind of thing will happen again tomorrow, and what the user means is "this kind of thing should not interrupt me".
  • Turning a category off also withdraws the notices already open in it. Keeping an old one around would ignore what the user just said.
  • Only settings that differ from the factory default are stored, so a default that changes later still takes effect.

Unreachable upstreams

The user's list named this, and #41 did not cover it.

  • Core's circuit breaker emits closed when its cooldown ends. That means "may try again", not "recovered".
  • Treating it as recovery breaks things: an upstream that is still down would open and close every minute and never outlast the one-minute hold.
  • So recovery is taken only from a request that the upstream actually served (RequestRouted → a served attempt).
  • The category is in-app by default. Most setups have a fallback, and a failure the fallback caught is not worth interrupting anyone. It is one switch away for users who want it.

Test plan

  • cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo test (94). New tests cover:
    • off records nothing
    • app lists but never interrupts
    • turning a category off withdraws what is open in it
    • every key maps to the category its setting is shown under
    • an unreachable upstream stays in the app by default, survives the cooldown's closed, and clears only on a served attempt
  • pnpm typecheck, pnpm build, pnpm test (88)
  • Walked through in the isolated preview:
    • the Settings section shows all eight categories with the right defaults
    • 不再弹出此类 appears only on notices that interrupted, switches the category to in-app, and confirms it

🤖 Generated with Claude Code

…eachable upstreams

Each category of notice can now raise a system notification, stay in the
app's list, or be turned off, from a new section in Settings. A notice
that interrupted also offers "不再弹出此类" in the list, which keeps that
category in the app from then on. The setting is per category, not per
notice: the same kind of thing will happen again tomorrow, and what the
user means is "this kind of thing should not interrupt me".

Turning a category off also withdraws what is open in it, because keeping
an old notice around would ignore what the user just said.

Upstreams that cannot be reached are now reported as well. Core's
circuit-breaker "closed" after its cooldown means "may try again", not
"recovered", so treating it as recovery would let an upstream that is still
down open and close every minute and never outlast the hold. Recovery is
taken only from a request the upstream actually served. The category stays
in the app by default: most setups have a fallback, and a failure the
fallback caught is not worth an interruption.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@fylorn
fylorn merged commit 2e187f5 into dev Sep 18, 2026
2 checks passed
@fylorn
fylorn deleted the feat/notice-prefs branch September 18, 2026 12:29
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