Skip to content

Commit

Permalink
Invert feture flag to enable enforcing @alias by default
Browse files Browse the repository at this point in the history
Reviewed By: gordyf

Differential Revision: D69669990

fbshipit-source-id: 266a35bed4f4798ebadc3d725682fd81f6341a11
  • Loading branch information
captbaritone authored and facebook-github-bot committed Feb 20, 2025
1 parent 9d556e7 commit c98f82a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
7 changes: 6 additions & 1 deletion compiler/crates/common/src/feature_flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub struct FeatureFlags {

/// Enforce that you must add `@alias` to a fragment if it may not match,
/// due to type mismatch or `@skip`/`@include`
#[serde(default)]
#[serde(default = "enabled_feature_flag")]
pub enforce_fragment_alias_where_ambiguous: FeatureFlag,

/// Print queries in compact form
Expand Down Expand Up @@ -189,6 +189,11 @@ pub enum FeatureFlag {
RolloutRange { rollout: RolloutRange },
}

/// Used for making feature flags enabled by default via Serde's default attribute.
fn enabled_feature_flag() -> FeatureFlag {
FeatureFlag::Enabled
}

impl FeatureFlag {
pub fn is_enabled_for(&self, name: StringKey) -> bool {
match self {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@
"enforce_fragment_alias_where_ambiguous": {
"description": "Enforce that you must add `@alias` to a fragment if it may not match, due to type mismatch or `@skip`/`@include`",
"default": {
"kind": "disabled"
"kind": "enabled"
},
"oneOf": [
{
Expand Down Expand Up @@ -3708,7 +3708,7 @@
"enforce_fragment_alias_where_ambiguous": {
"description": "Enforce that you must add `@alias` to a fragment if it may not match, due to type mismatch or `@skip`/`@include`",
"default": {
"kind": "disabled"
"kind": "enabled"
},
"oneOf": [
{
Expand Down Expand Up @@ -5925,7 +5925,7 @@
"enforce_fragment_alias_where_ambiguous": {
"description": "Enforce that you must add `@alias` to a fragment if it may not match, due to type mismatch or `@skip`/`@include`",
"default": {
"kind": "disabled"
"kind": "enabled"
},
"oneOf": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ query ModuleNameQuery {
"featureFlags": {
"disable_deduping_common_structures_in_artifacts": {
"kind": "enabled"
},
"enforce_fragment_alias_where_ambiguous": {
"kind": "disabled"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ query ModuleNameQuery {
"featureFlags": {
"disable_deduping_common_structures_in_artifacts": {
"kind": "enabled"
},
"enforce_fragment_alias_where_ambiguous": {
"kind": "disabled"
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion scripts/config.tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@
"relay_resolver_enable_interface_output_type": {
"kind": "enabled"
},
"enable_exec_time_resolvers_directive": true
"enable_exec_time_resolvers_directive": true,
"enforce_fragment_alias_where_ambiguous": {
"kind": "disabled"
}
},
"language": "flow",
"resolverContextType": {
Expand Down

0 comments on commit c98f82a

Please sign in to comment.