Skip to content

Document how validatePrefix composes the key prefix - #528

Closed
justin-masse wants to merge 1 commit into
splitio:developmentfrom
justin-masse:docs/clarify-prefix-composition
Closed

justin-masse wants to merge 1 commit into
splitio:developmentfrom
justin-masse:docs/clarify-prefix-composition

Conversation

@justin-masse

Copy link
Copy Markdown

What

A doc comment on validatePrefix. No behaviour change.

Why

The SDK's own SPLITIO segment is appended to the value you supply, so a prefix of myApp produces myApp.SPLITIO.split.<name> — the custom part comes first. That ordering is easy to get backwards, and SPLITIO isn't implied, so passing it explicitly produces SPLITIO.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, but validatePrefix has 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.

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`.
@justin-masse
justin-masse requested a review from a team as a code owner October 6, 2026 15:50
@justin-masse

Copy link
Copy Markdown
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.

@justin-masse
justin-masse deleted the docs/clarify-prefix-composition branch October 6, 2026 16:22
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.

1 participant