Skip to content

Commit ae495d4

Browse files
Enforce the contract crate's dependency rule, and the minimal build
Issue #18 §D4, with §D3 alongside it. `api/Cargo.toml` spells out a `cargo tree` command in a comment and asks that the contract crate never link a storage engine, a native library, an HTTP client, or an async runtime. It was left as a comment, so nothing ran it. A forbidden dependency does not arrive by someone typing it into the manifest; it arrives transitively, through a feature enabled two crates away, which is exactly the way nobody notices. The forward form is the one that works, and the manifest already explains why: `cargo tree -i <crate> -p tinymemory-api` discards the `-p` scope, prints the whole-workspace inverse tree, and exits 0 looking clean even when this crate is the one at fault. This runs what the comment says to run. Verified in both directions. The rule holds today — no match against `rusqlite|libsqlite|git2|reqwest|regex|tokio`. And injecting `regex = "1"` into the manifest makes the guard fire on `regex`, `regex-automata` and `regex-syntax`, then reverting makes it pass again. A guard nobody has watched fail is not yet a guard. §D3 asks that `--no-default-features` still compile and bind `NullMemoryProvider`. It does, so this pins it rather than changing anything: the minimal configuration builds, and #21's `null_provider` integration test runs against it — so "usable" is asserted, not just "compiles". That test is the one that would catch a null driver which panics instead of answering, or reports a fault instead of `Ready`. Refs #18 (§D3, §D4)
1 parent f1a3c13 commit ae495d4

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,38 @@ jobs:
5858
#
5959
# This is also the configuration that keeps the promise the feature
6060
# exists for: no `git2` / `libgit2-sys` in the graph.
61+
# `api/Cargo.toml` spells out this exact command in a comment and asks
62+
# that the contract crate never link a storage engine, a native library,
63+
# an HTTP client, or an async runtime. It was left as a comment, so
64+
# nothing checked it — and a forbidden dependency arrives transitively,
65+
# through a feature someone enabled two crates away, which is precisely
66+
# the way nobody notices.
67+
#
68+
# The FORWARD form is required. `cargo tree -i <crate> -p tinymemory-api`
69+
# discards the `-p` scope, prints the whole-workspace inverse tree, and
70+
# exits 0 looking clean even when this crate is the one at fault. The
71+
# manifest says so; this runs what it says.
72+
- name: Assert the contract crate stays free of heavy dependencies
73+
run: |
74+
forbidden="$(cargo tree -p tinymemory-api -e normal,build --prefix none \
75+
| grep -Ei 'rusqlite|libsqlite|git2|reqwest|regex|tokio' || true)"
76+
if [ -n "$forbidden" ]; then
77+
echo "tinymemory-api pulled in a dependency its manifest forbids:" >&2
78+
echo "$forbidden" >&2
79+
echo >&2
80+
echo "The contract is what hosts compile against. It must stay free of" >&2
81+
echo "storage engines, native libraries, HTTP clients and async runtimes." >&2
82+
exit 1
83+
fi
84+
85+
# The minimal build has to stay genuinely usable, not merely compile:
86+
# a host that wants the ports wired and nothing retained must be able to
87+
# bind the null driver without pulling an engine in behind it.
88+
- name: Build and bind the minimal configuration
89+
run: |
90+
cargo build -p tinymemory --no-default-features
91+
cargo test -p tinymemory --no-default-features --test null_provider
92+
6193
- name: Lint and test the adapter without its optional engine features
6294
run: |
6395
cargo clippy -p tinymemory-tinycortex --all-targets --no-default-features -- -D warnings

0 commit comments

Comments
 (0)