Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
chore: point source comments at the renamed db.ddlParity test (#6819)
[._.]/ Adam Eivycffad5e3588e
diff --git a/server/lib/catalogTypes.js b/server/lib/catalogTypes.jsindex 2d9112b167..f1fd40c34d 100644--- a/server/lib/catalogTypes.js+++ b/server/lib/catalogTypes.js@@ -18,7 +18,7 @@* constraint itself is the gated [catalog-type-table-vs-check] PLAN item.* Today the CHECK still lists the six types literally in init-db.sql + db.js —* `INGREDIENT_TYPE_IDS` is what those literals must equal (asserted by- * `db.catalogDdlParity.test.js`).+ * `db.ddlParity.test.js`).** Per-type `payloadSchemaVersion` + `payloadUpgraders`: the JSONB `payload`* carries `payload.schemaVersion` stamped at create time (seediff --git a/server/lib/db/schema/audit.js b/server/lib/db/schema/audit.jsindex 0b4196b6e9..7300979c5a 100644--- a/server/lib/db/schema/audit.js+++ b/server/lib/db/schema/audit.js@@ -2,7 +2,7 @@// trigger function, the list of audited tables, and the trigger builder.// Extracted verbatim from ensureSchemaImpl() in server/lib/db.js (#2832) with// zero behavior change. Parity-locked against server/scripts/init-db.sql by-// db.catalogDdlParity.test.js — keep auditedTables in sync with the+// db.ddlParity.test.js — keep auditedTables in sync with the// AUDITED_RECORD_TABLES list there.export const auditDdl = [// ─── Deletion audit log (incident #1248-follow-up) ──────────────────────@@ -15,7 +15,7 @@ export const auditDdl = [// wrongful delete is recoverable from the log alone. Local-only, never// federated (no sync_sequence) — each install audits its own mutations.// Mirrors the record_audit block in init-db.sql (parity-locked by- // db.catalogDdlParity.test.js).+ // db.ddlParity.test.js).`CREATE TABLE IF NOT EXISTS record_audit (id BIGSERIAL PRIMARY KEY,table_name TEXT NOT NULL,diff --git a/server/lib/db/schema/beeper.js b/server/lib/db/schema/beeper.jsindex 01b3d22e52..7f0c3b4c8f 100644--- a/server/lib/db/schema/beeper.js+++ b/server/lib/db/schema/beeper.js@@ -62,7 +62,7 @@ export const beeperDdl = [// repoint every child row — `source_chat_id` is the Beeper-side identity.// Pin/archive/mute/low-priority/unread state is Beeper's own state, mirrored// read-only; PortOS never invents a second source of truth for it. `type`- // is intentionally unconstrained: db.catalogDdlParity.test.js forbids a+ // is intentionally unconstrained: db.ddlParity.test.js forbids a// hardcoded enum constraint on any `type` column in this schema (the same// rule that keeps catalog_ingredients.type app-layer-gated), so a new// Beeper chat type never needs a two-file migration to accept.@@ -321,7 +321,7 @@ export const beeperDdl = [// the next purge + resweep would still lose it. This promotes each of those// to a durable claim. It is not in `server/scripts/init-db.sql`: that file// provisions a FRESH database, where there is no participant row to- // promote, and the parity test (`server/lib/db.catalogDdlParity.test.js`)+ // promote, and the parity test (`server/lib/db.ddlParity.test.js`)// compares table/index/trigger shape, which this statement does not touch.//// - The `NOT EXISTS` guard makes it ONE-SHOT. `ensureSchema()` does notdiff --git a/server/lib/db/schema/catalog.js b/server/lib/db/schema/catalog.jsindex c3a2ffa09f..1d15aa10e7 100644--- a/server/lib/db/schema/catalog.js+++ b/server/lib/db/schema/catalog.js@@ -1,7 +1,7 @@// Catalog DDL — scraps, ingredients, sources/refs/relations, tags, revisions,// ingredient media, and the user-defined ingredient types. Extracted verbatim// from ensureSchemaImpl() in server/lib/db.js (#2832) with zero behavior change.-// Parity-locked against server/scripts/init-db.sql by db.catalogDdlParity.test.js.+// Parity-locked against server/scripts/init-db.sql by db.ddlParity.test.js.//// catalog_user_types is a separate export because in the original array it sits// AFTER the media block, not adjacent to the other catalog tables — the composer@@ -203,7 +203,7 @@ export const catalogDdl = [// ingredient at the app layer. No sync_sequence — revisions stay local; the// synced ingredient row already LWW-merges the latest state across peers.// Mirrors the catalog_ingredient_revisions block in init-db.sql (parity is- // asserted by db.catalogDdlParity.test.js).+ // asserted by db.ddlParity.test.js).`CREATE TABLE IF NOT EXISTS catalog_ingredient_revisions (id TEXT PRIMARY KEY,ingredient_id TEXT NOT NULL REFERENCES catalog_ingredients(id) ON DELETE CASCADE,@@ -225,7 +225,7 @@ export const catalogDdl = [// app-layer enum (MEDIA_KINDS in catalogTypes.js), not a DB CHECK. Soft-// delete from day one so detaches tombstone + propagate. Mirrors the// catalog_ingredient_media block in init-db.sql (parity is asserted by- // db.catalogDdlParity.test.js).+ // db.ddlParity.test.js).`CREATE TABLE IF NOT EXISTS catalog_ingredient_media (ingredient_id TEXT NOT NULL REFERENCES catalog_ingredients(id) ON DELETE CASCADE,media_key TEXT NOT NULL,diff --git a/server/lib/db/schema/core.js b/server/lib/db/schema/core.jsindex 48f575abb8..ac31083694 100644--- a/server/lib/db/schema/core.js+++ b/server/lib/db/schema/core.js@@ -1,7 +1,7 @@// Core base-schema DDL — memory sync columns + the versioned db-migration// tracker. Extracted from ensureSchemaImpl() in server/lib/db.js (#2832) with// zero behavior change; every statement is idempotent and runs on every boot.-// Parity-locked against server/scripts/init-db.sql by db.catalogDdlParity.test.js.+// Parity-locked against server/scripts/init-db.sql by db.ddlParity.test.js.export const coreDdl = [`CREATE TABLE IF NOT EXISTS app_quality_measurements (app_id TEXT NOT NULL,@@ -19,7 +19,7 @@ export const coreDdl = [// Versioned DB-migration tracker (#1029). Records which ordered migration// files in server/scripts/db-migrations/ have been applied on THIS install.// It's part of the base schema (created here AND in init-db.sql, parity-- // locked by db.catalogDdlParity.test.js) so the runner — which executes+ // locked by db.ddlParity.test.js) so the runner — which executes// AFTER ensureSchema() at boot — can always read it. ensureSchema()'s// additive CREATE/ADD IF NOT EXISTS gates handle fresh-install schema; the// runner handles DELTAS that those gates can't express (renames, typediff --git a/server/lib/db/schema/index.test.js b/server/lib/db/schema/index.test.jsindex 0f5b1abd64..e4b16e0446 100644--- a/server/lib/db/schema/index.test.js+++ b/server/lib/db/schema/index.test.js@@ -15,7 +15,7 @@* the same contract, modeled on server/lib/editorial/checkInfraBarrel.test.js.** Out of scope: DDL statement text and ordering (schema.test.js and- * db.catalogDdlParity.test.js own those).+ * db.ddlParity.test.js own those).*/import { describe, it, expect } from 'vitest';diff --git a/server/lib/db/schema/schema.test.js b/server/lib/db/schema/schema.test.jsindex 59f013acd2..f9dc666060 100644--- a/server/lib/db/schema/schema.test.js+++ b/server/lib/db/schema/schema.test.js@@ -12,7 +12,7 @@** Byte-for-byte equivalence with the pre-split inline arrays was verified at* extraction time; catalog↔init-db.sql parity is locked separately by- * db.catalogDdlParity.test.js.+ * db.ddlParity.test.js.*/import { describe, it, expect } from 'vitest';diff --git a/server/scripts/db-migrations/README.md b/server/scripts/db-migrations/README.mdindex 2b149de6a6..5e35cc3375 100644--- a/server/scripts/db-migrations/README.md+++ b/server/scripts/db-migrations/README.md@@ -8,7 +8,7 @@ schema.| Change | Where it goes || --- | --- |-| New table / new column / new index (additive, fresh-install) | `ensureSchema()` in `server/lib/db.js` **and** `server/scripts/init-db.sql` (parity-locked by `db.catalogDdlParity.test.js`) |+| New table / new column / new index (additive, fresh-install) | `ensureSchema()` in `server/lib/db.js` **and** `server/scripts/init-db.sql` (parity-locked by `db.ddlParity.test.js`) || Column **rename**, **type change**, data **transform**, **embedding-dimension** change, dropping a column | A migration file here |`ensureSchema()`'s `CREATE/ADD IF NOT EXISTS` gates can only express additivediff --git a/server/scripts/init-db.sql b/server/scripts/init-db.sqlindex 1852c1f749..acee4b5892 100644--- a/server/scripts/init-db.sql+++ b/server/scripts/init-db.sql@@ -62,7 +62,7 @@ CREATE INDEX IF NOT EXISTS idx_memories_sync_sequence ON memories (sync_sequence-- Versioned DB-migration tracker (#1029). Records which ordered migration files-- in server/scripts/db-migrations/ have been applied on THIS install. Part of-- the base schema (mirrored in db.js ensureSchema, parity-locked by--- db.catalogDdlParity.test.js) so the boot-time runner can always read it.+-- db.ddlParity.test.js) so the boot-time runner can always read it.CREATE TABLE IF NOT EXISTS schema_migrations (id TEXT PRIMARY KEY,applied_at TIMESTAMPTZ DEFAULT NOW()@@ -1833,7 +1833,7 @@ CREATE INDEX IF NOT EXISTS idx_beeper_outbox_conversation_state ON beeper_outbox-- raw DELETE, a manual psql session). row_snapshot keeps the OLD row JSON so a-- wrongful delete is recoverable from the log alone. Local-only (not federated).-- Mirrors the record_audit block in server/lib/db.js (parity-locked by--- db.catalogDdlParity.test.js).+-- db.ddlParity.test.js).CREATE TABLE IF NOT EXISTS record_audit (id BIGSERIAL PRIMARY KEY,table_name TEXT NOT NULL,diff --git a/server/services/beeperSync.js b/server/services/beeperSync.jsindex c2b5d30c7e..380eab36ab 100644--- a/server/services/beeperSync.js+++ b/server/services/beeperSync.js@@ -201,7 +201,7 @@ export function normalizeAccountRow(account) {/*** Conversation row. `type` is stored RAW: the schema deliberately carries no- * enum constraint on it (`db.catalogDdlParity.test.js` forbids one), so a new+ * enum constraint on it (`db.ddlParity.test.js` forbids one), so a new* Beeper chat type never needs a two-file migration to accept. `is_group` is* the derived boolean the UI filters on.*/diff --git a/server/services/catalogDBRevisions.test.js b/server/services/catalogDBRevisions.test.jsindex e2d7f53bbd..4c8e6f33c8 100644--- a/server/services/catalogDBRevisions.test.js+++ b/server/services/catalogDBRevisions.test.js@@ -8,7 +8,7 @@** Postgres is mocked with a SQL-dispatching fake — we capture the INSERTs and* assert on them, so the suite runs without a live database. The DDL/integration- * round-trip is covered by db.catalogDdlParity.test.js + the live-DB suite.+ * round-trip is covered by db.ddlParity.test.js + the live-DB suite.*/import { describe, it, expect, vi, beforeEach } from 'vitest';