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

Question: Ordering of fleet-related policies #771

Open
mrsimpson opened this issue Jun 10, 2022 · 7 comments
Open

Question: Ordering of fleet-related policies #771

mrsimpson opened this issue Jun 10, 2022 · 7 comments
Labels
Policy Specific to the Policy API
Milestone

Comments

@mrsimpson
Copy link

Need for clarification

in the policy spec, it is quite clearly described that ordering of rules within a policy is used to model precedence of one rule over the other.
While this is comparatively easy to understand for policies addressing an individual device (time and speed rules), this is not intuitive for policies addressing an operators fleet (count): If a policy defines two rules, providers can violate both with the same fleet at the same time – and I'd expect both violations to be reported.

A quick example (illustrative):

      {
        "name": "Mobility Caps: Company 1",
        "description": "Caps for Company 1, year 2023",
        "policy_id": "1",
        "provider_ids": ["1"],
        "rules": [
          {
            "name": "Prevent down town being overloaded",
            "rule_id": "8a61de66-d9fa-4cba-a38d-5d948e2373fe",
            "rule_type": "count",
            "rule_units": "devices",
            "geographies": [
              "e3ed0a0e-61d3-4887-8b6a-4af4f3769c14"
            ],
            "vehicle_types": [
              "bicycle",
              "scooter"
            ],
            "maximum": 2000
          },
          {
            "name": "Ensure fair competition within the operational area",
            "rule_id": "57d47e74-6aef-4f41-b0c5-79bb35aa5b9d",
            "rule_type": "count",
            "rule_units": "devices",
            "geographies": [
              "1f943d59-ccc9-4d91-b6e2-0c5e771cbc49"
            ],
            "vehicle_types": [
              "bicycle",
              "scooter"
            ],
            "maximum": 4000
          }
        ]
      }

Although a provider may comply to the first rule and not flood down town with vehicles, there could still be too many devices within the whole district.

Describe the solution you'd like

I'd expect all rules with type count to be evaluated within a policy – and not interrupt the assessment after the first match.

Is this a breaking change

Currently, there is no explicit information about handling count-based policies/rules, but there is general precedence included in the spec, so I'd judge this

  • Yes, breaking

Impacted Spec

For which spec is this feature being requested?

  • policy

Describe alternatives you've considered

We could also split up count rules into own policies. However, this would make it more tricky to lifecycle them: They could have different dates as well as the need to be published individually.

@mrsimpson
Copy link
Author

/cc @marie-x WDYT? What was the original intention when authoring policy?

@schnuerle schnuerle added the Policy Specific to the Policy API label Jun 15, 2022
@mrsimpson
Copy link
Author

@schnuerle @marie-x any plans to tackle fleet policies in MDS 2.0?

@schnuerle
Copy link
Member

Let's see what @jean-populus and @S-eb think about clarifying this as part of the Policy work for 2.0, since they have been leading this work on the steering committee.

@jean-populus
Copy link
Collaborator

This is a pretty big change so I'm not sure we'd have time to solicit feedback and come up with a solution in time for this version. But let's add this for consideration for v3.

@schnuerle schnuerle modified the milestone: Future Dec 8, 2022
@schnuerle
Copy link
Member

Is this still a need @mrsimpson? If so maybe you can draft a PR off of MDS 2.0? If it's a breaking change we can try to line it up for 3.0.

@mrsimpson
Copy link
Author

@schnuerle I still see this as open and unclear wrt how the policy evaluation shall work.
But to be honest, I myself am currently not able to draft a PR 🙁

@schnuerle
Copy link
Member

Ok we will keep it open and hopefully get support from others on creating a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Policy Specific to the Policy API
Projects
None yet
Development

No branches or pull requests

3 participants