Skip to content

Instantly share code, notes, and snippets.

@squito
Created July 27, 2026 22:05
Show Gist options
  • Select an option

  • Save squito/9dc88871a5abcf0df65ec8302109005f to your computer and use it in GitHub Desktop.

Select an option

Save squito/9dc88871a5abcf0df65ec8302109005f to your computer and use it in GitHub Desktop.
CDP Port Jira Backport — Cursor agent skill for CDPD fix ports to CDH release branches

CDP Port Jira Backport Skill

Cursor agent skill for porting and backporting CDPD fixes to CDP release branches.

Files

File Purpose
SKILL.md Main skill — workflow, guardrails, phases 1–7
branch-mapping.md CDH branch ↔ version mapping rules
examples.md Worked examples and decision table

Usage in Cursor

Save as a skill at ~/.cursor/skills/cdp-port-jira/SKILL.md (with the companion files alongside it), or paste SKILL.md into a Cursor rule.

Trigger phrases: port Jira, backport, cherry-pick to a CDP version, [Port] CDPD-…, landing a fix on a release branch.

Requirements

  • Atlassian MCP (Jira)
  • gh CLI for GitHub Enterprise (github.infra.cloudera.com)
  • Local clones of target repos (e.g. CDH/spark3, CDH/spark-atlas-connector-for-spark3)

CDH Branch ↔ Version Mapping

Rules for resolving the git branch that corresponds to a CDP target version.

Branch naming patterns

Pattern Example Purpose
CDH-{M}.{m}.{p}.{build} CDH-7.3.2.100 Exact CDP target build
CDH-{M}.{m}.{p}.{build}x CDH-7.3.2.10000x Wildcard line for a build series
CDH-{M}.{m}.{p}.x CDH-7.3.2.x Umbrella branch for a minor release line
cdh_main Development trunk (next/future build line)
DEX-DEPS-{version}-MAIN DEX-DEPS-7.3.2-MAIN Dependency baseline
CDPD-{ticket}_CDH-{version} CDPD-104838_CDH-7.3.2.x Feature/fix branches for a port

Version → branch lookup

Target version Branch Notes
7.3.2.100 CDH-7.3.2.100 Exact match
7.3.2.10000 CDH-7.3.2.10000x Literal x suffix on branch name
7.3.2.20000 CDH-7.3.2.20000x Same wildcard pattern
7.3.2.x (line) CDH-7.3.2.x Verify POM; branch name may differ from POM suffix

General rule: strip any trailing x from the branch name when comparing to a Jira fix version, except when the Jira version itself ends in x.

Maven POM verification

The CDP build number is encoded in pom.xml as the last dotted segment before -SNAPSHOT:

{artifact_version}.{CDP_major}.{CDP_minor}.{CDP_patch}.{CDP_build}-SNAPSHOT
         3.5.4    .   7   .   3   .   2   .    100      -SNAPSHOT

Always verify the branch matches the target version:

git fetch origin
git branch -a | grep "CDH-7.3.2"
git show origin/CDH-7.3.2.100:pom.xml | grep -E '<version>|<spark.version>' | head -5

Expected for 7.3.2.100:

3.5.4.7.3.2.100-SNAPSHOT

Expected for 7.3.2.10000:

3.5.8.7.3.2.10000-SNAPSHOT

Branch selection priority

When multiple branches could match:

  1. Exact CDH-{version} (e.g. CDH-7.3.2.100 for version 7.3.2.100)
  2. Wildcard CDH-{version}x only when that is the established line (e.g. 10000x for 7.3.2.10000)
  3. Never assume .x umbrella branches without verifying pom.xml

Caveat: .x branches do not always match their POM suffix (e.g. CDH-7.3.2.x may carry 7.3.2.200-SNAPSHOT). Always check pom.xml on the target branch.

Known 7.3.2 mappings

Branch POM CDP suffix Role
cdh_main 7.3.2.20000-SNAPSHOT Future trunk
CDH-7.3.2.10000x 7.3.2.10000-SNAPSHOT Next release line after .100
CDH-7.3.2.100 7.3.2.100-SNAPSHOT Specific build
CDH-7.3.2.x 7.3.2.200-SNAPSHOT Integration line
DEX-DEPS-7.3.2-MAIN 7.3.2.0-SNAPSHOT Baseline / deps

Lookup commands

# List branches for a release line
git branch -a | grep 'CDH-7.3.2'

# Confirm POM suffix on a branch
git show origin/CDH-7.3.2.100:pom.xml | grep '<version>' | head -3

# Check if a remote branch exists
git ls-remote --heads origin 'CDH-7.3.2.100'

Feature branch naming for ports

When creating a branch for the port PR:

CDPD-<port-ticket>_CDH-<version>

Examples:

  • CDPD-111272_CDH-7.3.2.100
  • CDPD-110603_CDH-7.3.2.10000x

Base the feature branch on the target release branch, not on cdh_main.

Port Backport Examples

Worked examples using real CDPD tickets.


Example 1: Backport needed (CDPD-108116 → 7.3.2.100)

Input

User: "Port CDPD-108116 to 7.3.2.100"

Phase 1 — Resolve context

Field Value
Source Jira CDPD-108116
Summary Skip redundant alterTable in MSCK REPAIR TABLE when already tracked
Component Spark
Repo CDH/spark3 (from remote link to PR #648)
Target version 7.3.2.100
Target branch CDH-7.3.2.100
Source commit From gh pr view 648 --repo CDH/spark3 --json mergeCommit

Remote links on CDPD-108116 include PRs #640–#649 on github.infra.cloudera.com/CDH/spark3.

Phase 3 — Existing Port Jira check

Source Jira has Port links:

Port ticket Target version Action
CDPD-110603 7.3.2.10000 Different version — not a duplicate
CDPD-111272 7.3.2.100 Exact match — stop, report existing ticket

If CDPD-111272 did not exist, proceed to Phase 4.

Phase 4 — Already on branch? (read-only worktree)

git worktree add /tmp/port-assess-CDPD-108116 origin/CDH-7.3.2.100
cd /tmp/port-assess-CDPD-108116
git log --oneline --grep=CDPD-108116
git cherry -v origin/CDH-7.3.2.100 <commit-sha>
git cherry-pick -n <commit-sha> && git diff --stat
cd - && git worktree remove /tmp/port-assess-CDPD-108116 --force

If git cherry returns nothing and cherry-pick produces no diff → report "already done" and stop.

Phase 5 — Apply locally for review

Apply in the user's local clone, not a temp path:

cd ~/git/int/spark3
git fetch origin
git checkout CDH-7.3.2.100
git cherry-pick -n c5afe9dfbe
git restore --staged .

Tell the user:

Review the full diff at ~/git/int/spark3 on branch CDH-7.3.2.100 (git diff).

Summary:
- 3 files, +196 / -4 (clean cherry-pick)
- SQLConf.scala, ddl.scala, MsckRepairTableSuite.scala
- Conflicts: none

Always include a chat summary (files, stats, conflict status). Do not paste the full diff unless asked.

Phase 5b — Ask about tests

Would you like me to run tests?
(a) All tests — ./build/mvn test (slow)
(b) Relevant tests — ./build/mvn test -pl sql/hive \
      -DwildcardSuites=org.apache.spark.sql.hive.execution.command.MsckRepairTableSuite
(c) Skip

Wait for the user's choice before running anything.

Phase 6 — Create Port Jira (if needed)

Only if no duplicate and change not already present:

Summary: [Port] CDPD-108116 to 7.3.2.100
fixVersions: 7.3.2.100
Port link: inward=CDPD-108116, outward=CDPD-<new>

Phase 7 — Push and PR (on confirmation)

git checkout -b CDPD-111272_CDH-7.3.2.100 origin/CDH-7.3.2.100
git cherry-pick <commit-sha>
git commit -m "$(cat <<'EOF'
CDPD-108116: Skip redundant alterTable in MSCK REPAIR TABLE when already tracked

Port of CDPD-108116 to 7.3.2.100.

Port Jira: CDPD-111272
EOF
)"
git push -u origin CDPD-111272_CDH-7.3.2.100

gh pr create \
  --repo CDH/spark3 \
  --base CDH-7.3.2.100 \
  --head CDPD-111272_CDH-7.3.2.100 \
  --title "CDPD-108116: Skip redundant alterTable in MSCK REPAIR TABLE when already tracked"

Example 2: Existing Port Jira — stop early

Input

User: "Port CDPD-108116 to 7.3.2.100"

Assessment

Source Jira issuelinks include Port → CDPD-111272 with summary [Port] CDPD-108116 to 7.3.2.100.

Response

## Port assessment: CDPD-108116 → 7.3.2.100

**Existing Port Jira:** CDPD-111272 — https://cloudera.atlassian.net/browse/CDPD-111272

A Port ticket for this source and target version already exists. No duplicate needed.

If you want to continue the backport on that ticket, say so and I will assess
whether the cherry-pick is already on CDH-7.3.2.100.

Do not create a new Port Jira. Do not commit or push unless user asks to continue on the existing ticket.


Example 3: Change already on branch — stop early

Input

User: "Port CDPD-108116 to 7.3.2.100"

Assessment commands

git fetch origin
git log --oneline origin/CDH-7.3.2.100 --grep=CDPD-108116
# abc1234 CDPD-108116: Skip redundant alterTable in MSCK REPAIR TABLE when already tracked

git cherry -v origin/CDH-7.3.2.100 abc1234
# (empty output)

Or:

git checkout -B port-assess/CDPD-108116 origin/CDH-7.3.2.100
git cherry-pick -n abc1234
git status
# nothing to commit, working tree clean

Response

## Port assessment: CDPD-108116 → 7.3.2.100

**Repo:** CDH/spark3
**Target branch:** CDH-7.3.2.100

### Already on branch?
Yes — commit abc1234 with message "CDPD-108116: Skip redundant alterTable..."
is already on origin/CDH-7.3.2.100.

### Recommended next step
No backport needed. I will not create a Port Jira unless you specifically request one.

Example 4: Cherry-pick conflicts — hand off

Input

User: "Port CDPD-108116 to 7.3.2.100"

Cherry-pick produces conflicts in sql/hive/src/main/scala/.../HiveExternalCatalog.scala.

Response

## Port assessment: CDPD-108116 → 7.3.2.100

**Cherry-pick result:** conflicts

**Conflicts:**
- `sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveExternalCatalog.scala`

### Commands to apply manually

git fetch origin
git checkout -b CDPD-111272_CDH-7.3.2.100 origin/CDH-7.3.2.100
git cherry-pick <commit-sha>
# resolve conflicts in HiveExternalCatalog.scala
git add sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveExternalCatalog.scala
git cherry-pick --continue

When ready, ask me to create the Port Jira and open the PR.

Do not commit, push, or create Port Jira until user resolves conflicts and confirms.


Example 5: Different target version (7.3.2.10000)

Same source CDPD-108116, different target:

Field Value
Target version 7.3.2.10000
Target branch CDH-7.3.2.10000x
Existing Port CDPD-110603

Port to 7.3.2.10000 and port to 7.3.2.100 are separate tickets on separate branches. Always match the exact version string when checking for duplicates.


Outcome decision table

Existing Port Jira? Change on branch? Cherry-pick result Action
Yes, same version Report existing ticket, stop
No Yes Report already done, stop (no Port Jira)
No No Clean diff Show diff, wait for confirmation
No No Conflicts Hand off commands, stop
No No Clean diff + user confirms Apply diff locally for review; then commit, push, PR
name cdp-port-jira
description Port and backport CDPD fixes to CDP release branches: assess whether a cherry-pick is needed before creating a Port Jira, show uncommitted diffs for review, and only push or open a PR after explicit user confirmation. Use when the user mentions port Jira, backport, cherry-pick to a CDP version, [Port] CDPD-…, or landing a fix on a release branch like 7.3.2.100.

CDP Port Jira Backport

Assessment-first workflow for porting CDPD fixes to CDP release branches.

