Move forge connect onto shared engine

Task 13369 · Running · Coder · created · updated

## Original requirement (verbatim, epic 13348) Deep research all third party integrations in Lovable (Connect) and implement all of them. Ensure the highest level of code reuse, abstract out any generic code across all integrations. Users need an easy way to connect. Documentation must be as detailed as in Lovable or better. If something needs to be done on the partner website (e.g. register an app) and it can only be done by human create a follow up task per third party with exact step by step of what user needs to do). Mark it as user only task to set up but the runner will validate it was done correctly. You can refactor anything to make working with creds more robust. ## Settled inputs Full PRD and architecture: the epic's `prd` and `architecture` artifacts (Task 13348 BA, Task 13349 Architect). Section numbers below (§3.2 item 6, AC2.3, …) refer to them. They are settled: realize them, do not reopen them. Operator decisions O1–O6 and D1–D8 bind. ## This child's scope C6, architecture §6 forges row (GitHub, GitLab, Bitbucket, Azure DevOps). - Connect via `/api/integrations/{slug}/connect/start` on the shared engine; `forge_oauth.FORGE_OAUTH` keeps only forge extras (installation discovery), exposed as `OAuthProvider.on_grant = forge_oauth.on_grant` (installation discovery + `user_git_connections`). `user_git_connections` stays as the per-user git routing pointer. - No secret move. The `needs_reconnect_at` back-fill already ran in C1's revision (no migration in this child); readers read the column; during the overlap release the `grant_dead_at` config key is still written. - Old start routes (`routes/forge_connect.py`, `routes/git_connect.py`) 307 to the new one for one release (deletion is the final retirement child, not this one). - Callback compatibility: the redirect URI already registered at the vendor for this flow must keep working (route it into the shared callback handler) so the move needs NO partner-site change; if a vendor-side change is unavoidable, say so in the PR and report so a human setup task can be filed. - `components/GitConnectionsCard.tsx` keeps working (the retirement child turns it into a link). Security surface: autonomous security review lane. Credentials & reach: - Live Test on dev for Stripe, n8n, Jira, AWS, GitHub, Figma: `me/jaah/debug/stripe-dev`, `org/n8n`, `org/atlassian`, `org/aws`, `me/users/roman@gmind.tech/github`, `me/figma` — verified (credential_get succeeded for each) - Unit tests, `./dc check quick`, `tools/check_context.py` — verified (no credential) Out of scope (PRD §6, verbatim, plus what NOT to touch): - No app-user connectors (per-end-user OAuth, connector gateway for published apps). - No "Managed by Jaah" vendor keys or credit billing; no change to `apps/api/app/billing/`. - No per-vendor API client libraries or MCP tool wrappers built by Jaah (except where the vendor's own hosted MCP server is the connector). - No Lovable action-approval UI (allow once/always). - No change to runner auth to model providers (`account_auth.py`, `Account` table) or to login/sign-in OAuth (`routes/login_oauth.py`). - No change to NodeVault crypto semantics (`credential_crypto.py` encryption tiers) beyond what a refactor needs to keep behaviour identical. - Do not break existing rows: every existing credential type and every existing row keeps working; migrations additive (two-release overlap rule). - Supabase/project-backend and git-sync are not new work; Figma plugin/.fig upload out. - Never write a credential value into a task, doc, log or PR. - Do NOT file Tasks (no licence): the human-only OAuth registration tasks are filed outside this child. Done means: - AC1.3 (forges) The forges' credential-filling connect paths run on the shared engine. — `grep` for per-forge authorize/exchange code outside the shared engine + `forge_oauth.on_grant` returns only the paths the architecture lists as exceptions; unit test drives a GitHub and a GitLab connect through the shared start/callback, creating the credential and `user_git_connections`. - Old start routes answer 307 to the shared start — unit test. - Forge readers use `needs_reconnect_at` — unit test; existing forge rows keep working (existing forge test suites pass). - On dev after deploy: the existing GitHub roster connection (`me/users/roman@gmind.tech/github`) still passes Test — cite the observed result. - AC1.5 `./dc check quick` green and `tools/check_context.py` green on this PR — the gate output cited in the PR body.

Outcome

Pull request

Activity

  • Draft
  • Ready
  • Runner started