[PM-38443] feat: Add fill-assist per-account storage and constants#2811
Conversation
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE Reviewed the addition of per-account Code Review DetailsNo findings. The implementation correctly follows the established |
There was a problem hiding this comment.
Pull request overview
Adds new per-account persistence hooks and shared constants to support Fill-Assist caching and fetch cadence, and ensures Fill-Assist persisted data is cleared on logout. This extends the existing AppSettingsStore per-account storage pattern (e.g., serverConfig) in preparation for the repository/sync work in the next PR.
Changes:
- Added Fill-Assist constants (
fillAssistFormsVersion,fillAssistUpdateInterval,fillAssistExpectedSchemaMajor) to sharedConstants. - Added per-account
fillAssistCachedDataandfillAssistLastFetchTimestampgetters/setters toAppSettingsStore(plus mock + default implementations). - Cleared Fill-Assist persisted values during account logout in
StateService.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| BitwardenShared/Core/Platform/Utilities/Constants.swift | Introduces shared Fill-Assist constants for versioning and update interval. |
| BitwardenShared/Core/Platform/Services/Stores/TestHelpers/MockAppSettingsStore.swift | Adds mock storage + accessors for new per-account Fill-Assist values. |
| BitwardenShared/Core/Platform/Services/Stores/AppSettingsStore.swift | Extends the settings store protocol and default implementation with per-account Fill-Assist persistence keys. |
| BitwardenShared/Core/Platform/Services/StateService.swift | Clears Fill-Assist persisted data on account logout. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2811 +/- ##
==========================================
+ Coverage 81.19% 81.20% +0.01%
==========================================
Files 1026 1026
Lines 65799 65817 +18
==========================================
+ Hits 53425 53447 +22
+ Misses 12374 12370 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…ix null pathname decoding
…and fillAssistLastFetchTimestamp
| // MARK: Fill-Assist | ||
|
|
||
| /// The forms map major version key requested from the manifest (e.g. `"v1"`). | ||
| static let fillAssistFormsVersion = "v1" | ||
|
|
||
| /// The minimum interval between fill-assist manifest checks (6 hours, matching the browser implementation). | ||
| static let fillAssistUpdateInterval: TimeInterval = 6 * 60 * 60 | ||
|
|
||
| /// The expected major component of the forms schema version (e.g. `"1"` for `"1.0.0"`). | ||
| static let fillAssistExpectedSchemaMajor = "1" |
There was a problem hiding this comment.
🎨 If you agree I'd like to start adding nested enums here in constants for things that are related like this so we avoid the prefix repetition. We're already doing that with UTType. E.g.
extension Constants {
/// Fill-Assist constants used by the app.
///
enum FillAssist {
/// The forms map major version key requested from the manifest (e.g. `"v1"`).
static let formsVersion = "v1"
/// ....
}
So then we can use them by Constants.FillAssist.formsVersion.
I feel like it's better organized this way.
…d selector assignment
…els' into pm-38443/fill-assist-api-and-models
Swift synthesizes CompactDecodable<Int> in the memberwise init rather than [String: Int]?, so direct literal assignment fails to compile.
The base branch was changed.
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-38443
📔 Objective
Adds per-account
fillAssistCachedDataandfillAssistLastFetchTimestampstorage keys toAppSettingsStore(following the existingserverConfigpattern), fill-assist constants (fillAssistFormsVersion = "v1",fillAssistUpdateInterval = 6h,fillAssistExpectedSchemaMajor = "1"), and clears fill-assist data on account logout.Depends on #2810 (PR 1/3). This is PR 2/3 for PM-38443. PR 3/3 adds the repository and sync integration.