Skip to content

Svelte: Fix real-world server docgen and snippet regressions - #36845

Draft
valentinpalkovic wants to merge 4 commits into
svelte-docgen-sweep-comparatorfrom
svelte-docgen-realworld-fixes
Draft

valentinpalkovic wants to merge 4 commits into
svelte-docgen-sweep-comparatorfrom
svelte-docgen-realworld-fixes

Conversation

@valentinpalkovic

@valentinpalkovic valentinpalkovic commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #36847 at b406e21f5e073b43fac584015ec625689395b3d7, above #36773. Server docgen remains opt-in. This draft retains one unwaived comparison; CI and review remain required.

What I did

Summary

Svelte source → typed props/events/slots → server metadata
Story source → resolved component + static expressions/imports → copyable snippet
Legacy docgen → existing prop extraction, without parsing raw SCSS for server descriptions

Preserve inherited native attributes, legacy events and slots, SCSS component documentation, namespace component resolution, wrapped story indexing, unevaluated expression bindings, snippet fallback templates, spread precedence and unsafe string values. Callable props expose type.name: function with their exact signature in type.raw; snippet props retain their existing type representation.

Evidence

  • Before: legacy extraction throws css_expected_identifier for SCSS interpolation; native event aliases report type.name: other despite a callable TypeScript type.
    After: the SCSS fixture succeeds through the legacy engine without preprocessing, and the native alias fixture reports function while preserving MouseEventHandler<HTMLButtonElement> in both raw and the display summary.
  • Focused metadata: 11 tests pass. Renderer and indexer: 91 tests pass. Svelte check: zero errors and warnings. Rebuilt sandbox: all 16 component baselines match. Nine function fields in seven server baseline files intentionally change classification, retaining their exact signatures and required flags. Legacy harness snapshot files are unchanged.
  • Full Svelte harness after recording seven server snapshots: 144 passed and 6 expected failures. Recorder suite: 35 passed. Exact type text and required flags are preserved; zero legacy snapshot changes.
  • Gradio: one isolated worker process, 42 indexed components, zero extraction errors; peak process RSS 990.7 MiB and peak observed worker heap 774.0 MiB. RSS is sampled every 10 ms; heap is observed after each extraction.

Real-world captures retain the original repository revisions. Pink and addon use disclosed compatibility story migrations, identical sources and installs for the head legacy/server pair, and a source manifest recorded before each build. The migrations repair snippet scope without changing component implementations or dependency versions. Their old Storybook 10 comparisons remain informational.

Repo SHA Components Stories Unwaived Fixes / accepted evidence Waivers
ONS c7074b5b9dea70e92aaa8a9cb8a1fd08c059f4dd 67 183 0 20 default omissions accepted by the comparison harness 0
Gradio 526c24340024dfae9c9a7709aad552382ed99f86 42 131 0 1 default omission and 2 text equivalences accepted 0
addon-svelte-csf f2b232996e6c6357d3b88388409e72b8123ee989 22 62 1 Native HTML mock-handler comparison needs additional evidence 0
Pink 491cf4b26577bd8f9e345de528c591586f621f4f 87 450 0 6 callable-type representations; 3 binding representations 0

Both Pink and addon head legacy/server pairs now build and capture successfully, with identical pre-build source manifests and zero timeouts. All 218 component groups remain. Pink has 450 stories in each head capture; the old Storybook 10 capture has 449. The old Storybook 10 comparisons are informational: Pink has 978 differences, addon has 1.

One unwaived finding remains in addon-svelte-csf, tests-addons-actions--default: invalid-comparison because the baseline snippet has no parsable root element. Its native button handler lacks component type evidence. No waiver is applied and the zero-unwaived gate is unmet.

Accepted rule counts are default omissions 100, event omissions 9, snippet children 1, text equivalences 21, callable classifications 6, and binding representations 3. Zero-count root-defect and union-order rules were removed in #36847.

The published head includes the seven server snapshots. Previous-head CI passed type checking, build, format, lint, internal Storybook and Svelte/SvelteKit jobs, but its aggregate failed. New-head CI must complete; there are no approving reviews.

ons

