Skip to content

fix: keep test themes out of the published uniwind.css - #718

Open
dlebedynskyi wants to merge 1 commit into
uni-stack:mainfrom
alexa-endpoints:fix/published-artifact-test-theme
Open

dlebedynskyi wants to merge 1 commit into
uni-stack:mainfrom
alexa-endpoints:fix/published-artifact-test-theme

Conversation

@dlebedynskyi

@dlebedynskyi dlebedynskyi commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

I ran into this while comparing generated artifacts on a fork. After a test run, my local packages/uniwind/uniwind.css ended with a @theme block, but git status was clean because postinstall marks the file assume-unchanged. Then I checked the published package (npm pack uniwind@1.12.2) and it has the same block, so the release job ships whatever the tests leave behind. Claude was able to root case and propose fix.

The uniwind.css in the npm package doesn't match the one in the repo. Since 1.8.0 it ends with the theme block that tests/test.css generates:

$ npm pack uniwind@1.12.2 && tar -xzf uniwind-1.12.2.tgz
$ git show v1.12.2:packages/uniwind/uniwind.css | diff - package/uniwind.css
594a595,600
>
>
> @theme {
>     --color-background: unset;
>     --app-foreground: unset;
> }
\ No newline at end of file

1.7.0 is clean. Every release from 1.8.0 through 1.12.2 ships the block.

Cause

tests/setup.native.ts calls generateArtifacts('./uniwind.css') for tests/test.css (added in c8ed75f). That rewrites the package-root uniwind.css, which is the file the style export and @import "uniwind" resolve to. release.yaml runs bun run test and then bun run release in the same checkout, so npm publishes the rewritten file. The root postinstall marks the file assume-unchanged, so git status stays clean and nothing flags the change.

Until Metro or Vite regenerates it, every install exposes the fixture's --color-background and --app-foreground theme variables to anything that reads @import "uniwind". The file also no longer matches what a project without theme variables generates, so that project's first bundle rewrites the installed copy.

Fix

  • The native test setup builds uniwind.css the way a project without theme variables would (tests/default.css). The result is identical to the committed file, so buildCSS skips the write and tests/test.css compiles against the artifact a fresh install ships. Jest workers can't race: they all produce the same content, and the only write (when an example app has changed the local copy) is atomic.
  • tests/native/bundler/uniwind-css.test.ts fails if uniwind.css contains the themes generated from tests/test.css.
  • release.yaml fails before publishing if uniwind.css differs from the committed file.
  • CONTEXT.md documents both.

Testing

  • The new test fails on main, because the setup has just rewritten the file, and passes with this change.
  • Ran the CI steps locally: install, build, type checks, lint, format, circular check, and bun run test (native 204, web 48, e2e 9, types). Afterwards:
    • uniwind.css is byte-identical to the committed file.
    • The new release step passes. After a native test run on main, it exits 1.
    • npm pack --dry-run and bun pm pack ship the committed file (21720 bytes, no @theme block).
  • Exported apps/expo-example for iOS, Android and web, built apps/vite-example, and bundled apps/bare.

Summary by CodeRabbit

  • Bug Fixes
    • Release checks now stop if the committed CSS artifact has changed.
    • Native test setup builds the package CSS from the default test stylesheet, and a test verifies that test-theme styles are absent from the published CSS.
  • Documentation
    • Clarified how release checks validate the CSS artifact and how native tests build it.

Since 1.8.0 the uniwind.css in the npm package has ended with the theme
block that tests/test.css generates:

    @theme {
        --color-background: unset;
        --app-foreground: unset;
    }

The native test setup generated the package-root artifact, the file the
`style` export and `@import "uniwind"` resolve to, from tests/test.css.
The release workflow runs the tests and then publishes from the same
checkout, and the root postinstall marks the file assume-unchanged, so
git never showed the rewrite.

Build that file in the native setup the way a project without theme
variables would. The result matches the committed file, so test runs
leave it alone and still compile tests/test.css against what a fresh
install ships. The release workflow now also fails if uniwind.css
differs from the committed file before publishing.
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in 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: ae5cbec7-b4f7-448a-b60e-cfd3172287f8

📥 Commits

Reviewing files that changed from the base of the PR and between 9fc9b40 and c5817f2.


📒 Files selected for processing (5)
  • .github/workflows/release.yaml
  • CONTEXT.md
  • packages/uniwind/tests/default.css
  • packages/uniwind/tests/native/bundler/uniwind-css.test.ts
  • packages/uniwind/tests/setup.native.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.



📝 Walkthrough

Walkthrough

Native test setup now builds uniwind.css from tests/default.css. A test checks that generated light and dark theme CSS is absent from the artifact. The release workflow checks that uniwind.css matches the committed file.

Changes

CSS artifact verification

Layer / File(s) Summary
Build and validate native test CSS
packages/uniwind/tests/default.css, packages/uniwind/tests/setup.native.ts, packages/uniwind/tests/native/bundler/uniwind-css.test.ts, CONTEXT.md
Native setup builds uniwind.css from tests/default.css. A test checks that light and dark CSS generated from tests/test.css is absent from the artifact. The test documentation describes this setup.
Check the CSS artifact before release
.github/workflows/release.yaml, CONTEXT.md
The release workflow clears the assume-unchanged index flag for uniwind.css and fails if Git detects a diff. The documentation describes the release check.

Priority: ➖ Normal

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

Change: Bug fix

Suggested reviewers: brentlok


Merge Risk: ⚪ Minimal · up to c5817

The described checks address test-theme leakage and release-time artifact drift. No specific remaining merge risk is established in the supplied review context.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: preventing test themes from entering the published uniwind.css file.


✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR


  • 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

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

@greptile-apps

greptile-apps Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[High impact] The PR appears safe to merge; no actionable issues were found.

Summary

Keeps test themes out of the published uniwind.css.

  • Native tests keep fixture themes out of the package CSS.
  • The release workflow checks the package CSS before publishing.

No actionable issues found. Tests were not run during this review.

Reviews (1) · Last reviewed commit: "fix: keep test themes out of the publish..." · Reviewed by Greptile

This branch has not been deployed

No deployments
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