Skip to content

Add ddev release port-commit command#23686

Merged
AAraKKe merged 3 commits into
masterfrom
aarakke/port-commit-command
May 13, 2026
Merged

Add ddev release port-commit command#23686
AAraKKe merged 3 commits into
masterfrom
aarakke/port-commit-command

Conversation

@AAraKKe
Copy link
Copy Markdown
Contributor

@AAraKKe AAraKKe commented May 13, 2026

What does this PR do?

Adds ddev release port-commit: cherry-picks a commit onto a target branch, pushes a <user>/port-<sha>-to-<target> branch, and opens a PR (ready-for-review by default, --draft to opt in). Preserves .in-toto files from the target branch so package signatures stay intact.

The workflow runs in an isolated git worktree under .worktrees/port-commit/<sanitized-branch>/ so the user's primary working tree is never mutated. On success the worktree is removed; on failure it is left in place and its path is surfaced so the user can inspect or finish the work manually.

Motivation

Brings an existing personal backport script into ddev so the flow is consistent, discoverable, and reuses ddev's git + GitHub helpers.

Implementation notes:

  • Worktree-based execution. A SetupWorktreeStep runs git worktree add -B <port-branch> <path> origin/<target> to create the working area; all cherry-pick / .in-toto sweep / commit / push steps run inside a GitRepository instance bound to that worktree. A TeardownWorktreeStep removes the worktree on a clean run, and is intentionally skipped on failure so partial state is recoverable.
  • Sequential PortStep workflow. Each step has a uniform describe / planned_commands / execute interface; adding or reordering steps is a one-line change in build_port_steps. --dry-run is centralized in PortStep.run so every step prints its planned commands without executing them.
  • Preventive validation. resolve_port_plan fails fast (before any mutation) if github.user is missing, or if github.token is missing while PR creation is enabled (skippable via --no-pr or --dry-run). It also verifies the commit exists, reads its subject, warns about touched .in-toto files, and confirms the resolved plan with the user.
  • Async GitHub client. PR creation and label assignment go through AsyncGitHubClient, with httpx.HTTPError / pydantic.ValidationError wrapped into PortStepError so any HTTP / response-shape failure produces a clean abort instead of a raw traceback.

Stacks on top of #23685, which adds the async-client surface and FakeAsyncGitHubClient test helper this PR consumes.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add the qa/skip-qa label if the PR doesn't need to be tested during QA.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

@AAraKKe AAraKKe added the qa/skip-qa Automatically skip this PR for the next QA label May 13, 2026
@dd-octo-sts dd-octo-sts Bot added the ddev label May 13, 2026
AAraKKe added a commit that referenced this pull request May 13, 2026
AAraKKe added a commit that referenced this pull request May 13, 2026
@AAraKKe AAraKKe force-pushed the aarakke/port-commit-command branch from 5f3970c to f604f64 Compare May 13, 2026 07:38
@AAraKKe AAraKKe force-pushed the aarakke/async-github-refactor branch from cbef667 to e33bd03 Compare May 13, 2026 07:38
Copy link
Copy Markdown
Contributor Author

AAraKKe commented May 13, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@AAraKKe AAraKKe force-pushed the aarakke/async-github-refactor branch from e33bd03 to 579edab Compare May 13, 2026 07:41
@AAraKKe AAraKKe force-pushed the aarakke/port-commit-command branch from f604f64 to 6912a4f Compare May 13, 2026 07:41
@AAraKKe AAraKKe marked this pull request as ready for review May 13, 2026 07:48
@AAraKKe AAraKKe requested a review from a team as a code owner May 13, 2026 07:48
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6912a4f767

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +442 to +443
steps: list[PortStep] = [
FetchOriginStep(app, dry_run=plan.dry_run),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require a clean index before committing the backport

When the user has staged local edits before running this command, the workflow starts with fetch/checkout/cherry-pick and later runs git commit without ever checking that the index was clean, so those pre-existing staged changes are committed into the backport branch alongside the cherry-pick. This can silently publish unrelated local work in the pushed branch/PR; add an initial clean-worktree/index guard or explicitly reset/abort before the mutating steps.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed with a validation when creating the plan.

@AAraKKe AAraKKe force-pushed the aarakke/port-commit-command branch from 6912a4f to 4a797b4 Compare May 13, 2026 07:58
@AAraKKe AAraKKe force-pushed the aarakke/async-github-refactor branch from 579edab to 5729ee2 Compare May 13, 2026 07:58
@datadog-datadog-prod-us1
Copy link
Copy Markdown
Contributor

datadog-datadog-prod-us1 Bot commented May 13, 2026

Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: ca857eb | Docs | Datadog PR Page | Give us feedback!

@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

❌ Patch coverage is 96.54655% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.96%. Comparing base (aeda997) to head (ca857eb).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@AAraKKe AAraKKe force-pushed the aarakke/port-commit-command branch 2 times, most recently from 2edc14e to e2408d2 Compare May 13, 2026 08:33
@AAraKKe AAraKKe force-pushed the aarakke/async-github-refactor branch from 5729ee2 to 518fee5 Compare May 13, 2026 08:33
@AAraKKe AAraKKe force-pushed the aarakke/port-commit-command branch from e2408d2 to 4988ad1 Compare May 13, 2026 08:48
@AAraKKe AAraKKe force-pushed the aarakke/async-github-refactor branch from 518fee5 to f869e87 Compare May 13, 2026 08:48
@AAraKKe AAraKKe force-pushed the aarakke/port-commit-command branch from 4988ad1 to b57a198 Compare May 13, 2026 09:06
@AAraKKe AAraKKe force-pushed the aarakke/async-github-refactor branch from f869e87 to 18440ba Compare May 13, 2026 09:15
@AAraKKe AAraKKe force-pushed the aarakke/port-commit-command branch 3 times, most recently from c945300 to d8f8ae0 Compare May 13, 2026 09:28
@AAraKKe AAraKKe force-pushed the aarakke/async-github-refactor branch from 18440ba to 3d8ca21 Compare May 13, 2026 09:28
@AAraKKe AAraKKe force-pushed the aarakke/port-commit-command branch from d8f8ae0 to a56402e Compare May 13, 2026 09:36
@AAraKKe AAraKKe force-pushed the aarakke/async-github-refactor branch from 3d8ca21 to 99fa9d0 Compare May 13, 2026 09:36
@AAraKKe AAraKKe force-pushed the aarakke/port-commit-command branch 2 times, most recently from 57fa156 to 9362527 Compare May 13, 2026 09:47
@AAraKKe AAraKKe force-pushed the aarakke/async-github-refactor branch from 99fa9d0 to 2a381c6 Compare May 13, 2026 09:47
@AAraKKe AAraKKe force-pushed the aarakke/port-commit-command branch from 9362527 to 4c1c326 Compare May 13, 2026 10:42
@AAraKKe AAraKKe force-pushed the aarakke/async-github-refactor branch from 2a381c6 to 1c9e7d3 Compare May 13, 2026 10:42
NouemanKHAL
NouemanKHAL previously approved these changes May 13, 2026
Base automatically changed from aarakke/async-github-refactor to master May 13, 2026 11:20
@AAraKKe AAraKKe force-pushed the aarakke/port-commit-command branch from 7c1e084 to ca857eb Compare May 13, 2026 11:29
@temporal-github-worker-1 temporal-github-worker-1 Bot dismissed NouemanKHAL’s stale review May 13, 2026 11:29

Review from NouemanKHAL is dismissed. Related teams and files:

  • agent-integrations
    • .gitignore
    • ddev/changelog.d/23686.added
    • ddev/src/ddev/cli/release/init.py
    • ddev/src/ddev/cli/release/port_commit.py
    • ddev/src/ddev/cli/release/port_commit_workflow.py
    • ddev/tests/cli/release/test_port_commit.py
@AAraKKe AAraKKe enabled auto-merge May 13, 2026 11:30
@dd-octo-sts
Copy link
Copy Markdown
Contributor

dd-octo-sts Bot commented May 13, 2026

Validation Report

All 20 validations passed.

Show details
Validation Description Status
agent-reqs Verify check versions match the Agent requirements file
ci Validate CI configuration and Codecov settings
codeowners Validate every integration has a CODEOWNERS entry
config Validate default configuration files against spec.yaml
dep Verify dependency pins are consistent and Agent-compatible
http Validate integrations use the HTTP wrapper correctly
imports Validate check imports do not use deprecated modules
integration-style Validate check code style conventions
jmx-metrics Validate JMX metrics definition files and config
labeler Validate PR labeler config matches integration directories
legacy-signature Validate no integration uses the legacy Agent check signature
license-headers Validate Python files have proper license headers
licenses Validate third-party license attribution list
metadata Validate metadata.csv metric definitions
models Validate configuration data models match spec.yaml
openmetrics Validate OpenMetrics integrations disable the metric limit
package Validate Python package metadata and naming
readmes Validate README files have required sections
saved-views Validate saved view JSON file structure and fields
version Validate version consistency between package and changelog

View full run

@AAraKKe AAraKKe added this pull request to the merge queue May 13, 2026
Merged via the queue into master with commit c0767bc May 13, 2026
362 checks passed
@AAraKKe AAraKKe deleted the aarakke/port-commit-command branch May 13, 2026 11:51
@dd-octo-sts dd-octo-sts Bot added this to the 7.79.0 milestone May 13, 2026
github-actions Bot pushed a commit that referenced this pull request May 13, 2026
* Add ddev release port-commit command

* Lowercase port branch name and clean up step output

* Improve port-commit output: split steps, lighter styling, completion panel, commit link in PR body c0767bc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ddev qa/skip-qa Automatically skip this PR for the next QA team/agent-integrations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants