commit d293ea7fb79da801ab579582f21cbab59d64dd15
parent acd3477ba8314e3cd88b47d977e362aa8c115292
Author: triesap <tyson@radroots.org>
Date: Mon, 3 Aug 2026 09:03:51 +0000
sync: prove no hidden scheduler or runtime behavior
- scan every sync module for executor and task-spawn authority
- forbid timer, ambient-clock, signal, and process-exit ownership
- assert the normal dependency graph excludes runtime packages
- retain deterministic manual-poll and cancellation coverage
Diffstat:
1 file changed, 60 insertions(+), 0 deletions(-)
diff --git a/crates/sync/tests/package_boundary.rs b/crates/sync/tests/package_boundary.rs
@@ -2,6 +2,16 @@ use std::collections::BTreeSet;
const MANIFEST: &str = include_str!("../Cargo.toml");
const ROOT: &str = include_str!("../src/lib.rs");
+const README: &str = include_str!("../README.md");
+const SOURCES: &[(&str, &str)] = &[
+ ("engine.rs", include_str!("../src/engine.rs")),
+ ("ingest.rs", include_str!("../src/ingest.rs")),
+ ("policy.rs", include_str!("../src/policy.rs")),
+ ("projection.rs", include_str!("../src/projection.rs")),
+ ("pull.rs", include_str!("../src/pull.rs")),
+ ("push.rs", include_str!("../src/push.rs")),
+ ("status.rs", include_str!("../src/status.rs")),
+];
#[test]
fn sync_depends_only_on_final_orchestration_boundaries() {
@@ -49,6 +59,56 @@ fn sync_depends_only_on_final_orchestration_boundaries() {
);
}
+#[test]
+fn sync_has_no_runtime_scheduler_or_process_lifecycle_authority() {
+ for forbidden_dependency in [
+ "tokio",
+ "async-std",
+ "smol",
+ "rayon",
+ "signal-hook",
+ "ctrlc",
+ ] {
+ assert!(
+ !dependency_keys(MANIFEST).contains(forbidden_dependency),
+ "sync must not depend on runtime package `{forbidden_dependency}`"
+ );
+ }
+ for (path, source) in SOURCES {
+ for forbidden in [
+ "tokio::",
+ "async_std::",
+ "smol::",
+ "std::thread",
+ "thread::spawn",
+ ".spawn(",
+ "Runtime::new",
+ "new_multi_thread",
+ "new_current_thread",
+ "tokio::time",
+ "SystemTime::now",
+ "Instant::now",
+ "ctrl_c",
+ "signal_hook",
+ "process::exit",
+ ] {
+ assert!(
+ !source.contains(forbidden),
+ "{path} must not own runtime behavior `{forbidden}`"
+ );
+ }
+ }
+ let readme = README.split_whitespace().collect::<Vec<_>>().join(" ");
+ for explicit_boundary in [
+ "does not create an executor",
+ "spawn workers",
+ "install timers",
+ "own process lifecycle",
+ ] {
+ assert!(readme.contains(explicit_boundary));
+ }
+}
+
fn declarations<'a>(source: &'a str, prefix: &str) -> BTreeSet<&'a str> {
source
.lines()