Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(tasks/transform-conformance): support override to replace takeover mode #7771

Conversation

Dunqing
Copy link
Member

@Dunqing Dunqing commented Dec 10, 2024

This PR does the following things.

  1. Move the override output of the snapshots folder to the overrides folder.
  2. Support override mode to replace takeover mode
  3. The update_fixtures.js no longer uses overrides's output.js to replace Babel's output.js.

How does override mode work?

When running each test, it checks whether an output file for that test exists in the ⁠overrides directory. If it does, the output file will be used to compare with the transformed code.

Copy link

graphite-app bot commented Dec 10, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

@github-actions github-actions bot added A-transformer Area - Transformer / Transpiler C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Dec 10, 2024
Copy link

codspeed-hq bot commented Dec 10, 2024

CodSpeed Performance Report

Merging #7771 will not alter performance

Comparing 12-10-chore_tasks_transform-conformance_support_override_to_replace_takeover_mode (b089e8b) with main (450bb33)

Summary

✅ 29 untouched benchmarks

@Dunqing Dunqing force-pushed the 12-10-chore_tasks_transform-conformance_support_override_to_replace_takeover_mode branch from aef8822 to 4ee262c Compare December 10, 2024 14:43
@Dunqing Dunqing force-pushed the 12-10-chore_tasks_transform-conformance_support_override_to_replace_takeover_mode branch from 4ee262c to 516de5d Compare December 10, 2024 15:07
overlookmotel added a commit that referenced this pull request Dec 10, 2024
… fixtures (#7777)

In two of the overridden text fixtures for class properties transform, there was no `output.js` file because what was overridden was just `options.json` and `update_fixtures.js` script then generated new output files using Babel with the new options.

That was fine, but doesn't work with #7771. So add `output.js` files to the these overrides too.
@overlookmotel
Copy link
Contributor

I see one problem. There are 3 overrides for class properties transform where the options.json file is overridden too. To replace update_fixture.js, the new mechanism would need to look for options.json files in the overrides folder too, and use that as the source of truth if there is one (note: required for exec tests too).

This explains the difference in snapshots for class properties transform in this PR.

2 of the overrides for class properties transform have no output.js files in them, but I've changed that in #7777. If you want to rebase on top of that, it'll solve that particular problem.

What explains the difference in snapshots for the other transforms, I cannot say. Looks like something's not working!

@overlookmotel
Copy link
Contributor

PS I can clean up update_fixtures.js to remove dead code after this PR is merged. Probably faster for me to do it, as I'm familiar with it.

@Dunqing
Copy link
Member Author

Dunqing commented Dec 10, 2024

What explains the difference in snapshots for the other transforms, I cannot say. Looks like something's not working!

Looks like the takeover mode hasn't stored any information in snapshots, we even don't know if the semantic check is passed or not, now we does.

@overlookmotel
Copy link
Contributor

overlookmotel commented Dec 10, 2024

An unwelcome discovery! 😭

But yes better to know than not to know.

But every single test for object-rest-spread is now "Output mismatch"! I guess that's where --override comes in. Going through them all and checking our output is actually correct is going to be fun...

@Dunqing Dunqing force-pushed the 12-10-chore_tasks_transform-conformance_support_override_to_replace_takeover_mode branch from 516de5d to 4eb8657 Compare December 10, 2024 15:57
@Dunqing
Copy link
Member Author

Dunqing commented Dec 10, 2024

But every single test for object-rest-spread is now "Output mismatch"! I guess that's where --override comes in. Going through them all and checking our output is actually correct is going to be fun...

Fixed! By using --override 😂.

@Dunqing
Copy link
Member Author

Dunqing commented Dec 10, 2024

The private-loose/foobar/input.js test still mismatch, can you take a look more?

@Dunqing Dunqing force-pushed the 12-10-chore_tasks_transform-conformance_support_override_to_replace_takeover_mode branch from 4eb8657 to c4ade12 Compare December 10, 2024 16:20
@overlookmotel
Copy link
Contributor

overlookmotel commented Dec 10, 2024

The private-loose/foobar/input.js test still mismatch, can you take a look more?

Looks like the problem is that it's not looking for options.json in overrides folder and using that over the original Babel one if it's there. i.e. Currently you can override output.js, but not options.json.

Sorry if I was unclear above. #7777 solved the problem of when overrides folder contains only an options.json file and no output.js file (solved by just adding output.js files to those override folders). But still options.json in overrides needs to be obeyed!

@Dunqing
Copy link
Member Author

Dunqing commented Dec 10, 2024

The private-loose/foobar/input.js test still mismatch, can you take a look more?

Looks like the problem is that it's not looking for options.json in overrides folder and using that over the original Babel one if it's there. i.e. Currently you can override output.js, but not options.json.

Sorry if I was unclear above. #7777 solved the problem of when overrides folder contains only an options.json file and no output.js file (solved by just adding output.js files to those override folders). But still options.json in overrides needs to be obeyed!

Solved! Thank you for finding the root cause!

@Dunqing Dunqing force-pushed the 12-10-chore_tasks_transform-conformance_support_override_to_replace_takeover_mode branch from c4ade12 to 1556492 Compare December 10, 2024 23:01
@overlookmotel overlookmotel force-pushed the 12-10-chore_tasks_transform-conformance_support_override_to_replace_takeover_mode branch from 1556492 to 78574fa Compare December 11, 2024 16:00
@overlookmotel overlookmotel changed the base branch from main to 12-11-test_transformer_conformance_runner_use_helperloadermode_external_in_takeover_mode December 11, 2024 16:00
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Dec 11, 2024
@overlookmotel overlookmotel changed the base branch from 12-11-test_transformer_conformance_runner_use_helperloadermode_external_in_takeover_mode to graphite-base/7771 December 11, 2024 16:07
Copy link

graphite-app bot commented Dec 11, 2024

Merge activity

  • Dec 11, 11:07 AM EST: @graphite-app we removed the merge queue label because we could not find a Graphite account associated with your GitHub profile.

You must have a Graphite account in order to use the merge queue. Create an account and try again using this link

@graphite-app graphite-app bot added 0-merge Merge with Graphite Merge Queue and removed 0-merge Merge with Graphite Merge Queue labels Dec 11, 2024
Copy link
Contributor

@overlookmotel overlookmotel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rebased this on top of #7807, so it's easier to see that all the old takeover snapshots have just moved to overrides, and this change hasn't actually altered the output.js files.

@overlookmotel overlookmotel force-pushed the 12-10-chore_tasks_transform-conformance_support_override_to_replace_takeover_mode branch from 78574fa to 51b6b30 Compare December 11, 2024 16:11
@overlookmotel overlookmotel changed the base branch from graphite-base/7771 to main December 11, 2024 16:12
@overlookmotel overlookmotel force-pushed the 12-10-chore_tasks_transform-conformance_support_override_to_replace_takeover_mode branch from 51b6b30 to e21c9eb Compare December 11, 2024 16:12
…keover` mode (#7771)

This PR does the following things.

1. Move the override output of the `snapshots` folder to the `overrides` folder.
2. Support `override` mode to replace `takeover` mode
3. The `update_fixtures.js` no longer uses `overrides`'s `output.js` to replace Babel's `output.js`.

### How does `override` mode work?

When running each test, it checks whether an output file for that test exists in the ⁠`overrides` directory. If it does, the output file will be used to compare with the transformed code.
@overlookmotel overlookmotel force-pushed the 12-10-chore_tasks_transform-conformance_support_override_to_replace_takeover_mode branch from e21c9eb to b089e8b Compare December 11, 2024 16:18
@graphite-app graphite-app bot merged commit b089e8b into main Dec 11, 2024
26 checks passed
@graphite-app graphite-app bot deleted the 12-10-chore_tasks_transform-conformance_support_override_to_replace_takeover_mode branch December 11, 2024 16:22
Dunqing pushed a commit that referenced this pull request Dec 12, 2024
Follow-up after #7771 and #7779. Remove dead code from transformer fixtures updater script.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0-merge Merge with Graphite Merge Queue A-transformer Area - Transformer / Transpiler C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants