Skip to content

Merge upstream golang-migrate/migrate into ib (through v4.20.1) - #64

Merged
daniel-garcia merged 16 commits into
ibfrom
sync-upstream
Sep 18, 2026
Merged

daniel-garcia merged 16 commits into
ibfrom
sync-upstream

Conversation

@daniel-garcia

Copy link
Copy Markdown

Catches ib up with upstream golang-migrate/migrate. master was also stale and has been fast-forwarded separately to 504568a (it was 15 behind / 0 ahead — a pure mirror, no PR needed); it is now at 0 0 divergence from upstream.

Before this, ib was 13 upstream commits behind (merge base 2bd822b, 2026-03-11) and 75 ahead. Eight files conflicted.

Resolutions

source/aws_s3 — upstream bugfix ported, not merged

Upstream 5bcd008 fixes migrations past the first 1000 S3 objects being silently dropped and never applied. It's written against aws-sdk-go v1 (ListObjectsPages), which this fork no longer uses — it migrated this driver to SDK v2. So the fix could not be taken textually; it's reimplemented over s3.NewListObjectsV2Paginator.

Worth being explicit: the fork had this bug too. Our loadMigrations made a single unpaginated ListObjectsV2 call, so any repo with >1000 objects under the prefix was silently missing migrations. This is a live fix, not merge bookkeeping.

The test fake needed real work, not just a signature change. The v2 paginator issues one call per page, so the fake pages via ContinuationToken/NextContinuationToken and sorts keys — upstream's fake sliced a single result, but ranging over a Go map across multiple calls would shuffle page boundaries and drop or repeat keys between pages.

go.mod / go.sum — reconciled by taking the higher version per module

This preserves the CVE pins from 9272f75/a296630/8d1eb40 while still adopting upstream's bumps. Verified no regression:

