Skip to content

[BUG] flagd doesn't reindex flags on delete #181

Closed

Description

@agardnerIT

Observed behavior

Changing a flag key while flagd is running doesn't reindex the available flags and the old value is returned until flagd is restarted.

Adding new flags does work

Expected Behavior

Adding and removing flags is entirely dynamic and the JSON file is always the source of truth.

Steps to reproduce

Create a JSON file:

{
    "flags": {
      "foo": {
        "state": "ENABLED",
        "variants": {
          "value": "baz"
        },
        "defaultVariant": "value"
      }
    }
}

Which (correctly) returns baz.

Now change "foo": { to "foo2": { and re-execute the retrieval of foo. I'd expect a "no flag found" error or similar, but I still get baz.

Restart the flagd process and foo is no longer found (which is the correct behaviour).


Alternatively, run flagd and (while it is running) add a new flag called foo3. Now get foo3 and that works. Proving that adding dynamically works but deleting doesn't.

Activity

  1. added
    bug
    Needs Triage
    on Oct 2, 2022
  2. AlexsJones commented on Oct 2, 2022

    @AlexsJones
    Member

    Thank you for submitting the bug, I suspect this is to do with the way we merge JSON schema together.

    func (je *JSONEvaluator) SetState(state string) error {

    @skyerus @toddbaert thoughts?

  3. toddbaert commented on Oct 3, 2022

    @toddbaert
    Member

    Ya I think the merge was originally implemented without really thinking about flags being removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Needs Triagebug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions