Files
clash-verge-rev/src-tauri/AGENTS.md
T
Tunglies 447ce3ccfb refactor(backend): extract profile and subscription capabilities (#8800)
* chore(clippy): scope crate lint policy

Keep panic-on-error lints at application target roots and scope signal dependencies to Linux.

* docs(agents): define Rust backend architecture boundaries

Document which layer owns Rust capabilities, fallible inputs, background work, and crate validation.

* refactor(draft): type async publication conflicts

Return typed conflicts for async Draft edits. Release the lock and edit permit before converting the error, and exercise overlapping updates.

* refactor(logging): use typed logger errors

Expose crate-owned logger errors and preserve the underlying error sources.

* refactor(subscription): extract response decoding

Keep HTTP and persistence in the app. Decode response metadata and framing in the crate, and fall back when the server filename is invalid.

* refactor(profile): extract profile models and index rules

Move profile models and index rules into the crate, preserving serialization and returning a typed missing-profile error.

* refactor(profile): separate subscription refresh and scheduling policy

Separate download and scheduling policy from the subscription use case while retaining the existing write path.

* refactor(subscription): decode deep links in the subscription crate

* refactor(profile): extract selected node recovery rules

* docs(agents): define dependencies between capability crates

* refactor(task): move retry primitives into the task crate

* refactor(backup): extract backup ZIP writing

* refactor(subscription): keep profile writes outside proxy fallback

* fix(profile): preserve delays for future update timestamps

* fix(subscription): preserve filenames from response headers and URL paths

* fix(subscription): separate deep link parameters from nested URLs

* refactor(profile): look up the refresh target once

* refactor(subscription): pass the proxy directly to each download

* refactor(profile): build companion options in one place

* refactor(profile): remove companions from the deleted profile

* style(profile): keep profile fields together

* refactor(profile): name index operations after what they change

* refactor(profile): call the core reload directly

* refactor(backup): move archive validation to the restore change
2026-12-03 12:42:26 +00:00

1.6 KiB

Backend Architecture Guardrails

Follow Workspace Crate Architecture when changing backend capability boundaries, reusable orchestration, or background task ownership.

  • Tauri adapter. Commands validate transport input, delegate to application use cases, and map results and errors to IPC. Tauri wires dependencies and owns desktop lifecycle, window and tray integration, and event delivery. Keep domain validation and reusable orchestration independent of command handlers and framework state.
  • Configuration and effects. config owns source configuration, drafts, and persistence coordination. Persistence adapters perform storage and recovery. 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.