Skip to content

feat!: add evaluation details to finally hook - #280

Merged
beeme1mr merged 4 commits into
mainfrom
expand-finally-hook-stage
Dec 6, 2024
Merged

beeme1mr merged 4 commits into
mainfrom
expand-finally-hook-stage

Conversation

@beeme1mr

@beeme1mr beeme1mr commented Nov 19, 2024 •

Copy link
Copy Markdown
Member

This PR

  • extends the finally stage in hooks to include evaluation details.

Related Issues

#281

Notes

This is a breaking change but will significantly enhance the usefulness of the finally stage. Currently, the finally stage is used to perform end-of-transaction or clean-up tasks. If this proposal is accepted, the finally stage will have access to the same evaluation details that are returned to the application author.

This change will make implementing the OpenTelemetry Feature Flag Semantic Convention changes easier because the evaluation details in the finally stage can contain all the telemetry we'll need. Values like flag set id and flag set version can be supplied via flag metadata, which isn't accessible in the error or current finally stages.

Here's a draft PR showing how this could be implemented in JavaScript.

Follow-up Tasks

Implement the changes in all SDKs.

Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>

@lukas-reining lukas-reining 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.

I really like the change, I am just wondering if we should make this a breaking change.
Maybe we could avoid it as stated in the comment.

Comment thread specification/sections/04-hooks.md Resolved
Comment thread specification/sections/04-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.

One minor comment here.

But mostly I'd like to have some consensus on this before we get to implementaiton.

beeme1mr and others added 2 commits November 27, 2024 12:25
@beeme1mr beeme1mr self-assigned this Nov 27, 2024
@beeme1mr

beeme1mr commented Dec 4, 2024

Copy link
Copy Markdown
Member Author

I'm going to merge on Friday unless there's an objection. Thanks!

@toddbaert
toddbaert self-requested a review December 5, 2024 21:01

@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.

Approving, and for the record, I think we should generally implement this in SDKs as a breaking change without incrementing the major version, using the leeway this policy gives us. I really don't think many will be impacted, and I think it's an easy and clear fix for those few who are.

@beeme1mr
beeme1mr enabled auto-merge (squash) December 6, 2024 15:46
@beeme1mr
beeme1mr merged commit 776ee1f into main Dec 6, 2024
@beeme1mr
beeme1mr deleted the expand-finally-hook-stage branch December 6, 2024 15:46
@beeme1mr beeme1mr linked an issue Dec 11, 2024 that may be closed by this pull request
github-merge-queue Bot pushed a commit to open-feature/js-sdk that referenced this pull request Dec 12, 2024
## This PR

- adds evaluation details to the `finally` stage in hooks.

### Notes

