Repository navigation
test: expect a numeric's nan and infinities as json strings - #57
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The single commit updates the lab/pg-forms snapshot so it matches the engine's sound typing of a numeric inside JSON.
whole_json.scorewidened: it now expectsnumber | "-Infinity" | "Infinity" | "NaN" | null. This is the same non-finite unionsrc/render.tsemits for a numeric inside a JSON document.pgf_users.scoreis a barenumericwith no precision (lab/pg-forms/setup.sql:28), so it can hold all three non-finite values, and the type is exact rather than over-broad. The check assigns in both directions, so the order of the union's members does not matter.- Comment extended: it says why
to_jsonbwrites those values as strings. The plaincolumnssection'sscore: string | nullis correctly left alone, since a numeric arrives on the wire as text.
claude-opus-5-5 | 𝕏
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
lab-pg-formsgate fails onmainsince #5 typed JSON numbers soundly:to_jsonb(t)writes a numeric's NaN and infinities as the strings"NaN","Infinity"and"-Infinity", so the lab'swhole_json.scoreis nownumber | "-Infinity" | "Infinity" | "NaN" | null, and its expected type still saidnumber | null. CI does not run the labs, so #5's checks passed. This updates the expectation;lab-pg-formspasses again.