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
app record: one case is written, and earlier cases only when there were some (#1284)
jakalijeyadb792a5e835
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 6ff2eff0..6890dd9b 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -2,6 +2,9 @@## Unreleased+- When cases do not answer, `app record` says "The 1 that did is written" for one case, and says+ "the cases recorded before were kept" only when the folder had a recording before this run+ (#1259 by @jakalijey).- `app record --timeout` help and the MCP `app_record` tool say the timeout is saved with the casesand kept by a later record, 30 seconds unless it was changed, instead of "default 30" (#1251 by@jakalijey).diff --git a/src/app.rs b/src/app.rsindex 3b742c6f..f2af064d 100644--- a/src/app.rs+++ b/src/app.rs@@ -3186,27 +3186,40 @@ fn original_runtime(repo: &Path, run: &[String]) -> BTreeMap<String, String> {/// kept either way).const ALLOW_DROPPED_ENV: &str = "RUST_ANYTHING_ALLOW_DROPPED";-/// Why a recording cannot stand: cases that did not answer, or none that did.-pub(crate) fn recording_dropped(outcome: &RecordOutcome) -> Option<String> {+/// Why a recording cannot stand: cases that did not answer, or none that did. `had_recording`:+/// the folder held cases from an earlier record, which stay; on a first recording there are none+/// to mention.+pub(crate) fn recording_dropped(outcome: &RecordOutcome, had_recording: bool) -> Option<String> {if std::env::var_os(ALLOW_DROPPED_ENV).is_some_and(|v| !v.is_empty() && v != "0") {return None;}if outcome.cases == 0 {return Some(format!(- "recorded 0 cases ({} did not answer: {}); the cases recorded before were kept. Fix the app or the inputs and record again",+ "recorded 0 cases ({} did not answer: {}){}. Fix the app or the inputs and record again",outcome.timed_out.len(),- outcome.timed_out.join(", ")+ outcome.timed_out.join(", "),+ if had_recording {+ "; the cases recorded before were kept"+ } else {+ ""+ }));}if outcome.timed_out.is_empty() {return None;}Some(format!(- "{} of {} cases did not answer (timed out or no response) and were not recorded: {}. The {} that did are written, and the cases recorded before were kept. Fix the app or the inputs and record again, or set {ALLOW_DROPPED_ENV}=1 to accept the smaller recording",+ "{} of {} cases did not answer (timed out or no response) and were not recorded: {}. The {} that did {} written{}. Fix the app or the inputs and record again, or set {ALLOW_DROPPED_ENV}=1 to accept the smaller recording",outcome.timed_out.len(),outcome.timed_out.len() + outcome.cases,outcome.timed_out.join(", "),- outcome.cases+ outcome.cases,+ if outcome.cases == 1 { "is" } else { "are" },+ if had_recording {+ ", and the cases recorded before were kept"+ } else {+ ""+ }))}@@ -3226,7 +3239,10 @@ fn update_recorded_cases(outcome: &mut RecordOutcome,) -> Result<Option<String>> {let previous = previous.filter(|old| old.http.is_some() == config.http.is_some());- let dropped = recording_dropped(outcome);+ let dropped = recording_dropped(+ outcome,+ previous.is_some_and(|old| !old.recorded.is_empty()),+ );let stale_from = previous.filter(|_| dropped.is_none());drop_stale(outcome,diff --git a/tests/app_stale.rs b/tests/app_stale.rsindex 45d1e1a5..6085cdd2 100644--- a/tests/app_stale.rs+++ b/tests/app_stale.rs@@ -366,6 +366,31 @@ fn a_recorded_case_whose_input_times_out_now_fails_the_recording_and_stays() {assert_eq!(replayed.total, 2, "{:?}", replayed.failures);}+#[test]+fn a_first_recording_with_a_case_that_times_out_says_what_it_wrote() {+ let Some(python) = common::python() else {+ return;+ };+ let repo = repo("timeout-first");+ std::fs::write(+ repo.join("cli.py"),+ "import sys, time\nif sys.argv[1] == 'slow':\n time.sleep(5)\nprint(sys.argv[1])\n",+ )+ .unwrap();+ std::fs::write(+ repo.join("in.jsonl"),+ "{\"name\":\"fast\",\"args\":[\"fast\"]}\n{\"name\":\"slow\",\"args\":[\"slow\"]}\n",+ )+ .unwrap();+ let run = [python.to_string(), "cli.py".to_string()];+ let err = record_within(&repo, &run, false, Some(1)).unwrap_err();+ std::fs::remove_dir_all(&repo).unwrap();+ let msg = format!("{err}");+ assert!(msg.contains("1 of 2 cases did not answer"), "{msg}");+ assert!(msg.contains("The 1 that did is written."), "{msg}");+ assert!(!msg.contains("recorded before"), "{msg}");+}+fn lifted_test_path(repo: &Path) -> PathBuf {let app = repo.join("rust/app");std::fs::create_dir_all(app.join("tests")).unwrap();