module ib before merged
google.golang.org/grpc v1.85.0-dev.0.20260825072537 unchanged
golang.org/x/net v0.59.0 unchanged
golang.org/x/crypto v0.57.0 unchanged
grpc-gateway/v2 v2.27.2 unchanged (ours > upstream's 2.27.1)
docker/docker v28.3.3+incompatible v28.5.2+incompatible (upstream)

Kept go 1.26.0 over upstream's 1.25.11. Upstream's jackc/* and aws-sdk-go v1 requirements are deliberately not adopted — this fork's pgx drivers use lib/pq and its s3 source uses SDK v2, so nothing imports them (go mod tidy confirms both are dropped).

ci.yaml — kept the single-version test matrix. Upstream added 1.25.x, which cannot build a module requiring go 1.26.0. The Tests passed gate from #63 survives the merge, so the required check name is unaffected. Remaining delta is the golangci-lint and goreleaser version bumps, both inert here (lint is if: false, goreleaser is guarded to the golang-migrate repo).

Dockerfile — kept the distroless/nonroot final stage and cli/config, adopting upstream's alpine 3.24 pin for the builder (golang:1.26.4-alpine3.24). Pinned Dockerfile.github-actions to alpine:3.24 instead of floating latest.

README.md — badge set to Go 1.26, matching what this fork actually tests.

Verification

  • go build ./..., go vet ./... — clean.
  • go test ./source/... ./internal/... . — pass.
  • The ported pagination test was checked for teeth: breaking pagination to first-page-only makes it fail, loading 122 of 300 migrations. Restored, it passes.
  • Docker-backed database/* tests were not run locally; CI covers those.

Note

Sidesteps the trap that blocked #62: this had upstream's two-entry matrix landed, a version-named required check could not have stayed valid. Requiring Tests passed makes matrix shape irrelevant.

🤖 Generated with Claude Code

fzl-22 and others added 15 commits July 1, 2026 06:48
…Polaris findings) (golang-migrate#1402)

* fix(dktesting): ignore not-found error during image cleanup

* fix(deps): migrate docker/docker to moby/moby/client and moby/moby/api (CVE-2024-41110, CVE-2026-34040, CVE-2026-33997)

* fix: replace deprecated NewClientWithOpts with New

* fix: replace deprecated WithVersion with WithAPIVersion

* chore: cleanup unused comments

---------

Co-authored-by: Faisal, Ahmad Mu'min (contracted) <AhmadMumin.Faisal@contracted.sampoerna.com>
golang-migrate#1373)

Bumps the go_modules group with 1 update in the / directory: [google.golang.org/grpc](https://github.com/grpc/grpc-go).


Updates `google.golang.org/grpc` from 1.74.2 to 1.79.3
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](grpc/grpc-go@v1.74.2...v1.79.3)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-version: 1.79.3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* spanner: Update spansql statement parser version

* push to latest patch
* build: bump alpine docker image to 3.24

* apk upgrade
…tes (golang-migrate#1429)

Bumps the go_modules group with 3 updates in the / directory: [github.com/jackc/pgx/v5](https://github.com/jackc/pgx), [go.mongodb.org/mongo-driver](https://github.com/mongodb/mongo-go-driver) and [github.com/apache/thrift](https://github.com/apache/thrift).


Updates `github.com/jackc/pgx/v5` from 5.7.6 to 5.9.2
- [Changelog](https://github.com/jackc/pgx/blob/master/CHANGELOG.md)
- [Commits](jackc/pgx@v5.7.6...v5.9.2)

Updates `go.mongodb.org/mongo-driver` from 1.7.5 to 1.17.7
- [Release notes](https://github.com/mongodb/mongo-go-driver/releases)
- [Commits](mongodb/mongo-go-driver@v1.7.5...v1.17.7)

Updates `github.com/apache/thrift` from 0.16.0 to 0.24.0
- [Release notes](https://github.com/apache/thrift/releases)
- [Changelog](https://github.com/apache/thrift/blob/master/CHANGES.md)
- [Commits](apache/thrift@v0.16.0...v0.24.0)

---
updated-dependencies:
- dependency-name: github.com/apache/thrift
  dependency-version: 0.23.0
  dependency-type: indirect
- dependency-name: github.com/jackc/pgx/v5
  dependency-version: 5.9.2
  dependency-type: direct:production
- dependency-name: go.mongodb.org/mongo-driver
  dependency-version: 1.17.7
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
golang-migrate#1424)

Migrations.Append rebuilt and re-sorted the whole index on every call,
making source driver initialization O(n^2 log n) in the number of
migration files. All in-memory source drivers (file, iofs, aws_s3,
github, ...) call Append in a loop at Open/Init time, so startup cost
grew quadratically: 81ms at 1,000 migrations, 2.2s at 5,000 and 11.3s
at 10,000 on an i9-9900K.

Append now only marks the index dirty; the index is rebuilt at most
once, on the first read access (First/Prev/Next). No exported API
changes.

BenchmarkAppend5000 drops from ~2.2s/op to ~2ms/op.
* test: add PostgreSQL 18 to test matrix

* test: remove PostgreSQL 13 from test matrix (EOL on 2025-11-03)
* ci: fix GoReleaser build matrix

* extend ignore list
Brings in the 13 upstream commits since 2bd822b (through v4.20.1 /
504568a). Conflict resolutions:

* source/aws_s3: upstream 5bcd008 fixes migrations beyond the first 1000
  objects being silently dropped, but is written against aws-sdk-go v1
  (ListObjectsPages), which this fork no longer uses. Ported the fix to
  the v2 paginator (NewListObjectsV2Paginator) instead. The fork had the
  same bug, so this is a real fix here, not just a merge artifact. The
  test fake now pages via ContinuationToken and sorts keys, since the v2
  paginator issues one call per page and raw map order would shuffle
  page boundaries between calls.

* go.mod/go.sum: reconciled per module by taking the higher version, so
  upstream's bumps are adopted without regressing the CVE pins from
  9272f75/a296630/8d1eb40. Verified unchanged: grpc (1.85.0-dev pin),
  x/net 0.59.0, x/crypto 0.57.0, grpc-gateway 2.27.2; docker/docker
  moves up to upstream's 28.5.2. Kept go 1.26.0 over upstream's 1.25.11.
  Upstream's jackc/* and aws-sdk-go v1 requirements are not adopted --
  this fork's pgx drivers use lib/pq and its s3 source uses SDK v2, so
  nothing imports them.

* ci.yaml: kept the single-version test matrix; upstream's added 1.25.x
  cannot build a module requiring go 1.26.0.

* Dockerfile: kept the distroless/nonroot final stage and cli config,
  adopting upstream's alpine 3.24 pin for the builder. Pinned
  Dockerfile.github-actions to alpine:3.24 over floating latest.
The Dockerfile was the only place pinning a specific Go patch release; it
sat at 1.26.4 while 1.26.8 is the current 1.26 patch. The CI workflows ask
for "1.26.x", which setup-go already resolves to 1.26.8, so this only
brings the image in line with what CI has been compiling with.

Also adopts the alpine 3.24 pin on the builder tag, matching the base
image pinned in Dockerfile.github-actions.

go.mod's `go 1.26.0` is deliberately left alone: it declares the minimum
language version, not the toolchain used to build, and raising it would
restrict consumers for no gain.

Verified by building the image locally (`go version` in the builder
reports go1.26.8) since no CI job builds this Dockerfile.
@coveralls

coveralls commented Sep 18, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 35291475432

Coverage increased (+0.5%) to 52.623%

Details

  • Coverage increased (+0.5%) from the base build.
  • Patch coverage: 31 uncovered changes across 3 files (20 of 51 lines covered, 39.22%).
  • 1 coverage regression across 1 file.

Uncovered Changes

File Changed Covered %
testing/docker.go 23 0 0.0%
dktesting/dktesting.go 5 0 0.0%
source/aws_s3/s3.go 15 12 80.0%
Total (4 files) 51 20 39.22%

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
source/aws_s3/s3.go 1 75.25%

Coverage Stats

Coverage Status
Relevant Lines: 8424
Covered Lines: 4433
Line Coverage: 52.62%
Coverage Strength: 6506.63 hits per line

💛 - Coveralls

The final stage copies the binary to /migrate but declared
ENTRYPOINT ["migrate"]. gcr.io/distroless/static has no shell and does
not put / on PATH, so the exec-form entrypoint could not be resolved and
every `docker run` of the image failed with:

    exec: "migrate": executable file not found in $PATH

Point the entrypoint at the absolute path. Dockerfile.github-actions is
unaffected -- it installs to /usr/local/bin, which is on PATH.

Latent since the final stage moved to distroless; nothing caught it
because no CI job builds or runs this image. Verified by building the
image and running it with both the default CMD and an explicit argument.
@daniel-garcia
daniel-garcia merged commit 7447313 into ib Sep 18, 2026
6 checks passed
@daniel-garcia
daniel-garcia deleted the sync-upstream branch September 18, 2026 00:52
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.

8 participants