Skip to content

Reject unknown keys in product selector configuration #1035

Open

Description

@coderabbitai

Summary

Reject unknown keys when reading a phlex::product_selector from configuration. Currently, a misspelled key is ignored and can silently widen the selector.

Requested by @beojan in PR #1024.

Current behavior

The product_selector JSON conversion in phlex/configuration.cpp reads creator, layer, suffix, and stage, but does not reject other keys.

For example:

{"creator": "finder", "layer": "event", "suffx": "seeds"}

Reading this object with config.get<phlex::product_selector>(...) ignores suffx. The suffix field remains unset instead of selecting "seeds". This can select unintended products or cause ambiguity.

Required changes

  • Validate selector object keys during configuration conversion in phlex/configuration.cpp.
  • Reject keys other than creator, layer, suffix, and stage.
  • Report the offending key in a clear configuration error.
  • Keep supported fields optional. Missing supported keys must leave their fields unset.
  • Add regression coverage for direct selector conversion and selectors read within arrays.
  • Update docs/source/guide/product_selectors.rst to describe the corrected behavior.

Acceptance criteria

  • A selector containing suffx fails configuration conversion with a diagnostic that names suffx.
  • Other unknown keys are rejected.
  • Selectors containing only supported keys continue to work.
  • Empty selector objects and selectors that omit supported fields remain valid.
  • An unknown key in an array element is not silently ignored.

This issue concerns unknown object keys, not the separate array-length behavior documented nearby.

References

Activity

  1. coderabbitai commented on Nov 2, 2026

    @coderabbitai
    ContributorAuthor
    🔗 Related PRs

    #1024 - docs: document product selectors [open]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions