Skip to content

Commit 3c6867c

Browse files
committed
Format validation changes
1 parent e4fd38f commit 3c6867c

2 files changed

Lines changed: 35 additions & 18 deletions

File tree

src/core/validate.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3430,9 +3430,10 @@ fn validate_git_workspace_context(
34303430
];
34313431

34323432
let in_container = signals_container.iter().any(|(signal, _)| *signal);
3433-
let container_runtime_disabled = fs::read_to_string(repo_root.join(".decapod").join("OVERRIDE.md"))
3434-
.map(|content| content.contains(crate::plugins::container::CONTAINER_DISABLE_MARKER))
3435-
.unwrap_or(false);
3433+
let container_runtime_disabled =
3434+
fs::read_to_string(repo_root.join(".decapod").join("OVERRIDE.md"))
3435+
.map(|content| content.contains(crate::plugins::container::CONTAINER_DISABLE_MARKER))
3436+
.unwrap_or(false);
34363437

34373438
if in_container {
34383439
let reasons: Vec<&str> = signals_container

src/lib.rs

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2945,11 +2945,14 @@ fn should_scaffold_validation_surfaces(project_root: &Path) -> bool {
29452945
required.iter().any(|rel| !project_root.join(rel).exists())
29462946
}
29472947

2948-
fn heal_agents_contract(project_root: &Path) -> Result<Option<ValidationHealAction>, error::DecapodError> {
2948+
fn heal_agents_contract(
2949+
project_root: &Path,
2950+
) -> Result<Option<ValidationHealAction>, error::DecapodError> {
29492951
let path = project_root.join("AGENTS.md");
29502952
if !path.exists() {
2951-
let content = core::assets::get_template("AGENTS.md")
2952-
.ok_or_else(|| error::DecapodError::ValidationError("Missing AGENTS.md template".to_string()))?;
2953+
let content = core::assets::get_template("AGENTS.md").ok_or_else(|| {
2954+
error::DecapodError::ValidationError("Missing AGENTS.md template".to_string())
2955+
})?;
29532956
atomic_write_file(&path, &content)?;
29542957
return Ok(Some(ValidationHealAction {
29552958
action: "heal_agents_contract".to_string(),
@@ -2984,11 +2987,16 @@ fn heal_agents_contract(project_root: &Path) -> Result<Option<ValidationHealActi
29842987
Ok(Some(ValidationHealAction {
29852988
action: "heal_agents_contract".to_string(),
29862989
outcome: "updated".to_string(),
2987-
detail: format!("Added {} missing validator anchor(s) to AGENTS.md.", anchors.len()),
2990+
detail: format!(
2991+
"Added {} missing validator anchor(s) to AGENTS.md.",
2992+
anchors.len()
2993+
),
29882994
}))
29892995
}
29902996

2991-
fn heal_validation_scaffold(project_root: &Path) -> Result<Option<ValidationHealAction>, error::DecapodError> {
2997+
fn heal_validation_scaffold(
2998+
project_root: &Path,
2999+
) -> Result<Option<ValidationHealAction>, error::DecapodError> {
29923000
if !should_scaffold_validation_surfaces(project_root) {
29933001
return Ok(None);
29943002
}
@@ -3024,7 +3032,9 @@ fn heal_validation_scaffold(project_root: &Path) -> Result<Option<ValidationHeal
30243032
}))
30253033
}
30263034

3027-
fn heal_override_checksum(project_root: &Path) -> Result<Option<ValidationHealAction>, error::DecapodError> {
3035+
fn heal_override_checksum(
3036+
project_root: &Path,
3037+
) -> Result<Option<ValidationHealAction>, error::DecapodError> {
30283038
match docs_cli::sync_override_checksum(project_root, false)? {
30293039
docs_cli::OverrideChecksumStatus::MissingOverride
30303040
| docs_cli::OverrideChecksumStatus::Unchanged => Ok(None),
@@ -3068,7 +3078,9 @@ fn heal_container_runtime_override(
30683078
content.push_str("remediation: Install Docker or Podman, then remove this override if you want strict container gating restored.\n");
30693079
content.push_str("warning: disabling isolated containers increases risk of concurrent agents stepping on each other.\n");
30703080
let parent = override_path.parent().ok_or_else(|| {
3071-
error::DecapodError::ValidationError("OVERRIDE.md path missing parent directory".to_string())
3081+
error::DecapodError::ValidationError(
3082+
"OVERRIDE.md path missing parent directory".to_string(),
3083+
)
30723084
})?;
30733085
fs::create_dir_all(parent).map_err(error::DecapodError::IoError)?;
30743086
atomic_write_file(&override_path, &content)?;
@@ -3087,12 +3099,10 @@ fn attempt_validation_failure_heal(
30873099
) -> Result<Vec<ValidationHealAction>, error::DecapodError> {
30883100
let mut actions = Vec::new();
30893101

3090-
if report
3091-
.failures
3092-
.iter()
3093-
.any(|msg| msg.contains("Repo store missing todo.db")
3094-
|| msg.contains("Repo todo.db does NOT match rebuild from todo.events.jsonl"))
3095-
{
3102+
if report.failures.iter().any(|msg| {
3103+
msg.contains("Repo store missing todo.db")
3104+
|| msg.contains("Repo todo.db does NOT match rebuild from todo.events.jsonl")
3105+
}) {
30963106
let rebuild = todo::rebuild_from_events(&store.root)?;
30973107
actions.push(ValidationHealAction {
30983108
action: "todo.rebuild".to_string(),
@@ -3139,7 +3149,11 @@ fn render_validation_text(
31393149

31403150
validate::render_validation_report(report, verbose);
31413151
if !actions.is_empty() {
3142-
println!(" {} {}", "repair".bright_blue().bold(), format!("{} action(s)", actions.len()).bright_white());
3152+
println!(
3153+
" {} {}",
3154+
"repair".bright_blue().bold(),
3155+
format!("{} action(s)", actions.len()).bright_white()
3156+
);
31433157
for action in actions {
31443158
println!(
31453159
" {} {} {}",
@@ -3241,7 +3255,9 @@ fn run_validate_command(
32413255
"self_heal": heal_actions,
32423256
"report": report,
32433257
}))
3244-
.map_err(|e| error::DecapodError::ValidationError(format!("validate JSON encode failed: {e}")))?,
3258+
.map_err(|e| error::DecapodError::ValidationError(format!(
3259+
"validate JSON encode failed: {e}"
3260+
)))?,
32453261
);
32463262
} else {
32473263
render_validation_text(&report, &heal_actions, validate_cli.verbose);

0 commit comments

Comments
 (0)