@inerrata-corporation/errata 2.0.2-dev.517 → 2.0.2-dev.532
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 -4
- package/errata.mjs +686 -235
- package/package.json +1 -1
- package/pass-worker.mjs +104 -27
package/package.json
CHANGED
package/pass-worker.mjs
CHANGED
|
@@ -16721,7 +16721,7 @@ async function scan(root, current, ignores, providers, out2) {
|
|
|
16721
16721
|
}
|
|
16722
16722
|
}
|
|
16723
16723
|
}
|
|
16724
|
-
function
|
|
16724
|
+
function gitListRelPaths(root, ignores) {
|
|
16725
16725
|
let stdout;
|
|
16726
16726
|
try {
|
|
16727
16727
|
stdout = execFileSync(
|
|
@@ -16744,6 +16744,15 @@ function gitListFiles(root, ignores, providers) {
|
|
|
16744
16744
|
if (segs.some((s) => ignores.has(s) || s.startsWith(".") && s.length > 1)) {
|
|
16745
16745
|
continue;
|
|
16746
16746
|
}
|
|
16747
|
+
out2.push(rel);
|
|
16748
|
+
}
|
|
16749
|
+
return out2;
|
|
16750
|
+
}
|
|
16751
|
+
function gitListFiles(root, ignores, providers) {
|
|
16752
|
+
const rels = gitListRelPaths(root, ignores);
|
|
16753
|
+
if (rels === null) return null;
|
|
16754
|
+
const out2 = [];
|
|
16755
|
+
for (const rel of rels) {
|
|
16747
16756
|
const abs = join(root, rel);
|
|
16748
16757
|
let size;
|
|
16749
16758
|
try {
|
|
@@ -24083,6 +24092,7 @@ var init_csharp_treesitter = __esm({
|
|
|
24083
24092
|
// ../../packages/indexer/src/index.ts
|
|
24084
24093
|
var src_exports = {};
|
|
24085
24094
|
__export(src_exports, {
|
|
24095
|
+
DEFAULT_IGNORES: () => DEFAULT_IGNORES,
|
|
24086
24096
|
DRIFT_FORK_RATIO: () => DRIFT_FORK_RATIO,
|
|
24087
24097
|
TreeSitterCSharpProvider: () => TreeSitterCSharpProvider,
|
|
24088
24098
|
TreeSitterCppProvider: () => TreeSitterCppProvider,
|
|
@@ -24099,6 +24109,7 @@ __export(src_exports, {
|
|
|
24099
24109
|
findInnermostScope: () => findInnermostScope,
|
|
24100
24110
|
folderNodeId: () => folderNodeId,
|
|
24101
24111
|
fromHex: () => fromHex,
|
|
24112
|
+
gitListRelPaths: () => gitListRelPaths,
|
|
24102
24113
|
hammingDistance: () => hammingDistance,
|
|
24103
24114
|
hasForkedDrift: () => hasForkedDrift,
|
|
24104
24115
|
incrementalReindex: () => incrementalReindex,
|
|
@@ -24969,6 +24980,10 @@ var SqliteGraphStore = class {
|
|
|
24969
24980
|
if (!live) return null;
|
|
24970
24981
|
const version2 = live.version ?? 1;
|
|
24971
24982
|
const frozenId = `${liveId}@v${version2}`;
|
|
24983
|
+
if (this.getNode(frozenId)) {
|
|
24984
|
+
this.stmts.advanceLive.run({ live_id: liveId, t });
|
|
24985
|
+
return frozenId;
|
|
24986
|
+
}
|
|
24972
24987
|
this.stmts.freezeCopy.run({ frozen_id: frozenId, live_id: liveId, t });
|
|
24973
24988
|
this.mergeEdge({
|
|
24974
24989
|
id: `edge_superseded_${frozenId}`,
|
|
@@ -25027,6 +25042,7 @@ var CAUSAL_FAMILY = [
|
|
|
25027
25042
|
|
|
25028
25043
|
// ../../packages/local-graph/src/justification.ts
|
|
25029
25044
|
init_src();
|
|
25045
|
+
init_src2();
|
|
25030
25046
|
function addDependency(store2, opts) {
|
|
25031
25047
|
const id = digest({ from: opts.fromId, type: "DEPENDS_ON", to: opts.toId });
|
|
25032
25048
|
const attrs = { relation: opts.relation };
|
|
@@ -25057,15 +25073,22 @@ function markRevisit(store2, node, reason, ts, answeredWhen) {
|
|
|
25057
25073
|
revisit: true,
|
|
25058
25074
|
revisitReason: reason,
|
|
25059
25075
|
revisitSinceTs: ts,
|
|
25060
|
-
|
|
25076
|
+
revisitAnsweredWhen: answeredWhen
|
|
25061
25077
|
},
|
|
25062
25078
|
lastUpdatedAt: ts
|
|
25063
25079
|
});
|
|
25064
25080
|
}
|
|
25065
25081
|
var LEGACY_AUTO_CLOSE_ASK = "auto-closed off a pre-provenance anchor";
|
|
25082
|
+
var KNOWN_CONDITIONS = {
|
|
25083
|
+
parentProblemOpen: true,
|
|
25084
|
+
dependentStale: true
|
|
25085
|
+
};
|
|
25086
|
+
function isRevisitCondition(v) {
|
|
25087
|
+
return typeof v === "string" && Object.prototype.hasOwnProperty.call(KNOWN_CONDITIONS, v);
|
|
25088
|
+
}
|
|
25066
25089
|
function conditionOf(node) {
|
|
25067
25090
|
const explicit = node.attrs["revisitAnsweredWhen"];
|
|
25068
|
-
if (explicit
|
|
25091
|
+
if (isRevisitCondition(explicit)) return explicit;
|
|
25069
25092
|
if (String(node.attrs["revisitReason"] ?? "").startsWith(LEGACY_AUTO_CLOSE_ASK)) {
|
|
25070
25093
|
return "parentProblemOpen";
|
|
25071
25094
|
}
|
|
@@ -25073,23 +25096,32 @@ function conditionOf(node) {
|
|
|
25073
25096
|
}
|
|
25074
25097
|
function clearAnsweredRevisits(store2, ts) {
|
|
25075
25098
|
const report = { cleared: 0, standing: 0 };
|
|
25076
|
-
for (const
|
|
25077
|
-
|
|
25078
|
-
|
|
25079
|
-
|
|
25080
|
-
|
|
25081
|
-
|
|
25082
|
-
|
|
25083
|
-
|
|
25084
|
-
|
|
25085
|
-
report.
|
|
25086
|
-
continue;
|
|
25099
|
+
for (const label of SEMANTIC_NODE_LABELS) {
|
|
25100
|
+
for (const node of store2.findNodesByLabel(label)) {
|
|
25101
|
+
if (node.attrs["revisit"] !== true) continue;
|
|
25102
|
+
const condition = conditionOf(node);
|
|
25103
|
+
if (condition === void 0 || !isRevisitAnswered(store2, node, condition)) {
|
|
25104
|
+
report.standing++;
|
|
25105
|
+
continue;
|
|
25106
|
+
}
|
|
25107
|
+
clearRevisit(store2, node.id, ts);
|
|
25108
|
+
report.cleared++;
|
|
25087
25109
|
}
|
|
25088
|
-
clearRevisit(store2, node.id, ts);
|
|
25089
|
-
report.cleared++;
|
|
25090
25110
|
}
|
|
25091
25111
|
return report;
|
|
25092
25112
|
}
|
|
25113
|
+
function isRevisitAnswered(store2, node, condition) {
|
|
25114
|
+
switch (condition) {
|
|
25115
|
+
case "parentProblemOpen": {
|
|
25116
|
+
const parents = store2.inEdges(node.id, ["SOLVED_BY"]).map((e) => store2.getNode(e.from)).filter((n) => n !== null && n.validTo == null);
|
|
25117
|
+
return parents.every((p) => p.attrs["resolvedAt"] == null);
|
|
25118
|
+
}
|
|
25119
|
+
case "dependentStale": {
|
|
25120
|
+
const since = Number(node.attrs["revisitSinceTs"] ?? 0);
|
|
25121
|
+
return since > 0 && node.lastUpdatedAt > since;
|
|
25122
|
+
}
|
|
25123
|
+
}
|
|
25124
|
+
}
|
|
25093
25125
|
function clearRevisit(store2, nodeId, ts) {
|
|
25094
25126
|
const n = store2.getNode(nodeId);
|
|
25095
25127
|
if (!n) return;
|
|
@@ -26224,6 +26256,9 @@ function rankToolsForHandles(store2, limit = 5) {
|
|
|
26224
26256
|
// ../../packages/local-graph/src/principle-sync.ts
|
|
26225
26257
|
init_src2();
|
|
26226
26258
|
|
|
26259
|
+
// ../../packages/local-graph/src/mechanism-liveness.ts
|
|
26260
|
+
var STALL_MIN_SPAN_MS = 60 * 60 * 1e3;
|
|
26261
|
+
|
|
26227
26262
|
// ../../packages/generalizer/src/generalizer.ts
|
|
26228
26263
|
init_src2();
|
|
26229
26264
|
init_src();
|
|
@@ -26343,7 +26378,7 @@ function promoteMotifs(store2, t) {
|
|
|
26343
26378
|
}
|
|
26344
26379
|
|
|
26345
26380
|
// ../../packages/generalizer/src/nightly.ts
|
|
26346
|
-
function
|
|
26381
|
+
function runGraphRescore(store2) {
|
|
26347
26382
|
const started = Date.now();
|
|
26348
26383
|
const allowedTypes = new Set(pagerankEdgeTypes());
|
|
26349
26384
|
const nodeIds = [];
|
|
@@ -26426,11 +26461,6 @@ function runNightlyPipeline(store2) {
|
|
|
26426
26461
|
for (const [id, c] of comm.community) store2.updateNode(id, { community: c });
|
|
26427
26462
|
});
|
|
26428
26463
|
const motifs = promoteMotifs(store2, started);
|
|
26429
|
-
reopenAutoClosedProblems(store2, started);
|
|
26430
|
-
const revisits = clearAnsweredRevisits(store2, started);
|
|
26431
|
-
const fixCandidates = clearSettledFixCandidates(store2, started);
|
|
26432
|
-
const designResolved = markFixCandidates(store2, started);
|
|
26433
|
-
const cry = crystallize(store2, { ts: started });
|
|
26434
26464
|
return {
|
|
26435
26465
|
scoredNodes: scored,
|
|
26436
26466
|
iterations: result.iterations,
|
|
@@ -26440,17 +26470,51 @@ function runNightlyPipeline(store2) {
|
|
|
26440
26470
|
motifsPromoted: motifs.promoted,
|
|
26441
26471
|
techniques: motifs.techniques,
|
|
26442
26472
|
antipatterns: motifs.antipatterns,
|
|
26443
|
-
|
|
26444
|
-
|
|
26445
|
-
|
|
26473
|
+
durationMs: Date.now() - started
|
|
26474
|
+
};
|
|
26475
|
+
}
|
|
26476
|
+
function runSemanticMaintenance(store2) {
|
|
26477
|
+
const started = Date.now();
|
|
26478
|
+
reopenAutoClosedProblems(store2, started);
|
|
26479
|
+
const revisits = clearAnsweredRevisits(store2, started);
|
|
26480
|
+
const fixCandidates = clearSettledFixCandidates(store2, started);
|
|
26481
|
+
const designResolved = markFixCandidates(store2, started);
|
|
26482
|
+
const cry = crystallize(store2, { ts: started });
|
|
26483
|
+
return {
|
|
26446
26484
|
designResolved,
|
|
26447
26485
|
revisitsCleared: revisits.cleared,
|
|
26486
|
+
revisitsStanding: revisits.standing,
|
|
26448
26487
|
fixCandidatesSettled: fixCandidates.answered + fixCandidates.ignored + fixCandidates.unsubstantiated,
|
|
26488
|
+
fixCandidates,
|
|
26449
26489
|
claimsEvaluated: cry.evaluated,
|
|
26450
26490
|
claimsDerived: cry.derived.length,
|
|
26451
26491
|
durationMs: Date.now() - started
|
|
26452
26492
|
};
|
|
26453
26493
|
}
|
|
26494
|
+
function runNightlyPipeline(store2) {
|
|
26495
|
+
const started = Date.now();
|
|
26496
|
+
const rescore = runGraphRescore(store2);
|
|
26497
|
+
const semantic = runSemanticMaintenance(store2);
|
|
26498
|
+
return {
|
|
26499
|
+
scoredNodes: rescore.scoredNodes,
|
|
26500
|
+
iterations: rescore.iterations,
|
|
26501
|
+
converged: rescore.converged,
|
|
26502
|
+
landmarks: rescore.landmarks,
|
|
26503
|
+
communities: rescore.communities,
|
|
26504
|
+
motifsPromoted: rescore.motifsPromoted,
|
|
26505
|
+
techniques: rescore.techniques,
|
|
26506
|
+
antipatterns: rescore.antipatterns,
|
|
26507
|
+
skillsInduced: 0,
|
|
26508
|
+
// skills are cloud-induced now (see above)
|
|
26509
|
+
skillsRefreshed: 0,
|
|
26510
|
+
designResolved: semantic.designResolved,
|
|
26511
|
+
revisitsCleared: semantic.revisitsCleared,
|
|
26512
|
+
fixCandidatesSettled: semantic.fixCandidatesSettled,
|
|
26513
|
+
claimsEvaluated: semantic.claimsEvaluated,
|
|
26514
|
+
claimsDerived: semantic.claimsDerived,
|
|
26515
|
+
durationMs: Date.now() - started
|
|
26516
|
+
};
|
|
26517
|
+
}
|
|
26454
26518
|
function codeAnchorProjection(store2, semanticIds, opts = {}) {
|
|
26455
26519
|
const anchorToNodes = /* @__PURE__ */ new Map();
|
|
26456
26520
|
for (const id of semanticIds) {
|
|
@@ -26761,6 +26825,8 @@ async function findStaleFiles(store2, rootPath, workspaceId) {
|
|
|
26761
26825
|
const fnode = store2.getNode(fileNodeId(workspaceId, rel));
|
|
26762
26826
|
if (!fnode) {
|
|
26763
26827
|
stale.push(abs);
|
|
26828
|
+
} else if ((fnode.validTo ?? null) !== null) {
|
|
26829
|
+
stale.push(abs);
|
|
26764
26830
|
} else if (fnode.lastUpdatedAt < mtimeMs) {
|
|
26765
26831
|
stale.push(abs);
|
|
26766
26832
|
} else {
|
|
@@ -26788,12 +26854,23 @@ async function reconcileStaleFiles(store2, rootPath, workspaceId) {
|
|
|
26788
26854
|
const stale = await findStaleFiles(store2, rootPath, workspaceId);
|
|
26789
26855
|
if (stale.length === 0) return 0;
|
|
26790
26856
|
let total = 0;
|
|
26857
|
+
let failedBatches = 0;
|
|
26791
26858
|
const BATCH = 20;
|
|
26792
26859
|
for (let i2 = 0; i2 < stale.length; i2 += BATCH) {
|
|
26793
|
-
|
|
26794
|
-
|
|
26860
|
+
try {
|
|
26861
|
+
const r = await incrementalReindex(store2, rootPath, workspaceId, stale.slice(i2, i2 + BATCH));
|
|
26862
|
+
total += r.filesReindexed;
|
|
26863
|
+
} catch (err2) {
|
|
26864
|
+
failedBatches++;
|
|
26865
|
+
console.warn(
|
|
26866
|
+
`[errata] reconcile: batch ${i2 / BATCH + 1} failed (${stale.slice(i2, i2 + BATCH).length} file(s) skipped): ${err2 instanceof Error ? err2.message : err2}`
|
|
26867
|
+
);
|
|
26868
|
+
}
|
|
26795
26869
|
if (i2 + BATCH < stale.length) await new Promise((res) => setImmediate(res));
|
|
26796
26870
|
}
|
|
26871
|
+
if (failedBatches > 0) {
|
|
26872
|
+
console.warn(`[errata] reconcile: ${failedBatches} batch(es) failed; ${total} file(s) reindexed`);
|
|
26873
|
+
}
|
|
26797
26874
|
return total;
|
|
26798
26875
|
}
|
|
26799
26876
|
|