Repository navigation
feat(package): add import-selection command for project packages - #35
Merged
Merged
Conversation
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
Upstream spec 1.1.1 adds
importPackageSelection(POST /n8n-packages/import-selection), a beta endpoint. Wherepackage importbrings in a whole package, this one picks individual workflows from one source project of a project package. The CLI had no command for it, and the manifest listed it asplannedin phase 30.Changes
n8n package import-selection(Track A):--file FILE|-,--project-id, repeatable--workflow-id/--delete-workflow-id,--workflow-conflict-policy,--workflow-id-policy,--overwrite-deletion-policy,--yes,--output.--delete-workflow-id.ImportPackageSelection:selectedWorkflowIdsis always sent as a JSON-encoded string array,[]for a delete-only run.deletedWorkflowIdsis sent only when non-empty.workflowIdPolicyis always sent, aspackage importdoes.workflow-removal-conflict).--overwrite-deletion-policywithout--delete-workflow-idis rejected.hard-deletegets a stronger prompt that says the deletion is permanent and takes executions with it.--file -requires--yes.workflow-removal-forbidden→ needsworkflow:delete.n8n package export --project-id.workflow:import, plusworkflow:deletewhen deleting.ImportPackageandImportPackageSelectionshare one multipart transport. Form fields are now written in sorted order, so the request body is the same on every run. The result rendering andnewImportBlockedError(path)are reused.importPackageSelectionis nowimplemented, anddeliveredThroughgoes from 29 to 30. Docs are regenerated.Verification
Spec-derived: everything about the request and response shape comes from
openapi.upstream.yml1.1.1 (~7489). That covers the field names, JSON-string arrays, enums, the 409/422 issue bodies, and the 400 for workflow packages.Not live-verified. No call was made against an instance.
Client httptest covers:
[]for delete-only, and unset fields left outCLI in-process tests cover refusal before transport,
--file -requiring--yes, input validation, the hard-delete prompt, error hints, and text/JSON output.Integration tests:
N8N_INTEGRATION_DESTRUCTIVE=1: creates ann8n-cli-test-project with two workflows and registers cleanup first. It exports the project, imports one workflow, archives the other, then re-runs through the CLI withskip. The test skips on 403/404/503.make checkpasses locally (after rebasing on fix: core resource spec drift (evaluation, workflow, credential, data-table, project, variable, folder) #33 and ci: skip checks for docs-only pull requests #34)go test -race -shuffle=on -count=1 ./...passesmake docsrun (newdocs/n8n_package_import-selection.md)No secrets/keys/tokens in diff or logs
No
v*tag or release commit in this PRNotes for reviewer
--workflow-idand--delete-workflow-idis refused locally. Under--workflow-id-policy sourcethe server answers 409 for it. Undernewthe server might accept it, but it's almost certainly a mistake. Easy to relax if we'd rather let the server decide.--workflow-conflict-policyis optional here (server defaultnew-version). It is required onpackage import. The prompt shows the default it will use.package import. The server enforcesN8N_ENDPOINTS_PAYLOAD_SIZE_MAX(16 MB by default).idempotencyKeyparameter on this op is left for the idempotency-key branch (12).TestPhaseCountsrequires phases to be delivered in order.🤖 Generated with Claude Code