Skip to content

forcedotcom/sf-skills / plugins/builder/dx-devops/skills/dx-devops-conflict-resolve

dx-devops-conflict-resolve

Verified

Use this skill to diagnose and resolve what blocks a DevOps Center promotion of a work item's feature branch: Git merge conflicts and deployment failures. DevOps Center is Git-backed, so overlapping metadata changes surface as merge conflicts against the target stage branch, resolved with git (detect, resolve markers, commit, push). Deploy failures often cite a missing dependency a full promotion can fix when the component already exists on the branch. TRIGGER when the user wants to check a work item for conflicts before promoting, resolve merge conflicts or leftover conflict markers in metadata files (.xml, .object-meta.xml, .cls), reconcile a feature branch with its target stage branch, or diagnose why a DevOps Center promotion or deployment failed and whether a full promotion or a missing-dependency fix will resolve it. DO NOT TRIGGER for running the promotion itself (use dx-devops-promote), creating or updating work items (use dx-devops-work-item-manage), or deploying metadata directly to an org.

references/deploy-failure-resolution.md

View on GitHub
# DevOps Center Deploy-Failure Resolution Reference

DevOps Center promotes a work item by **deploying its feature branch** into the target stage branch. That deploy can fail, and the fix depends on *why*. This reference covers the decision tree the `scripts/diagnose-deploy-failure.sh` script implements, the error patterns it recognizes, and the reasoning behind recommending a **full promotion**.

## The two failure classes

| Class | Symptom | Can a re-promote / full promotion fix it? |
|-------|---------|-------------------------------------------|
| **Merge conflict** | Error mentions `MERGE_CONFLICT` or `CONFLICTS:` | **No.** The branches conflict — resolve the conflict first (see `git-conflict-resolution.md`), then re-promote. |
| **Deploy error** | The deploy runs but errors (missing dependency, invalid metadata, test failure, …) | **Sometimes.** A *full* promotion helps only when the deploy failed on a **missing dependency that already exists on the feature branch** but was left out of a partial deployed set. |

## Why a "full promotion" is the lever

DevOps Center can promote a **subset** of a work item's changes. When the deployed subset references a component it did not include (e.g. an Apex class that calls another class not in the set), the deploy fails with a *missing dependency* error. If that referenced component is **already committed on the feature branch**, promoting **everything** (a full promotion) includes it and the deploy succeeds. If the component is **not** on the branch, no promotion can supply it — it must be authored/committed first (or the work item that owns it must be included).

## The decision tree

```text
deploy error
├─ matches MERGE_CONFLICT / CONFLICTS:      → merge conflict; resolve, don't re-promote   (exit 2)
└─ otherwise, parse a missing dependency
   ├─ none parsed                            → generic fix; full promotion won't help      (exit 4)
   └─ dependency <Type> <Name> parsed
      ├─ present on feature branch           → FULL PROMOTION can fix; confirm & promote    (exit 0)
      └─ absent from feature branch          → add/commit the component first, then promote (exit 3)
```

## Recognized error patterns

The parser (mirrors the DevOps Center provider) extracts a metadata **type** and **component name** from these shapes:

| Error shape | Parsed as |
|-------------|-----------|
| `Variable does not exist: Foo` (or `Problem: Variable does not exist: Foo`) | `ApexClass` `Foo` |
| `no ApexClass named Foo found` (also `ApexTrigger`/`ApexPage`/`CustomObject`/`Flow`) | that type + `Foo` |
| `In field: apexClass - no ApexClass named Foo found (profiles/…)` | `ApexClass` `Foo` |
| `... Component: Foo, Type: ApexClass ...` (when not a "Variable does not exist"/"Problem:" line) | that type + `Foo` |

Anything else parses to *no dependency* → generic guidance.

## Branch-presence check

For a parsed `<Type> <Name>`, the script builds candidate source paths for the standard SFDX layout and asks git whether any exist on the branch:

```bash
git show <feature-branch>:force-app/main/default/classes/<Name>.cls        # local ref
git show origin/<feature-branch>:force-app/main/default/classes/<Name>.cls # remote ref fallback
```

Path templates by type:

| Type | Candidate paths (first match wins) |
|------|------------------------------------|
| `ApexClass` | `…/classes/<Name>.cls` (under `force-app/main/default/`, `main/default/`, or `classes/`) |
| `ApexTrigger` | `…/triggers/<Name>.trigger` |
| `ApexPage` | `…/pages/<Name>.page` |
| `Profile` | `…/profiles/<Name>.profile-meta.xml` |
| `CustomObject` | `…/objects/<Name>/<Name>.object-meta.xml` |
| `Flow` | `…/flows/<Name>.flow-meta.xml` |

If a project uses a non-standard package directory (custom `packageDirectories` in `sfdx-project.json`), the standard templates may miss the file and the script reports `dependency_not_in_feature_branch` conservatively — verify manually with `git show <branch>:<actual-path>` before concluding.

## Running the script

```bash
# From the repo clone. Pass an error file, or pipe the deploy output with '-'.
scripts/diagnose-deploy-failure.sh deploy-error.txt feature/WI-101 uat origin
sf project deploy start ... 2>&1 | scripts/diagnose-deploy-failure.sh - feature/WI-101 uat
```

It prints `REASON`, `CAN_FULL_PROMOTION_FIX`, `RECOMMENDATION`, and (when parsed) `MISSING_DEPENDENCY_TYPE` / `MISSING_DEPENDENCY_NAME` / `IN_FEATURE_BRANCH` (+ `IN_TARGET_BRANCH` when a target branch is given). Exit codes: `0` full promotion can fix, `2` merge conflict, `3` dependency absent, `4` unparsed, `1` usage/env error.

## Handing off

This skill diagnoses; it does not promote. When the diagnosis is `dependency_in_feature_branch`, confirm with the user and hand the **full promotion** to `dx-devops-promote`. When a component must be added, author it with the relevant domain skill, commit it to the feature branch, then re-promote. When the diagnosis is a merge conflict, switch to the conflict-resolution track in `git-conflict-resolution.md`.
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall