@inerrata-corporation/errata 2.0.2-dev.509 → 2.0.2-dev.517
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 +18 -0
- package/errata.mjs +24 -3
- package/package.json +1 -1
- package/pass-worker.mjs +23 -2
package/consolidate-worker.mjs
CHANGED
|
@@ -16562,6 +16562,24 @@ var SqliteGraphStore = class {
|
|
|
16562
16562
|
const rows = this.db.prepare("SELECT from_id, to_id, type FROM edges WHERE valid_to IS NULL").all();
|
|
16563
16563
|
return rows.map((r) => ({ from: r.from_id, to: r.to_id, type: r.type }));
|
|
16564
16564
|
}
|
|
16565
|
+
reviveReobserved(relPaths, workspaceId, since) {
|
|
16566
|
+
let revived = 0;
|
|
16567
|
+
const CHUNK = 400;
|
|
16568
|
+
for (let i = 0; i < relPaths.length; i += CHUNK) {
|
|
16569
|
+
const slice = relPaths.slice(i, i + CHUNK);
|
|
16570
|
+
if (slice.length === 0) continue;
|
|
16571
|
+
const r = this.db.prepare(
|
|
16572
|
+
`UPDATE nodes SET valid_to = NULL
|
|
16573
|
+
WHERE valid_to IS NOT NULL
|
|
16574
|
+
AND last_updated_at >= ?
|
|
16575
|
+
AND json_extract(attrs_json, '$.workspaceId') = ?
|
|
16576
|
+
AND json_extract(attrs_json, '$.relPath') IN (${slice.map(() => "?").join(",")})`
|
|
16577
|
+
).run(since, workspaceId, ...slice);
|
|
16578
|
+
revived += Number(r.changes);
|
|
16579
|
+
}
|
|
16580
|
+
if (revived > 0) this.mutations++;
|
|
16581
|
+
return revived;
|
|
16582
|
+
}
|
|
16565
16583
|
liveNodeIds(ids) {
|
|
16566
16584
|
const live = /* @__PURE__ */ new Set();
|
|
16567
16585
|
const CHUNK = 900;
|
package/errata.mjs
CHANGED
|
@@ -17237,6 +17237,24 @@ CREATE INDEX IF NOT EXISTS nodes_relpath ON nodes(json_extract(attrs_json, '$.re
|
|
|
17237
17237
|
const rows = this.db.prepare("SELECT from_id, to_id, type FROM edges WHERE valid_to IS NULL").all();
|
|
17238
17238
|
return rows.map((r) => ({ from: r.from_id, to: r.to_id, type: r.type }));
|
|
17239
17239
|
}
|
|
17240
|
+
reviveReobserved(relPaths, workspaceId2, since) {
|
|
17241
|
+
let revived = 0;
|
|
17242
|
+
const CHUNK = 400;
|
|
17243
|
+
for (let i2 = 0; i2 < relPaths.length; i2 += CHUNK) {
|
|
17244
|
+
const slice = relPaths.slice(i2, i2 + CHUNK);
|
|
17245
|
+
if (slice.length === 0) continue;
|
|
17246
|
+
const r = this.db.prepare(
|
|
17247
|
+
`UPDATE nodes SET valid_to = NULL
|
|
17248
|
+
WHERE valid_to IS NOT NULL
|
|
17249
|
+
AND last_updated_at >= ?
|
|
17250
|
+
AND json_extract(attrs_json, '$.workspaceId') = ?
|
|
17251
|
+
AND json_extract(attrs_json, '$.relPath') IN (${slice.map(() => "?").join(",")})`
|
|
17252
|
+
).run(since, workspaceId2, ...slice);
|
|
17253
|
+
revived += Number(r.changes);
|
|
17254
|
+
}
|
|
17255
|
+
if (revived > 0) this.mutations++;
|
|
17256
|
+
return revived;
|
|
17257
|
+
}
|
|
17240
17258
|
liveNodeIds(ids) {
|
|
17241
17259
|
const live = /* @__PURE__ */ new Set();
|
|
17242
17260
|
const CHUNK = 900;
|
|
@@ -29503,6 +29521,7 @@ async function incrementalReindex(store, rootPath, workspaceId2, changedAbsPaths
|
|
|
29503
29521
|
};
|
|
29504
29522
|
}
|
|
29505
29523
|
const fileHashes = /* @__PURE__ */ new Map();
|
|
29524
|
+
const contentMovedPaths = /* @__PURE__ */ new Set();
|
|
29506
29525
|
for (const rel of [...changedRelPaths]) {
|
|
29507
29526
|
let h;
|
|
29508
29527
|
try {
|
|
@@ -29515,6 +29534,8 @@ async function incrementalReindex(store, rootPath, workspaceId2, changedAbsPaths
|
|
|
29515
29534
|
if (fnode && fnode.attrs["contentHash"] === h && !fileHasStrandedSymbol(store, fnode.id)) {
|
|
29516
29535
|
store.updateNode(fnode.id, { lastUpdatedAt: t });
|
|
29517
29536
|
changedRelPaths.delete(rel);
|
|
29537
|
+
} else if (!fnode || fnode.attrs["contentHash"] !== h) {
|
|
29538
|
+
contentMovedPaths.add(rel);
|
|
29518
29539
|
}
|
|
29519
29540
|
}
|
|
29520
29541
|
if (changedRelPaths.size === 0) {
|
|
@@ -29649,6 +29670,7 @@ async function incrementalReindex(store, rootPath, workspaceId2, changedAbsPaths
|
|
|
29649
29670
|
changedRelPaths
|
|
29650
29671
|
});
|
|
29651
29672
|
store.transaction(() => {
|
|
29673
|
+
store.reviveReobserved([...changedRelPaths], workspaceId2, t);
|
|
29652
29674
|
const versionedAndFile = /* @__PURE__ */ new Set([...VERSIONED_LABELS, "File"]);
|
|
29653
29675
|
const ownedLive = [];
|
|
29654
29676
|
for (const n of store.nodesByRelPath([...changedRelPaths])) {
|
|
@@ -29758,12 +29780,11 @@ async function incrementalReindex(store, rootPath, workspaceId2, changedAbsPaths
|
|
|
29758
29780
|
if (!h) continue;
|
|
29759
29781
|
const fnode = store.getNode(fileNodeId(workspaceId2, rel));
|
|
29760
29782
|
if (!fnode) continue;
|
|
29761
|
-
const contentMoved = fnode.attrs["contentHash"] !== h;
|
|
29762
29783
|
store.updateNode(fnode.id, {
|
|
29763
29784
|
attrs: {
|
|
29764
29785
|
...fnode.attrs,
|
|
29765
29786
|
contentHash: h,
|
|
29766
|
-
...
|
|
29787
|
+
...contentMovedPaths.has(rel) ? { contentChangedAt: t } : {}
|
|
29767
29788
|
}
|
|
29768
29789
|
});
|
|
29769
29790
|
}
|
|
@@ -53841,7 +53862,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
|
|
|
53841
53862
|
}
|
|
53842
53863
|
|
|
53843
53864
|
// src/engine.ts
|
|
53844
|
-
var DAEMON_VERSION = true ? "2.0.2-dev.
|
|
53865
|
+
var DAEMON_VERSION = true ? "2.0.2-dev.517" : "2.0.0-alpha.0";
|
|
53845
53866
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
53846
53867
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
53847
53868
|
var GIT_OP_MUTE_MS = 4e3;
|
package/package.json
CHANGED
package/pass-worker.mjs
CHANGED
|
@@ -15885,6 +15885,7 @@ async function incrementalReindex(store2, rootPath, workspaceId, changedAbsPaths
|
|
|
15885
15885
|
};
|
|
15886
15886
|
}
|
|
15887
15887
|
const fileHashes = /* @__PURE__ */ new Map();
|
|
15888
|
+
const contentMovedPaths = /* @__PURE__ */ new Set();
|
|
15888
15889
|
for (const rel of [...changedRelPaths]) {
|
|
15889
15890
|
let h;
|
|
15890
15891
|
try {
|
|
@@ -15897,6 +15898,8 @@ async function incrementalReindex(store2, rootPath, workspaceId, changedAbsPaths
|
|
|
15897
15898
|
if (fnode && fnode.attrs["contentHash"] === h && !fileHasStrandedSymbol(store2, fnode.id)) {
|
|
15898
15899
|
store2.updateNode(fnode.id, { lastUpdatedAt: t });
|
|
15899
15900
|
changedRelPaths.delete(rel);
|
|
15901
|
+
} else if (!fnode || fnode.attrs["contentHash"] !== h) {
|
|
15902
|
+
contentMovedPaths.add(rel);
|
|
15900
15903
|
}
|
|
15901
15904
|
}
|
|
15902
15905
|
if (changedRelPaths.size === 0) {
|
|
@@ -16031,6 +16034,7 @@ async function incrementalReindex(store2, rootPath, workspaceId, changedAbsPaths
|
|
|
16031
16034
|
changedRelPaths
|
|
16032
16035
|
});
|
|
16033
16036
|
store2.transaction(() => {
|
|
16037
|
+
store2.reviveReobserved([...changedRelPaths], workspaceId, t);
|
|
16034
16038
|
const versionedAndFile = /* @__PURE__ */ new Set([...VERSIONED_LABELS, "File"]);
|
|
16035
16039
|
const ownedLive = [];
|
|
16036
16040
|
for (const n of store2.nodesByRelPath([...changedRelPaths])) {
|
|
@@ -16140,12 +16144,11 @@ async function incrementalReindex(store2, rootPath, workspaceId, changedAbsPaths
|
|
|
16140
16144
|
if (!h) continue;
|
|
16141
16145
|
const fnode = store2.getNode(fileNodeId(workspaceId, rel));
|
|
16142
16146
|
if (!fnode) continue;
|
|
16143
|
-
const contentMoved = fnode.attrs["contentHash"] !== h;
|
|
16144
16147
|
store2.updateNode(fnode.id, {
|
|
16145
16148
|
attrs: {
|
|
16146
16149
|
...fnode.attrs,
|
|
16147
16150
|
contentHash: h,
|
|
16148
|
-
...
|
|
16151
|
+
...contentMovedPaths.has(rel) ? { contentChangedAt: t } : {}
|
|
16149
16152
|
}
|
|
16150
16153
|
});
|
|
16151
16154
|
}
|
|
@@ -24889,6 +24892,24 @@ var SqliteGraphStore = class {
|
|
|
24889
24892
|
const rows = this.db.prepare("SELECT from_id, to_id, type FROM edges WHERE valid_to IS NULL").all();
|
|
24890
24893
|
return rows.map((r) => ({ from: r.from_id, to: r.to_id, type: r.type }));
|
|
24891
24894
|
}
|
|
24895
|
+
reviveReobserved(relPaths, workspaceId, since) {
|
|
24896
|
+
let revived = 0;
|
|
24897
|
+
const CHUNK = 400;
|
|
24898
|
+
for (let i2 = 0; i2 < relPaths.length; i2 += CHUNK) {
|
|
24899
|
+
const slice = relPaths.slice(i2, i2 + CHUNK);
|
|
24900
|
+
if (slice.length === 0) continue;
|
|
24901
|
+
const r = this.db.prepare(
|
|
24902
|
+
`UPDATE nodes SET valid_to = NULL
|
|
24903
|
+
WHERE valid_to IS NOT NULL
|
|
24904
|
+
AND last_updated_at >= ?
|
|
24905
|
+
AND json_extract(attrs_json, '$.workspaceId') = ?
|
|
24906
|
+
AND json_extract(attrs_json, '$.relPath') IN (${slice.map(() => "?").join(",")})`
|
|
24907
|
+
).run(since, workspaceId, ...slice);
|
|
24908
|
+
revived += Number(r.changes);
|
|
24909
|
+
}
|
|
24910
|
+
if (revived > 0) this.mutations++;
|
|
24911
|
+
return revived;
|
|
24912
|
+
}
|
|
24892
24913
|
liveNodeIds(ids) {
|
|
24893
24914
|
const live = /* @__PURE__ */ new Set();
|
|
24894
24915
|
const CHUNK = 900;
|