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
We have network access. Let's install node and set up the JS dependencies to run the actual Vue compiler oracle.
Assistant
Now let's check if generate-expected.ts is a plain TS file needing tsx/ts-node execution, and what runtime is used in CI (probably tsdown/vite-node or tsx). Let's check.
Assistant
NODE_PATH doesn't work well for ESM resolution. Let's just symlink node_modules into the tests directory (or repo root).
Assistant
It works. Let's check the diff (should be none since nothing changed yet).
Assistant
Now let's set up node_modules link and generate expected output for this isolated fixture, using a script that mimics
compileSFC.Assistant
Let's just put the script in /tmp/oracle where node_modules already exists.
Assistant
Now let's add the two generic combo cases after "generic component with default type".
Assistant
Now let's regenerate the whole script-setup expected snapshot using the isolated node oracle script (not the repo's generate-expected.ts, to avoid the hoistStatic-default discrepancy), but only appending new entries while keeping old ones untouched. Let's verify count of cases now.
Assistant
Good, 5 new cases (69 -> 74). Now let's append the 5 new expected entries (already generated in /tmp/new_cases.snap) to the expected snap file.
Assistant
Good, ends with newline, new starts with "===". Just concatenate directly.
Assistant
Now let's run cargo test/coverage to see how vize's actual compiler output compares to these new expected snapshots.
Assistant
Good, it compiles. Let's fix formatting nicely with proper
\nescapes for readability, then run the coverage tool.Assistant
Let me clean this up with proper
\nescape sequences for readability using edit tool.Assistant
Now let's fix the remaining two literal newlines similarly for consistency (not required but good practice).
Assistant
Now let's rerun the coverage tool.
Assistant
Let's change the
has_define_slotscomputation to also require a binding name.Assistant
Let's fix the same bug in function_mode/compiler.rs for consistency (this is used for non-inlineTemplate mode; not exercised by our fixtures but good to keep parity consistent).
Assistant
Good, already present and unique (added once). Now let's clean up temp files, remove symlink, unset PATH additions if needed, and verify the full diff.
Assistant
Let's view the full diff to review everything carefully.
Assistant
Now let's check other tests in the repo that might reference the old snapshot output for defineOptions/defineSlots TS behavior (unit tests within vize_atelier_sfc using insta snapshots) that could break due to our component_output.rs changes.
Assistant
This matches real Vue's output format exactly. Let's accept it.
Assistant
This confirms the fix correctly applies to the
has_default_export && is_tspath too, matching Vue's real behavior. Let's accept all pending.snap.newfiles.Assistant
All pass now. Let's run the entire test suite for the workspace to check for any other regressions caused by our compiler change.
Assistant
Confirmed these failures pre-exist regardless of our change (missing
pklbinary in this sandbox). Let's remove the leftover.snap.newfiles these unrelated tests created.Assistant
Now let's run the full workspace test suite skipping the pkl-related test, to look for any other regressions.
Assistant
Now let's re-run the coverage tool one final time to confirm 100% pass and correct totals, and double-check the js/ts snapshot pair for a couple of new cases visually.
Assistant
Let's also check the JS (non-TS) snapshot generation for the same fixtures doesn't break (since snapshot_tests.rs also has JS variant tests, and this new fixture set added TS-only cases but should still be exercised in JS forced mode too - let's confirm all still ok, already confirmed with 405 passed earlier). Let's view the coverage.rs test still passes.
Assistant
Now let's double check the diff for the fixture/expected files, and review other generated JS snapshot files for consistency.
Assistant
Now let's view the appended expected snapshot content to verify it's well formed.
Assistant
This looks great and directly derived from the real Vue compiler oracle. Let's also double check the remaining diff (generic defineSlots part).
Assistant
Everything looks good and consistent with the real Vue compiler output. Now let's clean up leftover temp files and the node install (not part of repo, in /tmp, doesn't need cleanup but let's remove symlink risk).
Assistant
Just pre-existing warnings, no errors. Let's check clippy on the modified files without --all-targets (lib only) to be safe, and verify no new warnings introduced by our diff specifically.
Assistant
No warnings for our modified files. Let's also run
cargo fmt --checkfor these files to ensure formatting compliance.Assistant
Formatting fixed. Let's rebuild and rerun tests to make sure formatting change didn't break anything.
Assistant
All good. Let's view the final diff summary.
Assistant
Now
git diff --cachedandgit difftogether should reflect everything. Let's verifygit diff HEADshows all changes including staged ones.Assistant
Everything is captured now with
git diff HEAD. This should be safe for submission regardless of whether the submit mechanism usesgit difforgit diff HEAD.Assistant
This is clean and well-documented. Let's do one final full test run to be thorough.
Assistant
Only the pre-existing environment-related pkl failures remain (unrelated, confirmed earlier via clean checkout). Let's clean up stray
.snap.newfiles created by this last test run.Assistant
Everything is clean and consistent. Let's do one more coverage run for final confirmation.
Assistant
Summary
I resolved the issue by:
-
Setting up the real Vue compiler oracle (
@vue/compiler-sfc@3.6.0-beta.10, matching the pinned catalog version) to generate authoritative expected outputs, installing Node.js locally since it wasn't present in the sandbox. -
Added new differential fixture cases to
tests/fixtures/sfc/script-setup.toml:defineOptions with inheritAttrs (ts)defineOptions with component name (ts)defineOptions with custom options (ts)generic component with defineOptions(script setup generic + defineOptions)generic component with defineSlots(script setup generic + defineSlots type params)
-
Regenerated only the affected expected snapshots (
tests/expected/sfc/script-setup.snap) using the real Vue compiler for exactly these new cases, appending them without disturbing the rest of the file (avoiding an unrelated full-file regen that would've introduced hoist-static noise from version drift). -
Found and fixed two genuine compiler parity bugs while diffing against the real oracle:
- Vize always emitted
Object.assign(options, {...})fordefineOptions/normal-script default-export merging, but real Vue spreads (...options) inside_defineComponent({...})when in TypeScript mode. Fixed incomponent_output.rs(and mirrored the same corrected snapshot expectations). - Vize unconditionally imported
useSlotswheneverdefineSlots()was used, even for the common type-only usage (defineSlots<{...}>()with no variable binding). Real Vue only needsuseSlotswhen the macro result is bound to a variable. Fixed in both the inline-template and function-mode compilers.
- Vize always emitted
-
Confirmed the
required: truenormalization already existed (normalize_default_required_trueintests/vize_test_runner/src/lib.rs) and works correctly for these new generic/props cases. -
Updated the coverage budget (
tests/vize_test_runner/src/coverage.rs) —MIN_SFC_PASSED159→164 andMIN_TOTAL_PASSED685→690 — so the tracked minimums reflect the new fixture corpus.KNOWN_FAILURESremains&[](0), which is accurate since all new cases now pass after the compiler fixes — the coverage command reports exactly 690/690 (100%), with no hidden failures. -
Regenerated the internal insta snapshots (
tests/snapshots/sfc/ts/*.snap) affected by the same fix.
Checklist
- Reproduced the error: Yes — ran the coverage tool and diffed against the real Vue oracle to discover the
Object.assignvs. spread mismatch and the spurioususeSlotsimport. - Fix resolves it: Yes —
cargo run -p vize_test_runner --bin coveragenow reports 690/690 (100%), including all 5 new cases. - Edge cases: Also fixed the analogous
has_default_export(TS) path and the non-inlinefunction_modecompiler for consistency, even though not directly exercised by the new fixtures, to keep both TS output paths correct. - Ran existing tests:
cargo test --workspacepasses except for 3 pre-existingpkl-binary-related failures invize_carton, confirmed unrelated viagit stashon a clean checkout.
-
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 →
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 →