open-standards/joule-code/joule-code-rs/crates/joule-code-conformance/src/main.rs
Transaction Science 81ba291c56
All checks were successful
joule-code conformance gate / joule-moq-relay, every target (pull_request) Successful in 2m7s
joule-code conformance gate / joule-moq-ingest, every target (pull_request) Successful in 2m14s
standards workspaces build + test / which workspaces this change touches (pull_request) Successful in 30s
repository checks / lockfiles, tests in CI, workflow hygiene, spec and section references, public text (pull_request) Successful in 1m47s
standards workspaces build + test / joule-code-rs (joule-code/joule-code-rs, joule-code-rs, linux-arm64, true) (pull_request) Successful in 3m43s
joule-code conformance gate / Build + round-trip C1-C4 vectors (pull_request) Successful in 3m25s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 7m0s
joule-code-conformance: the header undersold the harness by a whole suite
Found while hand-checking a candidate my own cross-standard audit had flagged.
The audit was wrong — `verify_cascade` and `verify_gated_cascade` both exist, so
C4 and C5 are implemented — but reading the crate to disprove the flag turned up
three stale claims in its own documentation.

**It says four suites; there are five.** "runs the four suites: C1 content
addressing, C2 signing, C3 receipt, C4 cascade" omits C5 gated cascade, whose
six vectors demonstrably run (`c5-ungranted-l4-denied-even-when-it-would-close`
and friends). A reader of the header would not know C5 is covered at all. This
is the understating direction of the same defect the last few changes here have
been about: documentation narrower than the code.

**It implies something is outstanding when nothing is.** Both the lib header
and `main.rs` explain SKIP as "derived fields pending regeneration", while
`conformance/v1/regeneration.md` says "Status: all fields are real ... all
vectors pass, none skipped. There are no placeholders." The run agrees: 24
passed, 0 failed, 0 skipped. The SKIP mechanism is kept, because a future input
change re-opens that state — but it no longer reads as a backlog. All three
documents now say the same thing.

**And three `cargo doc` warnings were the docs' own fault.** `issuer key =
[1;32], agent key = [2;32], steward key = [7;32]` are Rust array literals for
the fixed test keys, written without backticks, so rustdoc parsed each as an
intra-doc link and could not resolve it. Backticked; `cargo doc --no-deps` for
this crate goes from 3 warnings to 0.

Verified: pack 24 passed / 0 failed / 0 skipped, tests pass, clippy `-D
warnings` clean, `cargo doc` clean.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-10-20 13:51:38 -04:00

42 lines
1.5 KiB
Rust

//! `joule-code-conformance` — round-trip the published wire vectors.
//!
//! Usage: `joule-code-conformance verify <pack-dir>` (e.g. `verify ../conformance/v1`).
//! Exits non-zero if any vector FAILs (CI-ready). A SKIP marks a derived field
//! pending regeneration and does not fail the run; the published pack currently
//! has none (`conformance/v1/regeneration.md`).
use std::path::PathBuf;
use std::process::ExitCode;
fn main() -> ExitCode {
let args: Vec<String> = std::env::args().collect();
match args.get(1).map(String::as_str) {
Some("verify") => {
let dir = PathBuf::from(args.get(2).map(String::as_str).unwrap_or("conformance/v1"));
match joule_code_conformance::verify_pack(&dir) {
Ok(report) => {
for line in &report.lines {
println!("{line}");
}
println!(
"\n{} passed, {} failed, {} skipped (pending regeneration)",
report.pass, report.fail, report.skip
);
if report.fail > 0 {
ExitCode::FAILURE
} else {
ExitCode::SUCCESS
}
}
Err(e) => {
eprintln!("error: {e}");
ExitCode::FAILURE
}
}
}
_ => {
eprintln!("usage: joule-code-conformance verify <pack-dir>");
ExitCode::FAILURE
}
}
}