Repository navigation
Core: Make csf-tools printing and CLI dispatcher output Windows-stable - #36346
Merged
Merged
Conversation
tests-unit--windows in daily-generated failed 4 consecutive runs (bf83086, 4f66cee x3) with three failure signatures: 1. Reprinted config/CSF output contained CRLF on Windows. recast defaults lineTerminator to os.EOL; printConfig and printCsf now pin LF, matching the existing babelPrint wrapper. 2. _inferQuotes indexed token offsets into the raw source, which misreads when source lines end in CRLF; normalize CRLF before counting so quote inference is platform-independent. 3. The CLI help test captured benign wmic stderr ("No Instance(s) Available.") leaked by process-ancestry's execSync on Windows; patch the dependency to silence stderr while keeping stdout. Adds regression tests covering CRLF sources for both printers. Co-authored-by: Gert Hengeveld <gert@chromatic.com>
The Yarn patch for process-ancestry leaked a patch: descriptor into the published dependency manifests of core, cli-storybook, and create-storybook, while the patch file itself only exists in the monorepo. Generated sandboxes install published packages via Verdaccio and failed with ENOENT when Yarn could not resolve the patch file. Replace the patch with a repository-owned implementation in storybook/internal/common that preserves the Unix and Windows ancestry traversal, discards child stderr (wmic prints benign "No Instance(s) Available." noise on Windows), and removes the external dependency entirely. TelemetryService tests are updated to mock the new barrel export.
The normal-generated run on 1f6cd6b had a single failure out of 10,734 tests: a beforeEach hook timing out at 10s in code/frameworks/vue3-vite/src/plugins/vue-component-meta.test.ts (star case). The suite passes locally (20/20), its sibling cases passed in the same CI run, and the failure is a timeout, not an assertion. Re-running through a fresh pipeline since the CircleCI retry API is not permitted.
1 of 9 tasks
ghengeveld
approved these changes
Sep 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #
What I did
tests-unit--windowsindaily-generatedfailed 4 consecutive runs (SHAsbf830863e,4f66ceeb2x3) with three Windows-specific failure signatures, all verified mechanically:printConfigandprintCsfdelegate torecast.printwithout alineTerminator, and recast defaults that toos.EOL— so every reprinted line gained\ron Windows. Both wrappers now pinlineTerminator: '\n', matching whatbabelPrintincode/core/src/babel/babelParse.tsalready does (including its comment explaining exactly this).import preview from './preview';received"...";)._inferQuotes()indexed token offsets into the raw source string; when source lines end in CRLF the offsets no longer align and the count falls back to double quotes._inferQuotesnow normalizes CRLF before counting (a no-op for LF sources).wmicstderr leaked into the CLI help test (No Instance(s) Available.\r\r\ninstead of empty stderr).dispatcher.tscallsgetProcessAncestry()for every external-CLI command since CLI: Accept Node.js prerelease builds in the version gate #36320 landed5f32ebb8, andprocess-ancestry's Windows implementation runswmicviaexecSyncwithout astdiooption, so wmic's stderr forwards to the CLI's stderr.process-ancestry@0.1.0does not fix this, so the PR vendors the ancestry lookup asgetProcessAncestryinstorybook/internal/common— preserving the upstream Unix and Windows traversal, discarding child stderr viastdio: ['ignore', 'pipe', 'ignore']— and drops theprocess-ancestrydependency entirely.An earlier revision fixed #3 with a Yarn patch instead. That was unsafe for published packages: Yarn wires patches by writing
patch:process-ancestry@...descriptors into the dependency manifests ofcore,cli-storybook, andcreate-storybook, and those descriptors ship with the published packages while the patch file only exists in the monorepo. Generated sandboxes install published packages from Verdaccio, so every sandbox install failed withENOENTon.yarn/patches/process-ancestry-npm-0.0.2-a5c4b74866.patch. Vendoring removes the failure class instead of making the patch resolvable: no descriptor, no patch file, one less external dependency.Adds two regression tests (
ConfigObject.test.ts,CsfObject.test.ts) that feed CRLF sources to both printers and assert LF output and correct quote inference. Verified red against the pre-fix code and green after.Adds a
process-ancestry.test.tsunit suite covering PID validation, Unix traversal, Windows CSV parsing, stderr suppression, and cycle detection;TelemetryService.test.tsnow mocks the vendoredstorybook/internal/commonexport instead of the removed package.Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
Caution
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
No manual testing is needed: the failures are only observable on Windows (
os.EOL= CRLF,wmicpresent), and thedaily-generatedworkflow'stests-unit--windowsjob is itself the verification path. On Linux the new regression tests exercise both mechanisms via anos.EOLoverride and CRLF fixtures.Documentation
MIGRATION.MD
No documentation changes apply — internal CI/printing behavior only.
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsDeclare whether manual QA will be needed for this PR during the next release, through
qa:neededorqa:skipMake sure this PR contains one of the labels below:
Available labels
bug: Internal changes that fixes incorrect behavior.maintenance: User-facing maintenance tasks.dependencies: Upgrading (sometimes downgrading) dependencies.build: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup: Minor cleanup style change. Will not show up in release changelog.documentation: Documentation only changes. Will not show up in release changelog.feature request: Introducing a new feature.BREAKING CHANGE: Changes that break compatibility in some way with current major version.other: Changes that don't fit in the above categories.🦋 Canary Release - 🚫 Not run
This PR does not have a canary release associated.
In-repo PRs: add the
ci:canarylabel. Later pushes republish while the label remains.Fork PRs: the label does nothing (a later push must not auto-publish). A maintainer publishes from this repository with Run workflow and the
prinput.branchandshaare optional; if more than one is set, they must be the same commit. The fork author does not need to do anything.Human author: Gert Hengeveld (gert@chromatic.com)
🔗 Obvious Project · 🧵 Obvious Thread