Support `$.flags` context values in segment conditions
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
Research direction
Start by locating the engine's get_value_from_jsonpath path and the JsonPath::parse call, then read the evaluation flow around segment conditions and the serde_json_path_core::spec AST. Use the shared dependency cases from engine-test-data and compare the reference implementation in flagsmith-engine#343. Done means the dependency cases pass, contexts without $.flags avoid per-evaluation overhead, and detection follows the parser AST.
Written by the indexing model from the issue text.
Description
Dependent flags let a segment condition read another flag's result via a $.flags.<feature name>.<enabled|value|variant> property, so that flag has to be resolved before the condition is evaluated. Behaviour is defined by the shared cases in Flagsmith/engine-test-data#59; schema in Flagsmith/flagsmith#8396; reference implementation in Flagsmith/flagsmith-engine#343.
The reference implementation resolves a flag lazily, on first read, rather than scanning every condition up front to discover dependencies. Three things in this engine currently prevent that:
get_value_from_jsonpathcallsserde_json::to_value(ec)on every lookup, serialising the whole context (~268 µs on a 263-feature environment, of which the query itself is 389 ns). A lazily resolvedflagsmap has nothing to be inserted into, and lookups already dominate evaluation.JsonPath::parsealso runs on every lookup (~1.5 µs), uncached.serde_json::Valueexposes no lookup hook, so resolution must be triggered by inspecting the parsed path.serde_json_path::JsonPathkeeps itsQueryprivate, though the AST is public inserde_json_path_core::spec.
Acceptance criteria
engine-test-datais bumped fromv3.7.0to the tag containing the flag dependency cases, and they pass.- An environment with no
$.flagsconditions gains no per-evaluation cost. - Dependency detection uses the parser's AST, not a bespoke matcher, so all pinned spellings of a query agree.
- Dominant language
- Rust
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Flagsmith/flagsmith-rust-flag-engine
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Dependency DashboardOpen
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
All issues in Flagsmith/flagsmith-rust-flag-engine
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
install: root SSH tmpfiles.d drop-in is labeled etc_runtime_t instead of etc_tPossibly taken @andrewdunndev claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
[Misdetection] `text/tab-separated-values` file misdetected as `text/tsv`Possibly taken @bact claimed this today. Openmisdetection needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
C-bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days