Skip to content

Commit ecd8f4a

Browse files
committed
fix: preserve selected catalog report semantics
1 parent 72dd916 commit ecd8f4a

1 file changed

Lines changed: 22 additions & 9 deletions

File tree

src/run.rs

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,20 @@ pub struct UpReport {
553553
}
554554

555555
impl UpReport {
556+
fn absorb(&mut self, mut other: UpReport) {
557+
self.skipped |= other.skipped;
558+
self.launched.append(&mut other.launched);
559+
self.torn_down.append(&mut other.torn_down);
560+
self.gc.append(&mut other.gc);
561+
self.deferred.append(&mut other.deferred);
562+
self.flapping.append(&mut other.flapping);
563+
self.crash_loops.append(&mut other.crash_loops);
564+
self.adopted.append(&mut other.adopted);
565+
self.other_host.append(&mut other.other_host);
566+
self.unrunnable.append(&mut other.unrunnable);
567+
self.warnings.append(&mut other.warnings);
568+
self.errors.append(&mut other.errors);
569+
}
556570
/// True when the pass actually changed something (or hit an error) — used to keep the loop's log
557571
/// quiet on no-op ticks.
558572
pub fn is_noteworthy(&self) -> bool {
@@ -983,7 +997,6 @@ pub fn up_once_selected(
983997
) -> anyhow::Result<UpReport> {
984998
let found = crate::discovery::discover(catalog_root);
985999
let (owner, _, _) = crate::reconcile::resolve_task(&found.specs, selector, this_host)?;
986-
let all_specs = found.specs.clone();
9871000
let mut report = UpReport::default();
9881001
report.warnings.extend(found.warnings);
9891002
report.errors.extend(found.errors.into_iter().map(|e| e.message));
@@ -997,20 +1010,20 @@ pub fn up_once_selected(
9971010
let materialized =
9981011
crate::materialize::materialize_catalog(catalog_root, std::slice::from_ref(&owner), this_host);
9991012
report.warnings.extend(materialized.warnings);
1013+
let owner_materialization_failed = !materialized.failed_agents.is_empty();
10001014
report.errors.extend(materialized.errors);
1001-
if !report.errors.is_empty() {
1015+
if owner_materialization_failed {
10021016
return Ok(report);
10031017
}
10041018
let mut execution = up_once_selected_specs_with_gates(
1005-
catalog_root, &all_specs, selector, this_host, runner,
1019+
catalog_root,
1020+
&found.specs,
1021+
selector,
1022+
this_host,
1023+
runner,
10061024
|| Ok(()), crate::pretrust::pretrust_codex,
10071025
)?;
1008-
report.warnings.append(&mut execution.warnings);
1009-
report.errors.append(&mut execution.errors);
1010-
report.launched.append(&mut execution.launched);
1011-
report.torn_down.append(&mut execution.torn_down);
1012-
report.gc.append(&mut execution.gc);
1013-
report.adopted.append(&mut execution.adopted);
1026+
report.absorb(execution);
10141027
Ok(report)
10151028
}
10161029

0 commit comments

Comments
 (0)