fix: close release-gate defects in platform cfg, strict launch, and semantics
WHY - macOS/Windows failed to compile because `cfg!` left `linux::probe()` in the type-checked branch (E0433). - GitHub-hosted Linux can pass the strict probe and then fail the real launch with EAGAIN; the CLI test treated the inspect snapshot as a permanent promise. - The security matrix shared process-id-based scratch paths, so parallel `cargo test --workspace` made its own tests clobber each other. - Condition paragraphs silently ignored executable `Strong`/`Emph`, and condition parse spans included the code-span backticks. - The corpus had no native power/control-flow/inert fixtures and no independent generic Tool consumers. WHAT - Dispatch strict detection through `#[cfg]` functions; add a non-Linux compile/fail-closed regression test. - Split `linux::run` into an injectable probe/spawn seam; test probe-OK -> launch-EAGAIN returns LaunchFailed and never executes unrestricted. - Make the Linux CLI contract accept only (a) successful isolated run or (b) non-zero, diagnosed, fail-closed refusal with no project stdout. - Give each security test a unique project/outside path and compile the helper once. - Reject executable roles in a condition paragraph; map condition expressions from the literal bytes inside the backticks. - Add 10 AST, 8 semantic, 4 compile-negative and 2 runtime-negative fixtures for power, branch/loop conditions, source spans, inert prose/code fences and error boundaries. - Add `sample-view`/`sample-knowledge`/`sample-proof` independent Tool v1 packages and an end-to-end Analysis/Trace consumer test. - Add a locked path-dependency content-tamper test. TESTS - cargo fmt --all -- --check - cargo clippy --workspace --all-targets -- -D warnings - cargo test --workspace --locked - G-C VM lane (separate evidence commit/run) CI_URL - none from this host: the checkout has a Gitee remote and no GitHub credentials. Windows/macOS CI remains UNVERIFIED. BREAKING_CHANGE - An executable node in a list-item condition paragraph is now a hard `markdown.invalid_construct` error instead of being silently ignored. SECURITY_SCOPE - strict remains fail-closed; no downgrade, no new capability, L2 still rejected. G-C still requires the dedicated self-hosted lane for CI-signed evidence.
This commit is contained in:
1 parent
c9f01aa8fb
commit
d05f36fd26
65 files changed
+2134
-87
No files matched your search
@@ -349,3 +349,61 @@ fn deleted_lock_edge_fails_check_and_run() {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tampered_path_dependency_content_is_rejected_by_locked_sync() {
|
||||
let dir = TempDir::new("path-tamper");
|
||||
let root = dir.path();
|
||||
write(
|
||||
&root.join("marqdo.yaml"),
|
||||
"project:\n name: root\n version: 0.1.0\ndependencies:\n dep:\n path: ./dep\n",
|
||||
);
|
||||
write(
|
||||
&root.join("dep/marqdo.yaml"),
|
||||
"project:\n name: dep\n version: 0.1.0\n",
|
||||
);
|
||||
write(&root.join("dep/index.mq.md"), "## value\n\n*1*\n");
|
||||
write(
|
||||
&root.join("index.mq.md"),
|
||||
"---\nimport:\n dep: \"@dep\"\n---\n\n## main\n\n*1*\n",
|
||||
);
|
||||
assert_eq!(cli(root, &["lock"]).status.code(), Some(0));
|
||||
let lock_before = std::fs::read(root.join("marqdo.lock")).unwrap();
|
||||
assert_eq!(cli(root, &["sync", "--locked"]).status.code(), Some(0));
|
||||
let env_before = std::fs::read(root.join(".marqdo/env/env.json")).unwrap();
|
||||
|
||||
// Content change after the lock is a tamper/staleness signal. `run` and
|
||||
// `check` must never silently accept it, re-lock, or materialize a new
|
||||
// environment.
|
||||
write(&root.join("dep/index.mq.md"), "## value\n\n*2*\n");
|
||||
for args in [
|
||||
vec!["sync", "--locked"],
|
||||
vec!["run", "index.mq.md"],
|
||||
vec!["check", "index.mq.md"],
|
||||
] {
|
||||
let output = cli(root, &args);
|
||||
assert_eq!(
|
||||
output.status.code(),
|
||||
Some(1),
|
||||
"{args:?}: {}",
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
);
|
||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||
assert!(
|
||||
stderr.contains("out of date")
|
||||
|| stderr.contains("digest")
|
||||
|| stderr.contains("integrity"),
|
||||
"{args:?}: {stderr}"
|
||||
);
|
||||
}
|
||||
assert_eq!(
|
||||
std::fs::read(root.join("marqdo.lock")).unwrap(),
|
||||
lock_before,
|
||||
"a failed locked operation must not rewrite the lock"
|
||||
);
|
||||
assert_eq!(
|
||||
std::fs::read(root.join(".marqdo/env/env.json")).unwrap(),
|
||||
env_before,
|
||||
"a failed locked operation must not replace the materialized environment"
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user