Repository navigation
Test: Record vue-component-meta baselines in the vue3 docgen harness - #35574
Conversation
The harness so far only recorded the default vue-docgen-api engine. This adds a second recorder that drives the opt-in vue-component-meta path through the same 25 fixtures, replicating the vue3-vite plugin's processing exactly, and commits the results as cm-*.snapshot files. With both engines pinned, engine or plugin changes surface as reviewed snapshot diffs instead of silent drift.
WalkthroughAdds a Vue 3 ChangesVue 3 component-meta baseline flow
Sequence Diagram(s)sequenceDiagram
participant FixtureSFC
participant VueComponentMeta
participant VueDocgenApi
participant ExtractArgTypes
participant GenerateSourceCode
FixtureSFC->>VueComponentMeta: inspect SFC default export
VueComponentMeta->>VueDocgenApi: backfill event descriptions
VueComponentMeta->>ExtractArgTypes: provide component metadata
ExtractArgTypes->>GenerateSourceCode: process story exports and args
GenerateSourceCode->>FixtureSFC: write cm-snippet snapshots
Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
code/lib/docgen-harness/src/vue3/vue3-component-meta-baselines.test.ts (1)
150-158: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDead default:
docgen.displayNamealways overwrites the fallback.
docgen(built at Line 124) always sets its owndisplayNamefrom the filename, soObject.assign({ displayName: component.name ?? component.__name }, ...docgen)always has the second argument'sdisplayNamewin. The initial fallback object never has an observable effect here.Suggested simplification
- component.__docgenInfo = Object.assign( - { displayName: component.name ?? component.__name }, - JSON.parse(JSON.stringify(docgen)) - ); + component.__docgenInfo = JSON.parse(JSON.stringify(docgen));🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@code/lib/docgen-harness/src/vue3/vue3-component-meta-baselines.test.ts` around lines 150 - 158, Remove the unused displayName fallback from the Object.assign call in the component metadata setup, since the docgen object already supplies displayName. Preserve the existing JSON cloning and __docgenInfo assignment behavior in the docgen branch.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@code/lib/docgen-harness/src/vue3/__testfixtures__/props-basic-types/cm-snippet-UnrepresentableArgs.snapshot`:
- Line 8: Update the PropsBasicTypes snapshot’s :big binding to construct the
intended value without numeric precision loss, using a string-based BigInt
conversion or bigint literal so the rendered snippet preserves 9007199254740993.
In
`@code/lib/docgen-harness/src/vue3/__testfixtures__/runtime-proptype-cast/cm-argtypes.snapshot`:
- Around line 14-20: Escape the embedded quotes in the union-type strings for
the kind summary and value in
code/lib/docgen-harness/src/vue3/__testfixtures__/runtime-proptype-cast/cm-argtypes.snapshot
lines 14-20, and for the size summary and value in
code/lib/docgen-harness/src/vue3/__testfixtures__/type-intersection-whole/cm-argtypes.snapshot
lines 40-46, so both snapshots match serializer output.
---
Nitpick comments:
In `@code/lib/docgen-harness/src/vue3/vue3-component-meta-baselines.test.ts`:
- Around line 150-158: Remove the unused displayName fallback from the
Object.assign call in the component metadata setup, since the docgen object
already supplies displayName. Preserve the existing JSON cloning and
__docgenInfo assignment behavior in the docgen branch.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 77926930-583c-4745-afca-8fe0ded56851
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (57)
code/lib/docgen-harness/README.mdcode/lib/docgen-harness/package.jsoncode/lib/docgen-harness/src/vue3/__testfixtures__/cross-file-composed-utility/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/cross-file-composed-utility/cm-snippet-PropsAsWritten.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/cross-file-extended-interface/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/cross-file-extended-interface/cm-snippet-PropsAsWritten.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/cross-file-imported-interface/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/cross-file-imported-interface/cm-snippet-PropsAsWritten.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/cross-file-props-spread/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/cross-file-props-spread/cm-snippet-PropsAsWritten.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/cross-file-runtime-props/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/cross-file-runtime-props/cm-snippet-PropsAsWritten.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/cross-file-union-alias/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/cross-file-union-alias/cm-snippet-PropsAsWritten.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/define-props-destructured/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/define-props-destructured/cm-snippet-PropsAsWritten.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/define-props-runtime-array/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/define-props-runtime-array/cm-snippet-PropsAsWritten.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/define-props-runtime-object/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/define-props-runtime-object/cm-snippet-PropsAsWritten.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/define-slots-literal-bindings/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/define-slots-literal-bindings/cm-snippet-ScopedIconBinding.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/events-jsdoc/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/events-jsdoc/cm-snippet-WithHandlers.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/jsdoc-tags/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/jsdoc-tags/cm-snippet-PropsAsWritten.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/prop-slot-name-collision/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/prop-slot-name-collision/cm-snippet-IconPropAsWritten.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/props-basic-types/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/props-basic-types/cm-snippet-PropsAsWritten.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/props-basic-types/cm-snippet-UnrepresentableArgs.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/props-generic/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/props-generic/cm-snippet-PropsAsWritten.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/props-ts-enum/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/props-ts-enum/cm-snippet-PropsAsWritten.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/props-union-enum/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/props-union-enum/cm-snippet-PropsAsWritten.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/recursive-type/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/recursive-type/cm-snippet-PropsAsWritten.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/runtime-multi-constructor/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/runtime-multi-constructor/cm-snippet-PropsAsWritten.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/runtime-proptype-cast/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/runtime-proptype-cast/cm-snippet-PropsAsWritten.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/slots-template-only/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/slots-template-only/cm-snippet-ScopedBindings.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/slots-template-only/cm-snippet-StringChild.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/slots/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/slots/cm-snippet-ScopedBindings.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/slots/cm-snippet-StringChild.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/slots/cm-snippet-VNodeChild.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/type-intersection-whole/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/type-intersection-whole/cm-snippet-PropsAsWritten.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/type-intersection/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/type-intersection/cm-snippet-PropsAsWritten.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/v-model/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/v-model/cm-snippet-VModelBinding.snapshotcode/lib/docgen-harness/src/vue3/vue3-component-meta-baselines.test.ts
Documented withDefaults props plus defineSlots no longer lose prop meta under the vue-component-meta engine; both recorders capture the repro fully intact. A regression baseline, no red marker.
#35565 landed schema: true in the vue3-vite checker options, so the recorder now mirrors it. 17 of the 25 cm-argtypes baselines change - literal unions become structured enum sbTypes, imported union aliases unfold to their members, runtime [String, Number] and PropType casts become unions, and the "| undefined" noise disappears from optional primitives. Every cm-snippet baseline stays byte-identical. The recorder also joins the comparator, matching what next established for every other *-baselines.test.ts: it self-compares each committed baseline so a checker or plugin change that loses extraction quality fails with named violations rather than landing as an unremarkable snapshot diff.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@code/lib/docgen-harness/src/vue3/__testfixtures__/define-slots-with-props/DefineSlotsWithProps.vue`:
- Around line 2-4: Update the regression comment in the DefineSlotsWithProps
fixture to reflect the current behavior: prop descriptions, default values, and
slot documentation are preserved in the cm-argtypes snapshot. Describe the
fixture as guarding against regression rather than claiming the metadata is
lost.
- Around line 18-23: Raise the Vue dependency minimum from ^3.2.47 to a
3.3-or-newer range in the relevant manifest, then regenerate the lockfile so its
dependency metadata matches the updated requirement while preserving the
resolved Vue version.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: eb594ad4-4c91-4006-9beb-bec3e3ec4069
📒 Files selected for processing (7)
code/lib/docgen-harness/README.mdcode/lib/docgen-harness/src/vue3/__testfixtures__/define-slots-with-props/DefineSlotsWithProps.vuecode/lib/docgen-harness/src/vue3/__testfixtures__/define-slots-with-props/argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/define-slots-with-props/cm-argtypes.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/define-slots-with-props/cm-snippet-PropsAsWritten.snapshotcode/lib/docgen-harness/src/vue3/__testfixtures__/define-slots-with-props/input.stories.tscode/lib/docgen-harness/src/vue3/__testfixtures__/define-slots-with-props/snippet-PropsAsWritten.snapshot
🚧 Files skipped from review as they are similar to previous changes (1)
- code/lib/docgen-harness/README.md
What I did
The docgen harness so far only records the default
vue-docgen-apiengine for vue3. This PR adds a second recorder,vue3-component-meta-baselines.test.ts, that drives the opt-invue-component-metapath (docgen: 'vue-component-meta'in vue3-vite) through the same 25 fixtures and commits the results ascm-argtypes.snapshot/cm-snippet-<story>.snapshotnext to the legacy files.The recorder replicates the vue3-vite plugin's processing exactly: checker options, empty-meta skip, nested-schema pruning, exposed filtering, and the vue-docgen-api event-description backfill. Hence, the snapshots show what a
vue-component-metauser actually gets today. Like the legacy recorder, it self-compares every committed baseline through the comparator, so a checker or plugin change that loses extraction quality fails with named violations instead of landing as an unremarkable snapshot diff.Why this is worth committing:
vue-component-metauser upgrading could lose extraction quality (cross-file props, named models, slot binding types) the legacy baselines never recorded.The
cm-prefix keeps each recorder's stale-snippet guard scoped to its own files. README updated accordingly.What the baselines record
#35565 landed
schema: truein the vue3-vite checker options while this PR was open, so the recorder mirrors it and the baselines are recorded with schema extraction on. 17 of the 25cm-argtypesbaselines change; everycm-snippet-*stays byte-identical. The diff is the honest before/after for that flag:enumsbTypes instead of opaque strings, so the dropdown is restored.[String, Number]andPropTypecasts become structured union sbTypes (the Support multiple types for Vue #19394 symptom).| undefinednoise disappears, so optional primitives regain{ name: 'number', required: false }and control inference works again.Two things the flag does not fix, visible in the same diff and worth knowing before the OSA Vue engine adopts schema extraction:
type.valuedetail - inline objects, intersections, and recursive types record{ name: 'object', value: {} }becauseremoveNestedSchemasprunes non-enum schemas.table.type.summarykeeps the readable text, so the docs table is fine.otherat this point in the stack. Vue3: Support TypeScript enum props in vue-component-meta docgen #35684 fixes that on top of this PR, using theliteralschema node released invue-component-meta3.3.9.Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
No manual test necessary — this is an internal, unpublished test harness (
private: true, nothing ships to npm). To verify locally:cd code/lib/docgen-harnessyarn run -T vitest run src/vue3— all 4 vue3 suites pass (79 tests, 19 expected-fail red markers)Documentation
MIGRATION.MD
Checklist for Maintainers
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.tsqa:neededorqa:skipbuild🤖 Generated with Claude Code
https://claude.ai/code/session_015gvCXfY6v5hGRDVNL11JXS