Define unknown-field compatibility for recipe policy
- Ngôn ngữ chính
- Rust
- Star
- 54.2k
- Fork
- 6.2k
- Merge trung bình
- 3 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 240
Mô tả
**What problem would this solve?**
Recipe parsing currently ignores unknown top-level keys in both raw recipes and structured recipe DTOs. A near-miss such as `extension: []` can therefore look like an intentional restriction while being treated as though `extensions` were absent, which selects the recipient's configured/default extensions. We need an explicit compatibility contract so recipe authors and recipients agree on whether unrecognized policy fields are errors.
**What would a good outcome look like?**
Raw `Recipe` parsing and structured `RecipeDto` parsing should enforce the same documented rule. Security-sensitive policy typos must fail closed with a useful error, while any forward-compatibility behavior must be explicit and must not silently broaden tool or extension availability. Valid legacy recipes and Desktop save/deeplink flows need a defined migration story, including the meaning of an explicit empty `extensions` list.
The verification plan should cover unknown top-level fields in JSON and YAML; near-misses of `extensions` and other policy keys; omitted versus explicitly empty extensions; structured ACP/deeplink input; Desktop round trips; and identical extension selection before both legacy and state-machine agent loops.
**Possible approaches**
- Reject every unknown top-level field with Serde's strict unknown-field handling.
- Reject only unknown keys that resemble security-sensitive policy fields, preserving unrelated forward-compatible metadata.
- Add a versioned recipe envelope that defines strict policy fields separately from extensible metadata.
Whichever approach is chosen should be applied centrally enough that raw files and structured requests cannot disagree.
**Additional context**
Extension selection happens before the agent-loop branch, so one parsing and validation contract must cover both implementations.
- [x] I have verified this does not duplicate an existing feature request
Do not begin implementation until the issue reaches **Ready** on the [Goose Issues board](https://github.com/orgs/aaif-goose/projects/1).
Hướng dẫn đóng góp
Hướng nghiên cứu
The issue is about recipe parsing policy. Start by examining the recipe parsing code, likely in a module like `recipe.rs` or `policy.rs`. Look for Serde deserialization logic and the current handling of unknown fields. The goal is to define a contract that ensures raw JSON/YAML and structured DTO parsing behave identically, especially for security-sensitive fields like `extensions`. 'Done' means the same rule is enforced for all inputs, with a clear migration path for legacy recipes.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- rust
- Lĩnh vực
- backend-api-design, security
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100