Skip to content

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

fix(ci): allow multiple storage-bypass sites per file

Steven Enamakel933642485af1
diff --git a/scripts/__tests__/storage-bypass.test.mjs b/scripts/__tests__/storage-bypass.test.mjs
index b42ec82b15..012459981d 100644
--- a/scripts/__tests__/storage-bypass.test.mjs
+++ b/scripts/__tests__/storage-bypass.test.mjs
@@ -112,11 +112,13 @@ test("compare reports added and stale sites", () => {
});
test("every allowlisted path carries a reason and known rules", () => {
- for (const [file, entry] of ALLOW) {
+ for (const [file, entries] of ALLOW) {
assert.ok(file.startsWith(`${SRC}/`), file);
- assert.ok(entry.reason.length > 20, file);
- assert.ok(["sqlite-open", "json-write"].includes(entry.rule));
- assert.ok(entry.site.length > 5, file);
+ for (const entry of entries) {
+ assert.ok(entry.reason.length > 20, file);
+ assert.ok(["sqlite-open", "json-write"].includes(entry.rule));
+ assert.ok(entry.site.length > 5, file);
+ }
}
const state = `${SRC}/config/workspace/state.rs`;
const [site] = scan(state, "let conn = Connection::open(db_path)?;");
diff --git a/scripts/ci/check-storage-bypass.mjs b/scripts/ci/check-storage-bypass.mjs
index e8102ecdda..fe4bad33d8 100755
--- a/scripts/ci/check-storage-bypass.mjs
+++ b/scripts/ci/check-storage-bypass.mjs
@@ -143,17 +143,38 @@ export const ALLOW = new Map(
"if let Err(e) = std::fs::write(path, json) {",
"one process-global savings counter snapshot, cheap to lose; not per-user data a scope would mean anything for",
],
- ].map(([path, rule, site, reason]) => [
- `${SRC}${path}`,
- { rule, site, reason },
- ]),
+ [
+ "agent/artifacts/store.rs",
+ "json-write",
+ "tokio::fs::write(&tmp_path, json).await.map_err(|e| {",
+ FALLBACK,
+ ],
+ [
+ "agent/artifacts/store.rs",
+ "json-write",
+ "tokio::fs::write(&args_path, json)",
+ FALLBACK,
+ ],
+ [
+ "agent/artifacts/files.rs",
+ "json-write",
+ "match tokio::fs::OpenOptions::new()",
+ "reserves the artifact's content file in the user-visible files folder; the bytes stay a file on every backend (the port has no blob store), only the records moved",
+ ],
+ ].reduce((map, [path, rule, site, reason]) => {
+ const key = `${SRC}${path}`;
+ map.set(key, [...(map.get(key) ?? []), { rule, site, reason }]);
+ return map;
+ }, new Map()),
);
/** Whether `finding` is the allowlisted site of its file (its first occurrence). */
export function allowed(rel, finding) {
- const entry = ALLOW.get(rel);
- return (
- entry?.rule === finding.rule && entry.site === finding.text && finding.occurrence === 1
+ return (ALLOW.get(rel) ?? []).some(
+ (entry) =>
+ entry.rule === finding.rule &&
+ entry.site === finding.text &&
+ finding.occurrence === 1,
);
}
diff --git a/scripts/ci/storage-bypass-baseline.json b/scripts/ci/storage-bypass-baseline.json
index b31c8dba3f..1a9d98b685 100644
--- a/scripts/ci/storage-bypass-baseline.json
+++ b/scripts/ci/storage-bypass-baseline.json
@@ -1,25 +1,4 @@
[
- {
- "rule": "json-write",
- "path": "crates/openhuman-core/src/agent/artifacts/files.rs",
- "line": 141,
- "text": "match tokio::fs::OpenOptions::new()",
- "occurrence": 1
- },
- {
- "rule": "json-write",
- "path": "crates/openhuman-core/src/agent/artifacts/store.rs",
- "line": 167,
- "text": "tokio::fs::write(&tmp_path, json).await.map_err(|e| {",
- "occurrence": 1
- },
- {
- "rule": "json-write",
- "path": "crates/openhuman-core/src/agent/artifacts/store.rs",
- "line": 364,
- "text": "tokio::fs::write(&args_path, json)",
- "occurrence": 1
- },
{
"rule": "json-write",
"path": "crates/openhuman-core/src/agent/attachments/legacy.rs",