Skip to content

[test] Android VaultStoreTest has no regression test for setCoverArt's finalize-rename failure path #322

Closed

Description

@libravault-xyz

Context

Found while reviewing iOS VaultStoreTests.swift on feat/ios-vault-store-orchestration (unit test coverage pass, 2026-08-19).

VaultStore.kt's importFile has a dedicated regression test for the crash-safety ordering (encrypt-to-temp → rename → update-manifest) — the doc comment at VaultStore.kt:216 explicitly says this ordering was a bug an earlier review caught. setCoverArt (VaultStore.kt:314) has the identical structure (check(tmp.renameTo(finalFile)) { "Failed to finalize cover art" } at line 329) and identical cleanup-on-failure logic, but VaultStoreTest.kt has no matching test that forces the rename to fail and asserts the manifest/old-cover-art are left untouched.

The iOS port (feat/ios-vault-store-orchestration) added the equivalent test — testAFailedRenameDuringSetCoverArtLeavesTheManifestAndOldCoverUntouched in VaultStoreTests.swift — using a predictable injected newFileId plus pre-occupying the target path, mirroring the existing testAFailedRenameDuringImportLeavesNoManifestEntryBehind technique.

Ask

Port that same regression test to core/vaultstore/src/test/kotlin/xyz/libravault/core/vaultstore/VaultStoreTest.kt for setCoverArt, using the same "inject a predictable random: SecureRandom, pre-occupy the rename target" pattern the existing import regression test already uses.

Not a known live bug — this is a missing-test finding, not a reported failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    androidstatus:in-progressstatus:ready-for-dev

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions