feat(drive,lib,docs): add global settings for the Drive lease (#1677) - #1680
Merged
Merged
Conversation
ADR-0080 §13 designed a Global settings scope for `drive lease acquire`/`restore` (default expiry, backup dir, auth policy, headless opt-out) alongside the per-account and per-rule scopes, but only the latter two ever shipped. Add the missing Global scope: a new `lease` section in settings.json, a matching OMNI_DEV_DRIVE_LEASE_* env-var layer, and CLI-flag -> env -> settings.json -> hardcoded-default resolution for all four, mirroring resolve_model's precedent. The headless/off-macOS opt-out (§8) is new capability: acquiring without a device-owner authenticator is now possible via --allow-headless, with the waiver surfaced in CLI output, JSON output, and the audit log.
Fix the expiry-minutes resolver panicking on an out-of-range env/settings value instead of erroring, wire the restore path's headless-waiver flag into its audit verdict for parity with acquire, correct inverted CLI-help precedence text, load settings.json once instead of twice in LeaseFlags::resolve, and warn on ambient or malformed env/settings values that silently change lease behavior.
CoverageTotal: 97.26% ⚪ 0 pp vs Comparing
🔇 4 ignored region(s), 0 tolerated region(s)
Patch coveragePatch: 97.82% (403/412 new lines covered)
Uncovered new lines (9)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the Global settings scope for the Drive write lease that ADR-0080 §13 designed but deferred (#1664), closing #1677:
leasesection insettings.json(sibling ofdrive) fordefault_expiry_minutes,backup_dir,biometrics_only, andallow_headless.OMNI_DEV_DRIVE_LEASE_*env var for each setting.settings.json→ hard-coded default (matchingresolve_model's precedent), exceptbiometrics_only/allow_headless, which are additive opt-ins (any layer saying "yes" wins).A second commit closes gaps found in review of the first:
chrono::Duration, instead of relying on a downstream check that never ran for this path).drive lease restore's audit verdict now distinguishes a headless-waived restore (restored-headless-waiver), matchingacquire's existingacquired-headless-waiververdict.--helptext for--backup-dir/--expiry-minutes(it said settings.json beats the env var; the code, docs, and tests all say the opposite).LeaseFlags::resolve()now loadssettings.jsononce instead of twice, using the existingSettingsEnv::from_settingsfix built for exactly this (chore(gmail,drive): avoid double JSON parse of error bodies and redundant settings re-reads #1533).--allow-headless), and when a malformed env value is silently discarded.Test plan
cargo build,cargo fmt --check,cargo clippy -- -D warningsall cleancargo test— full suite passes (one pre-existing, unrelated daemon-lifecycle flake reproduced and confirmed to pass in isolation)cargo instasnapshot diff reviewed and accepted — only the two intended--helpline changes