Found during a full new-user walkthrough (signup -> import -> clone -> push
-> PR -> merge -> issue -> CI -> Ritgram connect -> link repo -> post):
- apps/gitea/custom/options/locale/locale_en-US.ini: the Actions tab's
empty-state ("There are no workflows yet") said "Gitea Actions" twice,
user-facing on every repo with no workflow yet. Now says "Rithub Actions".
- Ritgram's "Continue with Rithub" OAuth login/register buttons requested
scope=read:user only, so GET /forges/gitea/repos 500'd for every connected
user ("token does not have at least one of required scope(s),
required=[read:repository]"). Added read:repository to the authorize URL
in both login/page.tsx and register/page.tsx.
- RepoLinker's "My Repos" tab called githubService.getProjects() only, so a
Rithub-only user's own repos never appeared (My Repos (0) even with a real
repo). Now reads forgeService.list()'s connected forges and merges
forgeService.myRepos() (the existing GET /forges/:forge/repos endpoint,
already implemented backend-side but never called from the web app) with
the GitHub path.
- repositoryRouting.ts's parseRepositoryInput only recognized github.com
URLs, so pasting a real rithub.dev repo URL into the repo picker fell
through to "No repositories match your search." Now recognizes rithub.dev
(and git@rithub.dev: SSH) the same way as github.com.
- repositoryService.ts's searchRepositories() merged the cached DB with a
live GitHub search only; a brand-new, never-cached Rithub repo was
unsearchable by name. Wired in the Gitea adapter's already-built
searchRepos() as a third live source, same pattern as the GitHub one.
Verified live: Actions empty-state now says "Rithub Actions" (0 "Gitea"
text) on a fresh repo; backend tsc --noEmit and web tsc --noEmit both clean.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Owner rule: say Rithub, never Gitea. /docs/rit, /docs/rithub-vs-gitlab and
/docs/rithub-vs-codeberg named the upstream engine "Gitea" 6 times total.
Kept exactly one plain upstream-license attribution line (Gitea is
MIT-licensed, on /docs/rit, the dedicated "what runs rithub.dev" page) and
rewrote every other mention to say Rithub instead (including "Gitea
Actions" -> "Rithub Actions").
Scoped to these 3 files only -- apps/ritgram/web has other agents' WIP
(feed, onboarding, ContentComposer, middleware, api.ts) left untouched.
Account.followers/following and User.followers/following were labeled
backwards relative to what they actually return: the "followers" field
on each model was the back-relation for the FK column that makes *this*
row the follower (i.e. "who I follow"), and "following" was the
back-relation for the FK column that makes this row the target (i.e.
"who follows me") -- exactly inverted from their names.
Swap just the two field names on each model (relation tags, FK columns,
and the Follow model's own follower/following fields are untouched, so
this needs zero DB migration). This fixes every _count.select.followers/
following read across router.ts, social.ts, resolvers.ts, adminController,
searchController, popularController, socialGraphService,
trendingRankingService, fakeAccountDetectionService, etc. in one place --
all profile header counts, followers/following list pages, and REST/
tRPC/GraphQL responses were pulling the inverted number.
followService.ts and the tRPC getFollowers/getFollowing procedures
already bypass these relations (query Follow directly by followerUserId/
followingUserId), so they were already correct and are unaffected.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The already-shipped follow fix (userController.ts, commit 21acdbaa) only
covered one of five real call paths for the same Follow.followerId/
followingId-is-an-Account-FK-not-a-User-id bug:
- socialController.ts's parallel POST/DELETE /api/v1/social/follow/:userId
(plus its getUserFollowers/getUserFollowing, which filtered the
Account-keyed followingId/followerId columns with a User id and
silently matched nothing).
- trpc/routers/social.ts's follow.followUser/unfollowUser/getFollowers/
getFollowing (same write bug, same silently-wrong reads, plus
getFollowers/getFollowing returned Account rows as if they were User
rows -- different id space than every other User-facing endpoint).
- trpc/router.ts's own separate users.follow mutation and users.profile's
isFollowing check (yet another independent copy of the same bug,
found via a full grep sweep, not mentioned in the prior session's
"not reachable" list).
- graphql/resolvers.ts's followUser mutation.
- services/githubSyncService.ts's syncAndAutoFollow -- wired to a real,
reachable, authenticated route (POST /api/v1/github/social/sync-follows)
that writes raw User ids into the Account-keyed FK columns via
createMany; would FK-violate for any real user who links GitHub and
has GitHub followers already on Ritgram. Fixed to resolve real Account
rows for both sides before writing, same as the other paths.
None of socialController/trpc/graphql are called by the live Next.js web
client (re-confirmed via grep across apps/ritgram/web, same finding as
the prior session), so this was latent rather than user-visible -- but
they are reachable API routes with the same 500, and githubSyncService's
route specifically is both reachable and silently broken for any real
GitHub-linked user.
Added services/followService.ts as the single shared implementation
(followUser/unfollowUser/isFollowing/listFollowers/listFollowing) and
routed every one of the above call sites through it, including
userController.ts's already-shipped handlers -- so there is now exactly
one place this fix lives instead of five independent copies.
tsc --noEmit clean.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
followUser/getFollowers/getFollowing/getUser's isFollowing check all wrote
and read Follow.followerId/followingId as if they held User ids, but the
Prisma schema's FK for those two required columns actually targets
Account.id. Every real follow attempt threw
"Foreign key constraint violated: Follow_followerId_fkey" and 500'd
(confirmed live with a fresh mail.tm test account against caelum0x;
confirmed via `select count(*) from "Follow"` = 0 in production).
Every *other* consumer of this table (feed ranking, recommendations,
trending, activity feed, analytics, blocking, data export, muted words,
GitHub activity sync) already reads the schema's parallel
followerUserId/followingUserId columns, which are User-keyed and nullable
-- so even a hypothetical accidental FK match would still have been
invisible to the rest of the app.
Fix: followUser now resolves both sides' Accounts (same pattern already
used in createPost/addComment) to satisfy the required followerId/
followingId FK, and also writes followerUserId/followingUserId so the row
is visible to every User-keyed reader. getFollowers/getFollowing/getUser
switched to query the followerUserId_followingUserId compound unique key
instead. Added the missing `DELETE /api/v1/users/:id/follow` route +
unfollowUser handler -- the web client's userService.unfollow() has always
called DELETE, which 404'd (no such route existed; follow was only ever a
POST toggle).
Not touched, flagged instead: socialController.ts's parallel
`/api/v1/social/follow/:userId` (POST/DELETE) and the tRPC (`/trpc`) and
GraphQL follow mutations have the exact same followerId/followingId-as-
User-id bug. None of them are called by the live Next.js web client
(confirmed via grep across apps/ritgram/web) so they're not part of the
live product surface, but they are reachable API routes with the same
latent 500 -- worth a dedicated follow-up pass.
tsc --noEmit clean.
- createCommentValidator had the same .escape() bug already fixed in
createPostValidator (0ec2f661) for post content: HTML-entity-escaped
literal "/" in comment URLs. Comment renderers (CommentThread.tsx via
linkifyText, RealTimeComments.tsx via plain JSX) never use
dangerouslySetInnerHTML, so React's own escaping is the real XSS guard;
removed .escape() to stop mangling comment URLs.
- DELETE /api/v1/auth/account 500s when the request has no
Content-Type: application/json body (req.body is undefined, not {},
so destructuring `password` off it throws). Guard with `req.body || {}`.
- The post-edit UI (/posts/:id/edit, linked from every post's own detail
page) called `PUT /api/v1/posts/:id`, which never existed on the
backend (404) -- a real public-facing stub. Added updatePostValidator,
postController.updatePost (content/hashtags/repositoryId, regenerates
link previews, replaces hashtag links) and the route, reusing the same
requireOwnershipOrRole('Post') middleware deletePost already uses.
tsc --noEmit clean.
- postValidator: drop .escape() from createPost's content rule (was turning
every literal "/" in a URL into /, so link detection and link previews
silently never fired on any post containing a link). React already escapes
rendered text; PostCard never uses dangerouslySetInnerHTML for post content.
- compose/edit live-preview panes DO use dangerouslySetInnerHTML for their
markdown preview and relied on the backend .escape() as their only XSS
guard -- added an explicit &/</> escape before any markdown transform so
removing .escape() doesn't open that up.
- linkify.tsx: linkifyText only matched @mention/#hashtag; added a URL pass
(same regex as extractUrls.ts) so bare https:// URLs render as a real
<a target="_blank">, with mention/hashtag matching skipping any range a URL
already claimed.
- Profile Posts tab called a route that doesn't exist
(GET /users/:username/posts, 404 on every profile). Added real
username/userId filtering to postController.getPosts (it previously ignored
both query params entirely) and pointed both frontend callers
(profileApi.ts's fetchUserPosts, ProfileTabs.tsx's dead-code twin) at
GET /v1/posts?username=. Switched ProfileTabs' infinite-scroll fetcher from
a cursor param the backend never returned to real page-based pagination.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Rithub: desktop keeps the 12-link SEO footer unchanged; <=640px now
shows a short 5-link footer (Explore, Sign up, Move from GitHub,
Rithub vs GitHub, Is GitHub down?) instead of the full keyword list,
which read as spam stacked above the mobile tab bar. All 5 links
verified 200. SEO guides stay crawlable via sitemap-seo.xml.
- Mobile bottom tab bar was already fixed-position with safe-area
padding and body bottom-padding (shipped in a0b4c089) -- verified
still correct live at 390px, nothing to change there.
- Ritgram: wired the real uploaded OG card
(https://assets.scribase.com/cards/ritgram-og-1200x630-1117b.png,
verified 200 image/png 1200x630) into root layout.tsx's openGraph +
twitter metadata, replacing the placeholder blue-"R" dynamic
app/opengraph-image.tsx route (deleted) and the dead /og-image.png
reference.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Ritgram's "Continue with Rithub" authorize-URL builder never sent a
&scope= param, so Gitea's consent screen warned new signups it would
"access and write to all your account information, including private
repos and organisations" for what's meant to be a lightweight SSO
button — a real trust/conversion hit on the primary signup CTA.
Pinned by an earlier same-day session (plans/railyard.md) to the
exact two lines; apps/ritgram was off-limits then, free now.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Apple design (plans/gtm/APPLE-DESIGN-RULES-2026-11-17.md): rewrote theme
tokens in globals.css/tailwind.config.js to neutral black/white + one
accent (#0071E3), replacing the GitHub-dark blue+green dual-accent theme;
mechanically swept every raw inline hex/rgba literal across app/components
that bypassed the CSS vars (506 hex + 326 rgb(a) replacements) since most
of the app hardcoded colors rather than using tokens; removed all emoji,
decorative gradients (Tailwind bg-gradient-to-* and raw linear/radial-
gradient() in inline styles), confetti, and glow/blur decorative orbs;
converted Navbar/Navigation to icon-only with aria-label+title. Finished
two stopped agents' in-progress work: deleted the fake AnimatedStats/
LiveActivity/ProjectShowcase/Testimonials auth-panel components and
cleaned up the emoji-laden feature list in (auth)/layout.tsx. Removed
remaining fabricated stats (topics/topics/[slug] posts-per-week/
contributors/followers) per the no-fake-numbers rule.
Rithub sign-in: added "Continue with Rithub" as an icon-only OAuth2
button (RithubMark component) on login/register, hidden "Continue with
GitHub" when GITHUB_CLIENT_ID is unset (confirmed unset in prod). Backend:
authenticateWithGitea in oauthService.ts exchanges the Gitea OAuth2 code,
resolves identity via the existing ForgeConnection table (no schema
migration needed), issues the same JWT/session as GitHub/Google login.
OAuth2 app created live on rithub.dev via its REST API as admin user
caelum0x; client id/secret stored in railyard-box's compose file (env
files don't ship to the runtime image, so the actual wiring lives in
docker-compose.yml, not backend/.env) and in ~/products/.env.
Critical bug found and fixed while verifying: services/api.ts's global
401 interceptor redirected every anonymous visitor to /login a couple
seconds after ANY page load -- including /login and /register themselves
-- because the AuthBootstrap's background GET /auth/me (expected to 401
for signed-out visitors) was treated the same as a real session-expiry
401, triggering a refresh attempt, another 401, and a hard
window.location.href redirect, which re-ran AuthBootstrap and repeated.
Fixed by excluding /auth/me and /auth/refresh from that redirect path.
Verified live with a fresh, cookie-less browser: previously looped
/register -> /login forever; now stable after 6s.
Also fixed: production CORS/API origin mismatch -- the frontend was
built with NEXT_PUBLIC_API_URL pointing at ritgram.ereboslab.com while
served from ritgram.rithub.dev, so every API call (login, register, etc.)
was blocked by CORS; rebuilt with rithub.dev as canonical and CORS_ORIGIN
allowing both domains.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Three unauthenticated/cross-user PII leaks found and fixed before PH launch:
- GET /api/v1/accounts/:username (fully public, no auth middleware) returned
the full User row including bcrypt password hash, twoFactorSecret and
githubAccessToken via an unscoped `user: true` Prisma include.
- GET /api/v1/users/:username leaked any user's real email to unauthenticated
callers; email is now only attached when viewing your own profile.
- GET /api/v1/auth/me returned the caller's own password hash/2FA
secret/github token in the response body.
- POST /api/v1/stories/:id/reply (storyReactionsController) returned the
story owner's full User row to any other authenticated replier.
- POST /api/switch/account could return a shared account's full User row
(incl. secrets) to any repo manager/org member switching into it.
Also:
- backend/src/index.ts: app.set('trust proxy', 1) — every rate limiter keys
on req.ip, which without this always resolved to Caddy's internal IP, so
limits were shared across all visitors combined instead of per-visitor.
- web/middleware.ts: /explore added to publicPaths for the PH launch (its
page component has no client-side auth redirect, unlike /feed and
/trending which hardcode router.push('/login') and were left alone).
- web/components/StoriesRing.tsx: fixed a double-prefixed, nonexistent
/api/v1/stories/feed call to the real /stories endpoint.
Owner bought rithub.dev 2026-11-17; Rithub/Ritgram/Rit/gitgram-ai are all part
of it now. Replaces every ritgram.ereboslab.com / git.ereboslab.com reference
across Ritgram's pages/docs/sitemap/robots/og-tags with ritgram.rithub.dev /
rithub.dev, and adds NEXT_PUBLIC_SITE_URL fallback accordingly. New honest
/docs/rit page explains Rit (Rust git library, kept in this monorepo) is not
the production forge engine (that's go-gitea/gitea), added to the sitemap.
Old hosts (git.ereboslab.com, ritgram.ereboslab.com) now 301 to the new
domain at the Caddy layer (box-side change, not in this commit) except
/api/*, git smart-HTTP, and the Actions runner API, so existing
clones/pushes/CI/mobile keep working unchanged.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ritgram.ereboslab.com had no IndexNow key file live, unlike ereboslab.com
and sibling properties, so changed-URL pings for this host were
previously impossible. Serves the shared ereboslab.com IndexNow key from
this app's own public/ (baked into the Next.js build) and adds a ping
script modeled on menivor/ereboslab's existing ones.
The homepage fix for fake "10,000+ developers" stats (9a566b20) missed
the same copy in the shared (auth) layout shown on every login/register
page. Swap it for honest copy before deploy verification.
Live-verified GITHUB_CLIENT_ID is unset on the ritgram-backend container in
production, so /onboarding/welcome's "Continue" button — gated on
`githubConnected` — was a 100% dead end for every real signup: the only
working escape was "Skip for now" straight to an empty feed with no path to
the actual value prop (moving a repo onto Rithub). Fixes:
- welcome: un-gate Continue from GitHub OAuth; make the connect card
explicitly optional, since the no-OAuth username-based import is the real
"move your code" path, not this broken connect button.
- New /onboarding/first-repo step (follow -> here -> feed, TOTAL_STEPS 3->4):
primary CTA into the already-built no-OAuth /import-from-github flow,
secondary CTA to create a repo straight on Rithub, skip to feed.
- /feed empty state: add an "Import from GitHub" CTA alongside the
people-only "Discover"/"Trending" buttons that were there before.
- /register: honor ?next=<path> after signup (same-site paths only) so the
link already used by /import-from-github's "create an account first, then
come back here" actually returns the user to it instead of always
dropping them into onboarding.
- /docs/github-account-suspended: a complete page sitting uncommitted and
unlinked (curl-verified 404 live); added to sitemap.ts and cross-linked
from /docs/rithub-vs-github.
Not deployed this pass (local commit only, per task instructions); disk on
railyard-box was 82%/9.0GB free as of the prior cleanup pass, so headroom
exists for the next deploy.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Hero badge claimed "Join 10,000+ developers" and the stats section
claimed 10K+ developers / 50K+ posts / 25K+ repos / 100+ countries —
none of that is real on a near-zero-signup product. Replaced with
honest, verifiable differentiators (self-hosted on Rithub, one-form
GitHub import, no lock-in, free to start). No deploy this pass:
railyard-box is at 90% / 5.1GB free with nothing safely prunable
(docker builder/image/container prune all returned 0B) — matches the
same tight-disk threshold that caused a build to hit 100% earlier
today per this file's own history, so the deploy is held per the
"abort if disk is tight" rule rather than risking the box.
Rithub (Gitea) had GITEA_DISABLE_REGISTRATION=true left over on the box, a
leftover from before the SSO-OIDC path was closed out. It silently blocked
every "Move from GitHub" signup regardless of what the marketing pages said.
Enabled registration with the built-in image captcha (no SMTP available for
email-confirm) and documented the real anti-spam tradeoff in a comment.
Also: new Rithub-vs-GitLab and Rithub-vs-Codeberg comparison pages, a fix
for sitemap.ts silently excluding every /docs/* route, an import-from-github
rewrite that leads with the native one-form migration tool instead of the
git-CLI mirror, and a corrected homepage line ("one click" -> "one form").
Verified end to end: real account registered, real public GitHub repo
migrated via the native tool, both cleaned up after. Live-verified post
deploy via curl + a real headless-Chrome hydration check.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The original bug report's twitter:image item is only half-fixed by the
Gitgram->Ritgram domain rebrand: the domain is now correct
(ritgram.ereboslab.com, not the dead gitgram.app), but the path itself,
/og-image.png, was never a real file in public/ -- only a file-convention
app/opengraph-image.tsx route exists. Next.js auto-fills og:image from that
convention (confirmed live: og:image correctly resolves to
/opengraph-image?<hash>, 200), but it does NOT also auto-fill twitter:image
from it once an explicit twitter.images array is present -- so twitter:image
kept pointing at the nonexistent path and 404ed, confirmed live via curl.
Fix: drop the explicit twitter.images array so Next.js falls back to the
same opengraph-image route for Twitter cards too, same as it already does
for og:image.
tsc --noEmit clean.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Previous commit's generateMetadata-based notFound() fix did not actually
work, confirmed live: curl on a brand-new, never-requested /[owner] path
still returned HTTP 200 after that deploy, but this time the response body
contained `<template data-dgst="NEXT_NOT_FOUND">` -- hard proof Next.js did
resolve the 404 internally, generateMetadata's notFound() included, just
after the 200-status loading-skeleton shell had already started streaming
to the client. Status codes are committed with the first flushed byte;
nothing thrown later (including from generateMetadata) can change them
once a Suspense fallback shell has gone out.
Actual root cause: app/loading.tsx at the app root creates an implicit
Suspense boundary around every route with no more specific loading.tsx of
its own, including /[owner] and /[owner]/[name]. Next streams that
boundary's fallback (the feed-skeleton UI) as an instant 200 before the
async Server Component below it -- and its notFound() call -- resolves.
Fix: delete app/loading.tsx. Checked the blast radius first: feed/
messages/search/settings each already have their own scoped loading.tsx
(Next uses the nearest one, so they're unaffected); every other top-level
route (home, pricing, terms, privacy-policy, explore, discover, trending,
about, docs, import-from-github) is either a 'use client' component that
renders immediately or a server component with no slow data fetch (about
has neither), so none of them actually needed the global skeleton. Left
the generateMetadata additions from the previous commit in place -- they
are correct, harmless, deduped by Next's per-request fetch memoization,
and get the 404 <head> title right if some future loading.tsx narrows
back onto either route.
tsc --noEmit clean.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Found live, right after deploying the backend cacheMiddleware fix and the
page-level notFound() fix: a brand-new, never-requested /[owner] path
(confirmed via a timestamp-unique path, ruling out any cache) still
returned HTTP 200 with the loading-skeleton HTML body, even though curl
against the backend API directly for the same username correctly returned
404. Same for /[owner]/[name] with a made-up repo name under a real owner.
Root cause: app/loading.tsx exists at the app root and has no more specific
loading.tsx overriding it for either of these two routes, so Next.js wraps
both in an implicit Suspense boundary and streams the loading-skeleton
shell with HTTP 200 immediately -- before the async Server Component (and
its notFound() call) has resolved. Once that shell starts streaming, the
response status is locked at 200 no matter what the deferred page body
later throws. This is a known Next.js App Router gotcha, not specific to
this codebase.
Fix: add a `generateMetadata` export to both pages that performs the same
existence check and calls notFound(). generateMetadata runs before any
part of the route streams (it has to -- it fills in <head>), so it is not
subject to the loading.tsx/Suspense deferral; calling notFound() there sets
a real 404 status for the whole response. The underlying fetch is memoized
per-request by Next.js, so this does not add a second network round trip.
Left app/loading.tsx itself untouched (deleting it would remove the
loading skeleton for every other top-level page that doesn't have its own
loading.tsx, which is a real UX regression for a fix this surgical didn't
need).
tsc --noEmit clean.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Real root cause of the "unknown routes return a fake 200 instead of 404"
bug: it was never purely a frontend issue. cacheMiddleware (src/middleware/
cache.ts) wraps res.json on a cache miss and unconditionally cache.set()s
whatever gets written -- including a 404 ApiError's body -- then on the next
request for the same key replays it via a bare `res.json(cached)`, which
defaults to HTTP 200 since no res.status() call precedes it. Confirmed live
against ritgram.ereboslab.com: GET /api/v1/users/:id for a made-up username
returned a correct 404 on the DB-miss request, then 200 with the identical
"user_not_found" body on the next request within the 300s TTL -- and this
route (/api/v1/users/:id) backs the [owner]/page.tsx profile route, so any
nonexistent username/path served a fake 200 to crawlers once cached.
Fix: cache {status, data} together, skip caching any response with
statusCode >= 400 (errors shouldn't be cached regardless -- a user created
moments after a 404 was cached would stay invisible for the rest of the
TTL), and replay the cached status code on a hit instead of defaulting to
200. Affects 6 routes on this one middleware: /users/:id (+its repositories/
followers/following/tagged-posts) and /users/search.
tsc --noEmit clean.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- sitemap.xml, robots.txt, og:url, og:image, twitter:image, metadataBase all
resolve from NEXT_PUBLIC_SITE_URL with a https://ritgram.ereboslab.com
default instead of the dead gitgram.app (NXDOMAIN).
- Page titles, OG copy, PWA manifest, offline.html, service-worker push
notification title: Gitgram -> Ritgram. Left internal SW cache-name/tag
strings (gitgram-static-, gitgram-sync, etc.) alone as low-risk code
identifiers.
- /[owner]/page.tsx (top-level profile route) converted to an async Server
Component that calls fetchProfile() + notFound() before any HTML streams,
so a GET on any nonexistent username now returns a real 404 instead of a
200 loading-shell (the same pattern [owner]/[name]/page.tsx already used
one level down).
- apps/ritgram/backend: matching Gitgram->Ritgram string rename sweep across
controllers/services/config comments and defaults (EMAIL_FROM,
AITM_API_URL description, etc.) — no behavior change.
- apps/ritgram/mobile: matching user-visible string rename sweep.
tsc --noEmit clean on both web and backend.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
GitHub OAuth app approval is blocked, so this ships the next-best onboarding
path: paste a GitHub username (public repos, no token) or an optional
fine-grained read token (private repos), tick repos, and Rithub mirrors each
one with Gitea's built-in /repos/migrate, streamed as live per-repo progress
over SSE, landing on the new Ritgram profile when done.
- GiteaForgeAdapter.migrateRepo(): calls the real Gitea migrate API, treats
409 as "already there", and self-heals a false failure (proxy timeout or
a post-clone step erroring after the repo already landed — both observed
live against git.ereboslab.com) by re-checking existence with backoff
before reporting a real failure.
- New public POST /api/v1/github-import/preview and auth'd
POST /api/v1/github-import/start (requires an existing Rithub/Gitea
connection); the GitHub token, when provided, is used once in-memory for
that request and is never stored or logged. Both routes are rate limited.
- New /import-from-github page (public route) with username/token form,
a tickable repo list, and a live per-repo progress list fed by SSE.
Verified end to end against the live git.ereboslab.com instance: created a
disposable Gitea test account, ran preview + start through the real HTTP
routes against real octocat.github.com repos, confirmed migrated repos
landing on Gitea, then deleted the test repos, the test Gitea account, and
the matching Ritgram test user + DB rows. Found and noted a real, unrelated
blocker: railyard-box is at 99% disk (for reference, this backend's dev/db
config lives in apps/ritgram/backend/.env, pointed at the project's Neon
dev DB; no change needed here).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Honest fact-checked comparison (account control, price, migration speed,
social feed) at /docs/rithub-vs-github, linking to /register. Fills the gap
flagged in the 2026-11-17 growth pass: the existing /docs/import-from-github
page covers migration steps but no page framed the head-to-head comparison
with a direct signup CTA.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Carries forward the real, previously-uncommitted production fixes from the
2026-11-16 deploy pass (NEXT_PUBLIC_* as Docker build args, drop the
network-fetched Space_Grotesk font that was blocking builds on
railyard-box, non-root COPY --chown to avoid a duplicate overlayfs layer),
plus new work: a /docs/import-from-github page (GitHub username field works
today; git push --mirror to Rithub documented; OAuth one-click noted as
pending owner GitHub-app setup), a hero line pointing users leaving GitHub
at it, and the route added to middleware.ts public paths.
Verified: tsc --noEmit clean. Register+login tested live against the real
ritgram.ereboslab.com backend (201 then 200, no mocks).
The profile page's Repositories tab (RepoList in app/[owner]/page.tsx)
was the one repo-listing surface left behind when forge-awareness was
added to search/trending/explore (94bf6dbf) and to the user-repos
backend route (ad4e3c85): the backend already returns `forge` per
repo, but this component's Repo type dropped the field and the row
render never showed it, so a Rithub-only user's own profile listed
their repos with no indication they are not on GitHub — unlike every
other repo surface in the app. Add `forge` to the Repo type and render
the shared forgeBadgeText() pill next to the repo name, matching
RepoCard/RepositorySocialCard/TrendingRepos.
Local commit only, not pushed (GitHub account flagged) and not
deployed (Ritgram has no live hostname yet).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Rithub (Gitea) sign-in users could never manage their own repos because
every ownership gate in repositoryController only checked User.githubUsername.
Add isRepositoryOwner (repositoryController.ts) + getForgeLogin/getAllForgeLogins
(forgeConnectionService.ts) to resolve ownership against the user's login on
the repo's own forge (GitHub or Rithub/Gitea), or an explicit claim.
Also:
- Add the missing GET /api/v1/users/:id/repositories route + controller
(previously had no backend route at all; profile tab always 404'd).
- Fix computeTrendingForTier's stale TrendingEntry rows: delete by tier
instead of by (tier, periodStart), since periodStart drifts every run
and left duplicate rows piling up in the trending list.
Verified locally: tsc --noEmit clean; ran the real backend (port 3001,
real Neon DB), registered a throwaway user, linked a Gitea ForgeConnection
to the real caelum0x Gitea repos, and confirmed a previously-403 AITM
settings endpoint now returns 200 for that Gitea-only user (403 for a
control user with no forge link). Confirmed computeTrendingForTier no
longer accumulates duplicate rows across repeated runs. Test users and
temp verification script removed after.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Rithub (Gitea) repos were imported into the ritgram DB but most backend
paths and frontend views still assumed GitHub only:
- repositoryService.searchRepositories/getTrending were pure Octokit calls
(the two endpoints behind /repositories/search and /repositories/trending,
used by explore/discover/Feed/TrendingRepos) — now merge our own DB (any
forge) with live GitHub search/trending, with Rithub repos listed first
since a brand-new Rithub repo has 0 GitHub-scale stars and a pure
star-sort would always bury it under unrelated GitHub trending noise.
- repositoryController's follow/unfollow/getPosts/getSnippets/getMedia/
bookmark/update/remove/aitm-settings/etc. all resolved the repo via
getRepository(owner, name) with no forge param (silently defaulting to
github) — now thread ?forge= through via a resolveForge(req) helper.
- getActivityTimeline (repo activity feed) had the same default-to-github
gap — now forge-aware too.
- searchController's repo selects (unifiedSearch/searchAll/searchRepositories/
getPersonalizedTrending) didn't return `forge`, so the frontend had no way
to badge or route Gitea rows differently — added `forge`/`htmlUrl` to each.
- trendingAlgorithmService.getTrendingRepositories merged by bare fullName,
which could wrongly conflate a same-named GitHub and Gitea repo now that
fullName is only forge-scoped unique — merge key is now `forge:fullName`.
- Added a periodic Gitea repo re-sync (jobs/syncGiteaRepos.ts, every 6h),
reusing the exact upsert logic from scripts/importGiteaRepos.ts via a new
shared services/giteaSyncService.ts — one real implementation, idempotent.
- Frontend: RepoCard/RepositorySocialCard/TrendingRepos/search page/trending
page now show a "Rithub" badge on non-GitHub repos (web/lib/forge.ts).
Fixed two unrelated pre-existing bugs found while wiring this up: the
trending page sent invalid tier values (TRENDING_TODAY instead of the
backend's today/week/hot/rising aliases) and unwrapped the wrong level of
the {success,data:{...}} response envelope, so every trending panel showed
"failed to load" / empty regardless of forge.
Verified locally: backend+frontend running against the real ritgram Neon DB,
curled search/trending/repo-detail(?forge=gitea), and a logged-in headless
Chrome screenshot of /search and /trending showing the 14 real Rithub repos
with the "Rithub" badge. tsc --noEmit clean on backend and web.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds src/scripts/importGiteaRepos.ts: a one-shot importer using the
existing GiteaForgeAdapter (publicForgeAdapter('gitea')) to pull all
public repos for an owner from git.ereboslab.com and upsert them into
the Repository table (forge-scoped unique key from the §5.4 migration).
No prior path persisted forge-listed repos into Postgres — the
/forges/:forge/repos route only reads live, never writes.
Also makes repositoryService.fetchRepository/getRepository/
getRepositoryWithStats forge-aware (default github, optional gitea via
the same adapter) instead of hardcoded to Octokit, and threads a
?forge=gitea query param through repositoryController.get, so the
existing GET /api/v1/repositories/:owner/:name endpoint can actually
serve imported Gitea repos instead of 404ing against GitHub.
Verified: 14/14 caelum0x repos imported into the ritgram Neon DB
(crimson-rain-44261155), confirmed via direct query and live via
GET /api/v1/repositories/caelum0x/toolgate?forge=gitea and
GET /api/v1/search/suggest.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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>
- ForgeAdapter interface; existing Octokit code moved behind GitHubForgeAdapter (same behavior)
- GiteaForgeAdapter against /api/v1, paths checked against live Gitea 1.23.8 swagger
- One webhook ingestion for GitHub and Gitea (raw-body HMAC, X-Gitea-Signature detected first)
- Forge-agnostic activity feed (GitHub polled + Gitea webhook/polled, merged)
- Per-user ForgeConnection with legacy githubAccessToken backfill (migration 20261113000000)
Verified locally with a genuine delivery from a throwaway Gitea container and read-only probes of git.ereboslab.com; tsc clean, targeted jest 77/77.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Moved later/gitgram-ai/gitgram/ to apps/ritgram/ (fresh history; full history stays in caelum0x/gitgram).
AITimeMachine stays separate in later/gitgram-ai per the Rithub master plan.
Logs, pid files and env files are ignored; GPL-3.0 mobile/proximity noted in THIRD_PARTY_NOTICES.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>