Repository navigation
api-maintenance · core: Begin and Transact take *sql.TxOptions - #23
Merged
Merged
Conversation
- mise.toml: go 1.27.2 -> 1.27.4, golangci-lint 2.14.0 -> 2.15.0 - workflows: jdx/mise-action v5.1.2 -> v5.2.7, taiki-e/create-gh-release-action v1.11.0 -> v1.12.0 - postgres: pgx/v5 v5.11.0 -> v5.13.0 (v5.13.0 was released after the brief named v5.12.0; taken so currency reports nothing behind, with no code to adapt), sqlate v0.6.0 -> v0.6.1; tidy moved puddle/v2, x/sync, x/text indirects - sqlint: sqlate v0.5.0 -> v0.6.1 go directives stay at `go 1.27` with no toolchain line, matching the upgrade task's convention of tracking only the Go minor. golangci-lint 2.15.0 flags nothing. No API changes.
DB.Begin(ctx, opts *sql.TxOptions) passes opts to the pool's BeginTx as given: nil opens a default transaction, and a non-nil value's isolation level and read-only flag reach the driver unchanged. DB.Transact and the package-level Transact take a trailing *sql.TxOptions (required, nil for the default) and pass it to Begin; their commit, rollback-join, and panic handling are unchanged. Beginner's Begin has DB.Begin's signature, so *DB and any type embedding it still satisfy it. TxOption, Isolation, and ReadOnly are removed with no deprecated aliases. Callers in the base module move to the new form: query's returning fallback passes nil to Transact, and the tests pass nil or an explicit *sql.TxOptions. The tests over sqltest's recorder (which already records each begin's driver.TxOptions) show nil reaching the driver as default options and a non-nil value's Isolation and ReadOnly reaching it as given, through Begin, DB.Transact, and Transact on an embedding Beginner. postgres's integration-tagged returning_live_test.go still implements the old Beginner signature; it builds only with the integration tag in workspace mode, outside the check, and moves in a later slice.
…-module changelogs postgres's returning_live_test.go (integration tag) implements Begin(ctx, *sql.TxOptions) on its counting session and passes nil as Transact's new trailing argument. No other integration-tagged or sub-module code used the removed TxOption API; neither sub-module's exported API did. Changelogs: postgres v0.7.0 and sqlint v0.4.0, dated 2026-11-11, each marking the sqlate v0.7.0 requirement as Breaking (as the earlier requirement moves to a behavior-breaking base were), with a migrating note for callers of Begin/Transact, and stating the module's own API is unchanged. Compare links added. go.mod still requires sqlate v0.6.1 until v0.7.0 is tagged, so the GOWORK=off integration build of postgres fails on returning_live_test.go until release preparation moves the requirement; the check (untagged) passes. Verified: go vet -tags integration in workspace mode for postgres and sqlint, and mise run integration against the compose PostgreSQL.
…ruction-and-execution - docs/features.md: Transactions describe DB.Begin(ctx, opts), DB.Transact and Transact with the trailing *sql.TxOptions (nil = default transaction), and Beginner.Begin's DB.Begin signature; TxOption, Isolation, and ReadOnly are gone from the guide. - docs/quick-start.md: the two Transact calls pass nil; the Replace note says what the last argument is. - CHANGELOG.md: v0.7.0 (2026-11-11) with the signature changes under Changed and the removals under Removed, all marked Breaking, a "Migrating from v0.6.x" section with old-to-new code (Begin options, Transact's trailing argument, a Beginner implementer's Begin), and the compare links. The base changelog has never recorded toolchain or CI upgrades and slice 1 changed no base go directive or dependency, so the toolchain upgrade is not listed. The migrating heading follows go-core's "### Migrating from vX" form, since this file had none before. - STANDARDS.md: points to go-elemental's construction-and-execution principle in the same form as its other pointers. README.md and doc.go already show only the new forms (doc.go since the API change); no example_test.go exists.
…paragraph Applies context-architecture: the doc.go-side comment and the guide read at their wrap width after the *sql.TxOptions change left them ragged.
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.
api-maintenance · task 1/7 · core
Summary
go-core reactor.New(src, fn, reactor.Options{CancelAfter: reactor.CancelWithin(drain)})
event.NewRecorder(sink, source, event.Options{Clock, IDs})
sqlate db.Begin(ctx, &sql.TxOptions{Isolation: sql.LevelSerializable, ReadOnly: true})
db.Transact(ctx, fn, nil) // nil = default transaction
removed reactor.Option, reactor.CancelAfter, event.Option, event.Clock, event.IDs,
sqlate.TxOption, sqlate.Isolation, sqlate.ReadOnly — no aliases
Core changes
CancelWithin(drain) Option → CancelWithin(drain) time.Duration (half the drain)
why: construction-and-execution — one trailing options struct; zero value keeps today's default
why: same rule; each nil field keeps its own default (time.Now in UTC, UUID v7)
DB.Transact / Transact gain a required trailing *sql.TxOptions; Beginner.Begin matches DB.Begin
why: adopt the standard library's options type instead of our own (existing solution)
create-gh-release-action v1.12.0, postgres on pgx v5.13.0
and sqlate v0.7.0 with "Migrating from" sections, postgres v0.7.0, sqlint v0.4.0; both
STANDARDS.md point to construction-and-execution
Evidence
go-core mise run check ✓ all packages, race tests, 0 lint issues
mise run currency ✓ exit 0
sqlate mise run check ✓ base, postgres, sqlint (each GOWORK=off), 0 lint issues, sqlint ok
mise run currency ✓ exit 0
go vet -tags integration ./... (postgres, sqlint; workspace on) ✓
mise run integration ✓ postgres 13.4s against a live database
spec review: behaviors 1–10, 12, 13 hold; 11 deferred to release by the brief
(go doc -short ./reactor ./event and sqlate: old exports absent)
Decided without you
currency can't exit 0 otherwise
go 1.27, no toolchain line (repo tracks only the minor)sqlint carry one Breaking line for the sqlate v0.7.0 requirement
rewrapped long doc lines. Editor: tightened four doc comments and one guide sentence
Merge danger
one-way door for the tags · go-core v0.12.0; sqlate v0.7.0, postgres/v0.7.0, sqlint/v0.4.0
two-way for code and docs (merge by PR before tagging)
blast radius: every consumer of reactor, event, and sqlate's transactions — later tasks of
this goal migrate them; nothing else moves until then
release order: go-core merge → ci → tag v0.12.0; sqlate merge → ci → tag v0.7.0; then a
core-fixPR moves postgres and sqlint onto sqlate v0.7.0 (behavior 11), ci, then tagpostgres/v0.7.0 and sqlint/v0.4.0
Needs you
(none)