Repository navigation
Document how validatePrefix composes the key prefix - #528
Closed
justin-masse wants to merge 1 commit into
Closed
justin-masse wants to merge 1 commit into
justin-masse wants to merge 1 commit into
Conversation
The SDK's own SPLITIO segment is appended to the supplied value, so a prefix of `myApp` yields `myApp.SPLITIO.split.<name>` — the custom part comes first. That ordering is easy to get backwards, and `SPLITIO` is not implied, so passing it explicitly yields `SPLITIO.SPLITIO.split.<name>`. Worth documenting because the failure is silent rather than loud: a producer and a consumer that disagree on the prefix don't error, they just never find each other's keys, and every evaluation returns `control`.
Author
|
Folded into #527 — both changes touch the same Node.js pluggable storage path, so one PR is less overhead to review. Closing this one; the commit is unchanged over there. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A doc comment on
validatePrefix. No behaviour change.Why
The SDK's own
SPLITIOsegment is appended to the value you supply, so a prefix ofmyAppproducesmyApp.SPLITIO.split.<name>— the custom part comes first. That ordering is easy to get backwards, andSPLITIOisn't implied, so passing it explicitly producesSPLITIO.SPLITIO.split.<name>.We lost real time to this. A producer and a consumer that disagree on the prefix don't error — they simply never find each other's keys, and every evaluation returns
control. There's no log line and no exception, so there's nothing to search for.Worth saying out loud that the ordering seems genuinely easy to misremember: it was described to us in writing by Harness as
SPLITIO.<custom>.<key>, which is the reverse of what this function does. Documenting it at the source seemed better than filing a docs ticket.I considered warning when the supplied prefix is already
SPLITIO, butvalidatePrefixhas no logger in scope and changing the composition would silently move existing deployments' keys, so a comment seemed like the right scope.How did you test this code?
jest src/storages/__tests__/KeyBuilder.spec.ts— 9/9 passing.eslint src --ext .js,.ts— clean.