Skip to content

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

chore: files changed crates/openhuman-core/src/modules/schemas_tests.rs,scripts/__tests__/check-stor

Steven Enamakel0dffa473c21d
diff --git a/crates/openhuman-core/src/modules/schemas_tests.rs b/crates/openhuman-core/src/modules/schemas_tests.rs
index 58fe13c640..6a9b634625 100644
--- a/crates/openhuman-core/src/modules/schemas_tests.rs
+++ b/crates/openhuman-core/src/modules/schemas_tests.rs
@@ -79,25 +79,32 @@ async fn forgetting_sites_reports_how_many_went() {
for site in ["shop.test", "books.test"] {
std::fs::write(sites.join(format!("{site}.json")), b"{}").unwrap();
}
- let ctx = CoreContext::for_test_with_config(DomainSet::full(), config);
+ let ctx = CoreContext::for_test_with_config(DomainSet::full(), config.clone());
- let (one, every) = CoreContext::scope(ctx.clone(), async {
+ let (one, every, left) = CoreContext::scope(ctx.clone(), async {
let mut one = Map::new();
one.insert(
"site".to_string(),
Value::String("https://www.shop.test/cart".to_string()),
);
let one = super::handle_browser_forget_sites(DispatchCtx::new(ctx.clone()), one).await;
- (
- one,
- super::handle_browser_forget_sites(DispatchCtx::new(ctx.clone()), Map::new()).await,
- )
+ let every =
+ super::handle_browser_forget_sites(DispatchCtx::new(ctx.clone()), Map::new()).await;
+ // Site memory lives in the storage KV since schema v2; the legacy
+ // files are imported once and left in place, so "gone" is read from
+ // the store, not the directory.
+ let left = crate::modules::site_memory_host::forget(&config, None).await;
+ (one, every, left)
})
.await;
assert_eq!(one.unwrap()["forgotten"], 1);
assert_eq!(every.unwrap()["forgotten"], 1);
- assert!(!sites.join("books.test.json").exists());
+ assert_eq!(left.unwrap(), 0, "nothing may remain after forgetting every site");
+ assert!(
+ sites.join("books.test.json").exists(),
+ "the imported legacy file is left untouched"
+ );
}
#[test]
diff --git a/scripts/__tests__/check-storage-schema.test.mjs b/scripts/__tests__/check-storage-schema.test.mjs
index 54ef8fc177..bdf81a7d85 100644
--- a/scripts/__tests__/check-storage-schema.test.mjs
+++ b/scripts/__tests__/check-storage-schema.test.mjs
@@ -72,3 +72,22 @@ test('the rendering is stable and lists every owner', () => {
assert.ok(text.indexOf('## a') < text.indexOf('## b'));
assert.equal(render(dump), text);
});
+
+test('the dump example builds with web3 by default and with an override that keeps it', async () => {
+ const { dumpFeatures, dumpSchema } = await import('../ci/check-storage-schema.mjs');
+ assert.equal(dumpFeatures({}), 'web3');
+ assert.equal(dumpFeatures({ STORAGE_SCHEMA_FEATURES: 'web3,flows' }), 'web3,flows');
+ assert.throws(() => dumpFeatures({ STORAGE_SCHEMA_FEATURES: 'flows' }), /web3/);
+ const product = dumpFeatures({ STORAGE_SCHEMA_FEATURES: 'core-product' });
+ assert.ok(product.split(',').includes('web3'));
+ let args;
+ const dump = dumpSchema(undefined, {
+ env: { STORAGE_SCHEMA_FEATURES: 'core-product' },
+ run: (_cmd, argv) => {
+ args = argv;
+ return { status: 0, stdout: '{"owners":[]}', stderr: '' };
+ },
+ });
+ assert.deepEqual(dump, { owners: [] });
+ assert.equal(args[args.indexOf('--features') + 1], product);
+});
diff --git a/scripts/__tests__/self-hosted-lanes.test.mjs b/scripts/__tests__/self-hosted-lanes.test.mjs
index 5cd3ef846a..727db116e5 100644
--- a/scripts/__tests__/self-hosted-lanes.test.mjs
+++ b/scripts/__tests__/self-hosted-lanes.test.mjs
@@ -1028,6 +1028,28 @@ test("private coverage pools profiles for every Rust configuration without chang
}
});
+test("private storage-schema dump builds in the plain target with the product features of the plain cli build", () => {
+ const ex63 = buildPlan({ profile: "ex63", areas: ALL, env: EX63_ENV });
+ const check = ex63.lanes
+ .find((l) => l.name === "static")
+ .checks.find((c) => c.name === "storage-schema");
+ assert.equal(check.run, "node scripts/ci/check-storage-schema.mjs");
+ assert.equal(check.env.CARGO_BUILD_TARGET_DIR, "target/ci-private-build");
+ assert.equal(check.env.STORAGE_SCHEMA_FEATURES, "core-product");
+ const build = ex63.lanes.find((l) => l.name === "rust-lint");
+ assert.equal(check.env.CARGO_INCREMENTAL, "0");
+ assert.equal(check.env.CARGO_PROFILE_DEV_DEBUG, build.env.CARGO_PROFILE_DEV_DEBUG);
+ assert.equal(
+ check.env.CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER,
+ build.env.CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER,
+ );
+ const hosted = buildPlan({ profile: "hosted", areas: ALL });
+ assert.equal(
+ hosted.lanes.find((l) => l.name === "static").checks.find((c) => c.name === "storage-schema").env,
+ undefined,
+ );
+});
+
test("offline examples build in the dev profile so no release artifacts need cleaning", () => {
for (const plan of plans()) {
const lint = plan.lanes.find((lane) => lane.name === "rust-lint");
diff --git a/scripts/ci/check-storage-schema.mjs b/scripts/ci/check-storage-schema.mjs
index 47c1e425b3..6bf9767b3d 100644
--- a/scripts/ci/check-storage-schema.mjs
+++ b/scripts/ci/check-storage-schema.mjs
@@ -43,14 +43,21 @@ export const DUMP_FEATURES = 'web3';
/**
* Features for this run. `STORAGE_SCHEMA_FEATURES` lets private CI build the
- * dump with the feature set of an existing plain build (the core product
- * gates), so Cargo reuses that build instead of compiling the core again. The
- * schema is only gated on flows, skills, modules, web3 and tinymemes, all of
- * which are in both sets, so the dump is identical; the wallet owner (web3)
- * must be in any override.
+ * dump with the feature set of an existing plain build so Cargo reuses it
+ * instead of compiling the core again: a comma list, or `core-product` for
+ * `scripts/ci/product-features.sh --core` (what the plain `openhuman-cli`
+ * builds use). The schema is only gated on flows, skills, modules, web3 and
+ * tinymemes, all of which are in the default set plus web3 and in the product
+ * set, so the dump is identical; the wallet owner (web3) must be in any
+ * override.
*/
-export function dumpFeatures(env = process.env) {
- const features = env.STORAGE_SCHEMA_FEATURES?.trim() || DUMP_FEATURES;
+export function dumpFeatures(env = process.env, root = REPO_ROOT) {
+ let features = env.STORAGE_SCHEMA_FEATURES?.trim() || DUMP_FEATURES;
+ if (features === 'core-product') {
+ const run = spawnSync('bash', [resolve(root, 'scripts/ci/product-features.sh'), '--core'], { encoding: 'utf8' });
+ if (run.status !== 0) throw new Error(`product-features.sh --core failed:\n${run.stderr}`);
+ features = run.stdout.trim();
+ }
if (!features.split(',').includes('web3')) {
throw new Error(`STORAGE_SCHEMA_FEATURES must include web3 (the wallet owner): ${features}`);
}
@@ -71,7 +78,7 @@ export function dumpSchema(root = REPO_ROOT, { run: spawn = spawnSync, env = pro
'--example',
'storage_schema_dump',
'--features',
- dumpFeatures(env),
+ dumpFeatures(env, root),
],
{ cwd: root, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 }
);
diff --git a/scripts/ci/self-hosted/lanes-plan.mjs b/scripts/ci/self-hosted/lanes-plan.mjs
index 5b30a159f7..02a2ec6bd8 100644
--- a/scripts/ci/self-hosted/lanes-plan.mjs
+++ b/scripts/ci/self-hosted/lanes-plan.mjs
@@ -169,7 +169,7 @@ export function buildPlan({ profile, areas, env = {}, isPullRequest = true }) {
env: {
...rustEnv,
CARGO_BUILD_TARGET_DIR: targetDir("build"),
- STORAGE_SCHEMA_FEATURES: "web3,flows,skills,modules,tinymemes",
+ STORAGE_SCHEMA_FEATURES: "core-product",
},
}
: {}),