Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(storage): cover file store findings and curated writer coverage

Steven Enamakel31e90c09a39f
diff --git a/scripts/__tests__/storage-bypass-debt.test.mjs b/scripts/__tests__/storage-bypass-debt.test.mjs
index 14a3525057..3bec85d9ab 100644
--- a/scripts/__tests__/storage-bypass-debt.test.mjs
+++ b/scripts/__tests__/storage-bypass-debt.test.mjs
@@ -254,3 +254,33 @@ test("symlinked --root checkouts cannot bypass required canonical history", () =
rmSync(fixture, { recursive: true, force: true });
}
});
+
+
+test("new-based file stores are findings without matching memory stores", () => {
+ const findings = scan("crates/openhuman-core/src/catalog.rs", [
+ "let cache = FileCatalogStore::new(dir);",
+ "let cache = tinyskills::FileCatalogStore::new(dir);",
+ "let memory = MemoryCatalogStore::new();",
+ ].join("\n"));
+ assert.deepEqual(findings.map(f => f.rule), ["file-store-new", "file-store-new"]);
+});
+
+for (const [name, source] of [
+ ["task stores", "vendor/tinyagents/crates/tinyagents-tasks/src/store.rs"],
+ ["catalog store", "vendor/tinyskills/crates/tinyskills/src/registry/store.rs"],
+]) {
+ test(`${name} owning writers are included in curated coverage`, async () => {
+ const root = mkdtempSync(join(tmpdir(), "storage-owner-coverage-"));
+ try {
+ mkdirSync(join(root, "crates"));
+ mkdirSync(join(root, source, ".."), { recursive: true });
+ writeFileSync(join(root, source), "pub fn persist() { std::fs::write(path, bytes); }\n");
+ const findings = await collectFindings(root);
+ assert.equal(findings.length, 1);
+ assert.equal(findings[0].path, source);
+ assert.equal(findings[0].rule, "json-write");
+ } finally {
+ rmSync(root, { recursive: true, force: true });
+ }
+ });
+}