Skip to content

Fix apply: warnings must not mark a clean apply as failed#1565

Open
lileding wants to merge 1 commit into
DragonFlyBSD:masterfrom
lileding:fix/apply-warning-not-failure
Open

Fix apply: warnings must not mark a clean apply as failed#1565
lileding wants to merge 1 commit into
DragonFlyBSD:masterfrom
lileding:fix/apply-warning-not-failure

Conversation

@lileding

@lileding lileding commented Jul 3, 2026

Copy link
Copy Markdown

Problem

compose reports E_COMPOSE_APPLY_FAILED: <origin>: 0 op(s) failed [no per-op detail] for every dops-mode port, even though all ops apply cleanly (applied_ops == total_ops, errors == 0) and the generated output is correct.

Root cause

apply_plan (scripts/generator/dportsv3/engine/apply.py) computed:

ok = not diagnostics and all(row.status != "failed" for row in op_results)

not diagnostics requires the diagnostics list to be completely empty, but warning-severity diagnostics live in that same list. On a host without bmake, the default local oracle profile emits a single warning W_APPLY_ORACLE_SKIPPED ("bmake not found in PATH"). That lone warning flips ok to False, so compose reports the apply as failed — with zero failed ops and zero errors, hence the self-contradictory "0 op(s) failed" message.

This is not specific to any one port: it affects every dops-mode port on any host where the oracle emits a warning (e.g. bmake absent). It went unnoticed because the apply test-suite runs with oracle_profile="off", which never populates diagnostics.

Fix

Only error-severity diagnostics (or a genuinely failed op) mark the apply as failed:

has_error = any(d.severity == "error" for d in diagnostics)
ok = not has_error and all(row.status != "failed" for row in op_results)

Warnings are still recorded and surfaced; they just no longer masquerade as failures. Real oracle failures (E_APPLY_ORACLE_FAILED) and CI-profile unavailability (E_APPLY_ORACLE_UNAVAILABLE) remain error-severity and still yield ok=False.

Test

Adds test_apply_plan_local_unavailable_oracle_warning_keeps_ok: a clean apply whose only diagnostic is a warning-severity oracle skip must keep ok=True, with the warning still present. Verified red-before / green-after.

🤖 Generated with Claude Code

apply_plan computed `ok = not diagnostics and ...`, which treats ANY
diagnostic -- including warning-severity ones -- as failure. On hosts
without bmake the local oracle profile emits a single
W_APPLY_ORACLE_SKIPPED warning, so every dops-mode port's apply was
reported as failed (ok=False) even though all ops applied cleanly with
zero errors. compose then surfaced this as
`E_COMPOSE_APPLY_FAILED: 0 op(s) failed [no per-op detail]`.

Only error-severity diagnostics (or a failed op) should mark apply as
failed. Real oracle failures (E_APPLY_ORACLE_FAILED) and CI
unavailability keep yielding ok=False.

Add a regression test for the warning-only oracle-skip case.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant