Skip to content

Tech debt: Feature Flags schema accepts odd-but-harmless documents silently #8427

Description

@dreamorosi

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

tech-debtTechnical Debt tasks

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions