Backport credential activity history to v0.21.4 - #533
Conversation
Introduces a sharable on-device store for Android and iOS to retain credential activity. We're re-using some components from the Wallet storage here, while maintaining a separate database for the local activity as it is a separate concern and should never be backed up with the existing systems. I've modeled the changes after how I typically use rust; mod.rs is mainly imports with most of the code in dedicated files, and tests in their related files. This system is expected to evolve over time so i've prioritized a sensible migration strategy as part of these changes. Tested integration on iOS. Will do Android later and follow up with any PRs that might be necessary for their integration. No runtime differences until the host apps are updated to use the new system.
* Introduce Credential Activity History Store Introduces a sharable on-device store for Android and iOS to retain credential activity. We're re-using some components from the Wallet storage here, while maintaining a separate database for the local activity as it is a separate concern and should never be backed up with the existing systems. I've modeled the changes after how I typically use rust; mod.rs is mainly imports with most of the code in dedicated files, and tests in their related files. This system is expected to evolve over time so i've prioritized a sensible migration strategy as part of these changes. Tested integration on iOS. Will do Android later and follow up with any PRs that might be necessary for their integration. No runtime differences until the host apps are updated to use the new system. * feaat: minor improvements to activity history * feaat: minor improvements to activity history * Update schema.rs --------- Co-authored-by: James Michael <ketzu@me.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: afc510a497
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| pub(super) fn ensure_activity_schema(conn: &Connection) -> DbResult<()> { | ||
| conn.execute_batch( | ||
| "CREATE TABLE IF NOT EXISTS activity_entries ( |
There was a problem hiding this comment.
Move activity history out of the disposable cache
Creating activity_entries in CacheDb makes user-visible history subject to the existing cache/maintenance.rs::open_or_rebuild policy, which deletes the entire cache database and its sidecars after any open, key, or integrity failure. In that scenario every activity entry is silently lost; the added schema-version-reset test does not exercise this deletion path. Store this credential-specific history in the authoritative credential vault instead.
AGENTS.md reference: AGENTS.md:L12-L12
Useful? React with 👍 / 👎.
| fn encode_issuer_schema_ids(issuer_schema_ids: &[u64]) -> Vec<u8> { | ||
| let mut bytes = Vec::with_capacity(issuer_schema_ids.len() * 8); | ||
| for id in issuer_schema_ids { | ||
| bytes.extend_from_slice(&id.to_be_bytes()); |
There was a problem hiding this comment.
Freeze the issuer-schema ID encoding in a byte-level test
This big-endian concatenation becomes a persisted database format, but the added tests only write and read through the same implementation and merely check the decoded vector length. A future simultaneous encoder/decoder change would therefore pass while making existing activity rows decode incorrectly; add a fixture asserting the exact bytes for representative IDs next to this code.
AGENTS.md reference: AGENTS.md:L9-L9
Useful? React with 👍 / 👎.
Backport James's credential activity history (#481) and the #506 follow-up to v0.21.4 so host apps can record and display credential activity without adopting the other 0.22.0 changes.
Base:
codex/backport-base-v0.21.4, pinned to the v0.21.4 release commitf0e3795d31985b839d372fbd19a6f92b7bda6a0d.Changes
walletkit-dbcrate and include theTransaction::query_row_optionalhelper required by activity queries.The SQLite engine, linkage, encryption open sequence, dependency lockfile, workspace manifest, and toolchain pins remain those of v0.21.4. The native SQLite isolation fix is in the independent PR #535, also based directly on v0.21.4; it is not part of this PR.
Validation
cargo test -p walletkit-core --lib storage:: --locked: 64 passed, including activity recording/pagination/listeners, migration onto an existing cache, and history preservation across reopen and disposable-cache reset.cargo fmt --all -- --checkandgit diff --check: pass.Tests ran in a separate Git worktree with Rust 1.94.1 and the checksum-verified Nargo version pinned in
nix/nargo.nix. Cross-platform CI and host-app activity/persistence validation remain pending. Assign a distinct reviewed backport version before publishing artifacts; source versions still identify v0.21.4.