Skip to content

Surface failed partial package adoption as incomplete - #490

Merged
chubes4 merged 3 commits into
Automattic:mainfrom
lezama:fix/adoption-result-partial-status
Aug 26, 2026
Merged

Surface failed partial package adoption as incomplete#490
chubes4 merged 3 commits into
Automattic:mainfrom
lezama:fix/adoption-result-partial-status

Conversation

@lezama

@lezama lezama commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Package adoption uses the raw partial status for two distinct outcomes:

  • Some artifacts applied while others failed.
  • Some artifacts applied while others were intentionally skipped, such as artifacts awaiting approval.

The canonical run-result envelope previously could not distinguish those cases consistently for status-oriented consumers.

Fix

Canonical status now derives the partial outcome from the artifact results:

  • partial with a non-empty failed_artifacts list maps to incomplete.
  • partial with applied and intentionally skipped artifacts but no failures remains succeeded.
  • Full failure remains failed.
  • Clean success remains succeeded.

The raw package adoption contract is unchanged: get_status() and to_array() continue to expose partial for both partial variants.

Testing

Expanded tests/package-adoption-result-canonical-status-smoke.php with canonical envelope coverage for:

  • Applied plus failed artifacts.
  • Applied plus intentionally skipped artifacts.
  • Full success.
  • Full failure.
  • Raw get_status() and to_array() compatibility for both partial variants.

Validation completed after merging current origin/main:

  • All focused tests/package-*.php smoke tests pass.
  • composer test passes.
  • composer phpstan passes with no errors.
  • git diff --check origin/main...HEAD passes.

lezama and others added 3 commits August 6, 2026 17:36
WP_Agent_Package_Adoption_Result::canonical_status() mapped a 'partial'
adoption result to STATUS_SUCCEEDED. The orchestrator emits 'partial'
precisely when some artifacts were applied but OTHERS FAILED. As a result
the canonical run-result envelope reported top-level status = succeeded for
a run that had failures. The failures survived only inside outputs.failed,
invisible to any consumer keying on the envelope status, so partial
adoptions with real failures silently read as fully successful.

Map 'partial' to STATUS_INCOMPLETE, an existing non-success canonical
status that accurately describes a run that only partially completed. Fully
successful adoptions still map to SUCCEEDED and fully failed ones to FAILED.

Adds tests/package-adoption-result-canonical-status-smoke.php asserting a
partial result yields a non-succeeded canonical status with the failed
artifacts still visible, plus no-regression coverage on the clean success
and full-failure paths.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@chubes4 chubes4 changed the title Surface partial package adoption as a non-success status Surface failed partial package adoption as incomplete Aug 26, 2026
@chubes4
chubes4 marked this pull request as ready for review August 26, 2026 21:52
@chubes4
chubes4 merged commit 900ab71 into Automattic:main Aug 26, 2026
4 checks passed
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.

2 participants