Skip to content

fix(promotion): report blocked applies and accept gitlab providers - #28

Merged
SomeoneWithOptions merged 1 commit into
mainfrom
fix/promotion-apply-status
Oct 21, 2026
Merged

SomeoneWithOptions merged 1 commit into
mainfrom
fix/promotion-apply-status

Conversation

@SomeoneWithOptions

Copy link
Copy Markdown
Owner

Fixes drift between the n8n promotion commands and the upstream n8n Public API spec 1.1.1. The worst case: before this change, promotion apply printed Applied: <id> and exited 0 even when the server answered blocked and wrote nothing.

Apply status (breaking fix)

  • ApplyPromotionResult now models the applyPackageResultDto union on status:
    • applied: counts and warnings.
    • blocked: preflight with missing projects, missing bindings, access requirements, conflicts and warnings. Nothing was written.
    • source-changed: neither. Nothing was written.
  • An unknown status is kept as sent, so the decode never fails. A response without status but with counts (older servers) is treated as applied.
  • The result keeps the raw response and re-emits it, so --output json is lossless, unknown fields and variants included. Unknown top-level fields are also exposed in Extra. Preflight items use the ImportBlockingIssue pattern: a typed view plus the verbatim document.
  • New exit codes: 0 applied, 3 blocked, 4 source-changed, 1 an unknown status or any other error. Stdout always carries the full result. The new promotionApplyStoppedError is reported without the usage hint.
  • Text output for blocked lists the items by group, with project-deletion and destructive-change conflicts called out. Stderr says nothing was applied and prints the expected source (configId, branchName, commitSha) for continuing later. The continue command is worded as upcoming (feat(workflow): add workflow copy command #10).
  • PromotionExpectedSource (with commitSha validation) and ApplyPromotionResult.ExpectedSource() are added for feat(workflow): add workflow copy command #10 to reuse.
  • promotePackageResultDto was checked and has no drift.

GitLab providers

  • Provider type gitlab is accepted. config{schemaVersion, baseUrl} is accepted on create and update. A base URL must be an absolute http(s) URL, and config on a git provider is rejected locally.
  • Token auth requires username only on git providers; GitLab ignores it. Update can't know the provider type, so it leaves that check to the server.
  • provider create can now be built from flags: --name, --type, --base-url, --auth-type, --key-type, --username, --password-stdin. These can't be combined with --input. The token never goes in argv: it comes from a no-echo prompt or from stdin, and the document is validated before the prompt.

Read fields that were dropped

  • Provider config.baseUrl, connection target.repositoryPath, each config's checkout{hasCheckout, matchesConfig} (on connection get and config upserts), and apply dataTables.updated are now kept.
  • The connection target is split into a read model (PromotionTarget) and a write document (PromotionTargetDocument). repositoryPath is never sent, and --input containing it is rejected locally with a "read-only" message.
  • Text output shows the provider base URL, the connection repository path, and each direction's checkout state.

Non-breaking

  • gitConnection:discover scope entry for feat(workflow): add workflow copy command #10's repository listing.
  • 404 handling:
    • a 404 with a resource-specific message names the missing provider, connection or project;
    • a bare or generic 404 on an ID route names both causes (missing ID or module not served);
    • a 404 on a collection route keeps the module diagnostic.
  • Provider update 409 now explains the concurrent-change race.
  • Help fix: promote runs on the instance connection and ignores personal projects, so project links don't select what is promoted (needs variable:list when workflows use variables). The project group help now says links are for projects-scope connections.
  • Not in scope: Idempotency-Key (chore(release): clarify tag-on-main guard and feat-only curation #12) and the continue/project-selection commands (feat(workflow): add workflow copy command #10).

Verification

  • Spec-derived (openapi.upstream.yml 1.1.1): every change above. The spec has no example responses or 404 bodies, so the fixtures are built from the schema. The rule for telling a missing ID from a missing route is a guess at what an unmounted route returns.
  • Live-verified: none. Promotions are not licensed on automate.vineskills.com (403).
  • make docs && make check green. go test -race -shuffle=on green for cli/n8n/coverage.

🤖 Generated with Claude Code

@SomeoneWithOptions
SomeoneWithOptions merged commit 8a2683e into main Oct 21, 2026
4 checks passed
@SomeoneWithOptions
SomeoneWithOptions deleted the fix/promotion-apply-status branch October 21, 2026 23:02
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