@inerrata-corporation/errata 2.0.2-dev.476 → 2.0.2-dev.477

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/errata.mjs CHANGED
@@ -19409,6 +19409,7 @@ function isLegacyAnchor(attrs) {
19409
19409
  function repairLegacyAnchorsFromStatement(store, ts) {
19410
19410
  const report = {
19411
19411
  repaired: [],
19412
+ retiredGuesses: 0,
19412
19413
  noPathNamed: 0,
19413
19414
  pathUnknown: 0,
19414
19415
  alreadyCorrect: 0
@@ -19431,7 +19432,22 @@ function repairLegacyAnchorsFromStatement(store, ts) {
19431
19432
  const anchors = store.outEdges(p.id, ["ANCHORED_AT"]);
19432
19433
  const legacy = anchors.filter((e) => e.attrs?.["anchorProvenance"] === "legacy");
19433
19434
  if (legacy.length === 0) continue;
19434
- if (anchors.some((e) => e.attrs?.["anchorProvenance"] === "restated")) continue;
19435
+ const better = anchors.filter((e) => {
19436
+ const prov = e.attrs?.["anchorProvenance"];
19437
+ return prov === "restated" || prov === "witnessed" || prov === "edited";
19438
+ });
19439
+ if (better.length > 0) {
19440
+ const betterTargets = new Set(better.map((e) => e.to));
19441
+ let retired = 0;
19442
+ for (const e of legacy) {
19443
+ if (!betterTargets.has(e.to)) {
19444
+ store.closeEdge(e.id, ts);
19445
+ retired++;
19446
+ }
19447
+ }
19448
+ report.retiredGuesses += retired;
19449
+ continue;
19450
+ }
19435
19451
  const named = [...String(p.description ?? "").matchAll(STATEMENT_PATH_RE)].map((m) => m[0]);
19436
19452
  if (named.length === 0) {
19437
19453
  report.noPathNamed++;
@@ -19469,6 +19485,10 @@ function repairLegacyAnchorsFromStatement(store, ts) {
19469
19485
  restatedAt: ts
19470
19486
  }
19471
19487
  });
19488
+ for (const e of legacy) {
19489
+ if (e.to !== target.id) store.closeEdge(e.id, ts);
19490
+ }
19491
+ report.retiredGuesses += legacy.filter((e) => e.to !== target.id).length;
19472
19492
  report.repaired.push({
19473
19493
  problemId: p.id,
19474
19494
  problem: p.description,
@@ -53611,7 +53631,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
53611
53631
  }
53612
53632
 
53613
53633
  // src/engine.ts
53614
- var DAEMON_VERSION = true ? "2.0.2-dev.476" : "2.0.0-alpha.0";
53634
+ var DAEMON_VERSION = true ? "2.0.2-dev.477" : "2.0.0-alpha.0";
53615
53635
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
53616
53636
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
53617
53637
  var GIT_OP_MUTE_MS = 4e3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.2-dev.476",
3
+ "version": "2.0.2-dev.477",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
package/pass-worker.mjs CHANGED
@@ -25571,6 +25571,7 @@ var STATEMENT_PATH_RE = new RegExp(
25571
25571
  function repairLegacyAnchorsFromStatement(store2, ts) {
25572
25572
  const report = {
25573
25573
  repaired: [],
25574
+ retiredGuesses: 0,
25574
25575
  noPathNamed: 0,
25575
25576
  pathUnknown: 0,
25576
25577
  alreadyCorrect: 0
@@ -25593,7 +25594,22 @@ function repairLegacyAnchorsFromStatement(store2, ts) {
25593
25594
  const anchors = store2.outEdges(p.id, ["ANCHORED_AT"]);
25594
25595
  const legacy = anchors.filter((e) => e.attrs?.["anchorProvenance"] === "legacy");
25595
25596
  if (legacy.length === 0) continue;
25596
- if (anchors.some((e) => e.attrs?.["anchorProvenance"] === "restated")) continue;
25597
+ const better = anchors.filter((e) => {
25598
+ const prov = e.attrs?.["anchorProvenance"];
25599
+ return prov === "restated" || prov === "witnessed" || prov === "edited";
25600
+ });
25601
+ if (better.length > 0) {
25602
+ const betterTargets = new Set(better.map((e) => e.to));
25603
+ let retired = 0;
25604
+ for (const e of legacy) {
25605
+ if (!betterTargets.has(e.to)) {
25606
+ store2.closeEdge(e.id, ts);
25607
+ retired++;
25608
+ }
25609
+ }
25610
+ report.retiredGuesses += retired;
25611
+ continue;
25612
+ }
25597
25613
  const named = [...String(p.description ?? "").matchAll(STATEMENT_PATH_RE)].map((m) => m[0]);
25598
25614
  if (named.length === 0) {
25599
25615
  report.noPathNamed++;
@@ -25631,6 +25647,10 @@ function repairLegacyAnchorsFromStatement(store2, ts) {
25631
25647
  restatedAt: ts
25632
25648
  }
25633
25649
  });
25650
+ for (const e of legacy) {
25651
+ if (e.to !== target.id) store2.closeEdge(e.id, ts);
25652
+ }
25653
+ report.retiredGuesses += legacy.filter((e) => e.to !== target.id).length;
25634
25654
  report.repaired.push({
25635
25655
  problemId: p.id,
25636
25656
  problem: p.description,