Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 71 additions & 30 deletions .claude/commands/upgrade-assessment.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ discovery, authorized routine commands, scoped metadata updates and specialist d
Retain effective host permissions and all non-production, scope and sensitive-action gates.

This command is **assessment only**. It never edits application code, `composer.json` or
`composer.lock`, never runs Composer install/update, database, cache, deploy or git
commands, and never reads or writes secrets or `env.php`. It writes only the assessment
`composer.lock`, never runs Composer install/update in the project, database, cache, deploy or git
commands (the one exception is the throwaway patch-dry-run target tree in Step 2.6), and never reads or writes secrets or `env.php`. It writes only the assessment
data file and report documents inside the approved metadata scope. It is separate from
`/upgrade-hop` (which plans and analyses hop by hop) and can run before or after it.

Expand Down Expand Up @@ -97,8 +97,13 @@ in-memory assessment data model (Section 5):
Never consume an old scan to disguise a missing or failed prerequisite.
4. 3.5 Third-party modules, including the modified-vendor diff and client input list
5. 3.6 Custom modules, including removal candidates
6. 3.7 Patches (dry runs only when a pristine target tree was supplied; otherwise
`NOT ASSESSED` plus human-run commands)
6. 3.7 Patches, with an automatic dry-run: use an operator-supplied tree if given; otherwise run
`node <scripts>/assess_tools.mjs tree-plan . --target <targetVersion>` and ask ONE exact-action
approval for the two `composer` commands it prints (dependency install, so never implicit; run only inside
`var/ccua/target-tree-<targetVersion>`, never in the project; ambient Composer keys are used implicitly and
never read). If approved, run them one at a time, then its `thenRun` `patches` command
(`--tree-kind vanilla`) and delete the tree afterwards. If declined or failed, mark `UNABLE_TO_VALIDATE`,
record the reason in `gaps` and give the human-run commands. The report states the validation environment.
7. 3.8 Composer and dev-dependency proposal
8. 3.4 Core upgrade and 3.9 delivery outline and risks

