Take the release as a number or a string, and never as zero - #279
Merged
Merged
Conversation
The service is changing `release` on `start` from the string "97" to an int,
so that it matches /api/answer, which always sent one. Accepting both spellings
means neither side of that change breaks the panel -- a parser pinned to either
one would have.
The coercion that did this had a hole worth more than the rename. `Number(null)`,
`Number('')` and `Number(false)` are all 0, so an absent or empty release became
release 0: a number that sorts, compares and caches perfectly well while naming
no release that has ever existed. Now only a number or a non-empty string can be
a release, and it has to be positive.
The parsed value was also being stored in a private field nothing read. The
dead-code gate cannot see that -- a private field is not an export -- and a
value nobody maintains is exactly what a later reader trusts. The cache key
deliberately does not use it, so it is gone rather than kept.
Each new case fails against the code it replaces.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
The chatbot session is changing
releaseon thestartevent from the string"97"to an int, so that it matches/api/answer, which always sent one. They flagged it as a breaking wire change rather than letting us find it.Accepting both spellings means neither side of that change breaks the panel.
The bigger find
The coercion that handled the string had a hole worth more than the rename:
So an absent or empty release became release 0 — a number that sorts, compares and caches perfectly happily while naming no release that has ever existed. Now only a number or a non-empty string can be a release, and it has to be positive.
Dead state
The parsed value was stored in a private field nothing ever read.
check:deadcannot see that, because a private field is not an export. The cache key deliberately excludes release (this cache lives in one page's memory, and a release during a session would replace the process holding it), so the field is removed rather than kept — a value nobody maintains is exactly what a later reader trusts.Checks
🤖 Generated with Claude Code