Skip to content

ADR-0014: Debug fixture injection harness

  • Status: Accepted
  • Date: 2026-08-11
  • Deciders: maintainers
  • Related: tooling.md

Context

The parser and pipeline need end-to-end testing with fake bank notifications. adb shell cmd notification post -p <package> historically posted as a specific app, but API 35+ removed the -p flag — posts go out as com.android.shell, which production never tracks.

Decision

Debug builds include a broadcast receiver that injects fixtures straight into the capture pipeline, bypassing the system listener:

  • DebugFixtureReceiver (debug source set only) listens for com.zharif.autobudget.DEBUG_INJECT (extras: pkg, title, body, ts) and calls CapturePipeline.onNotification.
  • ParserEngine merges BankRuleSets.debugShellRules (12 generic rules for com.android.shell) when BuildConfig.DEBUG.
  • AutoBudgetApp.onCreate (debug) auto-adds com.android.shell to tracked packages.
  • scripts/post_fake_notifications.sh --broadcast drives it; --duplicate proves dedupe.

None of this ships in release: BuildConfig.DEBUG gates the rules merge and the auto-track; the receiver exists only in the debug manifest.

Consequences

  • Fixtures exercise the full runtime pipeline (filter → parse → classify → dedupe → insert) on API 35+ emulators where -p is gone.
  • --shell/default modes still work on older APIs or real devices where the flag works.
  • Debug-only surface: release APKs contain no receiver, no shell rules, and never track com.android.shell.

Alternatives considered

  • Relying on cmd notification post -p everywhere — rejected: broken on API 35+.
  • A test-only activity or instrumentation — rejected: heavier, and the receiver keeps the same single entry point as the real listener.