@camstack/system 1.2.222 → 1.2.223

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3270,7 +3270,7 @@ var SystemBackupService = class {
3270
3270
  for (const dbPath of dbPaths) try {
3271
3271
  const db = new Database(dbPath);
3272
3272
  try {
3273
- db.pragma("wal_checkpoint(TRUNCATE)");
3273
+ db.pragma("wal_checkpoint(PASSIVE)");
3274
3274
  } finally {
3275
3275
  db.close();
3276
3276
  }
@@ -3255,7 +3255,7 @@ var SystemBackupService = class {
3255
3255
  for (const dbPath of dbPaths) try {
3256
3256
  const db = new Database(dbPath);
3257
3257
  try {
3258
- db.pragma("wal_checkpoint(TRUNCATE)");
3258
+ db.pragma("wal_checkpoint(PASSIVE)");
3259
3259
  } finally {
3260
3260
  db.close();
3261
3261
  }
@@ -401,6 +401,31 @@ export declare class SqliteSettingsBackend implements ISettingsBackend {
401
401
  * inside that blob and are reached with `json_extract`.
402
402
  */
403
403
  private shapeOf;
404
+ /**
405
+ * Where a declaration LIVES, so it outlives the process that made it.
406
+ *
407
+ * `declaredCollections` used to be only an in-memory Map, and the
408
+ * declarations are made once, by each addon, at that addon's own boot.
409
+ * On 2026-09-12 this backend died with SIGBUS (a second connection
410
+ * truncated the WAL under its mmap) and `CrashSupervisor` respawned it: the
411
+ * new instance knew only the canonical KV collections, every other addon
412
+ * stayed up and never re-declared, and the cluster failed every settings
413
+ * read for six hours — the operator could not log in.
414
+ *
415
+ * The tables are durable. What the backend knows ABOUT them has to be too,
416
+ * because nothing in the system re-declares and nothing listens for this
417
+ * process restarting.
418
+ */
419
+ private static readonly DECLARATIONS_TABLE;
420
+ /** Create the meta table. Idempotent; called before anything reads it. */
421
+ private ensureDeclarationsTable;
422
+ /** Persist one declaration, replacing any earlier shape for the same table. */
423
+ private persistDeclaration;
424
+ /**
425
+ * Reload every persisted declaration. Called at init, BEFORE any addon has
426
+ * had the chance to re-declare — which on a respawn none of them will.
427
+ */
428
+ private restorePersistedDeclarations;
404
429
  declareCollection(input: {
405
430
  namespace?: string;
406
431
  collection: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/system",
3
- "version": "1.2.222",
3
+ "version": "1.2.223",
4
4
  "description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
5
5
  "keywords": [
6
6
  "camstack",