Skip to content

fix: raise theme CSS limit to 100,000 characters to match T3Code - #138

Merged
SunkenInTime merged 1 commit into
mainfrom
t3/theme-css-limit-115
Nov 29, 2026
Merged

SunkenInTime merged 1 commit into
mainfrom
t3/theme-css-limit-115

Conversation

@SunkenInTime

@SunkenInTime SunkenInTime commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

Part of #115 (the CSS limit part; see below)

What was broken

The gallery rejected theme css over 20,000 characters. T3Code accepts up to 100,000: THEME_CSS_MAX_LENGTH = 100_000 in packages/contracts/src/server.ts on pingdotgg/t3code main (checked at 58a4e59, Nov 29). Themes that import fine in the app, like the 49,996-character full Dave the Viber, could not be submitted here. The value lives in our @t3tools/contracts shim, so a vendor sync never updates it.

What changed

  • src/vendor/t3code/shims/contracts.ts: THEME_CSS_MAX_LENGTH is now 100_000.
  • docs/contributing-a-theme.md: the css row now says 100,000.
  • scripts/validate-themes.ts: the self-test that hardcoded "x".repeat(20_001) now uses THEME_CSS_MAX_LENGTH + 1, so it can't drift from the limit again.

The submit form has no cap of its own. Its GitHub link already drops the prefilled contents above 8,000 characters and asks for Copy JSON instead.

Verification

$ npm run validate
✓ 114 theme file(s) valid
$ npm run check-css
✓ CSS in 39 theme(s) passes T3Code's guard unchanged
$ npm run build
[build] 122 page(s) built in 7.24s
  • Parser limits: 49,996 and 100,000 characters are accepted. 100,001 is rejected with Theme CSS must be text of 100000 characters or fewer.
  • Probe theme: a temporary theme with 49,996 characters of CSS passes validate and check-css on this branch. On main it fails with Theme CSS must be text of 20000 characters or fewer.
  • Submit form: pasted into the built /submit page in Chromium, the probe theme shows "✓ Limit Probe is valid", offers the copy-first GitHub flow and logs no page errors.

Not in this PR

The issue's second half, theme background images (themes/<id>.jpg and --theme-background-image in previews), is a feature that needs its own design and PR.

T3Code's contracts allow 100,000 characters of theme CSS since
pingdotgg/t3code#37781. Match it in the contracts shim and the contributing
doc, and derive the validator's over-limit self-test from the constant.
@coderabbitai

coderabbitai Bot commented Nov 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 57 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 90a949de-d3c7-478f-a41c-bb5050ba160d
Commits

Reviewing files that changed from the base of the PR and between 5b20312 and ee270ef.

Files selected for processing: 3

  • docs/contributing-a-theme.md
  • scripts/validate-themes.ts
  • src/vendor/t3code/shims/contracts.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying t3-themes with  Cloudflare Pages  Cloudflare Pages

Latest commit: ee270ef
Status: ✅  Deploy successful!
Preview URL: https://5dd7918b.t3-themes.pages.dev
Branch Preview URL: https://t3-theme-css-limit-115.t3-themes.pages.dev

View logs

@SunkenInTime
SunkenInTime merged commit 6b14e9e into main Nov 29, 2026
4 checks passed
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.

1 participant