feat(rules): enhance rule identity documentation and introduce offline testing explanation

This commit is contained in:
Qiu Yuzhou
2026-10-02 22:38:11 +08:00
parent 63cb42da2a
commit 59ba9dfeff
2 changed files with 13 additions and 1 deletions
+6 -1
View File
@@ -16,9 +16,14 @@
- **Rule mode**: The ACL-backed routing mode in which built-in (and later custom) rules choose proxy versus direct per target; the unmatched default action is a separate persisted sub-option.
- **Rule default action**: The rule-mode sub-option that decides proxy versus direct for targets no rule matches. Factory default is proxy-when-unmatched. _Avoid_: fallback (ambiguous).
- **Built-in rule snapshot**: An app-shipped, pinned rule set produced by an explicit maintainer update; ordinary builds only read local snapshots and never fetch or convert. Three sources ship today: **geolocation-cn** (China domain direct candidates), **china-ipv4** (China mainland IPv4 CIDR direct candidates from gaoyifan/china-operator-ip), and **gfwlist** (proxy candidates from the official Base64 AutoProxy GFWList; only rules losslessly expressible as target domains, with `@@` exceptions shadowed by a broader proxy rule omitted and reported). Each snapshot carries its own source identity, digest, license, attribution, and conversion loss report.
- **Custom rule**: A user-persisted proxy or direct rule with an exact domain, domain suffix, or IPv4/IPv6 CIDR match and a stable opaque UUID. Custom rules merge with the active rule sub-mode's built-in sources into the sslocal ACL; global and direct modes do not load them. Rules that conflict with the fixed local scope or are shadowed by sslocal's domain-proxy / IP-direct priority are rejected at save or compile with an explainable reason and are never marked in effect. Diagnostics expose only a count and content-version summary, never raw custom domains. _Avoid_: user rule.
- **Custom rule**: A user-owned proxy or direct rule with a stable opaque identity and an exact-domain, domain-suffix, or IPv4/IPv6 address-range match; list order carries no routing priority. Same-action absorption and opposite-action shadowing do not erase saved rules or imply that they determine routing; rules violating the fixed local bypass policy are invalid. _Avoid_: user rule.
- **Rule identity**: The normalized match condition together with its routing action, shared by equivalent entries from different sources. It is distinct from the persistent identity of an editable custom entry; an individual IP address is equivalent to its full-length CIDR.
- **Rule source membership**: The collection of sources containing a rule identity; browsing merges equivalent entries while retaining every source membership. Removing a custom entry does not remove matching built-in entries.
- **Rule disablement**: The user's persisted exclusion of a normalized match condition and routing action across all rule sources; it excludes that rule identity without removing source entries or excluding broader rules covering the same targets. The fixed local bypass policy cannot be disabled.
- **Rule absorption**: A same-action coverage relationship in which a broader rule makes a narrower rule redundant for routing; excluding the broader rule makes surviving narrower rules eligible for matching again. It is distinct from opposite-action shadowing and does not erase the user's saved custom rule.
- **Rule shadowing**: An opposite-action coverage relationship in the analyzed rule collection; it may be complete or partial and may involve the fixed local bypass policy. It is distinct from same-action absorption and does not imply runtime activation.
- **Snapshot conversion report**: The conversion counts, omissions, rejections, and notes recorded when a built-in rule snapshot was produced. It describes snapshot creation rather than the current collection's coverage relationships or runtime state.
- **Offline rule test**: A rule-only explanation for a supplied domain, IP address, or URL host that returns proxy, direct, or no matching rule, independent of proxy mode, runtime state, and rule default action. It performs no DNS resolution or connectivity check and explicitly leaves DNS-dependent IP rules untested for domain inputs.
- **Proxy mode selector**: The common user action for choosing rule, global, or direct mode; it is distinct from enabling or disabling the proxy runtime, from the system proxy switch, and from custom-rule management. Its choice persists across GUI restarts.
- **Agent switch**: The user's persisted on/off intent for the background proxy runtime, distinct from whether that runtime is currently healthy. Its default is off. _Avoid_: proxy switch (ambiguous with the system proxy switch).
- **System proxy switch**: The user's persisted intent to use 2.0's local proxy endpoints through macOS system proxy settings, distinct from whether those settings are currently applied or suspended. Its default is off. _Avoid_: proxy switch (ambiguous with the agent switch).
@@ -0,0 +1,7 @@
# Rule identity across sources and independent offline testing
**Status**: accepted design; implementation pending.
Equivalent entries from multiple rule sources share a normalized match-and-action identity. Disablement applies to that identity across sources and persists even when no source currently contains it; deleting or editing a custom entry does not implicitly enable the old identity. Fixed local bypass rules remain immutable. This avoids duplicate sources silently defeating disablement and preserves the user's exclusion intent through source updates.
Offline testing evaluates all enabled rule sources and the fixed local policy, returning proxy, direct, or no matching rule. It reads no proxy mode, default action, or runtime state, performs no DNS resolution, and is unaffected by browsing filters. This deliberately explains the complete rule collection rather than predicting current traffic: runtime source selection remains a separate policy and can use a different subset. Domain inputs explicitly leave DNS-dependent IP rules untested.