Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow partial subjects #18

Merged
merged 2 commits into from
Apr 13, 2024
Merged

feat: allow partial subjects #18

merged 2 commits into from
Apr 13, 2024

Commits on Apr 13, 2024

  1. feat: allow partial subjects

    - Throw `Feature::Subject::NotApplicable` when an invalid subject is
      specified.  This allows for better differentiation of error cases.
    
    Given a feature specified as:
    
    ```yaml
    user:
      id: 1
    ```
    
    and a feature check like `Feature.enabled?(:check, user_id: 1)` then
    when the feature was modified to include *additional* constraints like
    
    ```yaml
    user:
      id: 1
    age:
      gt: 3
    ```
    
    every caller would immediately fail with `Feature::Subject::Invalid`.
    In production this creates an intensely tight coupling between the
    caller and feature data source that is effectively impossible to safely
    modify.
    
    By allowing *partial subject checks* the coupling is removed, allowing
    for data source additions without active caller errors.
    lanej committed Apr 13, 2024
    Configuration menu
    Copy the full SHA
    e09cc6f View commit details
    Browse the repository at this point in the history
  2. Bump toggles to 0.5.0

    lanej committed Apr 13, 2024
    Configuration menu
    Copy the full SHA
    d66963a View commit details
    Browse the repository at this point in the history