Skip to content

Download built-in rule fixes from GitHub daily - #49

Draft
kasnder wants to merge 1 commit into
mainfrom
ccr-5fcee933-rule-updates
Draft

kasnder wants to merge 1 commit into
mainfrom
ccr-5fcee933-rule-updates

Conversation

@kasnder

@kasnder kasnder commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Builds on #48 (merged), which keeps a row on when a rule is added to it. Without that, every downloaded sibling rule would switch its row off.

Concern addressed: A broken built-in rule stays broken until the next release (as with #46 and #47).

What changed and why:

  • RuleUpdates + RuleUpdateJobService: a daily JobScheduler job (any network) downloads the flavour's distraction_rules.txt from main. The URL is a string resource, overridden for gmwaylite. HTTPS to raw.githubusercontent.com only, redirects refused, 256 KiB cap, written atomically, last good copy kept on failure. On success the running service reloads its rules.
  • ServiceConfig.getRules() adds downloaded rules whose identity is not already bundled. Downloads never replace or remove a bundled rule, and navigation rules are never downloaded.
  • FilterRuleParser.usesOnlyKnownKeys: a downloaded line using a key this version does not know is dropped. Otherwise the parser would skip the key, and since new keys usually narrow a rule, older apps would apply it more widely than written.
  • Settings → Advanced: "Update built-in rules" switch, on by default. Turning it off cancels the job, deletes the stored copy and reloads.
  • Adds the INTERNET permission. AGENTS.md (the on-device principle, plus "merging a rule to main ships it") and the README privacy section are updated to match.

Evidence: New unit tests: known/unknown keys in FilterRuleParserTest; in ServiceConfigTest, default on, downloaded rule added as built-in, bundled duplicate not added twice, ignored when off, unknown-key line dropped, every bundled rule uses only known keys. CI passes on both flavours. Not run locally (no Android SDK in this container). The download, job scheduling and settings switch are untested on a device.

Not in this PR:

  • No signature check: anyone who can push to main can ship rules to every user within a day. Rules can only hide or cover things, not send data, but it's worth a follow-up.
  • A rule deleted from main stays in apps that bundle it. Downloads can only add.
  • The first download happens whenever the periodic job first runs (within a day), not straight away. There is no manual "check now".
  • Store listings (Play data safety, F-Droid) need updating for the new network request. That's outside this repo.

https://claude.ai/code/session_01GwnAB5CENNRMKt5vqGLKcS


Generated by Claude Code

@kasnder
kasnder added this pull request to stack #50 October 21, 2026 08:31
Base automatically changed from ccr-5fcee933-sibling-state to main October 21, 2026 08:31
Apps change their layouts faster than releases ship, so a broken
built-in rule stays broken for every user until the next release, as
the LinkedIn and WhatsApp rules just did.

A daily JobScheduler job now downloads the flavour's
distraction_rules.txt from main on raw.githubusercontent.com and
getRules() adds any rule it does not already have. Downloaded rules
never replace or remove bundled ones, and navigation rules are never
downloaded, since a wrong one taps things. A rule line using a key this
version does not know is dropped: the parser would otherwise skip the
key and apply the rule more widely than written. HTTPS to that one host
only, redirects refused, 256 KiB cap, and the last good copy is kept on
any failure.

It is on by default and can be turned off in Settings, which also
deletes the stored copy. This adds the INTERNET permission; AGENTS.md
and the README privacy section now say what the one request is.

Claude-Session: https://claude.ai/code/session_01GwnAB5CENNRMKt5vqGLKcS
@kasnder
kasnder force-pushed the ccr-5fcee933-rule-updates branch from d3de182 to b585169 Compare October 21, 2026 08:31
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.

2 participants