Files
clash-verge-rev/src-tauri/AGENTS.md
T
Tunglies 929bb6a0a1 refactor(backend): share single-owner drivers for background tasks (#8759)
* docs(backend): define background task ownership

* refactor(backend): give background operations single task owners

* test(backend): remove actor migration regression cases

* docs(changelog): drop backend actor migration entry

* refactor(backend): extract workspace task drivers

* fix(timer): omit profile identifier from panic log

* docs(backend): define workspace crate boundaries

* refactor(lightweight): use the task countdown driver

* refactor(lightweight): name countdown callbacks

* refactor(task): simplify driver startup and coalescing requests

* refactor(core): bind service handoff to the sidecar generation

* refactor(tun): coalesce background run state reconciliation

* refactor(core): own sidecar exit resources in one session

* refactor(core): remove automatic Windows service handoff

* refactor(task): simplify coalescing job signals

* refactor(runstate): keep operation status with service state

* refactor(dns): coalesce background override synchronization

* refactor(sysproxy): own the local guard under its operation lock

* fix(tray): read menu settings at publication

* fix(dns): retain script lock across caller cancellation

* refactor(profiles): own selected node restoration in one task

* refactor(timer): own subscription schedules in the scheduler

* test(timer): remove the added application test

* fix(service): renew provider sync retry budget on refresh
2026-11-29 00:42:52 +00:00

20 lines
1.2 KiB
Markdown

# Backend Architecture Guardrails
Use [Workspace Crate Architecture](../crates/AGENTS.md) when extracting backend
capabilities or changing background task ownership.
- **Configuration and effects.** `config` owns source configuration, drafts, and
persistence. The effects layer classifies every Verge patch field, including
fields without effects and platform-specific fields, and reconciles requested
state in dependency order. Publish rollbackable state after persistence and
commit. On failure, preserve already applied runtime effects, independently
committed state, their notifications, and the error.
- **Wire contract.** Use typed notifications and preserve event names, status
values, and payload compatibility with frontend consumers.
- **Lock order.** Acquire configuration-write, configuration-update, Core
lifecycle, and DNS ownership in that order when needed. Preserve independent
transaction boundaries and release synchronous guards before suspension.
- **Retries.** Reuse the backend retry policy and preserve attempts, delays, and
terminal errors. Keep monitor lifetime, condition waits, and candidate fallback
under their own contracts.