Rewrite your app in Rust, piece by piece, checked against the original at every step. Works with TypeScript, JavaScript, Python, Go, Ruby, Java, C, PHP, C#, Kotlin, PowerShell and Swift.
Rust agent-skillsclaude-codeclicode-migrationcodexffigolangjavajavascriptmcpmigrationnapiperformanceportingpyo3pythonrewriterubyrusttypescript
obligations: say "has" for one uncovered obligation and name no obligations as such (#1394)
Hashem Alkhanaizi60fe934103d3
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 8cec86f9..8a2bf1e6 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -2,6 +2,10 @@## Unreleased+- `obligations --evidence` ends with `1 of 3 obligations has no recorded case` for a single+ one. With no obligations at all, it and `app record` say that none were listed and point to+ `rust-anything obligations` for the families it could not enumerate, instead of `0 of 0`, which+ read like a pass; the extra blank line before that line is gone (#1374).- The `Arguments:` line of `drift-report.md` stays one code span when an argument holds abacktick: it opens and closes with more backticks than any run inside, as CommonMark asks, wherea single backtick used to end the span early (#1323).diff --git a/src/obligations/evidence/mod.rs b/src/obligations/evidence/mod.rsindex 2a158c29..381a1a0b 100644--- a/src/obligations/evidence/mod.rs+++ b/src/obligations/evidence/mod.rs@@ -379,14 +379,28 @@ fn render(out: &mut String, evidence: &Evidence) -> std::fmt::Result {writeln!(out, " ... and {more} more (see --json)")?;}}+ // With no families listed, the header's blank line already separates this one.+ let gap = if out.ends_with("\n\n") { "" } else { "\n" };writeln!(out,- "\n{} of {} obligations have no recorded case",- uncovered.len(),- evidence.entries.len()+ "{gap}{}",+ summary(uncovered.len(), evidence.entries.len()))}+/// The line that says how many obligations have no case. "0 of 0" would read like a pass, while+/// nothing was checked, so no obligations at all is said in words.+fn summary(uncovered: usize, total: usize) -> String {+ if total == 0 {+ return NONE_LISTED.to_string();+ }+ let verb = if uncovered == 1 { "has" } else { "have" };+ format!("{uncovered} of {total} obligations {verb} no recorded case")+}++const NONE_LISTED: &str = "No obligations were listed; run `rust-anything obligations` to see \+ which families could not be enumerated";+/// The block `app record` prints after a recording: how many obligations have no case, the/// first ones, and where to find the candidates. One note line when the registry or the/// bindings cannot be read: the recording is still a success.@@ -400,6 +414,9 @@ pub fn after_record(repo: &Path) -> String {format!("Obligations without a recorded case: not checked ({first})\n")}Ok(ev) => {+ if ev.entries.is_empty() {+ return format!("{NONE_LISTED}\n");+ }let uncovered: Vec<&Entry> = ev.uncovered().collect();let mut out = format!("Obligations without a recorded case: {} of {}\n",@@ -557,6 +574,39 @@ mod tests {assert!(text.contains("env:V0") && !text.contains(&format!("env:V{}", SHOWN_UNRESOLVED)));}+ #[test]+ fn the_last_line_says_has_for_one_and_names_no_obligations_as_such() {+ let evidence_of = |entries: Vec<Entry>| Evidence {+ schema: EVIDENCE_SCHEMA.to_string(),+ sources: EvidenceSources {+ cli_cases: 1,+ http_cases: 0,+ units: Vec::new(),+ refused: Vec::new(),+ },+ families: Family::ALL.iter().map(|&f| totals(f, &entries)).collect(),+ entries,+ };+ let one = evidence_of(vec![entry(+ &obligation("export:a.py#slug", Family::Export),+ Verdict::uncovered("n", None),+ None,+ )]);+ let text = evidence_text(&one);+ assert!(+ text.ends_with("\n\n1 of 1 obligations has no recorded case\n"),+ "{text}"+ );++ let none = evidence_text(&evidence_of(Vec::new()));+ assert_eq!(+ none,+ "Recorded cases for the obligations (1 CLI, 0 HTTP, 0 unit crates)\n\n\+ No obligations were listed; run `rust-anything obligations` to see which \+ families could not be enumerated\n"+ );+ }+#[test]fn a_citation_shows_three_cases_and_counts_the_rest() {let cases: BTreeSet<String> = (1..=5).map(|i| format!("cli:c{i}")).collect();diff --git a/tests/obligations_evidence.rs b/tests/obligations_evidence.rsindex 94ef6b17..b7702750 100644--- a/tests/obligations_evidence.rs+++ b/tests/obligations_evidence.rs@@ -2742,6 +2742,55 @@ fn app_record_ends_with_the_obligations_that_have_no_case() {serde_json::from_str::<Value>(&stdout(&out)).unwrap();}+#[test]+fn app_record_on_a_script_with_no_obligations_says_so_instead_of_0_of_0() {+ if !common::have("python3") {+ return;+ }+ // It reads sys.argv directly, so no command or flag can be listed.+ let root = scratch("record-none");+ put(+ &root,+ "hello.py",+ "import sys\nprint(\"hi \" + sys.argv[1])\n",+ );+ let inputs = root.join("in.jsonl");+ std::fs::write(&inputs, "{\"name\":\"world\",\"args\":[\"world\"]}\n").unwrap();+ let script = root.join("hello.py");+ let out = run(&[+ "app",+ "record",+ root.to_str().unwrap(),+ "--inputs",+ inputs.to_str().unwrap(),+ "--",+ "python3",+ script.to_str().unwrap(),+ ]);+ assert!(+ out.status.success(),+ "{}",+ String::from_utf8_lossy(&out.stderr)+ );+ let text = stdout(&out);+ assert!(!text.contains("0 of 0"), "{text}");+ assert!(+ text.contains(+ "No obligations were listed; run `rust-anything obligations` to see which \+ families could not be enumerated\n"+ ),+ "{text}"+ );++ let out = run(&["obligations", "--evidence", root.to_str().unwrap()]);+ let text = stdout(&out);+ assert!(!text.contains("0 of 0"), "{text}");+ assert!(+ text.ends_with(")\n\nNo obligations were listed; run `rust-anything obligations` to see which families could not be enumerated\n"),+ "{text}"+ );+}+// The recorded exit code, the absent subcommands and the scope of same-named options./// A CLI case written as is, for the headers that `cli_case` cannot write.