Is it possible to migrate / make sure that new Fea...
# ask-questions
g
Is it possible to migrate / make sure that new Feature flags are created with 'v2' of hashing algorithm?
s
Flags will default to v2 if your SDK supports it. You should check your SDK Connection and make sure the version is set to an up-to-date version.
g
@strong-mouse-55694 SDK support it , but The flag congifuration from CDN does not have hash version to set to 2
unless its incorrectly configured on SDK ?
https://github.com/growthbook/growthbook-golang/blob/774feea9089cb5657c1c945d898138d304fb63b8/hash.go#L9 It says default version is 1 (so it used old hash version) Passing explicitly V2 would force it to use V2, but CDN does not have this field set
According to doc https://docs.growthbook.io/lib/js#inline-experiments
Note: For backwards compatibility, if no
hashVersion
is specified, it will fall back to using version
1
, which is deprecated. In the future, version
2
will become the default. We recommend specifying version
2
now for all new experiments to avoid migration issues down the lin
So its seems it use v1. Is there any way to opt in for V2 ?
s
The way it works is that for experiment rules on flags, the default is v2, like in this payload:
Copy code
"flag-prompt-collaboration-features": {
      "defaultValue": false,
      "rules": [
        {
          "coverage": 1,
          "seed": "86752fdb-0a5a-419c-8807-2d7615064c01",
          "hashVersion": 2,
          "variations": [
            false,
            true
          ],
          "weights": [
            0.5,
            0.5
          ],
          "key": "prompt-collaboration-features",
          "phase": "0",
          "meta": [
            {
              "key": "0"
            },
            {
              "key": "1"
            }
          ]
        }
      ]
    },
It'll fallback to v1 if the hashVersion property isn't present. If a flag doesn't have an experiment rule, then the hashVersion isn't included, of course, because it's not needed.
g
I am using my flag with a % rollout, but just as a 'raw' flag, (not for experiment)
Copy code
"p.test_gradual": {
      "defaultValue": false,
      "rules": [
        {
          "id": "fr_19g61omg9ax9lb",
          "condition": {
            "bucket": "usa"
          },
          "force": true,
          "coverage": 0.1,
          "hashAttribute": "user_id"
        }
      ]
    }
  },
How can I make sure that CDN returns 2 as
hashVersion
?