This breaks the signature of the `finally` stages based on [this spec
enhancement](open-feature/spec#280). It is
**not** considered a breaking change to the SDK because hooks are marked
as experimental in the spec, and the change has no impact on known
hooks.

The noteworthy change to the interface is:

```diff
- finally?(hookContext: Readonly<HookContext<T>>, hookHints?: HookHints): HooksReturn;
+ finally?(hookContext: Readonly<HookContext<T>>, evaluationDetails: EvaluationDetails<T>, hookHints?: HookHints): HooksReturn;
```

### Follow-up Tasks

- Update the JS contribs repo

---------

Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
kevinmlong pushed a commit to kevinmlong/openfeature-js-sdk that referenced this pull request Dec 21, 2024
## This PR

- adds evaluation details to the `finally` stage in hooks.

### Notes

This breaks the signature of the `finally` stages based on [this spec
enhancement](open-feature/spec#280). It is
**not** considered a breaking change to the SDK because hooks are marked
as experimental in the spec, and the change has no impact on known
hooks.

The noteworthy change to the interface is:

```diff
- finally?(hookContext: Readonly<HookContext<T>>, hookHints?: HookHints): HooksReturn;
+ finally?(hookContext: Readonly<HookContext<T>>, evaluationDetails: EvaluationDetails<T>, hookHints?: HookHints): HooksReturn;
```

### Follow-up Tasks

- Update the JS contribs repo

---------

Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
wichopy pushed a commit to wichopy/openfeature-js-sdk that referenced this pull request Dec 31, 2024
## This PR

- adds evaluation details to the `finally` stage in hooks.

### Notes

This breaks the signature of the `finally` stages based on [this spec
enhancement](open-feature/spec#280). It is
**not** considered a breaking change to the SDK because hooks are marked
as experimental in the spec, and the change has no impact on known
hooks.

The noteworthy change to the interface is:

```diff
- finally?(hookContext: Readonly<HookContext<T>>, hookHints?: HookHints): HooksReturn;
+ finally?(hookContext: Readonly<HookContext<T>>, evaluationDetails: EvaluationDetails<T>, hookHints?: HookHints): HooksReturn;
```

### Follow-up Tasks

- Update the JS contribs repo

---------

Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Signed-off-by: Will Chou <w.chou06@gmail.com>
toddbaert added a commit that referenced this pull request Oct 7, 2026
> Reopens [#431](#431), which
could not be reopened after its branch moved. Same change, plus a second
package. **Base of the provider-conformance stack**:
[#423](#423) (assets) →
[#439](#439) (Appendix F) →
[#425](#425) (report schema)
stack on this, but it stands on its own and can merge alone.

## What

Sets up [release-please](https://github.com/googleapis/release-please)
to cut the specification's releases, replacing the manual tagging step.

## Why

The `vX.Y.Z` tags are created by hand. That is easy to postpone — v0.9.0
went out in July and the commits since it are unreleased — and it
assembles the changelog from whoever's memory is handy. release-please
proposes the version and the notes as a pull request, and tags once that
pull request is merged.

## What does not change

| | before | after |
|---|---|---|
| tag | `v0.9.0` | `v0.9.1`, `v0.10.0`, … |
| next version after a breaking change | minor, while < 1.0.0 |
unchanged |
| who decides a release goes out | a maintainer merging | a maintainer
merging the release PR |

`include-component-in-tag: false` keeps the bare `vX.Y.Z` shape rather
than `spec/vX.Y.Z`, and `.release-please-manifest.json` starts at
`0.9.0` so numbering continues rather than restarting. `release-type:
simple` because the root `package.json` is `private: true` and carries
no version of its own; `simple` tracks the version in `version.txt`,
which is why that file is added here.

## Scope: the specification package only

One package, `.`, tagged `vX.Y.Z` as it always has been.

The conformance assets under `specification/assets/provider-tck` need
their own tags too — a Go consumer cannot name a version without one —
but that configuration belongs beside the assets, so it is added in
[#423](#423) along with the
files it describes. This PR stays the general setup and can merge on its
own.

## What does change, and needs a decision

**Release notes become generated from conventional commits.** v0.9.0's
notes were written by hand, including the `⚠️ This release contains
breaking changes` callout linking #280, #306 and #360. Anything beyond
the commit subjects now has to be added to the release pull request
before it is merged.

If the TSC would rather keep the old shape, `changelog-sections` can be
tuned in a follow-up — the defaults are left here so the first release
is easy to eyeball.

## What to expect on merge

release-please runs on push to `main` and should open a release pull
request proposing **v0.9.1**; the non-chore commits since v0.9.0 are
#416, #419, #429 and #408, all `fix:` or `docs:`. Nothing is tagged
until that pull request is merged, so the first run is reviewable before
it has any effect.

The action configuration is the shape v5 actually reads: `command` and
`default-branch` are not v5 inputs, `target-branch` is, and `signoff` is
a configuration-file option rather than an action input — which matters
because this repository enforces DCO on the bot's own commits.

---------

Signed-off-by: Simon Schrottner <simon.schrottner@flagsmith.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
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.

Support expanded OpenTelemetry semantic attributes

7 participants