Skip to content

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

Update scripts and remove unused legacy references (#2159)

Leendert de Borst5ae16f2f0dcb
diff --git a/core/models/scripts/generate-password-defaults.cjs b/core/models/scripts/generate-password-defaults.cjs
index 1e208767e..7442a46c5 100644
--- a/core/models/scripts/generate-password-defaults.cjs
+++ b/core/models/scripts/generate-password-defaults.cjs
@@ -73,7 +73,7 @@ function toPascalCase(name) {
function generateRust(constants) {
const header = `//! Client-facing defaults for the password/passphrase generator.
//!
-//! @generated — do NOT edit this file directly. It is generated from
+//! @generated: do NOT edit this file directly. It is generated from
//! ${TS_SOURCE_REL} by core/models/scripts/generate-password-defaults.cjs.
//! Edit the TypeScript source and run 'core/models/build.sh' to regenerate.
`;
diff --git a/core/models/scripts/lib/vault-table-registry-emit.cjs b/core/models/scripts/lib/vault-table-registry-emit.cjs
index 36b444132..02af0cec4 100644
--- a/core/models/scripts/lib/vault-table-registry-emit.cjs
+++ b/core/models/scripts/lib/vault-table-registry-emit.cjs
@@ -31,10 +31,8 @@ function validateRegistry(registry) {
throw new Error('VAULT_TABLES must list Items first: registry order is merge insert order.');
}
for (const table of tables) {
- for (const key of [table.LegacyMergeKey, table.CanonicalMergeKey]) {
- if (key && table.ManifestScoped && key[0] !== registry.VAULT_MANIFEST_ID_COLUMN) {
- throw new Error(`${table.Name}: merge keys of a manifest-scoped table must start with ${registry.VAULT_MANIFEST_ID_COLUMN}.`);
- }
+ if (table.CanonicalMergeKey && table.ManifestScoped && table.CanonicalMergeKey[0] !== registry.VAULT_MANIFEST_ID_COLUMN) {
+ throw new Error(`${table.Name}: the merge key of a manifest-scoped table must start with ${registry.VAULT_MANIFEST_ID_COLUMN}.`);
}
}
if (!Array.isArray(registry.MULTI_VALUE_FIELD_KEYS) || registry.MULTI_VALUE_FIELD_KEYS.length === 0) {
@@ -84,9 +82,6 @@ function emitRustTableEntry(table) {
if (table.PrimaryKey.length !== 1 || table.PrimaryKey[0] !== 'Id') {
calls.push(`.with_primary_key(${rustStrSlice(table.PrimaryKey)})`);
}
- if (table.LegacyMergeKey) {
- calls.push(`.with_composite_key(${rustStrSlice(table.LegacyMergeKey)})`);
- }
if (table.CanonicalMergeKey) {
calls.push(`.with_canonical_key(${rustStrSlice(table.CanonicalMergeKey)})`);
}
diff --git a/core/models/src/vault/VaultTableRegistry.ts b/core/models/src/vault/VaultTableRegistry.ts
index c262c5ee5..4c6648c15 100644
--- a/core/models/src/vault/VaultTableRegistry.ts
+++ b/core/models/src/vault/VaultTableRegistry.ts
@@ -29,14 +29,8 @@ export type VaultTableDefinition = {
/** True when the table's rows hang off an Item row (re-stamped with their item, cascaded on delete). */
ItemChild: boolean;
/**
- * Match columns for the legacy statement merge. When absent, matching falls back to
- * (ManifestId, PrimaryKey).
- */
- LegacyMergeKey?: string[];
- /**
- * Match columns for the canonical merge only, where both sides are first normalized to the
- * manifest shape (see the Rust vault_codec::normalize module). Absent means the canonical merge
- * uses the same rule as the statement merge.
+ * Merge match columns, applied after both sides are normalized to the manifest shape (see the
+ * Rust vault_codec::normalize module). Absent means rows match on (ManifestId, PrimaryKey).
*/
CanonicalMergeKey?: string[];
/**
@@ -70,20 +64,18 @@ export const VAULT_TABLES: VaultTableDefinition[] = [
*/
{ Name: 'ItemStats', ManifestScoped: true, PrimaryKey: ['Id'], ItemChild: true, BucketCategory: 'Stats' },
/*
- * FieldValues legacy statement merge: a field value matches on the field it belongs to (FieldKey
- * for system fields, FieldDefinitionId for custom ones; exactly one is set), so independently
- * created rows of the same field converge. Canonical merge: both sides are normalized first,
- * which strips the derived id of every single-value row, so adding Id to the key makes a
- * single-value row match by its field (id part empty on both sides) while a multi-value row
- * matches by its OWNED id: two devices each adding a login.url are two different rows that must
- * both survive, and the id, unlike ValueIndex, is stable under reordering.
+ * FieldValues: a field value matches on the field it belongs to (FieldKey for system fields,
+ * FieldDefinitionId for custom ones; exactly one is set), so independently created rows of the
+ * same field are merged into one. Both sides are normalized first, which strips the derived id of every
+ * single-value row, so adding Id to the key makes a single-value row match by its field while a
+ * multi-value row matches by its OWNED id: two devices each adding a login.url are two different
+ * rows that must both survive, and the id, unlike ValueIndex, is stable under reordering.
*/
{
Name: 'FieldValues',
ManifestScoped: true,
PrimaryKey: ['Id'],
ItemChild: true,
- LegacyMergeKey: ['ManifestId', 'ItemId', 'FieldKey', 'FieldDefinitionId'],
CanonicalMergeKey: ['ManifestId', 'ItemId', 'FieldKey', 'FieldDefinitionId', 'Id'],
},
{ Name: 'Folders', ManifestScoped: true, PrimaryKey: ['Id'], ItemChild: false },
@@ -115,10 +107,9 @@ export const VAULT_TABLES: VaultTableDefinition[] = [
ReferencedBy: [{ Table: 'FieldValues', Column: 'FieldDefinitionId' }, { Table: 'FieldHistories', Column: 'FieldDefinitionId' }],
},
/*
- * FieldHistories canonical merge: every history row derives its id from (item, field, ChangedAt),
- * so after normalization the natural key IS the identity: concurrent changes union (distinct
- * ChangedAt), same-millisecond snapshots converge. Legacy statement merge keeps plain
- * (ManifestId, Id).
+ * FieldHistories: every history row derives its id from (item, field, ChangedAt), so after
+ * normalization the natural key IS the identity: concurrent changes union (distinct ChangedAt),
+ * same-millisecond snapshots converge.
*/
{
Name: 'FieldHistories',