Files
Tunglies 8328e34208 refactor(backend): declarative effects (#8128)
* refactor(core): type notice statuses behind the frozen wire contract

* refactor(utils): unified retry and strategy-list helpers

* refactor(feat): declarative effect registry for verge and clash patches

* refactor(core): derive refresh announcements from transaction commit

* refactor(core): fold tray, hotkey, autostart updates into effect ensures

* refactor(utils): migrate remaining bounded retry loops

* docs: add src-tauri architecture guardrails

* refactor(core): coalesce burst refresh announcements

* refactor(core): complete bounded service retry migration

* ci(backend): add architecture ban gates

* test(feat): freeze representative effect registry mappings

* docs(backend): record dead wire contract entries

* chore(core): document watcher exit conditions

* fix(backend): preserve applied state across later failures

* fix(config): retain runtime after an applied core replacement

* refactor(backend): flatten refresh publication and retry policies

* docs(backend): focus guardrails on architecture ownership

* refactor(effects): use one execution order

* fix(config): publish retained runtime and reconcile proxy settings
2026-10-07 07:38:55 +00:00

1.5 KiB

Backend Architecture Guardrails

These rules supplement the repository's root AGENTS.md.

  • Configuration ownership. config owns source configuration, drafts and persistence. The effects layer owns patch orchestration. Rollbackable transactions publish state after persistence and commit; already applied runtime and independently committed state remain authoritative even when a later step fails. Preserve that state, its notifications and the error.
  • Effect ownership. The declarative registry classifies every Verge patch field, including fields without effects and platform-specific fields. Effects reconcile toward the requested state with explicit dependencies and ordering. Configuration rollback does not imply reversal of OS or lifecycle effects.
  • Shared wire contract. Notifications are typed. Event names, status values and payload shapes stay compatible with frontend producers and consumers.
  • Synchronization ownership. Configuration-write serialization precedes configuration-update ownership, which precedes Core lifecycle ownership. When both are held, the lifecycle lock precedes the DNS lock. Independent transactions retain their ownership boundaries; asynchronous work does not hold synchronous data guards across suspension.
  • Retry ownership. Bounded retries share backend policy while preserving attempts, delays and terminal errors. Background monitors own their lifetime and cancellation separately; waiting for a condition or traversing distinct candidates is not a retry policy.