Repo SHA Components before / after Stories before / after Timeouts before / after Violations Waived Stale waivers Result
https://github.com/ONSvisual/svelte-components.git c7074b5b9dea70e92aaa8a9cb8a1fd08c059f4dd 67 / 67 183 / 183 1 / 0 0 0 0 PASS

accepted: text-equivalent 0
accepted: snippet-child 0
accepted: default-omitted 20
accepted: event-omitted 0
accepted: binding-represented 0
accepted: callable-classification 0

Component Story Violation Arg Detail

Gained components: none.

gradio

Repo SHA Components before / after Stories before / after Timeouts before / after Violations Waived Stale waivers Result
https://github.com/gradio-app/gradio.git 526c24340024dfae9c9a7709aad552382ed99f86 42 / 42 131 / 131 0 / 0 0 0 0 PASS

accepted: text-equivalent 2
accepted: snippet-child 0
accepted: default-omitted 1
accepted: event-omitted 0
accepted: binding-represented 0
accepted: callable-classification 0

Component Story Violation Arg Detail

Gained components: none.

addon-svelte-csf

Repo SHA Components before / after Stories before / after Timeouts before / after Violations Waived Stale waivers Result
https://github.com/storybookjs/addon-svelte-csf.git f2b232996e6c6357d3b88388409e72b8123ee989 22 / 22 62 / 62 0 / 0 1 0 0 FAIL

accepted: text-equivalent 19
accepted: snippet-child 1
accepted: default-omitted 6
accepted: event-omitted 9
accepted: binding-represented 0
accepted: callable-classification 0

Component Story Violation Arg Detail
tests-addons-actions tests-addons-actions--default invalid-comparison comparison The baseline snippet has no parsable root element; every committed baseline has one

Gained components: none.

pink

Repo SHA Components before / after Stories before / after Timeouts before / after Violations Waived Stale waivers Result
https://github.com/appwrite/pink.git 491cf4b26577bd8f9e345de528c591586f621f4f 87 / 87 450 / 450 0 / 0 0 0 0 PASS

accepted: text-equivalent 0
accepted: snippet-child 0
accepted: default-omitted 73
accepted: event-omitted 0
accepted: binding-represented 3
accepted: callable-classification 6

Component Story Violation Arg Detail

Gained components: none.

Merge Danger

Door: two-way

Set features.docgenServer: false to use legacy metadata and snippets.

Blast Radius: Svelte

Changes server metadata and source snippets. The legacy path only skips the server-specific description parse.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

  1. Run yarn test server-metadata.test.ts and yarn vitest run code/renderers/svelte/src/docgen code/renderers/svelte/src/svelte-csf/indexer --testTimeout 30000. Expect the SCSS and callable alias fixtures to pass.
  2. Run yarn nx check svelte. Expect zero errors and warnings.
  3. Build a svelte-vite/default-ts sandbox with features: { componentsManifest: true, docgenServer: true }, then run yarn workspace @storybook/docgen-harness baselines:sandbox --template svelte-vite/default-ts --sandbox /absolute/path/to/svelte-vite-default-ts. Expect all 16 documented components to match.
  4. Inspect Button's server metadata: its callable prop must retain its signature in type.raw, and its displayed type summary must be unchanged. Run the legacy mode SCSS fixture without supplying documentationSource; it must still return label.

Caution

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Declare whether manual QA will be needed for this PR during the next release, through qa:needed or qa:skip

  • Make 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:canary label. 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 pr input. branch and sha are optional; if more than one is set, they must be the same commit. The fork author does not need to do anything.

@valentinpalkovic valentinpalkovic added bug ci:normal Run our default set of CI jobs (choose this for most PRs). qa:needed Pull Requests that will need manual QA prior to release. labels Oct 16, 2026 — with Paperclip for GitHub
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor
Warnings
⚠️

This PR targets svelte-docgen-sweep-comparator. The default branch for contributions is next. Please make sure you are targeting the correct branch.

Generated by 🚫 dangerJS against aa5d119

@valentinpalkovic
valentinpalkovic changed the base branch from svelte-server-story-snippets to svelte-docgen-sweep-comparator October 16, 2026 22:18

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

bug ci:normal Run our default set of CI jobs (choose this for most PRs). qa:needed Pull Requests that will need manual QA prior to release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant