Skip to content

fix(package): support n8n 2.46.4 import changes - #42

Merged
SomeoneWithOptions merged 1 commit into
mainfrom
fix/package-import-2.46.4
Nov 4, 2026
Merged

SomeoneWithOptions merged 1 commit into
mainfrom
fix/package-import-2.46.4

Conversation

@SomeoneWithOptions

Copy link
Copy Markdown
Owner

What / why

Fixes schema drift between the n8n Public API 2.45.7 and stable 2.46.4 for the two existing package import operations, POST /n8n-packages/import and POST /n8n-packages/import-selection. It adds no new operations and makes no manifest change. Promotion code is untouched.

Changes

  • import request: new --credential-conflict-policy flag maps to the multipart field credentialConflictPolicy. Accepted values come from the spec: keep-existing, overwrite, fail. The value is checked locally before any request, and the field is left out when the flag is unset so older instances keep working. Help text explains each value and the credential:update scope that overwrite and fail need. The confirmation prompt warns when overwrite is set.
  • import + import-selection response: ImportCredentials.Updated models credentials.updated. Text output now reads N matched, N updated, N stubbed, N seeded, N incomplete, and a stderr note lists the target IDs of overwritten credentials. JSON keeps the field verbatim. When an older instance leaves the field out, it decodes as nil and shows 0 updated.
  • 409/422 issues: ImportBlockingIssue now decodes typed fields for the new variants agent-conflict, agent-invalid, agent-dependency-unresolved and agent-policy-violation (including violations[]). It also handles nullable targetFolderId and existingParentFolderId on workflow-folder-conflict, and the new optional targetId on credential-policy-violation. Raw is still preserved, and MarshalJSON re-emits it verbatim.
  • Issue rendering: before this change only the issue types appeared, inside the error message. Now both commands print Blocking issues (N): on stderr with one line per issue, from the new ImportBlockingIssue.Describe(). The new and changed variants get a sentence each, and a null folder reads as "the project root". Every other type, including unknown future ones, is shown as sorted scalar key=value pairs from the raw document. If a field in an unknown variant has an unexpected shape, decoding falls back to the type alone instead of failing.
  • Error hints: the 409 import hint now lists --credential-conflict-policy. The 422 hint covers credential-update-forbidden, and the 403 hint names credential:update.
  • make docs regenerated docs/n8n_package_import.md.

Tests

Client (internal/n8n/n8n_package_test.go):

  • TestImportPackageCredentialConflictPolicy: each enum value is sent, the field is omitted when unset, and a bad value is rejected with zero requests.
  • TestImportPackageResultCredentialsUpdated: updated present vs absent (pre-2.46), JSON round trip.
  • TestImportBlockingIssueDescribe: each agent variant, workflow-folder-conflict with a null and a non-null target, credential-policy-violation with and without targetId, a known variant and an unknown variant rendered generically, an unknown variant with a conflicting field shape, verbatim re-marshal, and a check that no null appears in the output.
  • TestImportPackageBlockedDecodesNewIssues: 409 and 422 decode the new fields.

CLI (internal/cli/n8n_package_test.go):

  • TestPackageImportCredentialConflictPolicy: bad enum rejected before any request, overwrite prompt warning, field sent / omitted, text output and stderr note, JSON keeps updated.
  • TestPackageImportToleratesAbsentCredentialsUpdated: import and import-selection against a pre-2.46 body.
  • TestPackageImportSelectionReportsCredentialsUpdated
  • TestPackageImportBlockedListsIssues: import and import-selection × 409/422. Each new variant line, the null target folder and the unknown variant are checked; stdout stays empty.
  • Existing TestPackageImportReportsIncompleteCredentials updated for the new Credentials line.

Verification

  • make check passes locally (exit 0, with openapi.upstream.yml from n8n@2.46.4 present)
  • make docs run if CLI help changed (docs/n8n_package_import.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

  • The spec diff was done on importResultDto.generated and importBlockingIssue.generated between 2.45.7 and 2.46.4. The only request-body change on these two operations is credentialConflictPolicy on import. The credential-conflict and credential-update-forbidden variants already existed in 2.45.7, so they use the generic renderer.
  • The Credentials: text line changed shape (new updated count). Anything parsing it should use --output json.

🤖 Generated with Claude Code

- import: add --credential-conflict-policy (keep-existing, overwrite,
  fail), validated locally and omitted when unset.
- import and import-selection: model credentials.updated (absent on
  older instances), show it in text output, keep it in JSON.
- Blocking issues: model agent-conflict, agent-invalid,
  agent-dependency-unresolved, agent-policy-violation, nullable
  workflow-folder-conflict targetFolderId, and credential-policy-violation
  targetId; list every issue on stderr, unknown types generically.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SomeoneWithOptions
SomeoneWithOptions merged commit 40e3278 into main Nov 4, 2026
5 checks passed
@SomeoneWithOptions
SomeoneWithOptions deleted the fix/package-import-2.46.4 branch November 4, 2026 02:40
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