Expand Down Expand Up @@ -444,34 +449,69 @@ with reason, comment (`No issues found`, `Minor issues found`, `Major issues fou
### 3.7 Patches

Collect the local inventory first with the read-only helper
`node .claude/scripts/assess_tools.mjs patches <projectDir> --target <X.Y.Z>`. It reads
`QUALITY_PATCHES` in `.magento.env.yaml`, the Cloud patches version in `composer.lock`,
`node .claude/scripts/assess_tools.mjs patches <projectDir> --target <X.Y.Z> [--tree <dir> --tree-kind upgraded-project|vanilla] [--qpt-info <patches-info.json>]`.
It reads `QUALITY_PATCHES` in `.magento.env.yaml`, the Cloud patches version in `composer.lock`,
hotfix directories (`m2-hotfixes/`, `patches/`, `hotfixes/`, including a README reasons
table), `composer.json` `extra.patches`, and the installed
`vendor/magento/quality-patches` catalogs. Per patch it returns type, target package and
installed version, purpose, upstream ID, evidence and a verdict. When the catalog limits an
Adobe patch to Commerce ranges that exclude the target, the verdict is `DROP` (fixed
upstream per Adobe metadata, to be confirmed in the target release notes). Patches whose
catalog entry targets another package (for example inventory) or is absent stay `REVIEW`
with that reason. The installed catalog can be older than the target; say so and never
treat a missing entry as a pass. Local hotfixes are `REVIEW` with
"Dry-run required on <target> tree" until the operator supplies one. Inventory every patch
from the hosting profile's sources (Section 2). Per patch record:
table), `composer.json` `extra.patches`, the installed `vendor/magento/quality-patches`
catalogs and the official QPT `patches-info.json`. Per patch it returns type, target package
and installed version, purpose, upstream ID, `qpt` lifecycle metadata, `validation`
(outcome, environment, detail), `recommendation` with `recommendationBasis`, evidence and a
verdict. Rows also carry `purposeSource` (`qpt`, `readme`, `patch-header`, `diff-analysis`,
`composer-description`, `package`) and, for local patches, `purposeEvidence` (header comment,
touched files and symbols, added/removed line counts, README reason).

**QPT metadata (`patches-info.json`)** is the data source of the official Quality Patches
page. Use it for: description/purpose, categories and components, the `releases` the patch is
listed for (`qpt.listedForTarget`, `qpt.latestListedRelease`), `deprecated`, `replacedWith`
(superseding patch), `require` (prerequisite patches) and `requirements` (manual steps). A
patch listed only for releases older than the target is "potentially obsolete or superseded",
never auto-removed. The installed catalog can be older than the target; IDs it does not know
are `UNKNOWN`, never a pass. Refresh with the target's quality-patches package where possible
(`--qpt-info`).

**Purpose.** Every row needs a meaningful purpose written for the reader: the issue fixed,
the functionality affected and the intended behaviour change. Prefer the QPT description. For
local patches, write an AI summary from `purposeEvidence` and the diff (read-only); state
only what the evidence supports and mark inferred wording as inferred. `validate` rejects
generic "Changes N file(s) in ..." purposes.

**Dry-run validation.** Pass `--tree` to dry-run every local patch with `git apply --check`
(read-only; never writes to the tree) against, in order of preference: (1) an isolated,
upgraded copy of the project (`upgraded-project`), (2) a vanilla install of the target
(`vanilla`). If no tree is supplied, run `assess_tools.mjs tree-plan <projectDir> --target <X.Y.Z>` (works for any
target version; prints exact commands, runs nothing) and propose building that throwaway vanilla
tree under `var/ccua/`. Creating it needs dependency installation, which is never automatic and
needs exact-action approval, which `/upgrade-assess` collects once, inside its single Step 0 approval (no second prompt); then run `patches` with the returned `thenRun` arguments and
remove the tree afterwards. A declined or failed build leaves `UNABLE_TO_VALIDATE`. Running the helper with `--tree`
executes `git` and is part of that approved scope. Outcomes per patch:
`APPLICABLE` (applies without conflicts), `CONFLICT` (not applicable), `POSSIBLY_OBSOLETE`
(already present in the tree per reverse dry-run, or QPT lists it only for older
releases / deprecated / replaced) and `UNABLE_TO_VALIDATE` (no tree, no local patch file,
or tool unavailable). Always state the environment used: a clean apply on a vanilla install
does not guarantee applicability to the customized project. Without `--tree`, record
`UNABLE_TO_VALIDATE` and put the exact human-run dry-run command in the runbook. QPT-delivered
patches without a local file are validated with `vendor/bin/magento-patches` on the target.

Inventory every patch from the hosting profile's sources (Section 2). Per patch record:
identifier/name, type (`adobe-quality`, `adobe-security`, `cloud-patch`, `composer-core`,
`composer-extension`, `local-hotfix`), target package and version, purpose, owner/ticket if
known, `fixedInTarget` (`Yes`/`No`/`Unknown`, from release notes or the Adobe patch
description, verified, never assumed), `appliesToTarget` (`Yes`/`Yes (offset)`/`No`/`n/a`/
`NOT ASSESSED`), action and complexity.

Actions: `DROP` (fixed upstream or obsolete), `KEEP_AND_REBASE`, `REWORK` (reimplement as
plugin/preference/custom module), `REPLACE_WITH_VENDOR_RELEASE`, `UPGRADE_PACKAGE`
(delivered by a package that updates with the upgrade).

- `appliesToTarget` requires a dry run (`git apply --check` / `patch --dry-run`) against a
pristine target tree. Producing that tree requires dependency installation, which is never
automatic: if the operator has not supplied a pristine target tree, record
`NOT ASSESSED` and add the exact human-run dry-run commands to the runbook.
- Add a one-line summary below the table (count per action).
description, verified, never assumed), `appliesToTarget`, `validationOutcome`,
`validationEnvironment`, `recommendation`, `recommendationBasis`, action and complexity.

**Recommendation** (one per patch, always with its supporting evidence; missing evidence is
`MANUAL_REVIEW`, never a guess): `RETAIN` (clean dry-run or QPT lists it for the target;
Cloud patches package), `REMOVE` (QPT range excludes the target, deprecated, or already in
the tree), `REPLACE` (QPT `replacedWith`, or the target vendor release contains the fix),
`ADAPT` (still needed but conflicts or needs rebase/rework), `MANUAL_REVIEW`.

Actions: `KEEP`, `DROP` (fixed upstream or obsolete), `KEEP_AND_REBASE`, `REWORK` (reimplement
as plugin/preference/custom module), `REPLACE_WITH_VENDOR_RELEASE`, `REPLACE_WITH_NEWER_PATCH`,
`UPGRADE_PACKAGE` (delivered by a package that updates with the upgrade), `REVIEW`.

- Add a one-line summary below the table (count per recommendation and per validation
outcome) and list the helper's `limitations` (missing tree, vanilla-only validation, QPT
catalog age) as visible gaps.
- For patches that stay against core, recommend opening an Adobe ticket for an official fix;
for feature customizations, recommend moving them out of core patches.

Expand Down Expand Up @@ -659,8 +699,9 @@ the report clean or ready to upgrade; empty rows mean unavailable findings, not
4. **Custom Modules Compatibility** — `# | Modules | Domain | Purpose | Status | Required |
Target Compatible | Findings (UCT/PHP) | Effort | Comments`, with a short legend.
5. **Patches Compatibility** — `# | Patch | Type | Target | Purpose | Fixed in <target> |
Applies to <target> | Action | Effort | Comments`, a one-line action summary and a short
"How to assess patches" list. For a non-Cloud source, leave out Cloud-only patch rows and
Applies to <target> | Action | Effort | Comments`: exactly these ten columns in this order, no extra columns. "Applies to" holds the dry-run outcome plus the validation environment; "Action" holds the recommendation (RETAIN/REMOVE/REPLACE/ADAPT/MANUAL_REVIEW); "Comments" holds the recommendation basis, QPT lifecycle metadata and dry-run detail. A one-line summary
per recommendation and validation outcome, the validation environment and limitations, and
a short "How to assess patches" list. For a non-Cloud source, leave out Cloud-only patch rows and
wording (`QUALITY_PATCHES` in `.magento.env.yaml`, the Cloud patches package, the
`cloud-patch` type, "delivered by the upgraded Cloud package"); list only the patches
found in the on-premises sources (`extra.patches`, hotfix directories, quality-patches).
Expand Down
2 changes: 1 addition & 1 deletion .claude/context/upgrade-assessment-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ <h2>4. Custom Modules Compatibility</h2>
<div class="tab-content">
<h2>5. Patches Compatibility</h2>
<div class="filters" data-table="patch-table">{{PATCH_FILTERS}}</div>
<table id="patch-table"><thead><tr><th>#</th><th>Patch</th><th>Type</th><th>Target</th><th>Purpose</th><th>Fixed in target</th><th>Applies to target</th><th>Action</th><th>Effort</th><th>Comments</th></tr></thead><tbody>{{PATCH_ROWS}}</tbody></table>
<table id="patch-table"><thead><tr><th>#</th><th>Patch</th><th>Type</th><th>Target</th><th>Purpose</th><th>Fixed in target</th><th>Applies to target (dry-run, environment)</th><th>Action (recommendation)</th><th>Effort</th><th>Comments</th></tr></thead><tbody>{{PATCH_ROWS}}</tbody></table>
{{PATCH_NOTES}}
</div>

Expand Down
Loading
Loading