Repository navigation
fix(vault): code review cleanup batch (L1-L8) - #537
libravault-pipeline-bot[bot] wants to merge 5 commits into
Conversation
VaultPlayerViewModel.onSkipForward clamped the skip target against exo.duration.coerceAtLeast(0), which collapses to 0 while duration is still C.TIME_UNSET (negative) — seeking to the very start of the book instead of leaving the skip a plain forward nudge. Extracted the target computation into skipForwardTarget() so it's unit-testable without a real ExoPlayer. Part of #530 (L1).
remainingDelayMillis used failedAttempts <= FREE_ATTEMPTS, so the first FOUR failures (0, 1, 2, 3) all passed through free, contradicting the FREE_ATTEMPTS = 3 constant's own name. Also documents the wall-clock trust tradeoff (PRD §7): rolling the system clock forward can skip the backoff, accepted deliberately since the hardware Keystore/TEE binding is the actual gate, not this throttle. Part of #530 (L2).
If the Keystore key is deleted between forExisting()'s existence check and the subsequent unwrap() call inside unlockWithPin, the resulting KeyStoreException escaped uncaught instead of mapping to UnlockOutcome.KeystoreKeyLost — the same recovery-key fallback path forExisting()'s own KeystoreKeyLostException catch already routes to. Widened the catch to cover this race, without counting it toward the failed-attempt throttle (same as the existing early-return path, since the user didn't supply a wrong credential). Part of #530 (L3).
vmk was retained as a field though it's only used in init to derive fileContentKey — dropped to a plain constructor parameter. close() now zeroes fileContentKey and the cached decrypted chunk instead of leaving them in memory for as long as the (possibly GC-deferred) reader instance survives. Part of #530 (L4).
VaultContentsScreen/VaultReaderScreen/VaultPlayerScreen each read
VaultScreenSecurityPreference.isEnabled(context) once via a keyless
remember { }, so toggling the setting in feature:settings only took
effect the next time the screen recomposed from scratch (leave and
re-enter) — contradicting SecureScreenEffect's own doc comment
("toggling restores normal behavior immediately").
Added VaultScreenSecurityPreference.observe(), the same
OnSharedPreferenceChangeListener + callbackFlow pattern
core.storage.SupporterRepository.observe already uses, and a
rememberScreenSecurityEnabled() composable helper that collects it as
state. All three call sites now recompose live when the setting
changes elsewhere.
Part of #530 (L5).
|
The dev agent's run failed (crashed or exhausted its turn budget) while producing this PR — routed to a human instead of silently advancing an unconfirmed fix to QA. See the workflow run log for what happened. |
|
Automated pipeline health check: Checked the job log for run 32752636837 (
Worth flagging the pattern: this is the third confirmed hard max-turns exhaustion at cap 120 today (also PR #535/issue #531, PR #490/issue #5), all on genuinely large multi-file/security-sensitive scopes. Needs a fresh human decision — raise the cap again, or split #530's 8-finding batch (L1-L8, already checkbox-tracked in the PR body, only L1 done) into smaller PRs so each fits comfortably under 120 turns. Not self-healing. Generated by Claude Code |
|
Splitting this batch to unblock it — hit dev-agent's 120-turn cap after 5 of 8 findings (the PR's checklist under-reported progress; the diff actually has real, tested fixes for L1-L5). Re-filed as 8 independent issues so each fits comfortably under the turn cap: #564 (L1), #565 (L2), #566 (L3), #567 (L4), #569 (L5), #570 (L6), #572 (L7), #574 (L8). L1/L2/L3/L5 reference this PR's diff as a ready-to-rebase or reference implementation; L4 needs reconciling against #539's overlapping VaultFileReader.close() change, already merged to dev. Closing without merging — the branch stays around for reference until each split issue lands. |
VaultContentsScreen/VaultPlayerScreen each read
VaultScreenSecurityPreference.isEnabled(context) once via a keyless
remember { }, so toggling the setting in feature:settings only took
effect the next time the screen recomposed from scratch (leave and
re-enter) — contradicting SecureScreenEffect's own doc comment
("toggling restores normal behavior immediately").
Added VaultScreenSecurityPreference.observe() in core:storage, the
same OnSharedPreferenceChangeListener + callbackFlow pattern
core.storage.SupporterRepository.observe already uses, and a
rememberScreenSecurityEnabled() composable helper in feature:vault
that collects it as state. Both call sites now recompose live when
the setting changes elsewhere.
Reimplemented against current dev rather than cherry-picking the
referenced PR #537 commit verbatim: #543 (merged after that commit
was written) moved SecureScreenEffect to core:ui and
VaultScreenSecurityPreference to core:storage, and deleted
VaultReaderScreen outright, so the original diff's file paths and
third call site no longer exist. observe() lives on
VaultScreenSecurityPreference itself (core:storage) since core:ui
does not depend on core:storage; rememberScreenSecurityEnabled()
lives in feature:vault, the only module currently gating
SecureScreenEffect on this preference.
Part of #530 (L5). Closes #569.
…#571) * fix(vault): make the "Screen Security" toggle take effect immediately VaultContentsScreen/VaultPlayerScreen each read VaultScreenSecurityPreference.isEnabled(context) once via a keyless remember { }, so toggling the setting in feature:settings only took effect the next time the screen recomposed from scratch (leave and re-enter) — contradicting SecureScreenEffect's own doc comment ("toggling restores normal behavior immediately"). Added VaultScreenSecurityPreference.observe() in core:storage, the same OnSharedPreferenceChangeListener + callbackFlow pattern core.storage.SupporterRepository.observe already uses, and a rememberScreenSecurityEnabled() composable helper in feature:vault that collects it as state. Both call sites now recompose live when the setting changes elsewhere. Reimplemented against current dev rather than cherry-picking the referenced PR #537 commit verbatim: #543 (merged after that commit was written) moved SecureScreenEffect to core:ui and VaultScreenSecurityPreference to core:storage, and deleted VaultReaderScreen outright, so the original diff's file paths and third call site no longer exist. observe() lives on VaultScreenSecurityPreference itself (core:storage) since core:ui does not depend on core:storage; rememberScreenSecurityEnabled() lives in feature:vault, the only module currently gating SecureScreenEffect on this preference. Part of #530 (L5). Closes #569. * ci: retrigger CI after ready_for_review produced no run Known pipeline race (#433, precedent: PR #429/#432) — gh pr ready uses the default GITHUB_TOKEN, so its ready_for_review event never triggers jvm-tests.yml/ios-app-build.yml. Empty commit via the elevated token to force a synchronize event instead. --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Summary
Batch fix for issue #530's 8 low-severity code review findings (L1-L8) across
core/vaultcrypto,core/vaultstore,core/vaultcontent,feature/vault, and a few sampled elsewhere. Pushing incrementally — this draft opens after the first fix (L1); the rest land as follow-up commits on this branch.VaultPlayerViewModel.onSkipForwardcollapsed "+30s" to 0 when duration is unknown (C.TIME_UNSETis negative, so clamping againstduration.coerceAtLeast(0)clamped the target to 0). Extracted the target computation to a pureskipForwardTarget()helper, unit-tested directly.failedAttempts <= FREE_ATTEMPTSmade the first 4 failures free, not 3) + wall-clock trust doc noteforExistingKey()andunwrap()) escaping as a raw crash instead ofUnlockOutcome.KeystoreKeyLostVaultFileReaderretainingvmkas a field, never zeroing derived key material onclose()SecureScreenEffect(enabled = remember { ... })only reads the setting once per compositionallowBackup="false"vs. deadbackup_rules.xml/data_extraction_rules.xmlreportHeight(px),AssetsPathHandlerexposing all bundled assetsPlaybackServiceaccepts all controllers (non-vault playback only)Risk
Touches
core/vaultcrypto/**andcore/vaultstore/**, both onagent-policy.yml'ssensitive_pathslist — this will be force-classifiedrisk:highregardless of size, which is correct here: L3/L4 change behavior in the Keystore-key-loss and key-zeroing paths of the vault unlock/read flow.Closes #530.