Skip to content

Prepare Relay conversions once and harden scalar handling - #674

Merged
zth merged 23 commits into
masterfrom
codex/conversion-performance
Sep 23, 2026
Merged

zth merged 23 commits into
masterfrom
codex/conversion-performance

Conversation

@zth

@zth zth commented Sep 21, 2026 •

Copy link
Copy Markdown
Owner

Prepare conversion functions once per generated module instead of interpreting paths on every Relay snapshot. Preserve legacy generated-artifact support while fixing custom-scalar ordering, nested lists, path collisions, recursive inputs, union conversion order, and plural @catch payloads.

  • Add a versioned plan runtime with lazy copying, opaque scalar results, and raw fragment references. No response or callback-result caching.
  • Keep generated helpers private, share identical plans, and use compact local callback IDs. Empty plans reuse a shared converter.
  • Add unit/model/mutation tests, mounted Relay regressions, reproducible benchmarks, and bundle-size budgets. Include the changelog and repair Linux PPX CI using Bookworm/GnuPG.

Dependency: merge zth/relay#40 first, retaining the pinned compiler commit in history; then merge this PR. Release compiler and runtime together. New artifacts require the new runtime; existing artifacts remain supported. If the compiler PR is squash-merged, update this submodule pin to its merged commit before merging here.

Validation: 263 main/persisted JS tests, including 157 utility tests; 35 compiler library tests; 20/20 targeted mutations detected; 100% runtime statement/branch/function/line coverage. Scalar tests exercise 960 ordering combinations twice, plus opposite selection orders through mounted hooks. Both compiler fixture projects regenerate deterministically and pass --validate. Codex reviewed the implementation with no remaining major findings. All parent CI checks pass on the final cleanup commit, including integration, bindings, CLI, and Linux/macOS/Windows PPX builds.

Performance and size: recorded conversion-only benchmarks versus master show roughly 13–14× for small fragments and 41–45× for 100-row connections; the Date-heavy scalar case is 5–7% slower. Results are workload/engine dependent, not app-wide latency claims. Across 129 fixed artifacts, combined gzip is 1,254 bytes smaller; the shared runtime including legacy support is 1,265 bytes larger. These separately measured components are approximately neutral together, not a whole-app bundle measurement.

See packages/rescript-relay/benchmarks/{RESULTS,SIZE}.md and docs/conversion-contract.md for evidence, reproduction and limits. The rejected ReScript prototype was removed from the merge diff and remains accessible through a history link in the benchmark guide.

@zth zth changed the title Optimize response conversion and establish its correctness contract Prepare response converters once with lossless compiler plans Sep 21, 2026
@zth

zth commented Sep 22, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please review the current head against the base, focusing on conversion correctness, compiler/runtime compatibility, generated-code and release-module behavior, and gaps in the tests. The paired compiler change is zth/relay#40 and is being reviewed separately. Please report actionable issues with severity and a reproducing scenario.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-22T11:53:53.031059Z 65d953f Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 86d3049f72

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@zth

zth commented Sep 22, 2026

Copy link
Copy Markdown
Owner Author

@codex review the full current PR at 64c0934. The prior runtime review found no major issues. The compiler review led to a plural @catch fix in zth/relay#40 at 6247069896de, plus mounted regressions here for ordinary/caught plural scalars, typed result wrappers, updates, mixed errors/successes, and raw-store preservation. Please check the new changes and any remaining major correctness/performance/packaging issues across the integration. All 250 main/persisted tests, 34 compiler library tests, 18 mutation checks and size budgets pass.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 64c0934353

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@zth

zth commented Sep 22, 2026

Copy link
Copy Markdown
Owner Author

@codex review the full current PR at 65d953f. The previous review found no major issues. Since then the compiler review exposed nullable and abstract plural @catch shapes: fixed in zth/relay#40 at 19bfb3d85aeb, with additional typed and mounted regressions here covering nullable success values, unions/interfaces, mixed success/error results, updates and raw-store preservation. Runtime unchanged. All 250 main/persisted tests, 35 compiler library tests and bundle-size budgets pass; runtime coverage remains 100%.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 65d953fb91

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@zth zth changed the title Prepare response converters once with lossless compiler plans Prepare Relay conversions once and harden scalar handling Sep 23, 2026
@zth
zth marked this pull request as ready for review September 23, 2026 09:08
@zth
zth merged commit c8577cb into master Sep 23, 2026
6 checks passed
@zth
zth deleted the codex/conversion-performance branch September 23, 2026 09:19
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