docs: amend ADR 0009 to tie cache key to OFREP resource (domain, url, auth)#80
docs: amend ADR 0009 to tie cache key to OFREP resource (domain, url, auth)#80jonathannorris wants to merge 8 commits into
Conversation
Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
📝 WalkthroughWalkthroughADR-0009 is amended to change how ChangesADR-0009 Cache Key Strategy Amendment
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Comment |
Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
service/adrs/0009-local-storage-for-static-context-providers.md (1)
309-316:⚠️ Potential issue | 🟠 Major | ⚡ Quick winAlign the
cacheKeyPrefixwording everywhere.This amendment says the prefix is only a supplemental namespace, but the earlier answer still describes it as wrapping
targetingKeyalone. Please update that section too, or the ADR will present two incompatible formulas.Proposed fix
- When provided, the cache key becomes `hash(cacheKeyPrefix + ":" + targetingKey)` instead of `hash(targetingKey)`. + When provided, the cache key becomes `hash(cacheKeyPrefix + ":" + url + ":" + auth + ":" + domain + ":" + targetingKey)` instead of `hash(url + ":" + auth + ":" + domain + ":" + targetingKey)`.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@service/adrs/0009-local-storage-for-static-context-providers.md` around lines 309 - 316, The ADR contains inconsistent descriptions of cacheKeyPrefix between sections. The new amendment (2026-06-19) describes cacheKeyPrefix as a supplemental namespace for storage partition separation, but an earlier section still presents it as wrapping targetingKey alone. Locate the earlier section that describes the cacheKeyPrefix configuration and update its wording to clarify that cacheKeyPrefix is now only a supplement for namespacing across storage partitions the application controls directly, not the primary mechanism for preventing collisions. The cache key collision avoidance now relies on hashing the OFREP URL, auth credential, domain, and targetingKey together by default, with cacheKeyPrefix serving as an optional escape hatch only.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@service/adrs/0009-local-storage-for-static-context-providers.md`:
- Around line 39-49: The cache key hash construction using simple
colon-separated concatenation of raw fields is ambiguous and collision-prone
because URLs, credentials, domains, and other fields can contain colon
characters, causing different field combinations to potentially hash to the same
value. Update the hash input construction to use an unambiguous serialization
approach such as length-prefixed encoding for each field, a serialization format
like JSON, or delimiters that encode field boundaries explicitly to ensure that
the hash inputs for the OFREP base URL, auth credential, domain, targetingKey,
and optional cacheKeyPrefix remain distinguishable regardless of their content.
---
Outside diff comments:
In `@service/adrs/0009-local-storage-for-static-context-providers.md`:
- Around line 309-316: The ADR contains inconsistent descriptions of
cacheKeyPrefix between sections. The new amendment (2026-06-19) describes
cacheKeyPrefix as a supplemental namespace for storage partition separation, but
an earlier section still presents it as wrapping targetingKey alone. Locate the
earlier section that describes the cacheKeyPrefix configuration and update its
wording to clarify that cacheKeyPrefix is now only a supplement for namespacing
across storage partitions the application controls directly, not the primary
mechanism for preventing collisions. The cache key collision avoidance now
relies on hashing the OFREP URL, auth credential, domain, and targetingKey
together by default, with cacheKeyPrefix serving as an optional escape hatch
only.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: fca43c2e-4ef6-4694-a3e4-947f09fb839e
📒 Files selected for processing (1)
service/adrs/0009-local-storage-for-static-context-providers.md
…che key Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
service/adrs/0009-local-storage-for-static-context-providers.md (1)
291-295:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winClarify the rebinding contract.
domain-scopedsays one instance can only bind to one domain, but the next bullet still describes what to do when the provider is rebound to a different domain. Please make one of those behaviors explicit so implementers don't end up with conflicting cache-invalidation rules.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@service/adrs/0009-local-storage-for-static-context-providers.md` around lines 291 - 295, There is a contradiction in the provider requirements: the first bullet states that persisting providers should be domain-scoped so each instance binds to at most one domain, but the last bullet describes behavior for when the provider is rebound to a different domain. Clarify the rebinding contract by either removing the domain-rebinding requirement from the last bullet if domain-scoped truly means no rebinding is possible, or revise the domain-scoped explanation to explicitly allow rebinding with appropriate cache invalidation. Choose one clear behavior pattern and ensure all bullets align with it.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@service/adrs/0009-local-storage-for-static-context-providers.md`:
- Around line 291-295: There is a contradiction in the provider requirements:
the first bullet states that persisting providers should be domain-scoped so
each instance binds to at most one domain, but the last bullet describes
behavior for when the provider is rebound to a different domain. Clarify the
rebinding contract by either removing the domain-rebinding requirement from the
last bullet if domain-scoped truly means no rebinding is possible, or revise the
domain-scoped explanation to explicitly allow rebinding with appropriate cache
invalidation. Choose one clear behavior pattern and ensure all bullets align
with it.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e976145c-67ce-4a5d-8b34-25aa8d523cc8
📒 Files selected for processing (1)
service/adrs/0009-local-storage-for-static-context-providers.md
Amends ADR 0009 (static-context local persistence) to tie the persisted cache key to the OFREP resource the evaluation was fetched from, by including the provider's bound
domain, the OFREP base URL, and the auth credential, in addition to thetargetingKey.Motivation
The accepted ADR keys the persisted cache on
targetingKey(optionally prefixed with an application-suppliedcacheKeyPrefix), leaving collision avoidance up to the application. A persisted evaluation is really a function of the resource it came from (server + credential + bound domain) and the identity it was requested for, so the cache key should reflect that automatically.Surfaced in open-feature/js-sdk-contrib#1566, where the OFREP web provider's local persistence has no way to know which
domainit's bound to.Changes
hash(url + ":" + auth + ":" + domain + ":" + targetingKey)(with optionalcacheKeyPrefixstill prepended).cacheKeyPrefixis demoted to a supplement for app-controlled namespacing.domainrelies on open-feature/spec#393, which supplies thedomaintoinitializeand adds an opt-indomain-scopeddeclaration the API enforces, so a persisting OFREP provider is bound to a singledomainand thedomaincomponent of the key is unambiguous.Open for discussion
Two points flagged as open questions in the ADR:
headersFactory, and a token that rotates on every request would defeat persistence. But auth doesn't change on every request, so for the common case of a stable credential it still provides useful separation between projects/environments/keys against the same URL. The original ADR droppedauthTokenfor the rotation reason (see protocol#64); reviewers may prefer a stable credential identifier or making the auth component opt-in.cacheKeyPrefix(Open Question chore: Configure Renovate #4): now that the URL, auth, anddomainare in the key by default, the collisionscacheKeyPrefixwas added to solve are handled automatically. I lean toward removing it to simplify the config surface, but open to keeping it as an explicit escape hatch.Marked as a draft for discussion.