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

Add golden tests for public configs #3922

Merged
merged 2 commits into from
Jan 4, 2024

Conversation

fendor
Copy link
Collaborator

@fendor fendor commented Dec 29, 2023

Changes to the vscode schema need to be communicated to vscode-haskell plugin maintainers, otherwise users can't make use of the new configurations.

In general, changes to the schema need to be done consciously when new plugin or features are added. We add these golden tests as an additional contract to inform relevant parties whenever the configs change.

To fix a failing of these tests, review the change. If it is expected, accept the change via:

TASTY_PATTERN="generate schema" cabal test func-test --test-options=--accept

As changes need to be applied for all GHC version specific configs, you either need to run this command for each GHC version that is affected by the config change, or manually add the change to all other golden config files. Likely, the easiest way is to run CI and apply the generated diffs manually.

@fendor fendor force-pushed the enhance/golden-schema-tests branch from abc20e1 to 6f9fbb5 Compare December 29, 2023 15:10
@fendor
Copy link
Collaborator Author

fendor commented Dec 29, 2023

This should make it much harder for us to miss updates for vscode-haskell as the testdata would be modified since the latest release.

For example:

git log 2.5.0.0..HEAD -- test/testdata/schema

would give us all changes to the public interface.

However, this might be really annoying for new plugin maintainers and maybe even release managers.

Copy link
Collaborator

@michaelpj michaelpj left a comment

Choose a reason for hiding this comment

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

This is a good idea and I like it.

I would like to do more in this direction, e.g. generate the lists of supported plugins from this and then have a test that the table in the docs agrees and so on. This is a good start, though.

test/functional/ConfigSchema.hs Outdated Show resolved Hide resolved
test/functional/ConfigSchema.hs Outdated Show resolved Hide resolved
@michaelpj
Copy link
Collaborator

Failures are hard to read, better to use one of the goldenWithDiff functions so we get a diff. Also it looks like maybe something is not available on windows, and so we get a config diff there? 😱

@michaelpj
Copy link
Collaborator

I think we probably do want it to be the case that our "plugin support matrix" varies across the "GHC version" axis but not the "platform" axis. That would just be too much.

@fendor
Copy link
Collaborator Author

fendor commented Jan 2, 2024

I think we probably do want it to be the case that our "plugin support matrix" varies across the "GHC version" axis but not the "platform" axis. That would just be too much.

I also don't think our plugin support matrix should be even allowed to be different per platform. A plugin that only works on a certain platform feels like a bad user experience.

@fendor fendor force-pushed the enhance/golden-schema-tests branch from 6f9fbb5 to 098218a Compare January 2, 2024 12:11
Changes to the vscode schema need to be communicated to vscode-haskell plugin maintainers,
otherwise users can't make use of the new configurations.

In general, changes to the schema need to be done consciously when new plugin or features are added.
We add these golden tests as an additional contract to inform relevant
parties whenever the configs change.

To fix a failing of these tests, review the change. If it is expected, accept the change via:

    TASTY_PATTERN="generate schema" cabal test func-test --test-options=--accept

As changes need to be applied for all GHC version specific configs, you either need to run this command for each
GHC version that is affected by the config change, or manually add the change to all other golden config files.
Likely, the easiest way is to run CI and apply the generated diffs manually.
@fendor fendor force-pushed the enhance/golden-schema-tests branch from 098218a to eb2a0a2 Compare January 2, 2024 12:37
@fendor fendor added the status: needs review This PR is ready for review label Jan 2, 2024
@michaelpj michaelpj enabled auto-merge (squash) January 4, 2024 17:27
@michaelpj michaelpj merged commit 93b6bf5 into haskell:master Jan 4, 2024
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs review This PR is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants