Skip to content

feat(promotion): add promotion environments - #44

Merged
SomeoneWithOptions merged 1 commit into
mainfrom
feat/promotion-environments
Nov 4, 2026
Merged

SomeoneWithOptions merged 1 commit into
mainfrom
feat/promotion-environments

Conversation

@SomeoneWithOptions

Copy link
Copy Markdown
Owner

What / why

n8n 2.46.4 replaced /promotions/connections with /promotions/environments. This PR adds n8n promotion environment ... for the 10 phase-35 operations. The promotion connection commands stay unchanged because older instances still serve them (their manifest ops stay retired). Environment apply, apply/continue, promote and the project-scoped configId → environmentId change are left for the phase-36 follow-up.

Changes

  • Client (internal/n8n/promotion_environment.go): list (scope, direction and providerId filters, cursor), create, get, update, delete, connect, disconnect, and project list/add/remove. Environment IDs must be UUIDs (spec format: uuid). Settings are a direction union: apply branchName, promote baseBranchName + required createBranchOnPromotion. They are checked against the direction before any request.
  • CLI (internal/cli/promotion_environment.go): promotion environment list|get|create|update|delete|connect|disconnect and project list|add|remove. Flags, output, pagination (--all) and --input file|- work the same way as in promotion connection.
    • Read-only fields are dropped and named on stderr (Not sent (read-only): ...), so a get --output json document can be fed back: id, provider, checkout, createdAt, updatedAt, remote.repositoryPath. On update, scope and direction are dropped too, and the document's direction is used first to check the settings shape.
    • Confirmation: update, delete, disconnect and project remove prompt when interactive and refuse without --yes before any request. update --input - always needs --yes. connect (safe to repeat), create and project add don't prompt, the same as their connection equivalents.
    • Errors: scope mapping for every environment action, plus 409/422 messages specific to environments.
  • 404 hints: a bare 404 from environment commands says an instance older than 2.46 serves connections (n8n promotion connection). Connection commands say the reverse (n8n promotion environment). Only hint text is added; 503 handling and connection behaviour are unchanged.
  • promotion group help now covers environments for 2.46+ and connections for older instances. Docs regenerated.
  • Manifest: 10 ops flipped to implemented with command paths, availability untouched. deliveredThrough raised to 35.
  • Tests: client + CLI tests for every command, including zero requests on destructive refusal, read-only filtering on create/update, project-ID path escaping and the 404 hints in both directions. There is also a read-only integration test (list/get/project list) that skips without env.

Verification

  • make check passes locally (with the n8n 2.46.4 openapi.upstream.yml present; TestManifestMatchesSpec/upstream and TestPhaseCounts pass)
  • make docs run if CLI help changed (docs/README.md updated)
  • No secrets/keys/tokens in diff or logs
  • No v* tag or release commit in this PR (maintainer releases separately)

Notes for reviewer

  • Idempotency: the spec accepts Idempotency-Key on environment create/connect/project add, but their connection equivalents don't use --idempotency-key, so it isn't added here. Connect is idempotent anyway, and a duplicate create or link gets a 409.
  • update now prompts. This differs from connection update: an environment update can replace settings, which was the prompting config set in the connection model, and can leave the checkout stale.
  • I haven't tested against a live 2.46 instance; the integration test skips without env.

🤖 Generated with Claude Code

n8n 2.46 replaced /promotions/connections with /promotions/environments.
Add 'n8n promotion environment' list, get, create, update, delete,
connect, disconnect, and project list|add|remove for the 10 phase-35
operations. Connection commands are unchanged for older instances.

- Environment IDs are validated as UUIDs, settings against the direction,
  all before any request.
- create/update drop read-only fields from 'get --output json' documents
  (id, provider, checkout, timestamps, remote.repositoryPath; plus scope
  and direction on update) and name them on stderr.
- update, delete, disconnect, and project remove confirm; non-interactive
  runs need --yes, and update --input - always needs --yes.
- A bare 404 from environment commands hints at 'promotion connection'
  (pre-2.46); connection commands hint at 'promotion environment'.
- Manifest: phase 35 implemented; deliveredThrough raised to 35.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SomeoneWithOptions
SomeoneWithOptions merged commit 6f31093 into main Nov 4, 2026
5 checks passed
@SomeoneWithOptions
SomeoneWithOptions deleted the feat/promotion-environments branch November 4, 2026 03:28
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.

1 participant