@remnic/core 10.0.112 → 10.0.114

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnic/core",
3
- "version": "10.0.112",
3
+ "version": "10.0.114",
4
4
  "description": "Framework-agnostic Remnic memory engine — orchestrator, storage, extraction, search, trust zones",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -3386,7 +3386,7 @@
3386
3386
  "core"
3387
3387
  ],
3388
3388
  "peerDependencies": {
3389
- "@remnic/coding-graph": "^10.0.112"
3389
+ "@remnic/coding-graph": "^10.0.114"
3390
3390
  },
3391
3391
  "peerDependenciesMeta": {
3392
3392
  "@remnic/coding-graph": {
@@ -409,6 +409,7 @@ function flushHarness(memories: FlushMemory[], buffered: FlushBuffer) {
409
409
  namespaceFromPath: () => "default",
410
410
  storageRouter: {
411
411
  storageFor: async () => ({
412
+ dir: "/memory",
412
413
  flushAccessTracking: async (entries: AccessTrackingEntry[]) => {
413
414
  out.flushed = entries;
414
415
  },
@@ -496,3 +497,16 @@ test("flushAccessTracking takes the earlier memory when a relative path matches
496
497
  await coordinator.flushAccessTracking();
497
498
  assert.deepEqual(out.flushed.map((e) => [e.memoryPath, e.newCount]), [[underMemoryDir, 6]]);
498
499
  });
500
+
501
+ test("flushAccessTracking tries the plain path before the QMD collection candidates", async () => {
502
+ const viaCandidate = path.join("/memory", "facts", "x.md");
503
+ const viaPlainPath = path.join("/memory", "collection", "facts", "x.md");
504
+ const memories = [
505
+ { path: viaCandidate, frontmatter: { id: "cand-a", accessCount: 5 } },
506
+ { path: viaPlainPath, frontmatter: { id: "plain-b", accessCount: 50 } },
507
+ ];
508
+ const buffered: FlushBuffer = new Map([["default:x", { memoryId: "x", memoryPath: "collection/facts/x.md", count: 1, lastAccessed: stamp }]]);
509
+ const { out, coordinator } = flushHarness(memories, buffered);
510
+ await coordinator.flushAccessTracking();
511
+ assert.deepEqual(out.flushed.map((e) => [e.memoryPath, e.newCount]), [[viaPlainPath, 51]]);
512
+ });
@@ -306,3 +306,35 @@ test("run() queues a session's first append behind earlier ones for the same pri
306
306
  assert.equal(outcome, "ran");
307
307
  assert.equal(order.at(-1), "remembered");
308
308
  });
309
+
310
+ test("run() keeps serving a primary directory's queue after one first append fails", async () => {
311
+ const memo = new WriteDirMemo();
312
+ const failed = memo.run("root", "s1", "primary", async () => {
313
+ throw new Error("boom");
314
+ });
315
+ const queued = memo.run("root", "s2", "primary", async () => "ran");
316
+ await assert.rejects(failed, /boom/);
317
+ assert.equal(await queued, "ran", "a failed first append must not fail the next one in the lane");
318
+ assert.equal(memo.pendingLanes, 0);
319
+ });
320
+
321
+ test("cleanup drops the remembered directories when it deletes a file whose rows are all expired", async () => {
322
+ await withManager(async ({ manager, root }) => {
323
+ const owner = "pi-geek:memo-emptied-file";
324
+ const channelDir = path.join(root, manager.getTranscriptPath(owner).dir);
325
+ await mkdir(channelDir, { recursive: true });
326
+ // Not a YYYY-MM-DD.jsonl name, so cleanup() takes the cleanupTranscriptFile path and deletes it once nothing is left.
327
+ const old = { ...entry(owner, "old"), timestamp: "2026-01-01T00:00:00.000Z" };
328
+ await writeFile(path.join(channelDir, "notes.jsonl"), `${JSON.stringify(old)}\n`, "utf-8");
329
+ await manager.append(entry(owner, "h1"));
330
+ assert.equal(await manager.cleanup(30), 1);
331
+ assert.equal((await readdir(channelDir)).includes("notes.jsonl"), false);
332
+ const verify = mock.method(JsonlOwnershipDigestCache.prototype, "verify");
333
+ try {
334
+ await manager.append(entry(owner, "h2"));
335
+ assert.ok(verify.mock.callCount() >= 1, "the directory was not verified again after the file was deleted");
336
+ } finally {
337
+ verify.mock.restore();
338
+ }
339
+ });
340
+ });