Skip to content

chore(usercontent): drop the unused theme stylesheet route and helper - #7384

Merged
saddlepaddle merged 1 commit into
mainfrom
chore/drop-unused-theme-stylesheet
Sep 10, 2026
Merged

saddlepaddle merged 1 commit into
mainfrom
chore/drop-unused-theme-stylesheet

Conversation

@saddlepaddle

@saddlepaddle saddlepaddle commented Sep 10, 2026 •

Copy link
Copy Markdown
Collaborator

Why

injectStylesheetLink and the /_superset/theme.css route it was written for have no callers. #7312 landed page theming by inlining the CSS with injectStyleTag instead, and nothing has linked the stylesheet since. The route served bytes no page ever asked for, and the helper carried ~20 tests for a code path that never ran.

Checked before removing: nothing in apps/ or packages/ references either symbol, and the path isn't documented anywhere for page authors.

The tests are retargeted, not deleted

injectStylesheetLink's suite was the only real coverage of injectIntoHead — head with attributes, a > inside a quoted attribute, a head inside a comment, a script or a style, <header> false positives, doctype fallbacks, a 2000-script-block document. injectStyleTag shares that helper and uses it to put the theme on every published page, so deleting the suite would have dropped regression cover for code that still runs — including the case 6859ee629 was written to fix.

They now exercise injectStyleTag, and the two thinner injectStyleTag cases are folded in. One assertion needed a real change: "stays ahead of the page's own styles" compared against indexOf("<style>"), which now matches the injected tag, so it targets the page's own CSS instead.

Verification

  • bun test src/usercontent/inject.test.ts — 18 pass, 0 fail
  • typecheck clean for apps/usercontent, lint clean at root
  • No behaviour change: no page links the stylesheet, so nothing 404s

https://claude.ai/code/session_01Ho5jMfrUs1e65svM8M2Hc6


Summary by cubic

Removes the unused theme stylesheet route and injectStylesheetLink helper; no page ever requested the CSS since theming was inlined via injectStyleTag, so the route and helper served no purpose. The tests previously covering injectStylesheetLink now exercise injectStyleTag's shared injectIntoHead logic, so regression coverage is preserved without any behavior change.

Written for commit 6d83f44. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Changes
    • Removed the dedicated theme stylesheet endpoint.
    • Removed automatic external stylesheet link injection.
    • Inline style injection remains available for supported content.
  • Tests
    • Expanded coverage for inline style insertion across varied document structures, including comments, scripts, attributes, headers, doctypes, and documents with multiple script blocks.

`injectStylesheetLink` and the `/_superset/theme.css` route it was written
for have no callers: #7312 landed the theme by inlining it with
`injectStyleTag` instead, and nothing has linked the stylesheet since. The
route served bytes no page ever asked for.

Its tests were the only real coverage of `injectIntoHead` — head with
attributes, a `>` inside a quoted attribute, a head inside a comment, a
script or a style, `<header>` false positives — which `injectStyleTag`
still depends on to put the theme on every published page. Retargeted
rather than deleted, and folded the two thinner `injectStyleTag` cases in.

Claude-Session: https://claude.ai/code/session_01Ho5jMfrUs1e65svM8M2Hc6
@coderabbitai

coderabbitai Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 863d03ed-de68-43bb-9c51-9eadf4b69294

📥 Commits

Reviewing files that changed from the base of the PR and between 7a6e804 and 6d83f44.

📒 Files selected for processing (5)
  • apps/usercontent/src/index.ts
  • packages/shared/src/usercontent/index.ts
  • packages/shared/src/usercontent/inject.test.ts
  • packages/shared/src/usercontent/inject.ts
  • packages/shared/src/usercontent/theme.ts
💤 Files with no reviewable changes (3)
  • packages/shared/src/usercontent/theme.ts
  • packages/shared/src/usercontent/inject.ts
  • apps/usercontent/src/index.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The change removes the theme stylesheet endpoint, helper, constant, and re-exports. Inline style injection remains available, with expanded tests for head detection and insertion behavior.

Changes

Usercontent stylesheet removal

Layer / File(s) Summary
Remove stylesheet endpoint and API
apps/usercontent/src/index.ts, packages/shared/src/usercontent/index.ts, packages/shared/src/usercontent/inject.ts, packages/shared/src/usercontent/theme.ts
The theme stylesheet endpoint, injectStylesheetLink, and THEME_STYLESHEET_PATH were removed.
Expand inline style injection coverage
packages/shared/src/usercontent/inject.test.ts
Tests now cover inline style insertion across document structure, head attributes, embedded content, and multiple script blocks.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 6d83f

The unused stylesheet endpoint and helper are removed while inline page theming remains supported and tested. No current merge-blocking risk is identified.

Suggested reviewers: harshithmullapudi

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: removal of the unused theme stylesheet route and helper. It follows the required conventional commit format.
Description check ✅ Passed The description explains what changed, why the route and helper were removed, how tests were retargeted, and how the changes were verified. It does not use the exact template headings and omits the ch…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/drop-unused-theme-stylesheet

Warning

Some tools did not complete. Review the errors below.

🔧 Biome (2.5.10)
packages/shared/src/usercontent/index.ts

Biome could not lint this file: nested root configuration. Check the repository's Biome configuration and plugins.

packages/shared/src/usercontent/inject.test.ts

Biome could not lint this file: nested root configuration. Check the repository's Biome configuration and plugins.


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

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch

Thank you for your contribution! 🎉

@saddlepaddle
saddlepaddle merged commit 53dccb7 into main Sep 10, 2026
20 checks passed

This branch was previously deployed

1 inactive deployment
preview — 6d83f445 Deployed Sep 10, 2026 by saddlepaddle via Deploy Admin #9530
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