@inerrata-corporation/errata 2.0.2-dev.313 → 2.0.2-dev.332

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
@@ -18609,22 +18609,26 @@ function priorsForFile(store, relPath) {
18609
18609
  if (!file2) return null;
18610
18610
  const openProblems = [];
18611
18611
  const constraints = [];
18612
+ const resolvedProblems = [];
18612
18613
  const seenProblem = /* @__PURE__ */ new Set();
18613
18614
  const related = /* @__PURE__ */ new Map();
18614
18615
  for (const e of store.inEdges(file2.id, ["ANCHORED_AT"])) {
18615
18616
  const n = store.getNode(e.from);
18616
18617
  if (!n) continue;
18617
18618
  if (n.label === "Problem") {
18618
- if (!n.attrs["resolvedAt"] && !seenProblem.has(n.id)) {
18619
- seenProblem.add(n.id);
18619
+ if (seenProblem.has(n.id)) continue;
18620
+ seenProblem.add(n.id);
18621
+ if (!n.attrs["resolvedAt"]) {
18620
18622
  (isConstraintProblem(n) ? constraints : openProblems).push(n);
18623
+ } else if (n.attrs["resolvedAs"] == null && n.attrs["mergedInto"] === void 0 && e.attrs?.["anchorProvenance"] !== "legacy") {
18624
+ resolvedProblems.push(n);
18621
18625
  }
18622
18626
  } else if (CITABLE_PRIOR_LABELS.has(n.label)) {
18623
18627
  related.set(n.id, n);
18624
18628
  }
18625
18629
  }
18626
18630
  const solutionsByProblem = /* @__PURE__ */ new Map();
18627
- for (const p of [...openProblems, ...constraints]) {
18631
+ for (const p of [...openProblems, ...constraints, ...resolvedProblems]) {
18628
18632
  for (const e of store.outEdges(p.id, ["SOLVED_BY", "CAUSED_BY", "INSTANCE_OF"])) {
18629
18633
  const n = store.getNode(e.to);
18630
18634
  if (n && CITABLE_PRIOR_LABELS.has(n.label)) related.set(n.id, n);
@@ -18635,11 +18639,22 @@ function priorsForFile(store, relPath) {
18635
18639
  }
18636
18640
  }
18637
18641
  }
18638
- if (openProblems.length === 0 && constraints.length === 0 && related.size === 0) return null;
18642
+ if (openProblems.length === 0 && constraints.length === 0 && resolvedProblems.length === 0 && related.size === 0)
18643
+ return null;
18639
18644
  const recentFirst = (a, b) => (b.lastUpdatedAt ?? 0) - (a.lastUpdatedAt ?? 0);
18640
18645
  openProblems.sort(recentFirst);
18641
18646
  constraints.sort(recentFirst);
18642
- return { file: file2, openProblems, constraints, related: [...related.values()], solutionsByProblem };
18647
+ resolvedProblems.sort(
18648
+ (a, b) => Number(b.attrs["resolvedAt"] ?? 0) - Number(a.attrs["resolvedAt"] ?? 0)
18649
+ );
18650
+ return {
18651
+ file: file2,
18652
+ openProblems,
18653
+ constraints,
18654
+ resolvedProblems,
18655
+ related: [...related.values()],
18656
+ solutionsByProblem
18657
+ };
18643
18658
  }
18644
18659
  function anchorProblemToDiff(store, problemId, changedPaths, workspaceId2, t, opts = {}) {
18645
18660
  return anchorNodeToDiff(store, problemId, "Problem", changedPaths, workspaceId2, t, opts);
@@ -21268,9 +21283,10 @@ function sliceForFile(store, relPath) {
21268
21283
  const priors = fp ? {
21269
21284
  openProblems: fp.openProblems.slice(0, 3).map((p) => ({ id: p.id, description: p.description })),
21270
21285
  constraints: fp.constraints.slice(0, 2).map((c) => ({ id: c.id, description: c.description })),
21286
+ resolvedProblems: fp.resolvedProblems.slice(0, 3).map((p) => ({ id: p.id, description: p.description })),
21271
21287
  related: fp.related.slice(0, 4).map((n) => ({ id: n.id, label: n.label, description: n.description })),
21272
21288
  solutionsByProblem: Object.fromEntries(
21273
- fp.openProblems.slice(0, 3).map((p) => [
21289
+ [...fp.openProblems.slice(0, 3), ...fp.resolvedProblems.slice(0, 3)].map((p) => [
21274
21290
  p.id,
21275
21291
  (fp.solutionsByProblem.get(p.id) ?? []).slice(0, 4).map((s) => ({ id: s.id, description: s.description }))
21276
21292
  ])
@@ -21462,6 +21478,19 @@ function renderSnapshot(s) {
21462
21478
  lines.push(` - ${c.description} \u2192 \`([${c.id}])\``);
21463
21479
  }
21464
21480
  }
21481
+ if (w.priors?.resolvedProblems.length) {
21482
+ lines.push(
21483
+ "- **Already fixed here** \u2014 these are RESOLVED, not open work, so there is no `(fix:)` token. They are shown for the opposite reason: if one has come BACK, that is a contradiction of the solution below it, and the most valuable thing you can report. Say so with `[!recurred: \u2026]` naming the problem, and cite the solution that did not hold with `([id])`:"
21484
+ );
21485
+ for (const p of w.priors.resolvedProblems) {
21486
+ lines.push(` - \u2713 ${p.description} \u2192 \`([${p.id}])\``);
21487
+ for (const s2 of w.priors.solutionsByProblem[p.id] ?? []) {
21488
+ lines.push(
21489
+ ` - fixed by: ${s2.description} \u2014 if that fix did NOT hold, contradict it: \`([${s2.id}])\``
21490
+ );
21491
+ }
21492
+ }
21493
+ }
21465
21494
  if (w.priors?.related.length) {
21466
21495
  lines.push("- **Related priors** (cite with `([id])` where you lean on one):");
21467
21496
  for (const n of w.priors.related) {
@@ -25885,7 +25914,7 @@ var init_scrub = __esm({
25885
25914
  EMAIL_RE = /\b[A-Za-z0-9._%+\-]+@[A-Za-z0-9.\-]+\.[A-Za-z]{2,}\b/g;
25886
25915
  IPV4_RE = /\b(?:\d{1,3}\.){3}\d{1,3}\b/g;
25887
25916
  IPV6_RE = /\b(?:[A-Fa-f0-9]{1,4}:){2,7}[A-Fa-f0-9:]{1,4}\b/g;
25888
- WIN_PATH_RE = /\b[A-Za-z]:[\\/](?:[^\\/\s"']+[\\/])*[^\\/\s"']*/g;
25917
+ WIN_PATH_RE = /\b[A-Za-z]:[\\/](?![\\/])(?:[^\\/\s"']+[\\/])*[^\\/\s"']*/g;
25889
25918
  WIN_UNC_RE = /\\\\[A-Za-z0-9_\-]+\\[A-Za-z0-9_\-$]+(?:\\[^\\\s"']+)*/g;
25890
25919
  POSIX_USER_PATH_RE = /\/(?:Users|home)\/[A-Za-z0-9_\-\.]+(?:\/[^"'\s)]+)*/g;
25891
25920
  LONG_HASH_RE = /\b[a-fA-F0-9]{24,}\b/g;
@@ -53006,7 +53035,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
53006
53035
  }
53007
53036
 
53008
53037
  // src/engine.ts
53009
- var DAEMON_VERSION = true ? "2.0.2-dev.313" : "2.0.0-alpha.0";
53038
+ var DAEMON_VERSION = true ? "2.0.2-dev.332" : "2.0.0-alpha.0";
53010
53039
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
53011
53040
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
53012
53041
  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.313",
3
+ "version": "2.0.2-dev.332",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
package/pass-worker.mjs CHANGED
@@ -25322,22 +25322,26 @@ function priorsForFile(store2, relPath) {
25322
25322
  if (!file2) return null;
25323
25323
  const openProblems = [];
25324
25324
  const constraints = [];
25325
+ const resolvedProblems = [];
25325
25326
  const seenProblem = /* @__PURE__ */ new Set();
25326
25327
  const related = /* @__PURE__ */ new Map();
25327
25328
  for (const e of store2.inEdges(file2.id, ["ANCHORED_AT"])) {
25328
25329
  const n = store2.getNode(e.from);
25329
25330
  if (!n) continue;
25330
25331
  if (n.label === "Problem") {
25331
- if (!n.attrs["resolvedAt"] && !seenProblem.has(n.id)) {
25332
- seenProblem.add(n.id);
25332
+ if (seenProblem.has(n.id)) continue;
25333
+ seenProblem.add(n.id);
25334
+ if (!n.attrs["resolvedAt"]) {
25333
25335
  (isConstraintProblem(n) ? constraints : openProblems).push(n);
25336
+ } else if (n.attrs["resolvedAs"] == null && n.attrs["mergedInto"] === void 0 && e.attrs?.["anchorProvenance"] !== "legacy") {
25337
+ resolvedProblems.push(n);
25334
25338
  }
25335
25339
  } else if (CITABLE_PRIOR_LABELS.has(n.label)) {
25336
25340
  related.set(n.id, n);
25337
25341
  }
25338
25342
  }
25339
25343
  const solutionsByProblem = /* @__PURE__ */ new Map();
25340
- for (const p of [...openProblems, ...constraints]) {
25344
+ for (const p of [...openProblems, ...constraints, ...resolvedProblems]) {
25341
25345
  for (const e of store2.outEdges(p.id, ["SOLVED_BY", "CAUSED_BY", "INSTANCE_OF"])) {
25342
25346
  const n = store2.getNode(e.to);
25343
25347
  if (n && CITABLE_PRIOR_LABELS.has(n.label)) related.set(n.id, n);
@@ -25348,11 +25352,22 @@ function priorsForFile(store2, relPath) {
25348
25352
  }
25349
25353
  }
25350
25354
  }
25351
- if (openProblems.length === 0 && constraints.length === 0 && related.size === 0) return null;
25355
+ if (openProblems.length === 0 && constraints.length === 0 && resolvedProblems.length === 0 && related.size === 0)
25356
+ return null;
25352
25357
  const recentFirst = (a, b) => (b.lastUpdatedAt ?? 0) - (a.lastUpdatedAt ?? 0);
25353
25358
  openProblems.sort(recentFirst);
25354
25359
  constraints.sort(recentFirst);
25355
- return { file: file2, openProblems, constraints, related: [...related.values()], solutionsByProblem };
25360
+ resolvedProblems.sort(
25361
+ (a, b) => Number(b.attrs["resolvedAt"] ?? 0) - Number(a.attrs["resolvedAt"] ?? 0)
25362
+ );
25363
+ return {
25364
+ file: file2,
25365
+ openProblems,
25366
+ constraints,
25367
+ resolvedProblems,
25368
+ related: [...related.values()],
25369
+ solutionsByProblem
25370
+ };
25356
25371
  }
25357
25372
  function recordAnchorHint(store2, problemId, relPath, provenance, ts) {
25358
25373
  const p = store2.getNode(problemId);
@@ -26320,9 +26335,10 @@ function sliceForFile(store2, relPath) {
26320
26335
  const priors = fp ? {
26321
26336
  openProblems: fp.openProblems.slice(0, 3).map((p) => ({ id: p.id, description: p.description })),
26322
26337
  constraints: fp.constraints.slice(0, 2).map((c) => ({ id: c.id, description: c.description })),
26338
+ resolvedProblems: fp.resolvedProblems.slice(0, 3).map((p) => ({ id: p.id, description: p.description })),
26323
26339
  related: fp.related.slice(0, 4).map((n) => ({ id: n.id, label: n.label, description: n.description })),
26324
26340
  solutionsByProblem: Object.fromEntries(
26325
- fp.openProblems.slice(0, 3).map((p) => [
26341
+ [...fp.openProblems.slice(0, 3), ...fp.resolvedProblems.slice(0, 3)].map((p) => [
26326
26342
  p.id,
26327
26343
  (fp.solutionsByProblem.get(p.id) ?? []).slice(0, 4).map((s) => ({ id: s.id, description: s.description }))
26328
26344
  ])