Repository navigation
fix(package): support n8n 2.46.4 import changes - #42
Merged
Merged
Conversation
- 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/importandPOST /n8n-packages/import-selection. It adds no new operations and makes no manifest change. Promotion code is untouched.Changes
--credential-conflict-policyflag maps to the multipart fieldcredentialConflictPolicy. 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 thecredential:updatescope thatoverwriteandfailneed. The confirmation prompt warns whenoverwriteis set.ImportCredentials.Updatedmodelscredentials.updated. Text output now readsN 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 shows0 updated.ImportBlockingIssuenow decodes typed fields for the new variantsagent-conflict,agent-invalid,agent-dependency-unresolvedandagent-policy-violation(includingviolations[]). It also handles nullabletargetFolderIdandexistingParentFolderIdonworkflow-folder-conflict, and the new optionaltargetIdoncredential-policy-violation.Rawis still preserved, andMarshalJSONre-emits it verbatim.Blocking issues (N):on stderr with one line per issue, from the newImportBlockingIssue.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 scalarkey=valuepairs 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.--credential-conflict-policy. The 422 hint coverscredential-update-forbidden, and the 403 hint namescredential:update.make docsregenerateddocs/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:updatedpresent vs absent (pre-2.46), JSON round trip.TestImportBlockingIssueDescribe: each agent variant,workflow-folder-conflictwith a null and a non-null target,credential-policy-violationwith and withouttargetId, a known variant and an unknown variant rendered generically, an unknown variant with a conflicting field shape, verbatim re-marshal, and a check that nonullappears 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 keepsupdated.TestPackageImportToleratesAbsentCredentialsUpdated: import and import-selection against a pre-2.46 body.TestPackageImportSelectionReportsCredentialsUpdatedTestPackageImportBlockedListsIssues: import and import-selection × 409/422. Each new variant line, the null target folder and the unknown variant are checked; stdout stays empty.TestPackageImportReportsIncompleteCredentialsupdated for the new Credentials line.Verification
make checkpasses locally (exit 0, withopenapi.upstream.ymlfrom n8n@2.46.4 present)make docsrun if CLI help changed (docs/n8n_package_import.md updated)v*tag or release commit in this PR (maintainer releases separately)Notes for reviewer
importResultDto.generatedandimportBlockingIssue.generatedbetween 2.45.7 and 2.46.4. The only request-body change on these two operations iscredentialConflictPolicyon import. Thecredential-conflictandcredential-update-forbiddenvariants already existed in 2.45.7, so they use the generic renderer.Credentials:text line changed shape (newupdatedcount). Anything parsing it should use--output json.🤖 Generated with Claude Code