Skip to content

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

feat(ci): enforce vendored tinystoragedrivers ownership

Steven Enamakel018d03465c36
diff --git a/AGENTS.md b/AGENTS.md
index 0045848578..0af8b1bb9b 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -561,6 +561,7 @@ Direct rendered submodules under `vendor/`:
| `tinyjuice` | Agent tool-output compression and recovery of omitted content. |
| `tinymcp` | The TinyMCP module implementation and its bus contract. Put MCP module behavior and contract changes here; OpenHuman owns configuration, lifecycle, and host integration. |
| `tinymemory` | Engine-neutral memory contracts, operations, and providers. Its nested TinyCortex submodule owns the TinyCortex memory engine. |
+| `tinystoragedrivers` | Storage ports, drivers (sqlite/file/mongodb/s3), secrets, storage bus contract; every module's tsd dependency is patched onto this checkout. |
| `tinysearch` | Web-search module, provider dispatch, tool declarations, and execution behind its TinyBus contract. |
| `tinyskills` | Host-independent skill/workflow bundle parsing, discovery, scope resolution, resource inventory, and safe reads. OpenHuman owns trust and execution policy. |
| `tinyvoice` | Host-agnostic voice primitives such as audio framing, VAD, wake-word gating, routing, and STT hallucination detection. |
diff --git a/crates/openhuman-core/src/storage/README.md b/crates/openhuman-core/src/storage/README.md
index f512a2f4c9..231d856ea3 100644
--- a/crates/openhuman-core/src/storage/README.md
+++ b/crates/openhuman-core/src/storage/README.md
@@ -2,7 +2,7 @@
The process's storage backend on the
[tinystoragedrivers](https://github.com/tinyhumansai/tinystoragedrivers)
-ports, taken by git tag (`v0.11.0`) by the host and by every module, so the build holds one copy.
+ports, vendored at `vendor/tinystoragedrivers` (v0.11.0). The host and every module declare it by git tag and the root and app `[patch]` tables redirect them all onto that checkout, so the build holds one copy (`scripts/ci/check-storage-owner.mjs` enforces it).
One URL picks it: `OPENHUMAN_STORAGE_URL`, else `[storage] url` in
`config.toml` (`config::StorageConfig`), else the default,
diff --git a/docs/gitbooks/en/developing/architecture/storage.md b/docs/gitbooks/en/developing/architecture/storage.md
index db5e6f6356..bf85efcc6b 100644
--- a/docs/gitbooks/en/developing/architecture/storage.md
+++ b/docs/gitbooks/en/developing/architecture/storage.md
@@ -7,7 +7,7 @@ icon: database
# Storage
-OpenHuman keeps durable state on the ports of [`tinystoragedrivers`](https://github.com/tinyhumansai/tinystoragedrivers), taken by git tag (`v0.11.0`) by the host and by every module, so the build holds one copy. One URL picks the backend for the whole process. The host adapter is `crates/openhuman-core/src/storage/`. It resolves the URL, opens the backend, holds it in a process slot and decides which scope a call runs in. The ports, the drivers and their conformance suites belong to `tinystoragedrivers`, and the typed records stay with the domain that owns them.
+OpenHuman keeps durable state on the ports of [`tinystoragedrivers`](https://github.com/tinyhumansai/tinystoragedrivers), vendored at `vendor/tinystoragedrivers` (v0.11.0). The host and every module declare it by git tag, and the root and app `[patch."https://github.com/tinyhumansai/tinystoragedrivers"]` tables redirect each of them onto that one checkout, so the build holds one copy. The vendored commit must stay semver-compatible with the tag modules declare; `scripts/ci/check-storage-owner.mjs` fails when any `tinystoragedrivers*` package resolves outside `vendor/tinystoragedrivers/`. One URL picks the backend for the whole process. The host adapter is `crates/openhuman-core/src/storage/`. It resolves the URL, opens the backend, holds it in a process slot and decides which scope a call runs in. The ports, the drivers and their conformance suites belong to `tinystoragedrivers`, and the typed records stay with the domain that owns them.
With no URL configured, which is the desktop default, the host opens `sqlite:<workspace>/storage` and installs it. The URL decides where the whole process keeps its state, and there is no second layout: older installs' per-domain databases, transcripts and turn-state files are imported once, read-only, when the backend is installed. The files that remain outside the ports are listed under "What is not on the ports yet" below.
diff --git a/scripts/__tests__/check-storage-owner.test.mjs b/scripts/__tests__/check-storage-owner.test.mjs
index 624ca8efdb..4f25b00356 100644
--- a/scripts/__tests__/check-storage-owner.test.mjs
+++ b/scripts/__tests__/check-storage-owner.test.mjs
@@ -9,9 +9,14 @@ import { fileURLToPath } from 'node:url';
import { ALLOWLIST, checkMetadata, formatReport } from '../ci/check-storage-owner.mjs';
const CHECKER = resolve(dirname(fileURLToPath(import.meta.url)), '../ci/check-storage-owner.mjs');
-const pkg = (name, deps = [], source = null) => ({
+const pkg = (name, deps = [], source = null, manifest_path) => ({
name,
source,
+ manifest_path:
+ manifest_path ??
+ (name.startsWith('tinystoragedrivers')
+ ? `/repo/vendor/tinystoragedrivers/crates/${name}/Cargo.toml`
+ : `/repo/vendor/${name}/Cargo.toml`),
dependencies: deps.map(d => ({ name: d, kind: null, optional: false })),
});
const registry = 'registry+https://github.com/rust-lang/crates.io-index';
@@ -75,3 +80,32 @@ test('CLI exits 1 on a violation, 0 when clean, 2 on unreadable input', () => {
rmSync(dir, { recursive: true, force: true });
}
});
+
+test('tinystoragedrivers packages under vendor/tinystoragedrivers pass', () => {
+ assert.deepEqual(
+ checkMetadata({ packages: [pkg('tinyflows', ['tinystoragedrivers-core']), pkg('tinystoragedrivers-core')] }),
+ []
+ );
+});
+
+test('a git or registry tinystoragedrivers package fails and names its dependents', () => {
+ const git = 'git+https://github.com/tinyhumansai/tinystoragedrivers?tag=v0.12.0#abc';
+ const v = checkMetadata({
+ packages: [
+ pkg('tinyflows', ['tinystoragedrivers-core']),
+ pkg('tinystoragedrivers-core', [], git, '/home/u/.cargo/git/checkouts/tsd/abc/Cargo.toml'),
+ ],
+ });
+ assert.equal(v.length, 1);
+ assert.equal(v[0].kind, 'tsd-not-vendored');
+ assert.match(formatReport(v), /tinystoragedrivers-core: resolves to git\+.*required by tinyflows.*bump vendor\/tinystoragedrivers/);
+ const reg = checkMetadata({ packages: [pkg('tinystoragedrivers-core', [], registry)] });
+ assert.equal(reg[0].kind, 'tsd-not-vendored');
+});
+
+test('a path tinystoragedrivers package outside the vendored checkout fails', () => {
+ const v = checkMetadata({
+ packages: [pkg('tinystoragedrivers-core', [], null, '/repo/vendor/tinyagents/vendor/tinystoragedrivers/crates/x/Cargo.toml')],
+ });
+ assert.equal(v.length, 1);
+});
diff --git a/scripts/ci/check-storage-owner.mjs b/scripts/ci/check-storage-owner.mjs
index c3ff520795..e8edb8dfbd 100644
--- a/scripts/ci/check-storage-owner.mjs
+++ b/scripts/ci/check-storage-owner.mjs
@@ -9,6 +9,10 @@
// of FORBIDDEN_DEPS (any kind, optional or not), or
// 2. a first-party package outside `tinystoragedrivers*` is named
// `*-sqlite`, `*-mongodb` or `*-file`.
+// 3. a `tinystoragedrivers*` package in the resolved graph is not built from
+// a path under `vendor/tinystoragedrivers/` (a registry or git source
+// means some manifest escaped the root `[patch]` onto the vendored copy,
+// for example a module that bumped its tag past the vendored commit).
// Third-party registry crates are ignored (they are the backends' own deps,
// e.g. `rusqlite -> libsqlite3-sys`).
//
@@ -53,6 +57,35 @@ const isOwner = name => name.startsWith('tinystoragedrivers');
/** First-party = built from a path or a git source, not from a registry. */
const isFirstParty = pkg => !pkg.source || pkg.source.startsWith('git+');
+export const VENDORED_TSD_DIR = 'vendor/tinystoragedrivers/';
+
+/** Rule 3: every tinystoragedrivers* package must be a path under VENDORED_TSD_DIR. */
+export function checkVendoredOwner(metadata) {
+ const out = [];
+ const packages = metadata.packages ?? [];
+ for (const pkg of packages) {
+ if (!isOwner(pkg.name)) continue;
+ const manifest = String(pkg.manifest_path ?? '').replaceAll('\\', '/');
+ if (!pkg.source && manifest.includes(`/${VENDORED_TSD_DIR}`)) continue;
+ const dependents = [
+ ...new Set(
+ packages
+ .filter(p => p.name !== pkg.name && (p.dependencies ?? []).some(d => d.name === pkg.name))
+ .map(p => p.name)
+ ),
+ ].sort();
+ out.push({
+ package: pkg.name,
+ kind: 'tsd-not-vendored',
+ detail:
+ `resolves to ${pkg.source ?? manifest} instead of ${VENDORED_TSD_DIR}` +
+ (dependents.length ? ` (required by ${dependents.join(', ')})` : '') +
+ '; bump vendor/tinystoragedrivers or the module\'s tinystoragedrivers tag so they agree',
+ });
+ }
+ return out;
+}
+
/** Returns `[{ package, kind, detail }]` violations for one metadata document. */
export function checkMetadata(metadata, allowlist = ALLOWLIST) {
const out = [];
@@ -70,7 +103,7 @@ export function checkMetadata(metadata, allowlist = ALLOWLIST) {
}
}
}
- return out;
+ return [...out, ...checkVendoredOwner(metadata)];
}
export function formatReport(violations) {