Skip to content

fix(test): make tailwind integration test rerun-safe#6473

Merged
masenf merged 1 commit intomainfrom
claude/debug-integration-test-68Vvy
May 8, 2026
Merged

fix(test): make tailwind integration test rerun-safe#6473
masenf merged 1 commit intomainfrom
claude/debug-integration-test-68Vvy

Conversation

@masenf
Copy link
Copy Markdown
Collaborator

@masenf masenf commented May 8, 2026

Two compounding bugs caused the (redis, 3.14, split 2) integration job to occasionally fail at test_tailwind_app[tailwind_v4]:

  1. The test wrote its sentinel stylesheet to Path(file).resolve().parent.parent / "assets". On a rerun triggered by pytest-rerunfailures, importlib.reload reuses the original module spec, so file keeps pointing at the previous tmp_path while the compiler reads stylesheets from Path.cwd() / "assets" in the new tmp_path. The mismatch raised FileNotFoundError at setup for every rerun. Write to Path.cwd() directly so the location matches the compiler regardless of reload-induced file staleness.

  2. The v4 color assertion read value_of_css_property without polling. In dev mode the @tailwindcss/postcss step can finish painting after the element appears, so under runner load the first attempt intermittently saw the default color and failed; that failure is what kicked off the buggy reruns above. Poll until the expected color is applied so first-attempt timing variance no longer fails the test.

Two compounding bugs caused the (redis, 3.14, split 2) integration job
to occasionally fail at test_tailwind_app[tailwind_v4]:

1. The test wrote its sentinel stylesheet to
   Path(__file__).resolve().parent.parent / "assets". On a rerun
   triggered by pytest-rerunfailures, importlib.reload reuses the
   original module spec, so __file__ keeps pointing at the previous
   tmp_path while the compiler reads stylesheets from
   Path.cwd() / "assets" in the new tmp_path. The mismatch raised
   FileNotFoundError at setup for every rerun. Write to Path.cwd()
   directly so the location matches the compiler regardless of
   reload-induced __file__ staleness.

2. The v4 color assertion read value_of_css_property without polling.
   In dev mode the @tailwindcss/postcss step can finish painting after
   the element appears, so under runner load the first attempt
   intermittently saw the default color and failed; that failure is
   what kicked off the buggy reruns above. Poll until the expected
   color is applied so first-attempt timing variance no longer fails
   the test.
@masenf masenf requested a review from a team as a code owner May 8, 2026 00:46
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 8, 2026

Greptile Summary

This PR fixes two bugs that caused the tailwind integration test to fail on reruns triggered by pytest-rerunfailures. The first bug used a stale __file__ path after importlib.reload, writing the sentinel stylesheet to the wrong directory; it is fixed by switching to Path.cwd(). The second bug asserted the v4 color synchronously without polling, causing intermittent failures when the Tailwind PostCSS step finished after the element appeared.

  • Asset path fix: assets = Path.cwd() / \"assets\" ensures the stylesheet is always written to the directory the compiler reads from, regardless of module reload state.
  • Polling fix: The color assertion for both v3 and v4 now uses poll_for_or_raise_timeout, waiting until the expected utility-class color is applied in the browser.

Confidence Score: 5/5

The change is safe to merge; it corrects two independent test-reliability issues without touching production code.

Both fixes are narrowly scoped to the integration test file. The path change from Path(__file__) to Path.cwd() directly matches how the harness sets up its working directory, and the polling loop mirrors the existing pattern used elsewhere in the test suite. No logic that could introduce a regression was touched.

No files require special attention.

Important Files Changed

Filename Overview
tests/integration/test_tailwind.py Fixes two rerun-safety bugs: replaces Path(__file__) with Path.cwd() for stylesheet placement, and polls for CSS color instead of asserting it immediately in tailwind v4.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[pytest runs test_tailwind_app] --> B[AppHarness.create with tmp_path]
    B --> C["TailwindApp() called via importlib"]
    C --> D["Write stylesheet to Path.cwd() / assets/\n(compiler's working directory)"]
    D --> E[App compiles with Tailwind]
    E --> F[Browser renders page]
    F --> G[poll_for_or_raise_timeout: find #p-content]
    G --> H{tailwind_version?}
    H -- 0 disabled --> I[assert color NOT in v3 colors]
    H -- 3 or 4 --> J["poll_for_or_raise_timeout:\nwait until color in expected_colors"]
    J --> K[Color matches - test passes]
    I --> K
    K --> L[Assert external stylesheet color]
Loading

Reviews (1): Last reviewed commit: "fix(test): make tailwind integration tes..." | Re-trigger Greptile

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 8, 2026

Merging this PR will not alter performance

✅ 24 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing claude/debug-integration-test-68Vvy (5001c06) with main (1eed933)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@masenf masenf merged commit e5eb243 into main May 8, 2026
69 checks passed
@masenf masenf deleted the claude/debug-integration-test-68Vvy branch May 8, 2026 13:53
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.

3 participants