Skip to content

[codex] Add transaction helpers - #28

Merged
zth merged 4 commits into
rescriptfrom
codex/transaction-helpers-ci
May 23, 2026
Merged

[codex] Add transaction helpers#28
zth merged 4 commits into
rescriptfrom
codex/transaction-helpers-ci

Conversation

@zth

@zth zth commented May 23, 2026

Copy link
Copy Markdown
Owner

Summary

Adds small ReScript transaction helpers for the existing pg bindings:

  • Pg.Client.transaction(client, callback) sends BEGIN, runs the callback, commits on success, and rolls back/rethrows on failure.
  • Pg.Pool.transaction(pool, callback) checks out a client, delegates to Client.transaction, and releases the client on both success and failure.
  • Includes the generated src/res/PgTyped.js runtime sibling required by the example test runtime.
  • Documents transaction usage in RESCRIPT.md.
  • Adds example coverage for rollback behavior and pool client release.

Refs #2.
Supersedes #27.

Validation

  • npm run build
  • npm test --workspace packages/cli -- --runInBand
  • npm run lint -- --project packages/cli/tsconfig.json
  • npm run build --workspace packages/example
  • node -e "require('./packages/cli/src/res/PgTyped.js'); console.log('ok')"

I also attempted npm test --workspace packages/example, but the Docker run is blocked locally on Apple Silicon: the container reports Package @rescript/linux-x64 not found during typegen and then the follow-up test container waits on Postgres. I stopped and cleaned up the compose containers with docker compose down --remove-orphans.

@zth
zth marked this pull request as ready for review May 23, 2026 12:38
@zth
zth force-pushed the codex/transaction-helpers-ci branch from 1b4044f to e72fb0c Compare May 23, 2026 12:40
@zth
zth marked this pull request as draft May 23, 2026 12:40
@zth
zth marked this pull request as ready for review May 23, 2026 12:57
@zth

zth commented May 23, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e72fb0c02d

ℹ️ 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".

Comment thread packages/example/src/rescript.test.res Outdated

zth commented May 23, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

ℹ️ 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 force-pushed the codex/transaction-helpers-ci branch from 11de0ca to 9aa24dc Compare May 23, 2026 13:31

zth commented May 23, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

ℹ️ 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 merged commit a99f94a into rescript May 23, 2026
5 checks passed
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