Skip to content

automate_observation: warn about ignored flag combinations - #36

Merged
billy-lau merged 1 commit into
android:mainfrom
billy-lau:uraniborg/sanitize-flags
Sep 29, 2026
Merged

billy-lau merged 1 commit into
android:mainfrom
billy-lau:uraniborg/sanitize-flags

Conversation

@billy-lau

Copy link
Copy Markdown
Member

Some flags are silently ignored depending on what they are combined with. Log a warning at startup for each:

  • --check_preinstalled_only, --verifier_path, --no_prefetch, --cache_dir, --cache_prefetch_concurrency and --cache_prefetch_timeout without --perform_inclusion_proof_check.
  • --cache_prefetch_concurrency and --cache_prefetch_timeout with --no_prefetch, since only pre-fetching reads them.
  • --pull-all-apks with --pull-preinstalled-apks-only, where only pre-installed APKs are pulled.

Integer flags count only when set to a non-default value. These are warnings, not errors, so existing invocations keep working and exit codes are unchanged; the only difference is the new log lines for these combinations. The checks live in a pure function, validate_argument_combinations(), so other tools can reuse the rules.

Test:

  • pytest uraniborg/scripts/python/tests/: 150 passed (21 new).
  • Live on an Android 14 emulator with four ignored inclusion-proof flags: four warnings at startup, run otherwise unchanged (exit 0).
  • Real process with --perform_inclusion_proof_check --no_prefetch and both tuning flags: both warnings logged, --cache_dir not flagged.

Change-Id: I49800dc522b5d1c4939749fe0d3812482adb6b6c

Some flags are silently ignored depending on what they are combined
with. Log a warning at startup for each:

- --check_preinstalled_only, --verifier_path, --no_prefetch,
  --cache_dir, --cache_prefetch_concurrency and
  --cache_prefetch_timeout without --perform_inclusion_proof_check.
- --cache_prefetch_concurrency and --cache_prefetch_timeout with
  --no_prefetch, since only pre-fetching reads them.
- --pull-all-apks with --pull-preinstalled-apks-only, where only
  pre-installed APKs are pulled.

Integer flags count only when set to a non-default value. These are
warnings, not errors, so existing invocations keep working and exit
codes are unchanged; the only difference is the new log lines for
these combinations. The checks live in a pure function,
validate_argument_combinations(), so other tools can reuse the rules.

Test:
- pytest uraniborg/scripts/python/tests/: 150 passed (21 new).
- Live on an Android 14 emulator with four ignored inclusion-proof
  flags: four warnings at startup, run otherwise unchanged (exit 0).
- Real process with --perform_inclusion_proof_check --no_prefetch and
  both tuning flags: both warnings logged, --cache_dir not flagged.

Change-Id: I49800dc522b5d1c4939749fe0d3812482adb6b6c
@billy-lau
billy-lau merged commit 3ef0733 into android:main Sep 29, 2026
7 checks passed
@billy-lau
billy-lau deleted the uraniborg/sanitize-flags branch September 29, 2026 15:52
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.

1 participant