Skip to content

feat(API): Add instance-level Git connection settings (no-changelog) - #36910

Draft
ireneea wants to merge 18 commits into
masterfrom
ligo-1020-support-instance-git-connection
Draft

feat(API): Add instance-level Git connection settings (no-changelog)#36910
ireneea wants to merge 18 commits into
masterfrom
ligo-1020-support-instance-git-connection

Conversation

@ireneea

@ireneea ireneea commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an instance-level Git connection: a settings-backed singleton (mirroring the per-project GitConnection shape plus an enabled toggle) exposed via two public API endpoints, GET and PUT /api/v1/instance-git-settings. The settings default to a disabled, empty connection and are readable before ever being configured; secrets are stored encrypted and never returned. The endpoints are gated behind the git-connections module, the GIT_CONNECTIONS license feature, and gitConnection:read/gitConnection:update scopes. This also extracts the shared Git connection auth logic (SSH key generation / HTTPS credential handling) into git-connections-auth.utils.ts so the project and instance services delegate to one implementation, and adds n8n-cli git-connections instance get/set commands.

How to test

  1. Boot an instance with the module and license enabled: N8N_ENABLED_MODULES=git-connections plus a license granting the GIT_CONNECTIONS feature.
  2. With an API key holding gitConnection:read, call GET /api/v1/instance-git-settings — expect a disabled, empty connection.
  3. With gitConnection:update, PUT a partial body (e.g. repositoryUrl, branchName, connectionType) and confirm the response reflects the update with secrets omitted; enabling requires a fully configured connection, and an empty body is rejected.
  4. Covered by the added service, controller, and public-API integration tests.

Related Linear tickets, Github issues, and Community forum posts

https://linear.app/n8n/issue/LIGO-1020

Review / Merge checklist

  • I have seen this code, I have run this code, and I take responsibility for this code.
  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with Backport to Beta, Backport to Stable, or Backport to v1 (if the PR is an urgent fix that needs to be backported)

🤖 PR Summary generated by AI

Review in cubic

ireneea and others added 5 commits August 24, 2026 11:27
Add a settings-backed singleton instance Git connection in the
git-connections module, stored under the features.gitConnections.instance
settings key. Same shape as a project connection minus name, plus an
enabled toggle, with inline encrypted secrets.

Expose it via GET/PUT /instance-git-settings (public API) and
git-connections instance get/set (CLI). Enabling requires a fully valid
configuration; disabling retains the config.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ettings DTO (no-changelog)

Export repositoryUrlSchema and branchNameSchema from git-connections.dto
instead of re-declaring them, and drop a stray blank line in the CLI client.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…test (no-changelog)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…nstance services (no-changelog)

Extract applyAuthenticationUpdate and validateHttpsCredentials into
git-connections-auth.utils.ts. Both services now delegate to it, and the
entity create path reuses the update path with an empty starting state.
Also validate the target URL and branch before applying auth in the
instance service, so invalid input fails fast instead of generating a
throwaway SSH key pair.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ngelog)

- Reject a repository URL when no connection type is set, so an
  unvalidated (and unusable) URL is never persisted.
- Persist the singleton via an atomic upsert to avoid a primary-key
  race on concurrent first writes, and raise OperationalError (not
  UnexpectedError) on a failed write.
- Share the auth deps adapter between the project and instance services
  via a gitAuthDeps factory.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@n8n-assistant

n8n-assistant Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

PR review overview

Based on ownership of the 22 changed files in this PR:

Ownership Files owned Share Source code Test files Misc
@n8n-io/catalysts 11 50% +400 / -82 +631 / -0 +0 / -0
@n8n-io/ligo 7 32% +200 / -0 +60 / -0 +0 / -0
@n8n-io/adore 4 18% +48 / -0 +0 / -0 +0 / -0
Total 22 100% +648 / -82 +691 / -0 +0 / -0

@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 17.64kB (0.03%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
editor-ui-esm 63.05MB 17.64kB (0.03%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: editor-ui-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/src-*.js 3.57kB 3.34MB 0.11%
assets/src-*.js 376 bytes 794.12kB 0.05%
assets/worker-*.js -3.2MB 18.44kB -99.43%
assets/worker-*.js 3.2MB 3.21MB 17334.42% ⚠️
assets/ParameterInputList-*.js 553 bytes 1.47MB 0.04%
assets/workflows.store-*.js 4.47kB 827.13kB 0.54%
assets/AgentBuilderView-*.js -32 bytes 784.36kB -0.0%
assets/InstanceAiThreadView-*.js -16 bytes 594.86kB -0.0%
assets/NodeView-*.js -8 bytes 339.85kB -0.0%
assets/markdown-*.js -3.64kB 263.31kB -1.36%
assets/WorkflowsView-*.js 40 bytes 242.44kB 0.02%
assets/router-*.js 635 bytes 157.42kB 0.41%
assets/useCanvasOperations-*.js 66 bytes 150.04kB 0.04%
assets/NodeSettings-*.js 1 bytes 145.37kB 0.0%
assets/builder.store-*.js 30 bytes 111.75kB 0.03%
assets/agents.eventBus-*.js -8 bytes 99.72kB -0.01%
assets/CanvasRunWorkflowButton-*.js 222 bytes 97.09kB 0.23%
assets/AgentToolConfigModal-*.js 9.56kB 76.25kB 14.33% ⚠️
assets/TestRunDetailView-*.css 16 bytes 74.59kB 0.02%
assets/AgentToolConfigModal-*.css 481 bytes 54.48kB 0.89%
assets/ExecutionsView-*.js 47 bytes 46.66kB 0.1%
assets/ui.store-*.js 160 bytes 40.72kB 0.39%
assets/AgentVectorStoresModal-*.js -8 bytes 34.51kB -0.02%
assets/ChatLayout-*.js -8 bytes 7.06kB -0.11%
assets/CredentialsView-*.js 40 bytes 31.35kB 0.13%
assets/ProjectVariables-*.js 40 bytes 22.91kB 0.17%
assets/AgentsListView-*.js 40 bytes 20.76kB 0.19%
assets/NodeToolSettingsContent-*.js -8 bytes 18.02kB -0.04%
assets/DataTableView-*.js 40 bytes 16.86kB 0.24%
assets/useWorkflowInitialization-*.js -8 bytes 14.9kB -0.05%
assets/useCredentialOAuth-*.js 495 bytes 12.76kB 4.04%
assets/useMcpServerAdapter-*.js 156 bytes 12.26kB 1.29%
assets/usePostMessageHandler-*.js -8 bytes 9.01kB -0.09%
assets/insights.store-*.js -3.37kB 99 bytes -97.14%
assets/insights.store-*.js (New) 3.47kB 3.47kB 100.0% 🚀
assets/insights-*.js (New) 79 bytes 79 bytes 100.0% 🚀
assets/insights-*.js (New) 172 bytes 172 bytes 100.0% 🚀

@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.66667% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...-connections.ee/instance-git-connection.service.ts 82.97% 4 Missing and 4 partials ⚠️
...ules/git-connections.ee/git-connections.service.ts 75.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

… settings DTOs (no-changelog)

Compose the instance Git settings DTOs from the connection DTOs instead of
restating their fields: extract a shared optional-fields shape for the update
DTOs, and derive the instance public schema from the connection public schema
via omit/extend.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ireneea
ireneea force-pushed the ligo-1020-support-instance-git-connection branch from 769c9a9 to 247d0d7 Compare August 24, 2026 10:56
@n8n-assistant n8n-assistant Bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Aug 24, 2026
ireneea and others added 12 commits August 24, 2026 12:06
…references (no-changelog)

Compose InstanceGitConnectionPreferences from the shared GitAuthMaterial type
and seed its defaults from emptyGitAuthMaterial(), removing the duplicated auth
field declarations and their default values.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…n (no-changelog)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… in place

Convert applyAuthenticationUpdate into computeAuthenticationUpdate, which
returns a GitAuthResult with a non-nullable connectionType. Callers apply the
result with Object.assign, so the compiler now forbids writing null into the
entity's non-nullable connectionType column while still supporting the nullable
instance-settings caller. Behavior is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…hangelog)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…no-changelog)

Construct the auth deps inline where computeAuthenticationUpdate is called
rather than holding them in a field initializer that reads constructor
parameter properties. The two-closure object is cheap to build per call and
this drops the initialization-order dependency on the compile target.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…gelog)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…on (no-changelog)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…no-changelog)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ngelog)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…on (no-changelog)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant