@githolon/testing 0.6.0 → 0.7.1
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.
- package/package.json +1 -1
- package/vendor/engine/engine.mjs +20 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@githolon/testing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "@githolon/testing — law TDD for Nomos domains: boot the REAL engine plane in-process (the exact machinery every cloud DO, heavy container and web client runs), dispatch directives, assert rows, assert TYPED REFUSALS, fork for what-ifs — fully offline inside vitest.",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
package/vendor/engine/engine.mjs
CHANGED
|
@@ -1190,7 +1190,7 @@ export function author(eng, ws, domain, directiveId, payload, controllerHash, op
|
|
|
1190
1190
|
// (`warmEngine`, which every host already calls) flushes it eagerly. Pass
|
|
1191
1191
|
// `opts.deferProjection: false` to keep the pre-#47 synchronous refresh.
|
|
1192
1192
|
const defer = opts.deferProjection !== false;
|
|
1193
|
-
const res = JSON.parse(call(eng.ex, "author", { repoArg: repoArgOf(ws), workspace: ws, domain, directiveId, payloadFile: `/work/payload-${seq}.json`, envelopeFile: `/work/envelope-${seq}.json`, seq, actor: "", domainFile: genesis ? "/work/domain.package.usda" : "", domainHash: genesis ? "" : controllerHash, branch: BRANCH, ...(defer ? { deferProjection: true } : {}) }, eng.STDERR));
|
|
1193
|
+
const res = JSON.parse(call(eng.ex, "author", { repoArg: repoArgOf(ws), workspace: ws, domain, directiveId, payloadFile: `/work/payload-${seq}.json`, envelopeFile: `/work/envelope-${seq}.json`, seq, actor: opts.actor ?? "", domainFile: genesis ? "/work/domain.package.usda" : "", domainHash: genesis ? "" : controllerHash, branch: BRANCH, ...(defer ? { deferProjection: true } : {}) }, eng.STDERR));
|
|
1194
1194
|
if (defer && res.ok) (eng.pendingProjection ??= new Set()).add(ws);
|
|
1195
1195
|
return res;
|
|
1196
1196
|
}
|
|
@@ -1208,6 +1208,25 @@ export function flushDeferredProjections(eng) {
|
|
|
1208
1208
|
if (eng.pendingProjection) eng.pendingProjection.clear();
|
|
1209
1209
|
}
|
|
1210
1210
|
|
|
1211
|
+
// ── PROJECTION CHECKPOINT (the cold-fold fix) ──────────────────────────────────────────────
|
|
1212
|
+
// A `:memory:` projection is rebuilt cold on every mount → a long-chain workspace (root, every
|
|
1213
|
+
// workspace's governance hub) re-folds genesis→tip = O(chain) (14s at 1105 commits, and it OOMs
|
|
1214
|
+
// the DO under load). The checkpoint persists the folded projection (cursor + every table) so a
|
|
1215
|
+
// cold mount RESTORES it and the first read folds only tip−cursor (O(delta)).
|
|
1216
|
+
|
|
1217
|
+
/** Export `ws`'s projection-at-head to a base64 blob the HOST persists. Returns
|
|
1218
|
+
* `{cursor, blob, bytes}` (or `{empty:true}` for an unborn branch). */
|
|
1219
|
+
export function exportCheckpoint(eng, ws) {
|
|
1220
|
+
return JSON.parse(call(eng.ex, "checkpoint_export", { repoArg: repoArgOf(ws), workspace: ws, branch: BRANCH }, eng.STDERR));
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
/** Restore a checkpoint blob into the pool BEFORE the first read on a cold mount (no-op if the pool
|
|
1224
|
+
* is already warm). The HOST restores ONLY a blob whose stored lawHash matches the workspace's
|
|
1225
|
+
* CURRENT law (schema parity); a mismatched/absent blob costs at most a cold fold, never a wrong read. */
|
|
1226
|
+
export function importCheckpoint(eng, ws, blobB64) {
|
|
1227
|
+
return JSON.parse(call(eng.ex, "checkpoint_import", { repoArg: repoArgOf(ws), workspace: ws, branch: BRANCH, blob: blobB64 }, eng.STDERR));
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1211
1230
|
// DURABILITY-BEFORE-ACK: only acked once the write LANDED in the ledger; a failed push
|
|
1212
1231
|
// unmounts (drops local state) so the next access re-restores from custody.
|
|
1213
1232
|
export async function commitAndPush(eng, ws, ledger) {
|