8000 feat(spec): drop the union's per field by colinhacks · Pull Request #189 · colinhacks/reylo · GitHub
[go: up one dir, main page]

Skip to content

feat(spec): drop the union's per field - #189

Merged
colinhacks merged 1 commit into
mainfrom
drop-per
Nov 5, 2026
Merged

colinhacks merged 1 commit into
mainfrom
drop-per

Conversation

@colinhacks
Copy link
Copy Markdown
Owner

A union in the type descriptor format is now read per value everywhere: per: "execution" is gone from spec/typedefs.schema.json, the generated spec/index.ts and site/public/typedefs/0.1.0.json, and from UnionType and Type::union in core.

Only MySQL's engine wrote the field, and nothing read it: the loader renders a union's members and decodes each value by the result's own column type. It could not be turned into a link between a parameter and a column either, since neither of the two things that pick the member is a parameter's type:

  • The plan. quarter(day) is a BIGINT, and an INT under SQL_BUFFER_RESULT.
  • How a driver encodes a bound value. select ? + ? with 5 and 5 is a DOUBLE through mysql2's execute() and a BIGINT through mariadb's query(), with both parameters typed double.

What changes:

  • MySQL's descriptors lose the field, and a union that held a per-execution union is now one flat union, as rule 4 asks (boolean | bigint | double | decimal | text).
  • Type::short writes a | b where it wrote either(a, b), so 134 lines of the MySQL cases' expected.txt change spelling and no type changes.
  • The TypeScript users see is unchanged, so the docs and the skill stay as they are.

The format stays at 0.1.0 rather than moving to a new version: that version is on no release yet (npm serves 0.7.0, and release has no site/public/typedefs/), so nothing has read a descriptor against it.

Checked locally: cargo build --workspace --all-targets with no warning, the tests of every crate, the oracle's 170 cases with --strict-coverage on Postgres 18, MySQL 8.4, SQLite and DuckDB, nub run typecheck, nub run test with none skipped, and engine/build.sh.

A union is read per value everywhere. MySQL's per-execution unions
come from the plan or from how a driver encodes a bound value, which
no parameter's type decides, and nothing read the field.
Copilot AI balanced review requested due to automatic review settings November 5, 2026 15:30
@vercel
vercel Bot commented Nov 5, 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 Nov 5, 2026 3:32pm 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 insufficient remaining quota. Try requesting a review at a lower effort level.

@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

I reviewed the whole diff: the format change, every call site that builds a union, and the re-blessed MySQL expectations.

  • per removed from the format: UnionType.per and the Per enum are gone from core, spec/typedefs.schema.json, spec/index.ts and site/public/typedefs/0.1.0.json. The MySQL example moved into UnionType's description.
  • Type::union flattens every unnamed union: a named union still stays a single member, and a new test covers that. Because of this, MySQL's boolean | either(…) now becomes one flat union, which is what rule 4 asks for.
  • Type::short spells every union as a | b: I rewrote each of the 134 removed expected.txt lines mechanically, turning either(a, b) into a | b. The result is exactly the set of added lines, so only the spelling changes and no type does.
  • Call sites in MySQL, Postgres and SQLite: these only change signature. In the tests, the either helper is removed and its callers use oneOf.

What I checked:

  • No leftovers: nothing remains in src/, engine/, spec/, site/ or the docs that reads or writes per or the either(…) spelling. The loader never read the field.
  • Old cached descriptors: core's types do not use deny_unknown_fields, so a cached descriptor that still holds per deserializes as before.
  • Keeping 0.1.0: this is safe. The latest release is v0.7.0, and the release branch has no site/public/typedefs/.

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

@colinhacks
colinhacks merged commit 97f0f8c into main Nov 5, 2026
26 of 27 checks passed
@colinhacks
colinhacks deleted the drop-per branch November 5, 2026 15:49
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

0