Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Refactor Rust core to use camelCase (#2159)

Leendert de Borstd44825681ee6
diff --git a/apps/browser-extension/src/migrations/0.31.0-AutofillMatchingModeCasingMigration.ts b/apps/browser-extension/src/migrations/0.31.0-AutofillMatchingModeCasingMigration.ts
new file mode 100644
index 000000000..e77f5b24b
--- /dev/null
+++ b/apps/browser-extension/src/migrations/0.31.0-AutofillMatchingModeCasingMigration.ts
@@ -0,0 +1,30 @@
+import { AutofillMatchingMode } from '@aliasvault/client/rust/RustCore';
+
+import { StorageKeys } from '@/utils/constants/storageKeys';
+import { logFailure } from '@/utils/Diagnostics';
+
+import { storage } from '#imports';
+
+/**
+ * Stored snake_case spellings from before the Rust core moved to camelCase enum values.
+ */
+const LEGACY_MATCHING_MODES: Record<string, AutofillMatchingMode> = {
+ 'url_exact': AutofillMatchingMode.URL_EXACT,
+ 'url_subdomain': AutofillMatchingMode.URL_SUBDOMAIN,
+};
+
+/**
+ * One-time, idempotent migration that rewrites a persisted snake_case autofill matching mode to its camelCase value.
+ *
+ * Added in the 0.31.0 release. Can be removed once installs from before 0.31.0 are no longer in use.
+ */
+export async function migrateAutofillMatchingModeCasing(): Promise<void> {
+ try {
+ const value = await storage.getItem(StorageKeys.AUTOFILL_MATCHING_MODE) as string | null;
+ if (value !== null && value in LEGACY_MATCHING_MODES) {
+ await storage.setItem(StorageKeys.AUTOFILL_MATCHING_MODE, LEGACY_MATCHING_MODES[value]);
+ }
+ } catch (error) {
+ logFailure('Failed to migrate autofill matching mode casing', error);
+ }
+}
diff --git a/apps/browser-extension/src/migrations/index.ts b/apps/browser-extension/src/migrations/index.ts
index c70cf7444..9c0f98480 100644
--- a/apps/browser-extension/src/migrations/index.ts
+++ b/apps/browser-extension/src/migrations/index.ts
@@ -1,4 +1,5 @@
import { migrateLegacyApiUrl } from '@/migrations/0.29.7-LegacyApiUrlMigration';
+import { migrateAutofillMatchingModeCasing } from '@/migrations/0.31.0-AutofillMatchingModeCasingMigration';
/**
* Generic entry point for one-time startup migrations. Called once during background startup;
@@ -11,4 +12,7 @@ import { migrateLegacyApiUrl } from '@/migrations/0.29.7-LegacyApiUrlMigration';
export async function runStartupMigrations(): Promise<void> {
// 0.29.7: Migrate legacy aliasvault.net URLs to aliasvault.com defaults.
await migrateLegacyApiUrl();
+
+ // 0.31.0: Rewrite the stored snake_case autofill matching mode to camelCase.
+ await migrateAutofillMatchingModeCasing();
}
diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/autofill/utils/RustItemMatcher.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/autofill/utils/RustItemMatcher.kt
index 213b55317..21dcf8990 100644
--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/autofill/utils/RustItemMatcher.kt
+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/autofill/utils/RustItemMatcher.kt
@@ -23,10 +23,10 @@ object RustItemMatcher {
DEFAULT("default"),
/** Exact URL matching only - no subdomain matching. */
- URL_EXACT("url_exact"),
+ URL_EXACT("urlExact"),
/** Subdomain matching - matches subdomains and root domains. */
- URL_SUBDOMAIN("url_subdomain"),
+ URL_SUBDOMAIN("urlSubdomain"),
}
init {
@@ -60,10 +60,10 @@ object RustItemMatcher {
val urlsArray = JSONArray()
item.urls.forEach { urlsArray.put(it) }
val credJson = JSONObject().apply {
- put("Id", idString)
- put("ItemName", item.name ?: JSONObject.NULL)
- put("ItemUrls", urlsArray)
- put("Username", item.username ?: JSONObject.NULL)
+ put("id", idString)
+ put("itemName", item.name ?: JSONObject.NULL)
+ put("itemUrls", urlsArray)
+ put("username", item.username ?: JSONObject.NULL)
}
rustCredentials.put(credJson)
itemMap[idString] = item
@@ -72,11 +72,11 @@ object RustItemMatcher {
// Prepare input JSON for Rust
val input = JSONObject().apply {
put("credentials", rustCredentials)
- put("current_url", searchText)
- put("page_title", "")
- put("matching_mode", "default")
- // Note: ignore_port=true because Android's Autofill API does not provide port numbers
- put("ignore_port", true)
+ put("currentUrl", searchText)
+ put("pageTitle", "")
+ put("matchingMode", "default")
+ // Note: ignorePort=true because Android's Autofill API does not provide port numbers
+ put("ignorePort", true)
}
// Call Rust via UniFFI
@@ -84,7 +84,7 @@ object RustItemMatcher {
// Parse output
val output = JSONObject(outputJson)
- val matchedIds = output.getJSONArray("matched_ids")
+ val matchedIds = output.getJSONArray("matchedIds")
// If no matches found, return empty list
if (matchedIds.length() == 0) {
@@ -137,10 +137,10 @@ object RustItemMatcher {
item.urls.forEach { urlsArray.put(it) }
val credJson = JSONObject().apply {
- put("Id", idString)
- put("ItemName", item.serviceName ?: JSONObject.NULL)
- put("ItemUrls", urlsArray)
- put("Username", item.username ?: JSONObject.NULL)
+ put("id", idString)
+ put("itemName", item.serviceName ?: JSONObject.NULL)
+ put("itemUrls", urlsArray)
+ put("username", item.username ?: JSONObject.NULL)
}
rustCredentials.put(credJson)
itemMap[idString] = item
@@ -150,9 +150,9 @@ object RustItemMatcher {
// Use https:// prefix for the rpId to match URL format
val input = JSONObject().apply {
put("credentials", rustCredentials)
- put("current_url", "https://$rpId")
- put("page_title", rpName ?: "")
- put("matching_mode", matchingMode.value)
+ put("currentUrl", "https://$rpId")
+ put("pageTitle", rpName ?: "")
+ put("matchingMode", matchingMode.value)
}
// Call Rust via UniFFI
@@ -160,7 +160,7 @@ object RustItemMatcher {
// Parse output
val output = JSONObject(outputJson)
- val matchedIds = output.getJSONArray("matched_ids")
+ val matchedIds = output.getJSONArray("matchedIds")
// If no matches found, return empty list
if (matchedIds.length() == 0) {
diff --git a/apps/mobile-app/app/upgrade.tsx b/apps/mobile-app/app/upgrade.tsx
index 545e9be48..65897a653 100644
--- a/apps/mobile-app/app/upgrade.tsx
+++ b/apps/mobile-app/app/upgrade.tsx
@@ -58,7 +58,7 @@ enum UpgradeKind {
}
/** The migration kind the native engine reports for the storage format move (see NativeVaultManager.getVaultMigrationStatus). */
-const MIGRATION_STATUS_STORAGE_FORMAT_UPGRADE = 'storage-format-upgrade';
+const MIGRATION_STATUS_STORAGE_FORMAT_UPGRADE = 'storageFormatUpgrade';
/** Engine failures that end the session instead of a retry on this page. */
const LOGOUT_ERROR_CODES: ReadonlySet<AppErrorCode> = new Set([
diff --git a/apps/mobile-app/ios/VaultStoreKit/Utils/RustItemMatcher.swift b/apps/mobile-app/ios/VaultStoreKit/Utils/RustItemMatcher.swift
index 027d7234a..c55780e6e 100644
--- a/apps/mobile-app/ios/VaultStoreKit/Utils/RustItemMatcher.swift
+++ b/apps/mobile-app/ios/VaultStoreKit/Utils/RustItemMatcher.swift
@@ -8,8 +8,8 @@ public enum RustItemMatcher {
/// Matching mode for item filtering.
public enum MatchingMode: String {
case `default` = "default"
- case urlExact = "url_exact"
- case urlSubdomain = "url_subdomain"
+ case urlExact = "urlExact"
+ case urlSubdomain = "urlSubdomain"
}
/// Filter items based on rpId using the Rust core item matcher.
@@ -34,10 +34,10 @@ public enum RustItemMatcher {
// Convert items to the format expected by Rust
let rustCredentials = items.map { item -> [String: Any?] in
return [
- "Id": item.itemId.uuidString.lowercased(),
- "ItemName": item.serviceName as Any?,
- "ItemUrls": item.urls,
- "Username": item.username as Any?
+ "id": item.itemId.uuidString.lowercased(),
+ "itemName": item.serviceName as Any?,
+ "itemUrls": item.urls,
+ "username": item.username as Any?
]
}
@@ -45,9 +45,9 @@ public enum RustItemMatcher {
// Use https:// prefix for the rpId to match URL format
let input: [String: Any] = [
"credentials": rustCredentials,
- "current_url": "https://\(rpId)",
- "page_title": "",
- "matching_mode": matchingMode.rawValue
+ "currentUrl": "https://\(rpId)",
+ "pageTitle": "",
+ "matchingMode": matchingMode.rawValue
]
let inputData = try JSONSerialization.data(withJSONObject: input, options: [])
@@ -62,7 +62,7 @@ public enum RustItemMatcher {
// Parse output
guard let outputData = outputJson.data(using: .utf8),
let output = try JSONSerialization.jsonObject(with: outputData) as? [String: Any],
- let matchedIds = output["matched_ids"] as? [String] else {
+ let matchedIds = output["matchedIds"] as? [String] else {
print("[RustItemMatcher] Failed to parse output JSON")
return []
}
diff --git a/apps/mobile-app/ios/VaultUI/Selection/Utils/RustItemMatcher.swift b/apps/mobile-app/ios/VaultUI/Selection/Utils/RustItemMatcher.swift
index 0e9a76175..b254a9263 100644
--- a/apps/mobile-app/ios/VaultUI/Selection/Utils/RustItemMatcher.swift
+++ b/apps/mobile-app/ios/VaultUI/Selection/Utils/RustItemMatcher.swift
@@ -21,19 +21,19 @@ public class RustItemMatcher {
// Convert AutofillCredential to the format expected by Rust
let rustCredentials = credentials.map { credential -> [String: Any?] in
return [
- "Id": credential.id.uuidString.lowercased(),
- "ItemName": credential.serviceName,
- "ItemUrls": credential.serviceUrls,
- "Username": credential.username
+ "id": credential.id.uuidString.lowercased(),
+ "itemName": credential.serviceName,
+ "itemUrls": credential.serviceUrls,
+ "username": credential.username
]
}
// Prepare input JSON for Rust
let input: [String: Any] = [
"credentials": rustCredentials,
- "current_url": searchText,
- "page_title": "",
- "matching_mode": "default"
+ "currentUrl": searchText,
+ "pageTitle": "",
+ "matchingMode": "default"
]
let inputData = try JSONSerialization.data(withJSONObject: input, options: [])
@@ -48,7 +48,7 @@ public class RustItemMatcher {
// Parse output
guard let outputData = outputJson.data(using: .utf8),
let output = try JSONSerialization.jsonObject(with: outputData) as? [String: Any],
- let matchedIds = output["matched_ids"] as? [String] else {
+ let matchedIds = output["matchedIds"] as? [String] else {
print("[RustItemMatcher] Failed to parse output JSON")
return []
}
diff --git a/apps/server/AliasVault.Client/Services/JsInterop/RustCore/RustCoreService.cs b/apps/server/AliasVault.Client/Services/JsInterop/RustCore/RustCoreService.cs
index dcf1c63e1..58536c340 100644
--- a/apps/server/AliasVault.Client/Services/JsInterop/RustCore/RustCoreService.cs
+++ b/apps/server/AliasVault.Client/Services/JsInterop/RustCore/RustCoreService.cs
@@ -20,16 +20,10 @@ using Microsoft.JSInterop;
/// </summary>
public class RustCoreService : IAsyncDisposable
{
- private static readonly JsonSerializerOptions JsonOptions = new()
- {
- PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower,
- WriteIndented = false,
- };
-
/// <summary>
- /// The vault codec and sharing DTOs are camelCase, unlike the older merge/prune DTOs. TODO: make all calls use consistent casing in future refactor.
+ /// Every Rust core DTO is camelCase on the wire.
/// </summary>
- private static readonly JsonSerializerOptions CodecJsonOptions = new()
+ private static readonly JsonSerializerOptions JsonOptions = new()
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
PropertyNameCaseInsensitive = true,
@@ -495,7 +489,7 @@ public class RustCoreService : IAsyncDisposable
public async Task<List<CodecBucketLayoutEntry>> VaultCodecBucketLayoutAsync()
{
var json = await InvokeCoreAsync<string>("rustCoreVaultCodecBucketLayout");
- return JsonSerializer.Deserialize<List<CodecBucketLayoutEntry>>(json, CodecJsonOptions) ?? [];
+ return JsonSerializer.Deserialize<List<CodecBucketLayoutEntry>>(json, JsonOptions) ?? [];
}
/// <summary>
@@ -558,7 +552,7 @@ public class RustCoreService : IAsyncDisposable
public async Task<CodecValidation> VaultCodecValidateManifestAsync(string manifestJson)
{
var json = await InvokeCoreAsync<string>("rustCoreVaultCodecValidateManifest", manifestJson);
- return JsonSerializer.Deserialize<CodecValidation>(json, CodecJsonOptions) ?? throw new InvalidOperationException("Failed to deserialize manifest validation result.");
+ return JsonSerializer.Deserialize<CodecValidation>(json, JsonOptions) ?? throw new InvalidOperationException("Failed to deserialize manifest validation result.");
}
/// <summary>
@@ -569,7 +563,7 @@ public class RustCoreService : IAsyncDisposable
public async Task<CodecValidation> VaultCodecValidateDataBucketAsync(string bucketJson)
{
var json = await InvokeCoreAsync<string>("rustCoreVaultCodecValidateDataBucket", bucketJson);
- return JsonSerializer.Deserialize<CodecValidation>(json, CodecJsonOptions) ?? throw new InvalidOperationException("Failed to deserialize data bucket validation result.");
+ return JsonSerializer.Deserialize<CodecValidation>(json, JsonOptions) ?? throw new InvalidOperationException("Failed to deserialize data bucket validation result.");
}
/// <summary>
@@ -608,7 +602,7 @@ public class RustCoreService : IAsyncDisposable
public async Task<ParsedEmail> ParseEmailSourceAsync(byte[] source)
{
var json = await InvokeCoreAsync<string>("rustCoreParseEmailSource", source);
- return JsonSerializer.Deserialize<ParsedEmail>(json, CodecJsonOptions) ?? throw new InvalidOperationException("Failed to deserialize parsed email.");
+ return JsonSerializer.Deserialize<ParsedEmail>(json, JsonOptions) ?? throw new InvalidOperationException("Failed to deserialize parsed email.");
}
/// <summary>
diff --git a/core/client/src/rust/RustCore.ts b/core/client/src/rust/RustCore.ts
index 86d63e26b..c7cac61ba 100644
--- a/core/client/src/rust/RustCore.ts
+++ b/core/client/src/rust/RustCore.ts
@@ -182,19 +182,19 @@ export function generateSeed(): string {
*/
export async function filterItems(items: Item[], currentUrl: string, pageTitle: string, matchingMode: AutofillMatchingMode = AutofillMatchingMode.DEFAULT): Promise<Item[]> {
const credentials = items.map(item => ({
- Id: item.Id,
- ItemName: item.Name ?? '',
- ItemUrls: getFieldValues(item, FieldKey.LoginUrl)
+ id: item.Id,
+ itemName: item.Name ?? '',
+ itemUrls: getFieldValues(item, FieldKey.LoginUrl)
}));
const result = await rustCore().filterCredentials({
credentials,
- current_url: currentUrl,
- page_title: pageTitle,
- matching_mode: matchingMode
+ currentUrl,
+ pageTitle,
+ matchingMode
});
- return result.matched_ids
+ return result.matchedIds
.map(id => items.find(item => item.Id === id))
.filter((item): item is Item => item !== undefined);
}
diff --git a/core/client/src/rust/RustCoreTypes.ts b/core/client/src/rust/RustCoreTypes.ts
index 576dd5f4c..1cda320aa 100644
--- a/core/client/src/rust/RustCoreTypes.ts
+++ b/core/client/src/rust/RustCoreTypes.ts
@@ -4,8 +4,8 @@
export enum AutofillMatchingMode {
DEFAULT = 'default',
- URL_EXACT = 'url_exact',
- URL_SUBDOMAIN = 'url_subdomain'
+ URL_EXACT = 'urlExact',
+ URL_SUBDOMAIN = 'urlSubdomain'
}
/**
@@ -59,14 +59,14 @@ export type ParsedEmail = {
/** Credential filter input for autofill matching, as the Rust matcher expects it. */
export type FilterCredentialsInput = {
- credentials: Array<{ Id: string; ItemName: string; ItemUrls: string[] }>;
- current_url: string;
- page_title: string;
- matching_mode: AutofillMatchingMode;
+ credentials: Array<{ id: string; itemName: string; itemUrls: string[] }>;
+ currentUrl: string;
+ pageTitle: string;
+ matchingMode: AutofillMatchingMode;
};
/** Credential filter output: the matched item ids. */
-export type FilterCredentialsOutput = { matched_ids: string[] };
+export type FilterCredentialsOutput = { matchedIds: string[] };
/** SRP ephemeral key pair (uppercase hex). */
export type SrpEphemeral = {
diff --git a/core/client/src/sync/VaultManifestMigration.ts b/core/client/src/sync/VaultManifestMigration.ts
index 22bc2911a..4dc2f5fe9 100644
--- a/core/client/src/sync/VaultManifestMigration.ts
+++ b/core/client/src/sync/VaultManifestMigration.ts
@@ -31,11 +31,11 @@ export enum VaultMigrationKind {
/**
* Rebuild the local database onto the current schema. Runs automatically.
*/
- SchemaRebuild = 'schema-rebuild',
+ SchemaRebuild = 'schemaRebuild',
/**
* Upgrades from sqlite-blob to manifest-v1 (api v1 to api v2) storage format.
*/
- StorageFormatUpgrade = 'storage-format-upgrade',
+ StorageFormatUpgrade = 'storageFormatUpgrade',
}
diff --git a/core/client/src/sync/VaultSyncEngine.ts b/core/client/src/sync/VaultSyncEngine.ts
index 816983a87..277ba428a 100644
--- a/core/client/src/sync/VaultSyncEngine.ts
+++ b/core/client/src/sync/VaultSyncEngine.ts
@@ -89,7 +89,7 @@ export type VaultSyncEngineResult = VaultSyncEngineResultBase & {
/** Outcome of the migration classification. */
export type VaultSyncMigrationStatusResult = VaultSyncEngineResultBase & {
- kind: 'none' | 'schema-rebuild' | 'storage-format-upgrade';
+ kind: 'none' | 'schemaRebuild' | 'storageFormatUpgrade';
};
/** Outcome of the manifest migration. */
diff --git a/core/rust/src/credential_matcher/mod.rs b/core/rust/src/credential_matcher/mod.rs
index ebedf37ce..aea127a4d 100644
--- a/core/rust/src/credential_matcher/mod.rs
+++ b/core/rust/src/credential_matcher/mod.rs
@@ -24,7 +24,7 @@ const DEFAULT_MAX_RESULTS: usize = 10;
/// Matching mode for credential filtering.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
-#[serde(rename_all = "snake_case")]
+#[serde(rename_all = "camelCase")]
pub enum AutofillMatchingMode {
#[default]
Default,
@@ -34,7 +34,7 @@ pub enum AutofillMatchingMode {
/// A credential record for matching.
#[derive(Debug, Clone, Serialize, Deserialize)]
-#[serde(rename_all = "PascalCase")]
+#[serde(rename_all = "camelCase")]
pub struct Credential {
pub id: String,
pub item_name: Option<String>,
@@ -47,6 +47,7 @@ pub struct Credential {
/// Input for credential filtering.
#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
pub struct CredentialMatcherInput {
/// List of credentials to filter
pub credentials: Vec<Credential>,
@@ -69,6 +70,7 @@ pub struct CredentialMatcherInput {
/// Output from credential filtering.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
pub struct CredentialMatcherOutput {
/// IDs of matched credentials, in priority order, capped at `input.max_results` (10 by default).
pub matched_ids: Vec<String>,
diff --git a/core/rust/src/credential_matcher/tests.rs b/core/rust/src/credential_matcher/tests.rs
index b2412f62e..2c8a39735 100644
--- a/core/rust/src/credential_matcher/tests.rs
+++ b/core/rust/src/credential_matcher/tests.rs
@@ -377,7 +377,9 @@ fn test_json_roundtrip() {
};
let json = serde_json::to_string(&input).unwrap();
+ assert!(json.contains("\"currentUrl\"") && json.contains("\"matchingMode\""), "input fields are camelCase on the wire");
let output_json = filter_credentials_json(&json).unwrap();
+ assert!(output_json.contains("\"matchedIds\""), "output fields are camelCase on the wire");
let output: CredentialMatcherOutput = serde_json::from_str(&output_json).unwrap();
assert_eq!(output.matched_ids.len(), 1);
diff --git a/core/rust/src/uniffi_api.rs b/core/rust/src/uniffi_api.rs
index 5c3cf400b..872902e3b 100644
--- a/core/rust/src/uniffi_api.rs
+++ b/core/rust/src/uniffi_api.rs
@@ -491,8 +491,8 @@ mod tests {
fn test_prune_vault_json() {
let input = r#"{
"tables": [{"name": "Items", "records": []}],
- "retention_days": 30,
- "current_time": "2024-01-15T10:30:00.000Z"
+ "retentionDays": 30,
+ "currentTime": "2024-01-15T10:30:00.000Z"
}"#;
let result = prune_vault_json(input.to_string());
diff --git a/core/rust/src/vault_pruner/mod.rs b/core/rust/src/vault_pruner/mod.rs
index b05053332..46a025a9f 100644
--- a/core/rust/src/vault_pruner/mod.rs
+++ b/core/rust/src/vault_pruner/mod.rs
@@ -21,6 +21,7 @@ use crate::vault_model::{BLOB_COLUMNS, MANIFEST_ID_COL, SYNCABLE_TABLES, TRASH_R
/// Input for the prune operation.
#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
pub struct PruneInput {
/// Tables from the local database (at minimum, Items table is required)
pub tables: Vec<CodecTableData>,
@@ -41,6 +42,7 @@ fn default_retention_days() -> u32 {
/// Statistics about what was pruned.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
pub struct PruneStats {
/// Number of items permanently deleted
@@ -58,6 +60,7 @@ pub struct PruneStats {
/// Output of the prune operation.
#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
pub struct PruneOutput {
/// Whether the prune was successful
pub success: bool,
diff --git a/core/rust/src/vault_pruner/tests.rs b/core/rust/src/vault_pruner/tests.rs
index 122ad0211..deeafd9a2 100644
--- a/core/rust/src/vault_pruner/tests.rs
+++ b/core/rust/src/vault_pruner/tests.rs
@@ -187,8 +187,8 @@ fn test_prune_json_api() {
"DeletedAt": "{}"
}}]
}}],
- "retention_days": 30,
- "current_time": "{}"
+ "retentionDays": 30,
+ "currentTime": "{}"
}}"#, old_date, now_str);
let output_json = crate::error::json_call(&input_json, prune_vault).unwrap();
diff --git a/core/rust/src/vault_sharing/tests.rs b/core/rust/src/vault_sharing/tests.rs
index 97f20d6c0..164a14c82 100644
--- a/core/rust/src/vault_sharing/tests.rs
+++ b/core/rust/src/vault_sharing/tests.rs
@@ -162,5 +162,5 @@ fn the_json_boundary_round_trips() {
fn a_skip_reason_is_a_stable_token() {
let set = resolve_manifest_write_set(write_set_request(&["PERSONAL"], &[], vec![record("MAN-1")]));
let json = serde_json::to_value(&set).unwrap();
- assert_eq!(json["skipped"][0]["reason"], "NO_ROWS_IN_VAULT");
+ assert_eq!(json["skipped"][0]["reason"], "noRowsInVault");
}
diff --git a/core/rust/src/vault_sharing/types.rs b/core/rust/src/vault_sharing/types.rs
index 887ae526e..fe417a79f 100644
--- a/core/rust/src/vault_sharing/types.rs
+++ b/core/rust/src/vault_sharing/types.rs
@@ -36,7 +36,7 @@ pub struct ManifestWriteSetRequest {
/// Why a manifest is left out of the write.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
-#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+#[serde(rename_all = "camelCase")]
pub enum WriteSkipReason {
/// The vault holds no rows for it, so writing would delete all its rows.
NoRowsInVault,
diff --git a/core/rust/src/vault_sync/merge.rs b/core/rust/src/vault_sync/merge.rs
index f33b2a265..48e18242c 100644
--- a/core/rust/src/vault_sync/merge.rs
+++ b/core/rust/src/vault_sync/merge.rs
@@ -185,7 +185,7 @@ fn validate_merged_manifest(entry: &CanonicalManifestMerge) -> Option<String> {
}
/// The bytes at hand for the blobs the merged manifests reference, per manifest. A blob without bytes is not loaded
-/// on this device: its row keeps the reference, and the push only uploads what the server lacks and this device has.
+/// (yet) by the client: its row keeps the reference, and the push only uploads what the server lacks and this device has.
fn collect_merged_blobs(manifests: &[Manifest], blob_map: &HashMap<String, Vec<u8>>, local_blobs: &HashMap<String, BlobEntry>) -> HashMap<String, HashMap<String, BlobEntry>> {
let mut by_manifest: HashMap<String, HashMap<String, BlobEntry>> = HashMap::new();
for manifest in manifests {
diff --git a/core/rust/src/vault_sync/tests/mod.rs b/core/rust/src/vault_sync/tests/mod.rs
index a6c3b2c1f..2e5ef8708 100644
--- a/core/rust/src/vault_sync/tests/mod.rs
+++ b/core/rust/src/vault_sync/tests/mod.rs
@@ -431,7 +431,7 @@ fn legacy_account_without_vault_key_reports_the_manifest_migration() {
assert_eq!(result["manifestMigrationRequired"], true);
let status = host.drive(&SyncSession::new(&request("migrationStatus", &kek, false, 0)).unwrap());
- assert_eq!(status["kind"], "storage-format-upgrade");
+ assert_eq!(status["kind"], "storageFormatUpgrade");
}
#[test]
@@ -486,7 +486,7 @@ fn schema_rebuild_of_a_stale_vault_pushes_without_touching_the_key_hierarchy() {
host.respond("POST", "Vault", json!({ "status": 0, "manifestRevisions": [{ "manifestId": PERSONAL_MANIFEST_ID, "revision": 4 }], "bucketRevisions": [], "missingBlobHashes": [] }));
let status = host.drive(&SyncSession::new(&request("migrationStatus", &vek, false, 0)).unwrap());
- assert_eq!(status["kind"], "schema-rebuild");
+ assert_eq!(status["kind"], "schemaRebuild");
let result = host.drive(&SyncSession::new(&request("migrateManifest", &vek, false, 0)).unwrap());
diff --git a/core/rust/src/vault_sync/types.rs b/core/rust/src/vault_sync/types.rs
index 44e790849..91c603edc 100644
--- a/core/rust/src/vault_sync/types.rs
+++ b/core/rust/src/vault_sync/types.rs
@@ -162,7 +162,7 @@ impl OperationResult for FullSyncResult {
/// The pending local migration, as the upgrade gate classifies it.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
-#[serde(rename_all = "kebab-case")]
+#[serde(rename_all = "camelCase")]
pub enum MigrationKind {
/// Nothing to migrate, or nothing that may be migrated yet: a vault still on the frozen sqlite-blob chain
/// classifies as `None` because that chain has to bring it to 2.0.0 before either kind below can apply.