@@ -1311,6 +1311,32 @@ describe("getMemoryWikiPage", () => {
|
1311 | 1311 | expect(result?.truncated).toBe(true); |
1312 | 1312 | }); |
1313 | 1313 | |
| 1314 | +it("defaults non-finite wiki line options before slicing", async () => { |
| 1315 | +const { rootDir, config } = await createQueryVault({ |
| 1316 | +initialize: true, |
| 1317 | +}); |
| 1318 | +await fs.writeFile( |
| 1319 | +path.join(rootDir, "sources", "alpha.md"), |
| 1320 | +renderWikiMarkdown({ |
| 1321 | +frontmatter: { pageType: "source", id: "source.alpha", title: "Alpha Source" }, |
| 1322 | +body: "# Alpha Source\n\nline one\nline two\n", |
| 1323 | +}), |
| 1324 | +"utf8", |
| 1325 | +); |
| 1326 | + |
| 1327 | +const result = await getMemoryWikiPage({ |
| 1328 | + config, |
| 1329 | +lookup: "sources/alpha.md", |
| 1330 | +fromLine: Number.NaN, |
| 1331 | +lineCount: Number.POSITIVE_INFINITY, |
| 1332 | +}); |
| 1333 | + |
| 1334 | +expect(result?.corpus).toBe("wiki"); |
| 1335 | +expect(result?.content).toContain("line one"); |
| 1336 | +expect(result?.fromLine).toBe(1); |
| 1337 | +expect(result?.lineCount).toBe(200); |
| 1338 | +}); |
| 1339 | + |
1314 | 1340 | it("resolves compiled claim ids back to the owning page", async () => { |
1315 | 1341 | const { rootDir, config } = await createQueryVault({ |
1316 | 1342 | initialize: true, |
@@ -1429,6 +1455,38 @@ describe("getMemoryWikiPage", () => {
|
1429 | 1455 | }); |
1430 | 1456 | }); |
1431 | 1457 | |
| 1458 | +it("defaults non-finite memory line options before memory reads", async () => { |
| 1459 | +const { config } = await createQueryVault({ |
| 1460 | +initialize: true, |
| 1461 | +config: { |
| 1462 | +search: { backend: "shared", corpus: "memory" }, |
| 1463 | +}, |
| 1464 | +}); |
| 1465 | +const manager = createMemoryManager({ |
| 1466 | +readResult: { |
| 1467 | +path: "MEMORY.md", |
| 1468 | +text: "durable alpha memory", |
| 1469 | +}, |
| 1470 | +}); |
| 1471 | +getActiveMemorySearchManagerMock.mockResolvedValue({ manager }); |
| 1472 | + |
| 1473 | +const result = await getMemoryWikiPage({ |
| 1474 | + config, |
| 1475 | +appConfig: createAppConfig(), |
| 1476 | +lookup: "MEMORY.md", |
| 1477 | +fromLine: Number.NaN, |
| 1478 | +lineCount: Number.POSITIVE_INFINITY, |
| 1479 | +}); |
| 1480 | + |
| 1481 | +expect(result?.fromLine).toBe(1); |
| 1482 | +expect(result?.lineCount).toBe(200); |
| 1483 | +expect(manager.readFile).toHaveBeenCalledWith({ |
| 1484 | +relPath: "MEMORY.md", |
| 1485 | +from: 1, |
| 1486 | +lines: 200, |
| 1487 | +}); |
| 1488 | +}); |
| 1489 | + |
1432 | 1490 | it("skips session memory reads outside the caller visibility policy", async () => { |
1433 | 1491 | const { config } = await createQueryVault({ |
1434 | 1492 | initialize: true, |
|