Why is this needed?
RulesValidator.validate() exits early on if not self.rules, so rules: [] (a list, where the docs specify a dict) passes validation; a non-empty list fails. An empty top-level document {} is also accepted with no output. These aren't bugs in evaluation, but they hide authoring mistakes (a typo'd feature name yields {} after an envelope query, and nothing says so).
Which area does this relate to?
Feature Flags
Suggestion
Emit a warning log for: empty top-level document, rules present but falsy and not a dict, and any feature with rules present but empty. Do not raise, to stay backward compatible. Add tests that pin the warnings.
Context: the TypeScript port (aws-powertools/powertools-lambda-typescript#5614) warns on the same cases and throws only where Python throws, so documents stay portable.
Acknowledgment
Why is this needed?
RulesValidator.validate()exits early onif not self.rules, sorules: [](a list, where the docs specify a dict) passes validation; a non-empty list fails. An empty top-level document{}is also accepted with no output. These aren't bugs in evaluation, but they hide authoring mistakes (a typo'd feature name yields{}after an envelope query, and nothing says so).Which area does this relate to?
Feature Flags
Suggestion
Emit a
warninglog for: empty top-level document,rulespresent but falsy and not a dict, and any feature withrulespresent but empty. Do not raise, to stay backward compatible. Add tests that pin the warnings.Context: the TypeScript port (aws-powertools/powertools-lambda-typescript#5614) warns on the same cases and throws only where Python throws, so documents stay portable.
Acknowledgment