Skip to content

test: expect a numeric's nan and infinities as json strings - #57

Merged
colinhacks merged 1 commit into
mainfrom
pg-forms-score
Oct 23, 2026
Merged

colinhacks merged 1 commit into
mainfrom
pg-forms-score

Conversation

@colinhacks

Copy link
Copy Markdown
Owner

The lab-pg-forms gate fails on main since #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's whole_json.score is now number | "-Infinity" | "Infinity" | "NaN" | null, and its expected type still said number | null. CI does not run the labs, so #5's checks passed. This updates the expectation; lab-pg-forms passes again.

Copilot AI balanced review requested due to automatic review settings October 23, 2026 03:24
@vercel

vercel Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
reylo Ready Ready Preview Oct 23, 2026 3:25am UTC

Request Review

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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.score widened: it now expects number | "-Infinity" | "Infinity" | "NaN" | null. This is the same non-finite union src/render.ts emits for a numeric inside a JSON document. pgf_users.score is a bare numeric with 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_jsonb writes those values as strings. The plain columns section's score: string | null is correctly left alone, since a numeric arrives on the wire as text.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@colinhacks
colinhacks merged commit 3bef415 into main Oct 23, 2026
6 checks passed
@colinhacks
colinhacks deleted the pg-forms-score branch October 23, 2026 03:32
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.

2 participants