Skip to content

Commit 6a22f2e

Browse files
mikolalysenkoclaude
andcommitted
ci(vex): use vexctl merge for round-trip validation
`vexctl list <arg>` parses <arg> as a selector (status / justification), not a file path. Switch to `vexctl merge --files <path>` which loads, parses, and re-emits the document — the canonical single-file parse gate at vexctl v0.3.x. A successful merge proves the input is valid OpenVEX; we additionally assert the output round-trips through serde as JSON. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent bd7721f commit 6a22f2e

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

crates/socket-patch-cli/tests/e2e_vex.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,12 @@ fn verify_mode_all_failed_exits_non_zero() {
564564
/// vexctl before the test step so the validation actually runs there;
565565
/// local devs without Go see a skip message instead of a failure.
566566
///
567-
/// `vexctl list <file>` loads the document and prints its statements —
568-
/// it exits non-zero when the JSON fails to parse as an OpenVEX doc,
569-
/// which makes it the canonical schema gate at v0.3.x (vexctl does
570-
/// not yet expose a dedicated `validate` subcommand).
567+
/// `vexctl merge --files=<path>` loads, parses, and re-emits the
568+
/// document. vexctl does not yet expose a dedicated `validate`
569+
/// subcommand at v0.3.x, but a successful merge of a single file is
570+
/// the canonical proof that the input parses cleanly against the
571+
/// OpenVEX schema (`list` requires a selector argument, `filter`
572+
/// requires a query expression — merge is the only no-arg parse gate).
571573
fn maybe_validate_with_vexctl(vex_text: &str) {
572574
let Some(vexctl) = find_vexctl_on_path() else {
573575
eprintln!("(skipping vexctl validation — binary not on PATH)");
@@ -577,7 +579,7 @@ fn maybe_validate_with_vexctl(vex_text: &str) {
577579
std::fs::write(tmp.path(), vex_text).unwrap();
578580

579581
let out = Command::new(&vexctl)
580-
.args(["list", tmp.path().to_str().unwrap()])
582+
.args(["merge", "--files", tmp.path().to_str().unwrap()])
581583
.output()
582584
.expect("spawn vexctl");
583585
assert!(
@@ -586,6 +588,9 @@ fn maybe_validate_with_vexctl(vex_text: &str) {
586588
String::from_utf8_lossy(&out.stderr),
587589
String::from_utf8_lossy(&out.stdout)
588590
);
591+
// Sanity: the merge output must itself be valid OpenVEX JSON.
592+
let _: Value = serde_json::from_slice(&out.stdout)
593+
.expect("vexctl merge output must be valid JSON");
589594
}
590595

591596
/// Stdlib-only `PATH` lookup for `vexctl`. Returns `None` if missing.

0 commit comments

Comments
 (0)