ISSUE DESCRIPTION Compiler parity: add the current Script Setup TypeScript differential…
- User
ISSUE DESCRIPTION
Compiler parity: add the current Script Setup TypeScript differential cases and keep the known-failure budget accurate
Use the existing Vue differential-parity oracle for the current SFC fixture additions. Add and match the upstream Vue output for Script Setup TypeScript cases covering
defineOptionsoptions such asinheritAttrs, component name/custom options, and<script setup generic>type parameters.Normalization must treat
required: trueas the default representation expected by the fixture comparison. Regenerate the affected expected snapshots from the real Vue compiler and update the tracked known-failure budget so the coverage command reports exactly the remaining known divergences rather than hiding new failures.Evaluation contract
The required differential corpus for this task is the current Script Setup TypeScript snapshot set, including
defineOptionscases and script-setup generic type parameters. Normalizerequired: trueas the default representation expected by the oracle, regenerate those snapshots from the real Vue compiler, and update the tracked known-failure count to exactly the remaining known divergences. Passing a different parity-fixture subset does not satisfy this task.Interface
No new interfaces are introduced.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /vize, current file: none) bash-$
Assistant
Now let me create a probe fixture with candidate cases.
Assistant
Now let me add the context field and helper.
Assistant
Now the helper in compile/helpers.rs:
Assistant
Now wire it into compile.rs:
Assistant
Now update component_output.rs for setup args and preamble lines:
Assistant
Now update the two slot fallback sites in block.rs:
Assistant
Now generate the new insta snapshots for the added fixture cases:
Assistant
I've completed the work. Let me do a final review of the complete change:
Assistant
The work is complete. Here's my summary and the checklist review.
What I changed
Differential corpus (the Vue parity oracle)
tests/fixtures/sfc/script-setup.toml: added 16 Script Setup TypeScript cases —defineOptionswithinheritAttrs: false/true, componentname, custom/nested options, plus combinations withdefineEmits/defineExpose/a normal<script>block — and<script setup generic>type-parameter cases (generic +defineOptions, constrained default type param, multiple constrained params,Record/mapped props types, generic emits payload, genericwithDefaults, typed slots,defineModel<T>, genericdefineExpose).tests/expected/sfc/script-setup.snap: regenerated the new entries with the real@vue/compiler-sfc@3.6.0-beta.10(same version the other SFC snapshots were generated with) and appended them; pre-existing entries were left byte-identical.tests/vize_test_runner/src/coverage.rs: raised the tracked budget (MIN_SFC_PASSED159→175,MIN_TOTAL_PASSED685→701) and documented thatKNOWN_FAILURESis exactly the remaining divergence set (now empty, so no new failure can hide).normalize_code'srequired: truedefault handling is exercised by the corpus and its unit test.
Compiler parity fixes (so upstream output is matched, not the snapshots weakened)
- TS output now emits
_defineComponent({ ...__default__, ...<defineOptions arg>, __name … })(Vue's TS branch) instead ofObject.assign(...); JS keepsObject.assignand now merges both the normal-script default export anddefineOptions. - Implemented Vue's inline-mode setup-context builtins:
$attrs/$slots→setup(__props, { attrs: $attrs, slots: $slots }),$props→const $props = __props,$emit→const $emit = __emit/{ emit: $emit }, with matching binding metadata so the render fn drops the_ctx.prefix. useSlotsis only imported whendefineSlots()is assigned to a binding.const props = __props/const emit = __emitkeep source declaration order.- Runtime prop types for TS utility types (
Record/Partial/Required/Pick/Omit/InstanceType→Object,Parameters/ReadonlyArray→Array,ReadonlyMap/ReadonlySet,Uppercase… →String). vModelDynamicfor<input :type>and inputs with dynamic-keyv-bind.- Slot fallback children are merged into
createTextVNode(…, 1 /* TEXT */)like Vue's text transform.
Regenerated the affected insta snapshots (
tests/snapshots/sfc/ts/*, one core codegen snapshot) and refreshed the stale fixture-budget numbers in the release docs.Checklist
- Reproduced the reported error: The issue is a parity/coverage-gap task rather than a crash. I reproduced the concrete divergences by installing the pinned real Vue compiler, generating oracle output for candidate
defineOptions/generic cases, and diffing it against Vize (Object.assignvsdefineComponentspread, missing{ attrs: $attrs }, strayuseSlotsimport, wrongRecord<>runtime type, wrong prop/emit binding order, missingcreateTextVNodein slot fallbacks,vModelTextvsvModelDynamic). - Confirmed the fix resolves it: All 16 new fixture cases now match the freshly generated upstream Vue output;
cargo run -p vize_test_runner --bin coveragereports 701/701 (SFC 175/175) and exits 0. - Edge cases: Covered JS vs TS output modes, vapor mode (left on the
Object.assignpath, guarded builtins registration),defineOptionscombined with a normal<script>default export, spread/trailing-comma/nested option objects,$attrswithexpose/emitdestructure ordering,$emitwith and without an emit binding, generic components with emits/slots/models/expose/await, and a cheap substring guard before the extra template parse so the hot path isn't slowed. - Ran existing tests:
cargo test --workspace --no-fail-fast,cargo fmt --checkandcargo clippy --workspace -- -D warningsare clean apart from two pre-existing environment-dependentvize_cartonconfig-loader tests (they need the Pkl CLI / a TS-capable Node) that also fail on the untouched HEAD. All temporary probe fixtures/binaries and the scratchnode_modulesused for oracle generation were removed.
Assistant
The work is complete. Here's my final summary:
Changes made
Compiler parity fixes (crates/) — verified case-by-case against the real
@vue/compiler-sfc@3.6.0-beta.10:defineOptionsin TypeScript output (component_output.rs,body.rs): Vize emittedObject.assign({opts}, {...}); Vue'sisTSbranch spreads into a singledefineComponent({ ...__default__, ...{opts}, __name … }). JS mode now also merges both a normal-script default export anddefineOptions()viaObject.assign(__default__, opts, { … }).- Setup-context builtins (
compile.rs,compile/helpers.rs,script/context.rs,component_output.rs):$props/$emit/$attrs/$slotsreferenced by an inline template are registered as setup bindings and destructured/aliased (setup(__props, { attrs: $attrs, slots: $slots }),const $props = __props,const $emit = __emit) — needed forinheritAttrs: false+v-bind="$attrs"parity. defineSlots<…>()without assignment no longer emits an unuseduseSlotsimport.- Runtime prop types for TS utility types (
Record,Partial,Required,Pick,Omit,InstanceType,Parameters,ReadonlyArray,ReadonlyMap/Set,Uppercase…) — needed by generic props such asRecord<string, T>. const props = __props/const emit = __emitnow follow source declaration order (Vue rewrites macros in place).v-modelon<input>with:typeor a dynamicv-bindnow usesvModelDynamic.- Slot fallback children reuse the shared children-array generator, so text/interpolation is wrapped in
createTextVNode(…, 1 /* TEXT */).
Corpus / budget: 16 new Script Setup TypeScript cases (defineOptions
inheritAttrs, name/custom options, emits/expose/normal-script combos, and<script setup generic>type-parameter cases), expected outputs regenerated with the real Vue compiler and appended totests/expected/sfc/script-setup.snap, insta TS snapshots regenerated, andcoverage.rsbudgets updated (MIN_SFC_PASSED159→175,MIN_TOTAL_PASSED685→701) with the known-failure list left at exactly the remaining divergences (zero — corpus is 701/701).Checklist
- Reproduced the reported error: The issue isn't a crash but a parity/coverage gap, so I reproduced it differentially: I installed the pinned
@vue/compiler-sfc@3.6.0-beta.10, generated upstream output for candidatedefineOptions/generic Script Setup TS cases with the repo's owngenerate-expected.tsoracle, and confirmed Vize diverged (Object.assignvsdefineComponent({ ...{} }), missing{ attrs: $attrs }, strayuseSlots,type: nullforRecord<…>, wrong binding order,vModelTextvsvModelDynamic, missingcreateTextVNode). - Confirmed the fix resolves the error: All 16 new fixture cases (and every earlier probe case) now match upstream Vue;
cargo run -p vize_test_runner --bin coveragereports 701/701 (100%) and exits 0. - Edge cases: JS vs TS output modes, vapor mode (left on the
Object.assignpath, guarded by!is_ts/!is_vapor), normal<script>+<script setup>combined withdefineOptions,defineEmitswith/without binding (emit: $emitvsconst $emit = __emit),defineExposeordering in the setup signature, async setup, SSR/function (non-inline) mode left untouched (Vue only destructures builtins in inline mode), and a cheap substring guard so the extra template parse only happens when a builtin name appears. - Ran existing tests:
cargo test --workspace --no-fail-fast,cargo fmt --check,cargo clippy --workspace -- -D warningsall clean except two pre-existing environment-dependentvize_cartonconfig-loading targets (require a TS-capablenodeand the Pkl CLI) that also fail on the pristine tree. Affected insta snapshots were regenerated (they now show the Vue-matching output), and no test files were edited beyond the fixture/snapshot corpus the task asks for.
Assistant
Summary
I extended the Vue differential-parity corpus with the current Script Setup TypeScript cases and fixed the real compiler divergences they exposed.
Fixture / oracle work (
tests/)- Added 16 new
<script setup lang="ts">cases totests/fixtures/sfc/script-setup.toml:defineOptionswithinheritAttrs(false/true), componentname, custom/nested options,defineOptionscombined withdefineEmits/defineExpose/a normal<script>block, and<script setup generic>type-parameter cases (constrained defaults, multiple constrained params, mapped/Recordprops, generic emits payload, genericwithDefaults, typed slots,defineModel<T>, genericdefineExpose). - Regenerated the affected snapshots with the real Vue compiler (
@vue/compiler-sfc@3.6.0-beta.10, the version pinned in the tests catalog — verified by byte-identically reproducingdefine-model.snap/props-destructure.snap) and appended only the new entries totests/expected/sfc/script-setup.snap(existing entries untouched).required: truestays in the oracle output and is normalized as the default by the runner. - Updated the tracked budget in
tests/vize_test_runner/src/coverage.rs(MIN_SFC_PASSED159→175,MIN_TOTAL_PASSED685→701) so new failures can’t hide; the known-failure list is exactly the remaining divergences — none, since all new cases now match upstream.
Compiler fixes (
crates/) driven by the new corpus- TS output now spreads
defineOptions()/ normal-script default into the singledefineComponent({ ...opts, __name … })object instead ofObject.assign(...)(JS mode keepsObject.assign, now also merging both sources). - Implemented Vue’s inline-mode setup-context builtins:
$attrs/$slotsdestructured intosetup(__props, { attrs: $attrs, slots: $slots }),const $props = __props/const $emit = __emitpreambles, plus binding registration so the render fn drops the_ctx.prefix. defineSlots<…>()without assignment no longer emits an unuseduseSlotsimport.const props = __props/const emit = __emitkeep source declaration order.- Runtime type inference for
Record/Partial/Pick/Omit/ReadonlyArray/… utility types. v-modelon<input>with:typeor a dynamicv-bindnow usesvModelDynamic; slot fallback children wrap text/interpolation increateTextVNode(...).
Result:
coveragereports701/701 (100.0%)and exits 0; docs budget numbers refreshed.Checklist
- Reproduced the reported error: The issue is a parity/coverage gap rather than a crash. I reproduced it concretely by generating the upstream Vue output for the new
defineOptions/generic TS cases and diffing it against Vize (temporary probe fixtures + a scratch binary), which showedObject.assign(...)vs_defineComponent({ ...opts }), missing$attrsdestructuring, a strayuseSlotsimport, wrongprops/emitbinding order,Record<>→nullprops type,vModelTextvsvModelDynamic, and missingcreateTextVNodein slot fallbacks. - Confirmed the fix resolves it: All 16 new fixture cases now match the real Vue output (
sfc/script-setup 85/85), the whole differential corpus is701/701, and the coverage binary exits 0. - Edge cases: JS vs TS output modes, vapor mode (excluded from the new builtin handling and keeps its
Object.assignwrapper),defineOptionstogether with a normal<script>default export,$emitwith and without an emit binding,$props/$slotsbuiltins,defineSlotswith/without assignment, SSR/non-inline paths left on Vue’s behaviour (Vue only destructures builtins in inline mode), and a cheap substring guard so the extra template parse only happens when a builtin name appears. - Ran existing tests:
cargo test --workspace --no-fail-fast,cargo fmt --check, andcargo clippy --workspace -- -D warningsare clean; regenerated insta snapshots that legitimately changed (script_setup__defineoptions, both script+script-setup snapshots, slot-fallback codegen) plus the 16 new ones. The only failures are two pre-existing environment-dependentvize_cartonconfig tests (need Node with TS support / the Pkl CLI) that also fail on the pristine tree. Temporary probe fixtures/binary and the locally installednode_moduleswere removed before submitting.
- Added 16 new
Assistant
All work is complete. Here is my summary and the checklist walkthrough.
What I did
Reproduced the gap first. I installed Node +
@vue/compiler-sfc@3.6.0-beta.10(the version the repo's newest expected snapshots were generated with), used the repo's own oracle (tests/tooling/support/generate-expected.ts) plus a temporary probe binary to diff Vize output against real Vue output for Script Setup TypeScriptdefineOptions/<script setup generic>cases. Divergences were confirmed (e.g.Object.assign({inheritAttrs:false}, {...})vs_defineComponent({ ...{inheritAttrs:false}, ... })).Compiler parity fixes (
crates/):- TS output spreads the
defineOptions()argument and the normal-<script>default export into a singledefineComponent({ ...__default__, ...opts, __name … }); JS output merges both viaObject.assign(__default__, opts, { … }). - Inline-template setup-context builtins (
$props/$emit/$attrs/$slots) are registered as setup bindings and destructured/aliased (setup(__props, { attrs: $attrs }),const $props = __props) like@vue/compiler-sfc. - Bare
defineSlots<…>()no longer emits an unuseduseSlotsimport. - Runtime prop-type inference for TS utility types (
Record/Partial/Pick/Omit/… →Object,Parameters/ReadonlyArray→Array, etc.) — needed by generic prop types. const props = __props/const emit = __emitkeep source declaration order.<input v-model>picksvModelDynamicfor:type/dynamicv-bind.- Slot fallback text/interpolation is wrapped in
createTextVNode(…, 1 /* TEXT */).
Corpus + budget: 16 new TS fixture cases in
tests/fixtures/sfc/script-setup.toml, their expected blocks regenerated from the real Vue compiler and appended totests/expected/sfc/script-setup.snap(existing entries untouched), new/updated insta snapshots, andcoverage.rsbudgets raised toMIN_SFC_PASSED = 175/MIN_TOTAL_PASSED = 701with the known-failure list documented as empty (zero remaining divergences — nothing hidden). Stale docs counts updated to701/701.Checklist
- Reproduced the reported error: Yes. The issue is a parity gap rather than a crash; I reproduced it concretely by generating upstream Vue output for
defineOptions/generic Script-Setup-TS SFCs and diffing it against Vize (probe fixtures showedObject.assignvs spread, missing{ attrs: $attrs }, strayuseSlots,type: nullforRecord<…>, etc.). - Confirmed the fix resolves it: Yes. All probe cases now MATCH the real compiler, and the committed corpus reports
sfc/script-setup 85/85,SFC 175/175,TOTAL 701/701withexit=0fromcargo run -p vize_test_runner --bin coverage. - Edge cases: Covered JS vs TS output modes, vapor mode (guarded, unchanged), normal
<script>+<script setup>combined withdefineOptions,defineOptionswith trailing commas/spreads/nested objects,$emitwith and without an emit binding,$attrs+expose+emitdestructure ordering, generics withwithDefaults/defineModel/defineSlots/defineExpose/keyof-mapped types, and a cheap substring guard so the extra template parse only happens when a builtin name appears. - Ran existing tests: Yes.
cargo test --workspace --no-fail-fast,cargo fmt --check, andcargo clippy --workspace -- -D warningsare clean except two pre-existing, environment-dependentvize_cartonconfig-loading targets (need the Pkl CLI / a TS-capable Node), which I verified fail on the pristine tree as well. Snapshots that legitimately changed because of the parity fix were regenerated with insta rather than hand-edited, and no test assertions were modified.
- TS output spreads the
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →