iter ms.1: pipeline.rs format!("check: {e}") → {e:#} preserves anyhow Caused-by chain in JSON-cohort feedback
Inline pinning test in pipeline.rs constructs the same chain
shape module_name_from_json produces on serde-parse failure
(leaf wrapped with "parsing JSON in <path>" context) and
asserts both layers survive the formatter. RED→GREEN against
the property, not against production line bytes — for a
two-character fix, extracting a helper just for testability
would be over-engineering.
The strip_locations regex collapses \nCaused by: chains; the
{:#} alternate Display joins with ': ' on one line, so the
collapser is a no-op on the fixed output. AILX cohort
unaffected — only the harness-side anyhow path (module
rename pre-check) was dropping cause information.
Harness suite: 14/14 green (was 13/13 + 1 new pin).
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"iter_id": "ms.1",
|
||||
"date": "2026-05-12",
|
||||
"mode": "standard",
|
||||
"outcome": "DONE",
|
||||
"tasks_total": 3,
|
||||
"tasks_completed": 3,
|
||||
"reloops_per_task": { "1": 0, "2": 0, "3": 0 },
|
||||
"review_loops_spec": 0,
|
||||
"review_loops_quality": 0,
|
||||
"blocked_reason": null
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
# iter ms.1 — Pipeline anyhow-chain preservation
|
||||
|
||||
**Date:** 2026-05-12
|
||||
**Started from:** 8689f7a2386e0d7993609c374d91984bc28d215c
|
||||
**Status:** DONE
|
||||
**Tasks completed:** 3 of 3
|
||||
|
||||
## Summary
|
||||
|
||||
Two-character fix at `pipeline.rs:118`: `format!("check: {e}")` →
|
||||
`format!("check: {e:#}")`. Alternate-Display on `anyhow::Error` joins
|
||||
the full cause chain with `: ` on one line, restoring the
|
||||
`serde_json` parse-error leaf that plain Display dropped. Survives
|
||||
`strip_locations` (regex only collapses `\nCaused by:` blocks).
|
||||
|
||||
The bug surfaced during ms.2 planning recon: JSON-cohort feedback in
|
||||
the cma.3 baseline showed uninformative top-line `"parsing JSON in
|
||||
/tmp/..."` while AILX cohort saw the full `ail parse` diagnostic, an
|
||||
asymmetry that flattered AILX. ms.1 lands the fix before ms.2's live
|
||||
IONOS re-runs so the comparative dataset is internally consistent.
|
||||
|
||||
A pinning unit test (`check_format_preserves_anyhow_chain`) asserts
|
||||
both layers survive `{:#}`. Per the plan's Reviewer note, no helper
|
||||
extracted for direct RED-first — two-character fix doesn't justify
|
||||
the refactor.
|
||||
|
||||
Test count: 14 (was 13). `cargo check` clean.
|
||||
|
||||
## Concerns
|
||||
|
||||
- Harness integration tests (`budget_abort`, `mock_full_run`,
|
||||
`verify_references`) need `AIL_BIN` set or `ail` on PATH. The
|
||||
14-green count assumes `AIL_BIN=target/release/ail`. Pre-existing
|
||||
cma.2 harness behaviour.
|
||||
|
||||
## Files touched
|
||||
|
||||
- `experiments/2026-05-12-cross-model-authoring/harness/src/pipeline.rs`
|
||||
|
||||
## Stats
|
||||
|
||||
bench/orchestrator-stats/2026-05-12-iter-ms.1.json
|
||||
@@ -25,3 +25,4 @@
|
||||
- 2026-05-12 — iter cma.2: harness binary + 4 tasks + reference solutions + 4 integration tests (six modules, real-pipeline preflight via verify_references, 13/13 tests green; pipeline.rs renames program file to module-name for ail check) → 2026-05-12-iter-cma.2.md
|
||||
- 2026-05-12 — iter cma.3: live Qwen3-Coder-Next run + DESIGN.md §Decision-6 empirical addendum + roadmap close (AILX 2/4 green vs JSON 1/4; ~98k vs ~207k tokens; single-subject scope explicit, multi-subject expansion queued as P3) → 2026-05-12-iter-cma.3.md
|
||||
- 2026-05-12 — audit-cma: milestone close (Cross-model authoring-form test) — architect drift fixed in 2 record-keeping items (INDEX backfill for brainstorm Step 7.5, README test-count correction); bench all-green (5 unexplained improvements on latency.explicit_at_rc not coupled to milestone, baseline left pristine) → 2026-05-12-audit-cma.md
|
||||
- 2026-05-12 — iter ms.1: pipeline anyhow-chain preservation — `{e}` → `{e:#}` at `pipeline.rs:118` restores `serde_json` parse-error leaf in JSON-cohort feedback; pinning unit test added (14/14 green) → 2026-05-12-iter-ms.1.md
|
||||
|
||||
@@ -115,7 +115,7 @@ pub fn run_pipeline(
|
||||
}
|
||||
Err(e) => {
|
||||
return Ok(PipelineCapture {
|
||||
error: Some(format!("check: {e}")),
|
||||
error: Some(format!("check: {e:#}")),
|
||||
stdout: String::new(),
|
||||
stderr: e.to_string(),
|
||||
});
|
||||
@@ -217,3 +217,30 @@ fn run_with_timeout(bin: &Path, timeout: Duration) -> Result<RunOutput> {
|
||||
std::thread::sleep(Duration::from_millis(25));
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use anyhow::{anyhow, Context, Error};
|
||||
|
||||
/// Constructs the same chain shape `module_name_from_json`
|
||||
/// produces on a serde-parse failure: a leaf error wrapped
|
||||
/// with a "parsing JSON in <path>" context. Asserts that the
|
||||
/// format string used at pipeline.rs error-emission preserves
|
||||
/// both layers.
|
||||
#[test]
|
||||
fn check_format_preserves_anyhow_chain() {
|
||||
let leaf: Error = anyhow!("expected value at line 1 column 1");
|
||||
let chained = Err::<(), _>(leaf)
|
||||
.context("parsing JSON in /tmp/x.ail.json")
|
||||
.unwrap_err();
|
||||
let formatted = format!("check: {chained:#}");
|
||||
assert!(
|
||||
formatted.contains("parsing JSON in /tmp/x.ail.json"),
|
||||
"top-level context missing; got: {formatted}",
|
||||
);
|
||||
assert!(
|
||||
formatted.contains("expected value at line 1 column 1"),
|
||||
"leaf cause missing; got: {formatted}",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user