Problem
A single preflight_workspace_verify event in events.jsonl carries a full output string with the cargo workspace dry-run output, including raw ANSI escape codes like \u{1b}[1m\u{1b}[92m. This dominates the event log: one event ≈ 2KB; the other 26 events combined ≈ small. Persisting ANSI codes to a "structured" data file is wrong for downstream tooling, and the artifact bloats unnecessarily—most consumers don't need the full output, they need a summary.
Current behavior
- Event definition (
crates/shipper-types/src/lib.rs:1338, variant):
PreflightWorkspaceVerify {
passed: bool,
output: String, // <-- full cargo dry-run stderr with ANSI codes
}
- Event emission (
crates/shipper/src/engine/mod.rs:156-163):
event_log.record(PublishEvent {
timestamp: Utc::now(),
event_type: EventType::PreflightWorkspaceVerify {
passed: workspace_dry_run_passed,
output: workspace_dry_run_output.clone(), // full output with ANSI
},
package: "all".to_string(),
});
- Cargo dry-run source (
crates/shipper/src/engine/mod.rs:123-141):
Output includes raw ANSI escape codes from cargo stderr, picked up in the format string and persisted as-is.
Proposed change
- Keep in event:
passed: bool, optional brief summary (e.g., exit code, first error line)
- Move to sidecar: full output to
.shipper/preflight_workspace_verify_output.txt
- Apply ANSI stripping using existing
shipper-output-sanitizer crate (already handles token redaction + ANSI should be easy addition) before writing sidecar OR before persisting in event
Implementation sketch
- Add ANSI stripping function to
crates/shipper-output-sanitizer/src/lib.rs (e.g., strip_ansi(s: &str) -> String). Use existing crate like regex or simple pattern.
- Update
EventType::PreflightWorkspaceVerify variant to hold only metadata:
passed: bool
exit_code: i32 (from dry-run result)
elapsed_ms: u64
- Optional
summary: Option<String> (first error line or empty on success)
- In
engine/mod.rs:156-163, write full output to sidecar path .shipper/preflight_workspace_verify_output.txt and strip ANSI/tokens before writing.
- No
Reporter trait changes needed; Reporter uses preflight summary, not full output.
Compatibility
Events.jsonl readers may rely on the output field. Options:
- Option A: Keep
output as a brief summary (safe, backward-compatible)
- Option B: Remove
output entirely and update CHANGELOG with migration guide (cleaner but requires consumer updates)
- Recommend Option A for now; can migrate to Option B in v0.4.0.
Acceptance criteria
Problem
A single
preflight_workspace_verifyevent inevents.jsonlcarries a fulloutputstring with the cargo workspace dry-run output, including raw ANSI escape codes like\u{1b}[1m\u{1b}[92m. This dominates the event log: one event ≈ 2KB; the other 26 events combined ≈ small. Persisting ANSI codes to a "structured" data file is wrong for downstream tooling, and the artifact bloats unnecessarily—most consumers don't need the full output, they need a summary.Current behavior
crates/shipper-types/src/lib.rs:1338, variant):crates/shipper/src/engine/mod.rs:156-163):crates/shipper/src/engine/mod.rs:123-141):Output includes raw ANSI escape codes from cargo stderr, picked up in the format string and persisted as-is.
Proposed change
passed: bool, optional brief summary (e.g., exit code, first error line).shipper/preflight_workspace_verify_output.txtshipper-output-sanitizercrate (already handles token redaction + ANSI should be easy addition) before writing sidecar OR before persisting in eventImplementation sketch
crates/shipper-output-sanitizer/src/lib.rs(e.g.,strip_ansi(s: &str) -> String). Use existing crate likeregexor simple pattern.EventType::PreflightWorkspaceVerifyvariant to hold only metadata:passed: boolexit_code: i32(from dry-run result)elapsed_ms: u64summary: Option<String>(first error line or empty on success)engine/mod.rs:156-163, write full output to sidecar path.shipper/preflight_workspace_verify_output.txtand strip ANSI/tokens before writing.Reportertrait changes needed; Reporter uses preflight summary, not full output.Compatibility
Events.jsonl readers may rely on the
outputfield. Options:outputas a brief summary (safe, backward-compatible)outputentirely and update CHANGELOG with migration guide (cleaner but requires consumer updates)Acceptance criteria
preflight_workspace_verifyevent is <100 bytes in most cases.shipper/preflight_workspace_verify_output.txtevents.jsonlfile size for typical run reduced by >90%