Fully Automated - 100% Backpressure - Pipeline runner ๐Ÿƒ for AI workflows. ๐Ÿš€

Commit 71c31e71

71c31e71ec7fMerged

Scott Nixon <[email protected]> ยท 5 months ago ยท 6 files ยท ~6 modified

Description

refactor: address code review findings for attractor-5b8

Architecture:

  • Fix [toolchains] schema mismatch: init.rs now generates [toolchain] (singular) aligned with Manifest struct; polyglot extras listed as comments
  • Remove enrich from public API (pub(crate) + dead_code allow); stub is incomplete and will be wired in a future task
  • Remove is_interactive() free function; use !opts.is_non_interactive() consistently at call site

Security:

  • Add tracing::warn! for PAS_TRUST_THIS and PAS_AGENT trust bypasses with path and hash in structured fields
  • Log corrupted trust store errors instead of silently returning false
  • Show full blake3 hash (not 16-char truncation) at trust prompt

Performance / simplicity:

  • Cap stderr at 1 MB before UTF-8 conversion in quality_handler
  • Replace VecDeque ring buffer in truncate_head_tail with direct slice indexing (lines[total-tail..])
  • Eliminate double-clone in resolution.rs: use read_to_string + hash content bytes directly
  • Log resolve() errors at debug level before falling back to quality_checks

Details

Commit
71c31e71ec7f
Parent
1a9e54693786

crates/attractor-cli/src/commands/init.rsmodifiedView file

@@ -64,12 +64,6 @@
6464 }
6565 }
6666
67-/// Returns `true` when we should show TUI prompts.
68-fn is_interactive() -> bool {
69- std::io::stdin().is_terminal()
70- && std::env::var("PAS_NON_INTERACTIVE").as_deref() != Ok("1")
71- && std::env::var("PAS_AGENT").as_deref() != Ok("1")
72-}
7367
7468 // ---------------------------------------------------------------------------
7569 // Toolchain detection
@@ -113,14 +107,21 @@
113107 .and_then(|n| n.to_str())
114108 .unwrap_or("my-project");
115109
116- let toolchain_list = if toolchains.is_empty() {
117- "# (no toolchains detected)".to_string()
110+ // Emit the primary detected toolchain as [toolchain], matching the Manifest schema.
111+ // Additional toolchains are listed as comments for human reference.
112+ let toolchain_section = if let Some((primary_lang, _)) = toolchains.first() {
113+ let extras: Vec<_> = toolchains[1..]
114+ .iter()
115+ .map(|(name, marker)| format!("# also detected: {name} ({marker})"))
116+ .collect();
117+ let comment_block = if extras.is_empty() {
118+ String::new()
119+ } else {
120+ format!("\n{}", extras.join("\n"))
121+ };
122+ format!("[toolchain]\nlanguage = \"{primary_lang}\"{comment_block}\n")
118123 } else {
119- toolchains
120- .iter()
121- .map(|(name, _)| format!(" \"{name}\""))
122- .collect::<Vec<_>>()
123- .join(",\n")
124+ "# no toolchains detected โ€” add [toolchain] manually if needed\n".to_string()
124125 };
125126
126127 format!(
@@ -130,15 +131,12 @@
130131 [project]
131132 name = "{project_name}"
132133 version = "0.1.0"
133-
134-[toolchains]
135-detected = [
136-{toolchain_list}
137-]
138134
139-[pipeline]
140-default_max_steps = 200
141-default_max_budget = 10.0
135+{toolchain_section}
136+[quality]
137+stages = []
138+# Add your quality check commands here, e.g.:
139+# stages = ["cargo test", "cargo clippy"]
142140 "#
143141 )
144142 }
@@ -199,7 +197,7 @@
199197 let mut manifest_content = build_manifest(root, &toolchains);
200198
201199 // โ”€โ”€ interactive preview / edit โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
202- if is_interactive() && !opts.dry_run {
200+ if !opts.is_non_interactive() && !opts.dry_run {
203201 // Print detected toolchains summary
204202 if toolchains.is_empty() {
205203 println!("Detected: (none)");