Skip to content

[Refactor] Centralize integration lifecycle transitions - #1651

Draft
roomote-roomote[bot] wants to merge 4 commits into
developfrom
feature/centralize-integration-lifecycle-3qpjsymccxrvu
Draft

[Refactor] Centralize integration lifecycle transitions#1651
roomote-roomote[bot] wants to merge 4 commits into
developfrom
feature/centralize-integration-lifecycle-3qpjsymccxrvu

Conversation

@roomote-roomote

@roomote-roomote roomote-roomote Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

​Created by Roomote. View the task or mention @roomote-roomote for follow-up asks.

What changed

  • Added one persistence-owned path for authenticated deployment MCP connections, deployment enablement transitions, and lifecycle telemetry.
  • Routed all nine credential-backed integration saves and OAuth enablement through the shared transition logic while keeping provider-specific validation and credential shaping local.
  • Removed duplicate Linear OAuth enablement writes and reused the same connected/enabled event emitter for OAuth and custom MCP connection completion.
  • Made deployment disables atomic and ordered their connection and enablement writes consistently with credential saves.
  • Added regression coverage for independent connection and enablement transitions.
  • Scoped Brain backfill idempotency coverage to per-run uniqueness so unrelated completed runs from parallel test workers cannot cause false failures.

Why this change was made

Connection persistence previously calculated and emitted the same lifecycle transitions in multiple provider commands and OAuth paths. Centralizing that ownership reduces duplication and prevents integrations from drifting into inconsistent telemetry behavior.

Impact

There is no intended user-facing behavior change. Integration connection and enablement events now reflect independently persisted state transitions, concurrent saves and disables cannot leave an enabled integration without its connection, and the Test CI check no longer depends on a global insert count that parallel workers can change. The main MCP command module is also substantially smaller.

@roomote-community

roomote-community Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

No new code issues found. See task

  • apps/web/src/lib/server/deployment-mcp-connection.ts:178 credential saves and deployment disables acquire row locks in reverse order, allowing a deadlock.

Reviewed b0431c6

Comment thread apps/web/src/lib/server/deployment-mcp-connection.ts
@roomote-roomote

roomote-roomote Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

Resolved in b0431c6: Brain backfill idempotency now checks per-run uniqueness instead of a global insert count that parallel test workers can change, and the follow-up shared-database stress assertion was removed after it proved similarly cross-worker-sensitive. Replacement CI run 32868922402 passed, including the Test job.

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.

2 participants