Support `$.flags` context values in segment conditions
还没有人认领这个 Issue。
评估
调研方向
首先定位 engine 的 get_value_from_jsonpath 路径和 JsonPath::parse 调用,然后阅读围绕 segment 条件以及 serde_json_path_core::spec AST 的评估流程。使用 engine-test-data 中共享的依赖项用例,并与 flagsmith-engine#343 中的参考实现进行比较。当依赖项用例通过、没有 $.flags 的 context 避免每次评估的开销,并且检测遵循 parser AST 时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Rust
- 星标
- 1
- 派生
- 0
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Flagsmith/flagsmith-rust-flag-engine 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 4/5 3-5 天 新手友好度 25/100
-
难度 3/5 1-2 天 新手友好度 45/100
查看 Flagsmith/flagsmith-rust-flag-engine 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
vercel-labs/agent-browser#2017 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
tursodatabase/turso#9405 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
PolyMeilex/Neothesia#447 ·
维护者通常 1 天内回复
-
backend::vllm diffusion multimodal
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
trezor/trezor-firmware#7985 ·
维护者通常 2 天内回复