Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Support `$.flags` context values in segment conditions

未关闭
#40 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
52/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
rust
领域
backend

调研方向

首先定位 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_jsonpath calls serde_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 resolved flags map has nothing to be inserted into, and lookups already dominate evaluation.
  • JsonPath::parse also runs on every lookup (~1.5 µs), uncached.
  • serde_json::Value exposes no lookup hook, so resolution must be triggered by inspecting the parsed path. serde_json_path::JsonPath keeps its Query private, though the AST is public in serde_json_path_core::spec.
Acceptance criteria
  • engine-test-data is bumped from v3.7.0 to the tag containing the flag dependency cases, and they pass.
  • An environment with no $.flags conditions 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,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Flagsmith/flagsmith-rust-flag-engine 的其他 Issue

查看 Flagsmith/flagsmith-rust-flag-engine 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。