-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
migrate encoding v1 to sway-features #6586
Conversation
2e7e798
to
cc5c455
Compare
CodSpeed Performance ReportMerging #6586 will improve performances by 10.96%Comparing Summary
Benchmarks breakdown
|
dbd8d28
to
30f2f05
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great too see rich infrastructure for feature flags getting implemented! Just one quick comment after glancing over the PR description. Overall, the described infrastructure and intended usage looks great! ❤️
..._vm_tests/test_programs/should_pass/language/main_args/main_args_empty/test.encoding_v1.toml
Show resolved
Hide resolved
65cec66
to
00c666a
Compare
5292f16
to
567c7d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These configurations are applied in a very specific order to allow them to be overwritten. The order from the weakest to the strongest is:
1 - Workspace TOML
2 - Project TOML
3 - CLI
4 - Environment variables.
Are you sure you want environment variables overwriting CLI and not the other way around? It feels like that could lead to some confusion for the user when he's passing a CLI argument that gets ignored because of an environment variable he didn't realize had been set.
Another thing is the use of both experimental
and no-experimental
. What happens if you give contradictory settings? And what happens if you fail to give a setting for a feature - presumably we fall back on a default setting, but wouldn't it then be better to only have the experimental
option, and use the default setting if no user-defined setting is given?
If CLI dominates, developers without access to Another use case is to overwrite them in a CI environment easily. What we may do, is print a warning, that some features are being overwritten by environment variables.
"Contradictory settings" is actually a feature that we want eventually. If you want to test a specific set of settings you do
Yes, we fallback to default. But without "NO_EXPERIMENTAL", if an experimental feature is enabled by default, there is no way to turn it off. |
95e8292
to
cc89e4c
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking forward to get this PR merged and start incorporating experimental flags in two features I work on right now 😄
Just one additional remark. The support for E2E tests is great, but we will down the road also need to decide what to do with, e.g. SDK tests or Sway language tests. The former run precompiled Sway binaries which will for the time being be compiled without experimental features. The latter just run forc test
so again, without experimental features. I expect once we start getting first PRs with experimental features, we can discuss the approach to bringing these tests to run with experimental features as well.
Description
This PR starts the implementation of https://github.com/FuelLabs/sway-rfcs/blob/master/rfcs/0013-changes-lifecycle.md.
CLI flags
Now, all
CLI
s, including our tests, support two new argumentsExperimental features can also be enabled inside
Forc.toml
for workspaces and individual projects.And can be enabled using environment variables:
These configurations are applied in a very specific order to allow them to be overwritten. The order from the weakest to the strongest is:
1 - Workspace
TOML
2 - Project
TOML
3 - CLI
4 - Environment variables.
The rationale is:
1 - We want an easy way to enable and/or disable a feature for the whole workspace;
2 - But we want to allow projects to overwrite these features, when needed.
These two are the suggested approach to configure experimental features, but we also want to allow someone to easily turn on or off features to test something in particular. For that one can use the CLI flags; and in the specific case one does not have access to the CLI, for example, when one of the
SDK
is compiling the code, one can still completely overwrite theTOML
files using environment variables.We are also applying the "no experimental" first. This is to allow the use case of exactly controlling which features will be enabled and disabled. In this case one can use the "meta-feature"
all
to disable everything and enable only the desired features. For example:Test for "-h"
This PR also introduces snapshot tests for "-h" for all forc commands at https://github.com/FuelLabs/sway/pull/6586/files#diff-20a5e677d2ae9266a2247739b6a473d2ad0c627955187d668822e7d194f8e940
Multiple test.toml
This PR also enables the use of multiple
test.toml
. Now eachtest.toml
will be a different test, allowing the same code to be compiled and asserted differently.For example,
main_args_empty
has two files: the normaltest.toml
and a newtest.encoding_v1.toml
. One hasnew_encoding
enabled and the other disabled.When a
test.toml
file has theexperimental
field, we do not use fields with_new_encoding
suffix anymore, making these files simpler:test.toml:
test.encoding_v1.toml
Test tomls with a suffix use
test.toml
as a base. So we do not need to repeat every field in them.Now when we run a test, we will see two tests instead of just one:
Conditional compilation
It is also possible to use conditional compilation using these experimental features. Examples can be found inside
sway-lib-std
.Checklist
Breaking*
orNew Feature
labels where relevant.