fix(global-css): make generated global element CSS deterministic#6461
Conversation
|
📚 Branch Preview Links🔍 First Generation Visual Regression Test ResultsWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
Deployed to Azure Blob Storage: If the changes are expected, update the |
Coverage Report for CI Build 28449794503Coverage remained the same at 96.246%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
Remove the best-effort `stylelint --fix` post-process from the vite-global-elements-css plugin. It reordered properties in the generated, do-not-edit, .stylelintignore'd global-*.css files but ignored its exit code and swallowed errors, so when it was skipped (binary missing, or killed under parallel-build load) the raw output was written and the checked-in files showed as modified after a build. Property order on these files is unenforced and functionally irrelevant (cascade unaffected; duplicate declarations already deduped at generation), so output is now deterministic = generation order. Regenerated global-button.css and global-action-button.css to match.
| @@ -0,0 +1,7 @@ | |||
| --- | |||
| '@adobe/spectrum-wc': patch | |||
There was a problem hiding this comment.
You dont need changeset for this
b8f8e85 to
b20601d
Compare
Description
yarn buildreliably leftglobal-action-button.cssandglobal-button.cssmodified in the working tree, even on a clean checkout.Root cause: the
vite-global-elements-cssplugin ran a best-effortstylelint --fixon each generated file purely to reorder properties. That subprocess ignored its exit code and swallowed all errors, so whenever it didn't apply — binary not found, or the process killed under CPU contention during parallel workspace builds — the raw generation order was written instead of the stylelint-ordered version that was checked in. The result was a phantom diff after every build.Fix: remove the reorder step. Output is now deterministic (generation order), and the two affected files are regenerated to match.
Key decisions
2nd-gen/packages/swc/stylesheets/globaldirectory is already in.stylelintignore, so property order on theseDO NOT EDIT, machine-generated files is enforced nowhere. It is also functionally irrelevant: the cascade is unaffected and duplicate declarations are already deduped during generation (mergeRules). The reorder was cosmetic and was the sole source of nondeterminism.stylelint.config.js— real maintenance to satisfy a convention nothing enforces on this directory. The order difference originates only from concatenating the base file's declarations with the component's during merge; both inputs are individually canonical.Motivation and context
Removes a recurring source of dirty working trees and accidental file churn in unrelated PRs.
Related issue(s)
Author's checklist
Manual review test cases
yarn buildgit status2nd-gen/packages/swc/stylesheets/global/*.cssAccessibility testing checklist
Keyboard (required)
Screen reader (required)