Skip to content
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

(feature) evaluation command line for local testing #2560

Open
thomaspoignant opened this issue Oct 22, 2024 · 7 comments · May be fixed by #2609
Open

(feature) evaluation command line for local testing #2560

thomaspoignant opened this issue Oct 22, 2024 · 7 comments · May be fixed by #2609
Assignees
Labels
📍 Assigned enhancement New feature or request good first issue Good for newcomers ODHack9 p2 Medium priority 📌 Pinned

Comments

@thomaspoignant
Copy link
Owner

Requirements

Context

When using GO Feature Flag in case of percentage based evaluation sometimes you want to know which variant will be returned for a specific evaluation context.

Proposed solution

We want a command line tool that allow to perform the evaluation directly in the terminal allowing to get a fast feedback on which variant is served for a specific flag configuration file.

Example

$ go-feature-flag-cli evaluate --config ./flag.goff.yaml --flag "my-flag-name" --evaluation-context '{"targetingKey": "03b77ca4-b599-4a43-8241-af67b23b8fc5"}'

{
  "trackEvents": false,
  "variationType": "Variation_1",
  "failed": false,
  "version": "",
  "reason": "STATIC",
  "errorCode": "",
  "value": true,
  "cacheable": true
}

The cli should allow those commands:

  • -c or --config: path to the flag configuration file (mandatory)
  • -f or --flag: name of the flag to evaluate (optional), if not set the cli should evaluate all the flags available in the -f file configuration.
  • -e or --evaluation-context: the evaluation context to validate the flag against the file.

Implementation

Here are some guidelines for the implementation:

  • The code for this command line should be under cmd/cli.
  • We can use a framework to manage this command line, my choice will be to use spf13/cobra.
  • Consider that the evaluate sub command will be the 1st one but we want to extend the usage of this command line to other need in the future (maybe move the linter there also).
  • The logic behind this command line will be similar to the editor API available here.
@thomaspoignant thomaspoignant added enhancement New feature or request good first issue Good for newcomers p2 Medium priority ODHack9 labels Oct 22, 2024
@thomaspoignant thomaspoignant changed the title (feature) evaluation cli for local testing (feature) evaluation command line for local testing Oct 22, 2024
@mexes20
Copy link

mexes20 commented Oct 23, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hello I want to be assigned to work on this as a first time contributor to the project.

I am a developer with over 4 years of experience.

Copy link
Contributor

github-actions bot commented Nov 2, 2024

This issue has been automatically unassigned due to inactivity.

@github-actions github-actions bot added the Stale When an issue is open for too long label Nov 2, 2024
@github-actions github-actions bot removed the Stale When an issue is open for too long label Nov 2, 2024
@mexes20 mexes20 linked a pull request Nov 2, 2024 that will close this issue
4 tasks
@pheobeayo
Copy link

Can I tackle this one?

@thomaspoignant
Copy link
Owner Author

@pheobeayo there is already a PR open for this one.
You can have a look at it if you want to review it.

@pheobeayo
Copy link

@thomaspoignant okay, I will do that

@SoarinSkySagar
Copy link

Would love to tackle this! I've reviewed the PR made by previous assignee and I'm pretty confident that I can work on top of that one and resolve this issue.
ETA: 3 Days

@0xdevcollins
Copy link

Is it okay if I take this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📍 Assigned enhancement New feature or request good first issue Good for newcomers ODHack9 p2 Medium priority 📌 Pinned
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants