@inerrata-corporation/errata 2.0.2-dev.77 → 2.0.2-dev.81
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/consolidate-worker.mjs +14 -0
- package/errata.mjs +32 -7
- package/package.json +1 -1
- package/pass-worker.mjs +14 -0
package/consolidate-worker.mjs
CHANGED
|
@@ -16028,6 +16028,13 @@ var SqliteGraphStore = class {
|
|
|
16028
16028
|
findByLabel: this.db.prepare(
|
|
16029
16029
|
"SELECT * FROM nodes WHERE label = ? AND valid_to IS NULL"
|
|
16030
16030
|
),
|
|
16031
|
+
// Scalar count twin of findByLabel — same live-row semantics, no row
|
|
16032
|
+
// hydration. Exists because status surfaces (daemon `/` + `/health`) used
|
|
16033
|
+
// findNodesByLabel(...).length, materializing every row's attrs JSON and
|
|
16034
|
+
// embedding blob per request — seconds of synchronous loop-hold per poll.
|
|
16035
|
+
countByLabel: this.db.prepare(
|
|
16036
|
+
"SELECT COUNT(*) AS n FROM nodes WHERE label = ? AND valid_to IS NULL"
|
|
16037
|
+
),
|
|
16031
16038
|
// ALL versions of a label — incl frozen/closed (valid_to set). Used by the
|
|
16032
16039
|
// clean-reindex purge so a true wipe removes history too, not just live rows.
|
|
16033
16040
|
findByLabelAll: this.db.prepare("SELECT * FROM nodes WHERE label = ?"),
|
|
@@ -16281,6 +16288,13 @@ var SqliteGraphStore = class {
|
|
|
16281
16288
|
const rows = this.stmts.findByLabel.all(label);
|
|
16282
16289
|
return rows.map(rowToNode);
|
|
16283
16290
|
}
|
|
16291
|
+
/** Live-row count for a label — `findNodesByLabel(label).length` without the
|
|
16292
|
+
* per-row hydration (attrs JSON + embedding blob). Status surfaces poll this
|
|
16293
|
+
* per project per request; the materializing form held the daemon's event
|
|
16294
|
+
* loop for seconds at scale. */
|
|
16295
|
+
countNodesByLabel(label) {
|
|
16296
|
+
return Number(this.stmts.countByLabel.get(label).n);
|
|
16297
|
+
}
|
|
16284
16298
|
findAllVersionsByLabel(label) {
|
|
16285
16299
|
const rows = this.stmts.findByLabelAll.all(label);
|
|
16286
16300
|
return rows.map(rowToNode);
|
package/errata.mjs
CHANGED
|
@@ -16674,6 +16674,13 @@ CREATE INDEX IF NOT EXISTS nodes_relpath ON nodes(json_extract(attrs_json, '$.re
|
|
|
16674
16674
|
findByLabel: this.db.prepare(
|
|
16675
16675
|
"SELECT * FROM nodes WHERE label = ? AND valid_to IS NULL"
|
|
16676
16676
|
),
|
|
16677
|
+
// Scalar count twin of findByLabel — same live-row semantics, no row
|
|
16678
|
+
// hydration. Exists because status surfaces (daemon `/` + `/health`) used
|
|
16679
|
+
// findNodesByLabel(...).length, materializing every row's attrs JSON and
|
|
16680
|
+
// embedding blob per request — seconds of synchronous loop-hold per poll.
|
|
16681
|
+
countByLabel: this.db.prepare(
|
|
16682
|
+
"SELECT COUNT(*) AS n FROM nodes WHERE label = ? AND valid_to IS NULL"
|
|
16683
|
+
),
|
|
16677
16684
|
// ALL versions of a label — incl frozen/closed (valid_to set). Used by the
|
|
16678
16685
|
// clean-reindex purge so a true wipe removes history too, not just live rows.
|
|
16679
16686
|
findByLabelAll: this.db.prepare("SELECT * FROM nodes WHERE label = ?"),
|
|
@@ -16927,6 +16934,13 @@ CREATE INDEX IF NOT EXISTS nodes_relpath ON nodes(json_extract(attrs_json, '$.re
|
|
|
16927
16934
|
const rows = this.stmts.findByLabel.all(label);
|
|
16928
16935
|
return rows.map(rowToNode);
|
|
16929
16936
|
}
|
|
16937
|
+
/** Live-row count for a label — `findNodesByLabel(label).length` without the
|
|
16938
|
+
* per-row hydration (attrs JSON + embedding blob). Status surfaces poll this
|
|
16939
|
+
* per project per request; the materializing form held the daemon's event
|
|
16940
|
+
* loop for seconds at scale. */
|
|
16941
|
+
countNodesByLabel(label) {
|
|
16942
|
+
return Number(this.stmts.countByLabel.get(label).n);
|
|
16943
|
+
}
|
|
16930
16944
|
findAllVersionsByLabel(label) {
|
|
16931
16945
|
const rows = this.stmts.findByLabelAll.all(label);
|
|
16932
16946
|
return rows.map(rowToNode);
|
|
@@ -51681,7 +51695,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
|
|
|
51681
51695
|
}
|
|
51682
51696
|
|
|
51683
51697
|
// src/engine.ts
|
|
51684
|
-
var DAEMON_VERSION = true ? "2.0.2-dev.
|
|
51698
|
+
var DAEMON_VERSION = true ? "2.0.2-dev.81" : "2.0.0-alpha.0";
|
|
51685
51699
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
51686
51700
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
51687
51701
|
var GIT_OP_MUTE_MS = 4e3;
|
|
@@ -54213,8 +54227,10 @@ async function startMultiDaemon(opts = {}) {
|
|
|
54213
54227
|
path: r.root,
|
|
54214
54228
|
stack: r.entry.stack,
|
|
54215
54229
|
nodes: r.engine.store.nodeCount(),
|
|
54216
|
-
|
|
54217
|
-
|
|
54230
|
+
// COUNT(*) — the materializing findNodesByLabel(...).length form held
|
|
54231
|
+
// the event loop for seconds per poll once stores grew (HZ-index-hydrate).
|
|
54232
|
+
problems: r.engine.store.countNodesByLabel("Problem"),
|
|
54233
|
+
solutions: r.engine.store.countNodesByLabel("Solution"),
|
|
54218
54234
|
endpoints: `/ws/${r.id}/`
|
|
54219
54235
|
})),
|
|
54220
54236
|
humanView: "run `errata report` \u2014 the dashboard was retired (GRAFT 4e)"
|
|
@@ -54270,8 +54286,9 @@ async function startMultiDaemon(opts = {}) {
|
|
|
54270
54286
|
name: r.entry.name,
|
|
54271
54287
|
path: r.root,
|
|
54272
54288
|
nodes: r.engine.store.nodeCount(),
|
|
54273
|
-
|
|
54274
|
-
|
|
54289
|
+
// COUNT(*) — same hydration hazard as `/` (HZ-index-hydrate).
|
|
54290
|
+
problems: r.engine.store.countNodesByLabel("Problem"),
|
|
54291
|
+
solutions: r.engine.store.countNodesByLabel("Solution"),
|
|
54275
54292
|
stranded: strandedCount(r)
|
|
54276
54293
|
}))
|
|
54277
54294
|
})
|
|
@@ -54827,6 +54844,8 @@ async function startMultiDaemon(opts = {}) {
|
|
|
54827
54844
|
}
|
|
54828
54845
|
};
|
|
54829
54846
|
app.post("/api/sync", async (c) => {
|
|
54847
|
+
if (boundaryFlushing) return c.json({ skipped: "in-flight" }, 409);
|
|
54848
|
+
boundaryFlushing = true;
|
|
54830
54849
|
try {
|
|
54831
54850
|
const principles = await daemon.syncPrinciplesPublic();
|
|
54832
54851
|
const triage = await daemon.syncTriagePublic();
|
|
@@ -54835,6 +54854,8 @@ async function startMultiDaemon(opts = {}) {
|
|
|
54835
54854
|
return c.json({ principles, triage, instances, edgeBackfill });
|
|
54836
54855
|
} catch (err2) {
|
|
54837
54856
|
return c.json({ error: err2 instanceof Error ? err2.message : String(err2) }, 500);
|
|
54857
|
+
} finally {
|
|
54858
|
+
boundaryFlushing = false;
|
|
54838
54859
|
}
|
|
54839
54860
|
});
|
|
54840
54861
|
app.post("/api/tick", async (c) => {
|
|
@@ -57658,8 +57679,12 @@ async function cmdSync(arg) {
|
|
|
57658
57679
|
try {
|
|
57659
57680
|
const res = await fetch(`${lock.webUiUrl}/api/sync`, {
|
|
57660
57681
|
method: "POST",
|
|
57661
|
-
signal: AbortSignal.timeout(
|
|
57682
|
+
signal: AbortSignal.timeout(15 * 6e4)
|
|
57662
57683
|
});
|
|
57684
|
+
if (res.status === 409) {
|
|
57685
|
+
console.log("sync already running: the daemon is mid-drain \u2014 it will finish on its own. Nothing new was started.");
|
|
57686
|
+
return;
|
|
57687
|
+
}
|
|
57663
57688
|
if (!res.ok) {
|
|
57664
57689
|
const detail = await res.text().catch(() => "");
|
|
57665
57690
|
console.error(`sync failed: daemon at ${lock.webUiUrl} returned ${res.status}${detail ? ` \u2014 ${detail}` : ""}`);
|
|
@@ -57670,7 +57695,7 @@ async function cmdSync(arg) {
|
|
|
57670
57695
|
} catch (err2) {
|
|
57671
57696
|
const timedOut = err2 instanceof Error && err2.name === "TimeoutError";
|
|
57672
57697
|
console.error(
|
|
57673
|
-
timedOut ? `sync
|
|
57698
|
+
timedOut ? `sync gave up waiting after 15 min \u2014 the daemon's pass may STILL be running (aborting this request does not cancel it). Check daemon.log before retrying; a retry while it runs answers 409.` : `sync failed: could not reach the running daemon at ${lock.webUiUrl} (${err2 instanceof Error ? err2.message : err2})`
|
|
57674
57699
|
);
|
|
57675
57700
|
process.exit(1);
|
|
57676
57701
|
}
|
package/package.json
CHANGED
package/pass-worker.mjs
CHANGED
|
@@ -24335,6 +24335,13 @@ var SqliteGraphStore = class {
|
|
|
24335
24335
|
findByLabel: this.db.prepare(
|
|
24336
24336
|
"SELECT * FROM nodes WHERE label = ? AND valid_to IS NULL"
|
|
24337
24337
|
),
|
|
24338
|
+
// Scalar count twin of findByLabel — same live-row semantics, no row
|
|
24339
|
+
// hydration. Exists because status surfaces (daemon `/` + `/health`) used
|
|
24340
|
+
// findNodesByLabel(...).length, materializing every row's attrs JSON and
|
|
24341
|
+
// embedding blob per request — seconds of synchronous loop-hold per poll.
|
|
24342
|
+
countByLabel: this.db.prepare(
|
|
24343
|
+
"SELECT COUNT(*) AS n FROM nodes WHERE label = ? AND valid_to IS NULL"
|
|
24344
|
+
),
|
|
24338
24345
|
// ALL versions of a label — incl frozen/closed (valid_to set). Used by the
|
|
24339
24346
|
// clean-reindex purge so a true wipe removes history too, not just live rows.
|
|
24340
24347
|
findByLabelAll: this.db.prepare("SELECT * FROM nodes WHERE label = ?"),
|
|
@@ -24588,6 +24595,13 @@ var SqliteGraphStore = class {
|
|
|
24588
24595
|
const rows = this.stmts.findByLabel.all(label);
|
|
24589
24596
|
return rows.map(rowToNode);
|
|
24590
24597
|
}
|
|
24598
|
+
/** Live-row count for a label — `findNodesByLabel(label).length` without the
|
|
24599
|
+
* per-row hydration (attrs JSON + embedding blob). Status surfaces poll this
|
|
24600
|
+
* per project per request; the materializing form held the daemon's event
|
|
24601
|
+
* loop for seconds at scale. */
|
|
24602
|
+
countNodesByLabel(label) {
|
|
24603
|
+
return Number(this.stmts.countByLabel.get(label).n);
|
|
24604
|
+
}
|
|
24591
24605
|
findAllVersionsByLabel(label) {
|
|
24592
24606
|
const rows = this.stmts.findByLabelAll.all(label);
|
|
24593
24607
|
return rows.map(rowToNode);
|