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

Improve English language parsing of known complex policy expression patterns. #838

Closed
mchernicoff opened this issue Jan 28, 2025 · 3 comments
Assignees
Labels
product: hc Relates to the core "hc" binary product: plugin Relates to one or more hipcheck-maintained plugins type: enhancement New feature or request
Milestone

Comments

@mchernicoff
Copy link
Contributor

We should improve the parsing of English language policy expressions that are complex but follow a known pattern.

For example, the policy expression

(lte (count (filter (eq #t) $)) 0)

for a failed affiliation plugin currently parses to

"Expected the number of elements in "equal to true" filtered on the repository's contributors flagged as affiliated to be less than or equal to 0"

but could say something like

"Expected the number of the repository's contributors flagged as affiliated to be less than or equal to 0"

And the policy expression

(lte (divz (count (filter (eq #f) $)) (count $)) 0.05)

for a failed review plugin currently parses to

"Expected the number of elements in "equal to false" filtered on commits to the repo indicating review or not divided by the number of elements in commits to the repo indicating review or not to be less than or equal to 0.05"

but could say something like

"Expected the percent of commits to the repo not indicating review to be less than or equal to 0.05"

These are suggestions, and even something in between the current and suggested expressions could work.

@mchernicoff mchernicoff added product: hc Relates to the core "hc" binary product: plugin Relates to one or more hipcheck-maintained plugins type: enhancement New feature or request labels Jan 28, 2025
@mchernicoff mchernicoff added this to the 3.11.0 milestone Jan 28, 2025
@mchernicoff mchernicoff self-assigned this Jan 28, 2025
@mchernicoff
Copy link
Contributor Author

We could also improve the display of Span duration primitives. Currently they display as an internal jiff format e.g.

"Expected span of time that has elapsed since last activity in repo to be less than or equal to P364D but it was PT44315963.530639277S"

@BurntSushi
Copy link

FWIW, that format is ISO 8601. Jiff does also support a "friendly" format for durations.

@mchernicoff
Copy link
Contributor Author

FWIW, that format is ISO 8601. Jiff does also support a "friendly" format for durations.

Thanks for the tip. I used it in MR #878 to resolve this component of the issue.
It was very simple and easy to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product: hc Relates to the core "hc" binary product: plugin Relates to one or more hipcheck-maintained plugins type: enhancement New feature or request
Projects
Status: Done
Status: Done
Development

No branches or pull requests

2 participants