Skip to content

ADR-0004: Per-notification rule loading

  • Status: Accepted
  • Date: 2026-08-11
  • Deciders: maintainers
  • Related: ADR-0002

Context

Rules are editable in-app (Settings → Parse rules). The parser must honor edits (enable/disable, pattern changes, deletes) immediately — cached rule sets would go stale.

Decision

Rules are loaded per notification from the rules table (RuleDao.enabledForPackage) inside the ingestion module. The parser is not cached.

A package with no enabled rules never parses — there is no fallback to the static BankRuleSets.

Consequences

  • Every in-app rule edit takes effect on the next notification. No cache invalidation problem.
  • Cost: one DB read per notification. Negligible for notification volume (a handful per day).
  • The static BankRuleSets are seeds only; they stop being authoritative once the table has data.

Alternatives considered

  • Loading rules once at startup and invalidating on edit — rejected: invalidation is error-prone and the volume doesn't justify the cache.
  • Falling back to BankRuleSets when a package has no rules — rejected: would silently resurrect rules the user deleted, contradicting the editor.