Skip to content

feat: added local persistence to ofrep-web provider#1508

Open
jsalaber wants to merge 8 commits intoopen-feature:mainfrom
jsalaber:feat/local-persistence-ofrep-web
Open

feat: added local persistence to ofrep-web provider#1508
jsalaber wants to merge 8 commits intoopen-feature:mainfrom
jsalaber:feat/local-persistence-ofrep-web

Conversation

@jsalaber
Copy link
Copy Markdown

@jsalaber jsalaber commented Apr 2, 2026

This PR

  • adds local persistence to ofrep-web provider
  • caches based on hashed targeting key
  • uses cache if available, wipes in 4xx cases
  • uses evaluation reason CACHED when using cached values
  • new disableLocalCache option to disable local cache

Related Issues

Implements this ADR: open-feature/protocol#64

@jsalaber jsalaber requested review from a team as code owners April 2, 2026 20:42
@jsalaber jsalaber changed the title feat: added local persistence to ofre-web provider feat: added local persistence to ofrep-web provider Apr 2, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces persistent local caching for the OFREP Web provider using localStorage, including a new Storage utility that hashes targeting keys for privacy. The provider now supports cache-first initialization and context changes, with options to disable this behavior. Feedback points out a missing import for GeneralError that would cause a runtime error, and recommends a stale-while-revalidate approach to ensure cached data is eventually refreshed from the network. Other suggestions include hardening localStorage and JSON parsing logic against exceptions, and ensuring the correct context is used when clearing the cache after evaluation failures.

Comment thread libs/providers/ofrep-web/src/lib/ofrep-web-provider.ts Outdated
Comment thread libs/providers/ofrep-web/src/lib/ofrep-web-provider.ts Outdated
Comment thread libs/providers/ofrep-web/src/lib/ofrep-web-provider.ts Outdated
Comment thread libs/providers/ofrep-web/src/lib/ofrep-web-provider.ts Outdated
Comment thread libs/providers/ofrep-web/src/lib/ofrep-web-provider.ts Outdated
Comment thread libs/providers/ofrep-web/src/lib/store/storage.ts Outdated
Comment thread libs/providers/ofrep-web/src/lib/store/storage.ts Outdated
@jsalaber jsalaber force-pushed the feat/local-persistence-ofrep-web branch 2 times, most recently from 9befa19 to 347de53 Compare April 7, 2026 18:22
Comment thread libs/providers/ofrep-web/tsconfig.lib.json Outdated
Comment thread libs/providers/ofrep-web/src/lib/ofrep-web-provider.ts Outdated
Comment thread libs/providers/ofrep-web/src/lib/store/storage.ts Outdated
@jsalaber jsalaber force-pushed the feat/local-persistence-ofrep-web branch 4 times, most recently from 0443d45 to 4f9c6fe Compare April 8, 2026 19:55
Comment thread libs/providers/ofrep-web/tsconfig.lib.json Outdated
@jsalaber jsalaber force-pushed the feat/local-persistence-ofrep-web branch from 4f9c6fe to faf981c Compare April 8, 2026 20:44
jsalaber and others added 4 commits April 15, 2026 15:41
Signed-off-by: Salaber <jason.salaber@dynatrace.com>
Signed-off-by: Salaber <jason.salaber@dynatrace.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: Salaber <jason.salaber@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Salaber <jason.salaber@dynatrace.com>
@jsalaber jsalaber force-pushed the feat/local-persistence-ofrep-web branch from c58734a to 7c9f570 Compare April 15, 2026 19:41
@github-actions github-actions bot requested a review from beeme1mr April 15, 2026 19:41
github-actions bot and others added 3 commits April 15, 2026 15:42
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: Salaber <jason.salaber@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Salaber <jason.salaber@dynatrace.com>
…o prefix local storage keys

Signed-off-by: Salaber <jason.salaber@dynatrace.com>
@jsalaber jsalaber force-pushed the feat/local-persistence-ofrep-web branch from ab29e37 to 9a7215a Compare April 15, 2026 19:42
Copy link
Copy Markdown
Member

@beeme1mr beeme1mr left a comment

Choose a reason for hiding this comment

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

The ADR referenced in the PR has been closed. There's a new one but it hasn't been merged yet. Let's old off merging this until that ADR has been accepted.

https://github.com/open-feature/protocol/pull/75/changes

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.

7 participants