Skip to content

First pass at a hooks definition. - #45

Merged
justinabrahms merged 19 commits into
open-feature:mainfrom
justinabrahms:hooks
May 6, 2022
Merged

justinabrahms merged 19 commits into
open-feature:mainfrom
justinabrahms:hooks

Conversation

@justinabrahms

Copy link
Copy Markdown
Member

I'm explicitly not structuring this into the requirements language at first. I'd like to get some general feedback on the content before I fight with the spec parser. I also want to avoid the situation where some folks comment on the json and others on the text. :)

Comment thread specification/flag-evaluation/hooks.md Resolved
Comment thread specification/flag-evaluation/hooks.md Resolved
Comment thread specification/flag-evaluation/hooks.md Resolved
Comment thread specification/flag-evaluation/hooks.md Resolved
Comment thread specification/flag-evaluation/hooks.md Resolved
Comment thread specification/flag-evaluation/hooks.md Resolved
Comment thread specification/flag-evaluation/hooks.md Resolved
Comment thread specification/flag-evaluation/hooks.md Resolved
Comment thread specification/flag-evaluation/hooks.md Resolved
Comment thread specification/flag-evaluation/hooks.md Resolved
Comment thread specification/flag-evaluation/hooks.md Resolved
Comment thread specification/flag-evaluation/hooks.md Resolved
Comment thread specification/flag-evaluation/hooks.md Resolved

@toddbaert toddbaert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a very good first pass, I left a few comments and look forward to the full version.

The parser script is a bit finicky - it could benefit from some improvement on edge-cases - let me know if you have issues with it.

Also, once #36 is done, we should be able to .gitignore all the JSON files and do some nice automation.

Comment thread specification/flag-evaluation/hooks.md Resolved
@toddbaert toddbaert mentioned this pull request May 2, 2022
Comment thread specification/flag-evaluation/hooks.md Resolved
Comment thread specification/flag-evaluation/hooks.md Resolved
Comment thread specification/flag-evaluation/hooks.md Resolved
Comment thread specification/flag-evaluation/hooks.md Resolved
Comment thread specification/flag-evaluation/hooks.md Resolved
Comment thread specification/flag-evaluation/hooks.md Resolved
Comment thread specification/flag-evaluation/hooks.md Resolved
Comment thread specification/flag-evaluation/hooks.md Resolved
Comment thread specification/flag-evaluation/hooks.md Resolved
Comment thread specification/flag-evaluation/hooks.md Outdated

> When an error occurs in hook evaluation, further evaluation **MUST** stop and error hook evaluation begins.

> If an error is encountered in the error stage, it **MUST** not be returned to the user.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for consistency, it seems like this should also be the case for errors in the finally stage?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent of this line was: If you have an error from the provider and that somehow triggers an error in the error flow.. don't overwrite their original error with this new one.

I'm not actually clear what an error in finally should do. Our whole MO seems to be "never throw, except maybe around client initialization", but also I don't want to have this logic complexity in the finally handler.

try:
  before()
  eval()
  after()
except:
  error()
finally:
  try:
    finally()
  except:
    error()

Comment thread specification/flag-evaluation/hooks.md Resolved
Comment thread specification/flag-evaluation/hooks.md Outdated

> `Flag evalution options` must contain a list of hooks to evaluate.

> `Flag evaluation options` may contain `state`, a map of data to be provided to hook invocations.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we'd specify this somewhere else, but I'm left a bit unclear as to how exactly an Application Author would pass this state in to an invocation

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagine this would be done via the EvaluationOptions. To your earlier point, I think a HookHints option would be apropos here.

Comment thread specification/flag-evaluation/hooks.md Resolved
Comment thread specification/flag-evaluation/hooks.md Resolved
Comment thread specification/flag-evaluation/hooks.md Resolved
@toddbaert

toddbaert commented May 5, 2022 •

Copy link
Copy Markdown
Member

I can't speak for @moredip , but besides the comments I just made (which I think are already resolved and just yet to be updated) I'm good with this. Approving, assuming it's clear how to resolve those.

@toddbaert
toddbaert self-requested a review May 5, 2022 18:54
@moredip

moredip commented May 5, 2022

Copy link
Copy Markdown
Member

no additional concerns on my end 👍

@justinabrahms
justinabrahms merged commit 264ed2a into open-feature:main May 6, 2022
@justinabrahms
justinabrahms deleted the hooks branch May 6, 2022 22:02
jonathannorris added a commit that referenced this pull request Sep 15, 2026
- js-yaml 3.15.1 -> 3.15.2 (high, alert #45)
- js-yaml 4.3.1 -> 4.3.2 (high, alert #44)
- ignore cloud-native.slack.com archive links in markdown-link-check (403 due to Slack blocking unauthenticated crawlers, unrelated to dependency changes but needed to keep json-lint CI green)

Signed-off-by: Jonathan Norris <[email protected]>
jonathannorris added a commit that referenced this pull request Sep 21, 2026
- js-yaml 3.15.1 -> 3.15.2 (high, alert #45)
- js-yaml 4.3.1 -> 4.3.2 (high, alert #44)
- ignore cloud-native.slack.com archive links in markdown-link-check (403 due to Slack blocking unauthenticated crawlers, unrelated to dependency changes but needed to keep json-lint CI green)

Signed-off-by: Jonathan Norris <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants