flaviostutz / ruller-dsl-feature-flag

A feature flag engine that can be used to enable, change or rollout features of a system dynamically based on system or user attributes
MIT License
2 stars 6 forks source link

Behavior when condition's needed input parameter is not found during evaluation #12

Closed Gorgho closed 4 years ago

Gorgho commented 4 years ago

Now if i send a request without input, i will reicive an error. How about create a default where if condition ask for input and i don't send that, the app continue just not aplly that condition?

flaviostutz commented 4 years ago

What do you think, @tiagostutz @jairsjunior @abilioesteves?

@Gorgho could you please send a real example on this?

flaviostutz commented 4 years ago

@rafamarts

eabili0 commented 4 years ago

@flaviostutz, I think this is a Domain Specific Issue, meaning only the client app would know the behaviour it wants to see.

Although it's a weak link, we do have a semantic relationship between client apps and rule groups as heavily suggested by feature-dsl's examples.

Based on that, we could add to each rule group a boolean lazyEvaluation field that tells the Ruller the right evaluation behaviour for a specific group:

What do you think?

jairsjunior commented 4 years ago

I think that is a good option has the property lazyEvaluation because with this the evaluation can be not so strict if the client app permits.

flaviostutz commented 4 years ago

Indeed, I think this would be a DSL option, not a feature for the core ruller. It would be a "config" option on the json itself or something. Lets continue this discussion here: https://github.com/flaviostutz/ruller-dsl-feature-flag/issues/11

flaviostutz commented 4 years ago

So, what do you think about placing this option at the "config" node of the rules json? Something like:

{
    "_config": {
        "seed": 123,
        "default_condition": true,
        "lazy_evaluation": false,
        "flatten": true,
    },
    "_items": [{
            "provider": "aws",
            "_condition": "randomPerc(10, input:customerid)",
            "_items": [{
                    "region": "sa-east-1",
                    "login": "login.sa-east-1.test.com",
                    "bootcamp": "bootcamp.sa-east-1.test.com",
                    "_condition": "input:_ip_country=='Brazil'"
                },
                {
                    "region": "us-west-1",
                    "login": "login.us-west-1.test.com",
                    "events": "events.us-west-1.test.com",
                    "bootcamp": "bootcamp.us-west-1.test.com"
                }
            ]
        },
        {
            "provider": "azure",
            "_condition": "randomPercRange(10, 50, input:customerid)",
            "_items": [{
                    "region": "azure-brazil",
                    "login": "login.azure-brazil.test.com",
                    "_condition": "input:_ip_country=='Brazil'"
                },
                {
                    "region": "azure-ny",
                    "login": "login.azure-ny.test.com",
                    "events": "events.azure-ny.test.com",
                    "bootcamp": "bootcamp.azure-ny.test.com"
                }
            ]
        },
        {
            "provider": "vpsdime",
            "_items": [{
                "region": "vpsdime",
                "login": "login.vpsdime.test.com",
                "events": "events.azure-ny.test.com",
                "bootcamp": "bootcamp.azure-ny.test.com"
            }]
        }
    ]
}

I suggest "lazy_evaluation" default value to be "false" because we will stop throwing errors when a required input is not present, so that it will be much harder to detect when the caller is sending wrong values to ruller.

What do you think?

Gorgho commented 4 years ago

For me it is an excellent solucion.

flaviostutz commented 4 years ago

Great!