Hard guardrails

  • Never commit, push, or open a PR without explicit user confirmation after showing the diff.
  • Port commit subjects and PR titles use the source Jira key (e.g. CDPD-108116), not the Port ticket; put the Port ticket at the end of the commit body and in the PR body. Feature branch names still use the Port ticket.
  • Never create a Port Jira if the change is already on the target branch (unless user explicitly requests the ticket anyway).
  • Never create a duplicate Port Jira when one already exists for the same source + version.
  • Use throwaway worktrees only for read-only checks (already present? conflicts?). For user review, apply the cherry-pick in the local repo clone on the target branch, unstaged.
  • Tell the user the exact repo path and branch where the diff was applied. The local git diff is the full review surface; do not paste the entire diff in chat unless the user asks.
  • Still provide a brief chat summary: files changed, line counts, and especially any merge conflicts (file names and conflict regions). A summary complements the local diff; it does not replace it.
  • On throwaway worktrees/branches used for assessment, clean up after the check completes.

Workflow overview

1. Resolve context (source Jira, target version, repo, commits)
2. Resolve target git branch
3. Check for existing Port Jira → stop if duplicate
4. Check if change already on branch → stop if done
5. Assess cherry-pick (worktree) → apply unstaged in local repo for git diff review
6. Ask user whether to run tests (all / relevant / skip)
7. Create Port Jira (only if backport needed and no duplicate)
8. Commit, push, open PR (only on explicit user confirmation)

For branch naming rules, see branch-mapping.md. For worked examples, see examples.md.


Phase 1 — Resolve context (read-only)

Gather inputs before any git writes or Jira creation.

Source Jira

Use Atlassian MCP:

  • getJiraIssue — summary, description, components, assignee, fixVersions, issuelinks
  • getJiraIssueRemoteIssueLinks — linked GitHub PRs

Target version

From user input, or parse an existing Port summary: [Port] CDPD-108116 to 7.3.2.100.

Repository

Infer in order:

  1. Jira remote links (e.g. github.infra.cloudera.com/CDH/spark3/pull/648)
  2. Jira component:
    • Spark → CDH/spark3
    • Spark Atlas Connector (SAC) → CDH/spark-atlas-connector-for-spark3
  3. Current workspace remote if ambiguous → ask user

GitHub host is typically github.infra.cloudera.com. Use gh with the correct repo:

gh pr view 648 --repo CDH/spark3 --json mergeCommit,commits,title,headRefName,baseRefName

Source commit(s)

In order of preference:

  1. Merge commit from the linked GitHub PR
  2. Commit(s) with CDPD-XXXXX in the message on the source/fix branch
  3. Squashed commit SHA from PR commits if merge commit unavailable

Record the SHA(s) and the branch they landed on originally.


Phase 2 — Resolve target branch

Map target version to branch name. See branch-mapping.md for full rules.

Quick reference:

Target version Typical branch
7.3.2.100 CDH-7.3.2.100
7.3.2.10000 CDH-7.3.2.10000x
7.3.2.x line CDH-7.3.2.x

Always verify before cherry-pick:

git fetch origin
git branch -a | grep "CDH-<version>"
git show origin/CDH-<branch>:pom.xml | grep -E '<version>' | head -3

Prefer exact CDH-{version} over wildcard branches unless the wildcard is the established line (e.g. 10000x).


Phase 3 — Check for existing Port Jira

Before any git writes or new Jira creation.

On the source Jira, inspect issuelinks for type Port (inward: ported from, outward: port to).

Parse linked ticket summaries: [Port] CDPD-108116 to 7.3.2.100

If one exists for the exact same target version:

  • Report the ticket key and URL
  • Stop. Do not create a duplicate.

JQL fallback:

project = CDPD AND summary ~ "CDPD-108116" AND summary ~ "7.3.2.100"

Use searchJiraIssuesUsingJql via Atlassian MCP.


Phase 4 — Check if change is already present (read-only worktree)

Before creating any Port Jira.

Use a throwaway worktree so the user's working tree is not disturbed:

git fetch origin
git worktree add /tmp/port-assess-CDPD-108116 origin/CDH-7.3.2.100
cd /tmp/port-assess-CDPD-108116

Checks (run all that apply):

# 1. Commit already on target branch with Jira key in message
git log --oneline --grep=CDPD-108116

# 2. Patch already applied (empty output = already present)
git cherry -v origin/CDH-7.3.2.100 <commit-sha>

# 3. Dry-run cherry-pick
git cherry-pick -n <commit-sha>
git status
git diff --stat

If cherry-pick produces no changes (clean index/worktree):

  • Report: change appears already present on <branch>
  • Stop. Do not create a Port Jira unless user explicitly requests it.

Always clean up the worktree when done:

git cherry-pick --abort 2>/dev/null || git reset --hard HEAD
cd -
git worktree remove /tmp/port-assess-CDPD-108116 --force

Phase 5 — Apply in local repo for review (no commit, no Port Jira)

If the change is not already present, apply it in the user's local clone of the target repo so they can review with git diff in their IDE or terminal.

Important: The diff must land in the correct repo directory (e.g. ~/git/int/spark3), not merely a temp worktree or the wrong workspace. Confirm the repo path from Phase 1 and tell the user explicitly where to look.

cd <local-repo-path>    # e.g. /Users/you/git/int/spark3
git fetch origin
git checkout CDH-7.3.2.100 || git checkout -b CDH-7.3.2.100 origin/CDH-7.3.2.100
git cherry-pick -n <commit-sha>
git restore --staged .   # leave changes unstaged so plain `git diff` works
git diff --stat
git diff --check
git status

Tell the user:

  • Repo path: <local-repo-path>
  • Branch: CDH-7.3.2.100
  • How to review: run git diff or open the modified files in the IDE diff view
  • Summary in chat (always include):
    • Files changed and git diff --stat line counts
    • Whether cherry-pick was clean or had conflicts
    • If conflicts: list each conflicted file and describe the conflict hunks; do not skip this
  • Source commit SHA

Do not paste the full diff in chat unless the user asks. The summary complements the local tree; it does not replace it.

Do NOT commit. Do NOT create Port Jira. Do NOT push.

If cherry-pick fails or has conflicts in the local repo

Leave conflict markers in place if the user may want to inspect them, or abort with git cherry-pick --abort after reporting. Give exact recovery commands:

cd <local-repo-path>
git fetch origin
git checkout -b CDPD-<port-ticket>_CDH-7.3.2.100 origin/CDH-7.3.2.100
git cherry-pick <commit-sha>
# resolve conflicts in <files>
git add <files>
git cherry-pick --continue

Stop and wait for the user if cherry-pick failed or has unresolvable conflicts.


Phase 5b — Offer to run tests

After applying the diff locally and giving the chat summary, ask the user whether they want you to run tests. Use AskQuestion or a clear prompt with these options:

  1. All tests — full repo/module test suite
  2. Relevant tests only — your best guess based on changed files
  3. Skip — no tests for now

Do not run tests automatically. Wait for the user's choice.

Choosing relevant tests

Infer from the changed paths:

Signal Relevant test target
A *Suite.scala / *Test.java file was modified That suite/class directly
Production code under sql/hive/ Matching test module + suite for that package
Production code with no obvious test Module-level tests (-pl <module>)
pom.xml only Build smoke test (mvn package -DskipTests or module compile)

State your reasoning when proposing relevant tests (e.g. "MsckRepairTableSuite.scala was added in the same module as ddl.scala").

Repo-specific commands (when known)

CDH/spark3:

cd <local-repo-path>

# Relevant — single Scala suite (adjust FQCN from changed test file)
./build/mvn test -pl sql/hive \
  -DwildcardSuites=org.apache.spark.sql.hive.execution.command.MsckRepairTableSuite

# Relevant — module containing the change
./build/mvn test -pl sql/hive

# All tests (very slow — warn the user)
./build/mvn test

CDH/spark-atlas-connector-for-spark3:

cd <local-repo-path>

# Relevant — module tests
mvn test -pl spark-atlas-connector

# All tests
mvn test

When you do not know how to run tests

If the repo has no discoverable test command (no pom.xml, build/mvn, build/sbt, Makefile target, or CI script), tell the user honestly:

I don't know how to run tests in this repo. I checked for … and found nothing conclusive. Do you have a standard test command?

Do not guess a command that may not exist.

After tests complete

Report pass/fail, link to or summarize failures, and remind the user that nothing has been committed unless they previously confirmed a commit step.


Phase 6 — Create Port Jira (only when backport is needed)

Create a [Port] Jira only if all are true:

  • Change is not already on the target branch
  • No existing Port Jira for the same source + version
  • User wants to proceed (assessment showed a real backport is needed)

Use Atlassian MCP (cloudId from getAccessibleAtlassianResources):

createJiraIssue:

{
  "projectKey": "CDPD",
  "issueTypeName": "Task",
  "summary": "[Port] CDPD-108116 to 7.3.2.100",
  "description": "<copy from source Jira>",
  "assignee_account_id": "<source assignee>",
  "additional_fields": {
    "fixVersions": [{"name": "7.3.2.100"}],
    "components": [{"name": "Spark"}],
    "priority": {"name": "Important"}
  }
}

createIssueLink (type Port):

{
  "type": "Port",
  "inwardIssue": "CDPD-108116",
  "outwardIssue": "CDPD-<new-port-ticket>"
}

If user only wanted assessment, skip this phase.


Phase 7 — Commit, push, and PR (explicit confirmation only)

Proceed only when the user confirms the cherry-pick looks correct.

Commit and PR naming convention

Port commits and PR titles use the source Jira key, not the Port ticket key. The Port ticket is referenced at the end of the commit message body and in the PR body.

  • Commit subject: CDPD-<source-ticket>: <short summary> (same key as the original fix)
  • Commit body: port context, then Port Jira on its own line at the end
  • PR title: same as commit subject — CDPD-<source-ticket>: <short summary>
  • Feature branch name: still uses the Port ticket — CDPD-<port-ticket>_CDH-<version> (branch naming is separate from commit/PR titles)

Example for source CDPD-108116, Port CDPD-111272:

CDPD-108116: Skip redundant alterTable in MSCK REPAIR TABLE when already tracked

Port of CDPD-108116 to 7.3.2.100.

Port Jira: CDPD-111272

Feature branch

git fetch origin
git checkout -b CDPD-<port-ticket>_CDH-7.3.2.100 origin/CDH-7.3.2.100
git cherry-pick -n <commit-sha>   # or continue from assessment branch
git commit -m "$(cat <<'EOF'
CDPD-<source-ticket>: <short summary>

Port of CDPD-<source-ticket> to 7.3.2.100.

Port Jira: CDPD-<port-ticket>
EOF
)"
git push -u origin CDPD-<port-ticket>_CDH-7.3.2.100

Pull request

gh pr create \
  --repo CDH/spark3 \
  --base CDH-7.3.2.100 \
  --head CDPD-<port-ticket>_CDH-7.3.2.100 \
  --title "CDPD-<source-ticket>: <short summary>" \
  --body "$(cat <<'EOF'
## Summary
Port CDPD-<source-ticket> to 7.3.2.100.

## Jira
- Source: https://cloudera.atlassian.net/browse/CDPD-<source-ticket>
- Port: https://cloudera.atlassian.net/browse/CDPD-<port-ticket>

## Test plan
- [ ] Cherry-pick applies cleanly on CDH-7.3.2.100
- [ ] Existing tests pass
EOF
)"

Return the PR URL to the user.


Assessment report template

Use this format when presenting findings:

## Port assessment: CDPD-108116 → 7.3.2.100

**Repo:** CDH/spark3
**Target branch:** CDH-7.3.2.100
**Source commit:** `<sha>`

### Existing Port Jira
- [exists / none] CDPD-XXXXX — <url>

### Already on branch?
- [yes / no] <evidence>

### Cherry-pick result
- [clean / conflicts / failed]
- Files changed: ...
- Conflicts: ...

### Local review
- Repo path: `/path/to/repo`
- Branch: `CDH-7.3.2.100`
- Review with: `git diff` in that directory

### Chat summary (always include)
- Files + line counts from `git diff --stat`
- Clean or conflicts?
- If conflicts: list files and describe conflict hunks

### Recommended next step
- [stop — already done / stop — Port exists / diff applied locally — ask about tests / hand off commands]

Component → repo quick reference

Jira component GitHub repo
Spark CDH/spark3
Spark Atlas Connector (SAC) CDH/spark-atlas-connector-for-spark3

When component is ambiguous or missing, check remote links on the source Jira first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment