caelum0x 34f6f846db fix(ritgram): forge-scope Repository uniqueness, add Rithub connect UI
Repository.fullName and (owner, name) were globally unique, so a GitHub
owner/name and a Gitea owner/name with the same path could never coexist
(plan §5.4 "Left"). Rescope both constraints to (forge, fullName) and
(forge, owner, name) in a new migration (20261113010000, additive-only,
no data loss) after 20261113000000_forge_connections, and update every
Prisma query that relied on the old global unique keys (findUnique/upsert
on fullName or owner_name) to the compound key.

Add the missing "Connect Rithub" UI in web settings: a token input next
to the existing GitHub connection, wired to the already-built
POST /api/v1/forges/gitea/connect endpoint via a new forgeService.ts.

Verified: tsc --noEmit clean (backend + web). Both migrations applied
cleanly end-to-end on a fresh local Postgres; a GitHub and a Gitea row
with the same owner/name now coexist (confirmed with a direct insert),
same-forge duplicates still rejected. Backend run locally against that
DB: live POST to git.ereboslab.com with an invalid token returns a clean
401 "Gitea rejected this token", no ForgeConnection row created.

Not applied to prod Neon: apps/ritgram/backend/.env's DATABASE_URL
password is rejected by the live server (confirmed via psql against
both the pooler and direct host — TCP reachable, password auth fails).
Needs an owner credential rotation before `prisma migrate deploy` can
run there.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-13 13:04:30 +03:00
..