Skip to content

chore: adopt Go 1.27 - #672

Open
mariusvniekerk wants to merge 9 commits into
mainfrom
chore/go-1.27
Open

chore: adopt Go 1.27#672
mariusvniekerk wants to merge 9 commits into
mainfrom
chore/go-1.27

Conversation

@mariusvniekerk

@mariusvniekerk mariusvniekerk commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Move msgvault's supported build toolchain to Go 1.27.0 across the module, CI and release-derived setup, container builders, Nix packaging, and source-build documentation.

Pin golangci-lint 2.13.1, set its analyzer language level to Go 1.27, and adopt its gomodguard_v2 replacement. Apply the Go 1.27 modernization rewrites required by that pinned analyzer, including typed errors.As calls and promoted embedded fields. CI installs the linter through the versioned Make target and prepends its bin directory so self-hosted runners cannot select an older cached binary.

The Nix development shell now builds gopls 0.23.0, gotools 0.44.0, golangci-lint 2.13.1, and Delve 1.27.1 with the same pinned Go 1.27.0 compiler. Delve retains its test phase but skips two generator checks whose versioned tool queries conflict with Go 1.27's forced vendoring behavior.

Update go-sqlite3 to v1.14.50, its current stable release, so the migration uses the maintained SQLite amalgamation and recent driver fixes. The driver update alone did not remove the Go 1.27 database/sql close-mutex deadlock: msgvault's logging wrapper consumed Rows.Err at the end of Next, then normal callers consumed it again. Capture the terminal row error once and return that cached result, preserving SQL logging without the second lock acquisition.

Historical implementation plans remain unchanged because their older Go versions describe work at the time rather than active build support.

generated by a clanker

@mariusvniekerk
mariusvniekerk requested a review from wesm as a code owner August 22, 2026 13:03
@roborev-ci

roborev-ci Bot commented Aug 22, 2026

Copy link
Copy Markdown

roborev: Combined Review (c3bb337)

The Go 1.27 upgrade is generally sound, but the Nix development shell retains incompatible tooling.

Medium

  • flake.nix:101 — The shell uses Go 1.27 while gopls, golangci-lint, and Delve come from the older locked nixpkgs revision. Notably, it misses CI’s golangci-lint v2.13.1 upgrade, which can break linting and editor workflows for Nix users. Pin Go 1.27-compatible tool versions built with goPinned, especially golangci-lint v2.13.1, or update flake.lock to a compatible nixpkgs revision.

Reviewers: 2 done | Synthesis: codex, 8s | Total: 6m14s

mariusvniekerk and others added 3 commits August 22, 2026 09:47
Go 1.27 is now the supported build toolchain, so local, CI, release,
container, and Nix builds need one consistent version and analyzer level.

Adopt the Go 1.27 lint rewrites required by golangci-lint 2.13.1 so the
repository does not carry suppressions or syntax that the pinned analyzer
rejects.

Generated with Codex (GPT-5)
Co-authored-by: Codex <codex@openai.com>
Nix users received the Go 1.27 compiler with a language server, linter, and
debugger from the older locked package set. That split left the development
shell unable to guarantee support for the module's active Go version.

Build compatible tool releases with the same pinned compiler. Keep Delve's
test phase enabled, but skip its two generator checks because Go 1.27 rejects
their versioned tool queries under the derivation's forced vendoring mode.

Generated with Codex (GPT-5)
Co-authored-by: Codex <codex@openai.com>
The base branch added this fixture after the Go 1.27 migration branch was
created. Its explicit embedded token literal does not pass the migration's
pinned modernize analyzer.

Use promoted token fields so the rebased branch follows the same Go 1.27
literal form as the rest of the repository.

Generated with Codex (GPT-5)
Co-authored-by: Codex <codex@openai.com>
@roborev-ci

roborev-ci Bot commented Aug 22, 2026

Copy link
Copy Markdown

roborev: Combined Review (0896537)

No issues found.


Reviewers: 2 done | Synthesis: codex | Total: 6m48s

@wesm

wesm commented Aug 22, 2026

Copy link
Copy Markdown
Member

looking

@wesm wesm self-assigned this Aug 22, 2026
Use the current stable driver for Go 1.27 compatibility. The prior release
predates recent statement-close and SQLite amalgamation fixes.

The Go 1.27 database/sql row-cleanup deadlock remains reproducible, so this
dependency update is not the fix for that failure.

Generated with Codex (GPT-5)
Co-authored-by: Codex <codex@openai.com>
@roborev-ci

roborev-ci Bot commented Aug 22, 2026

Copy link
Copy Markdown

roborev: Combined Review (a7638ff)

Verdict: Two medium-severity Nix dependency hash issues must be fixed.

Medium

  • go.mod:33, nix/package.nix:19 — Updating go-sqlite3 changes the dependency closure, but the Nix vendorHash remains unchanged, preventing the package from realizing its vendored modules. Regenerate and update nix/package.nix’s vendorHash.

  • flake.nix:75delvePinned replaces Delve’s version and source while retaining the locked package’s vendor hash for the previous dependency graph, preventing the development shell from realizing Delve. Add the regenerated vendorHash for Delve v1.27.1.


Reviewers: 2 done | Synthesis: codex, 8s | Total: 5m25s

Install golangci-lint through the versioned Make target and put its bin directory first in later CI steps so self-hosted runners cannot select a stale binary. Refresh the Nix module hash after the SQLite driver update.
@roborev-ci

roborev-ci Bot commented Aug 22, 2026

Copy link
Copy Markdown

roborev: Combined Review (75237f5)

No issues found.


Reviewers: 2 done | Synthesis: codex | Total: 7m26s

Capture the terminal row error when iteration ends and return that cached result to callers. This preserves SQL logging while avoiding the Go 1.27 database/sql close-mutex race caused by immediately acquiring the row read lock twice.
@roborev-ci

roborev-ci Bot commented Aug 22, 2026

Copy link
Copy Markdown

roborev: Combined Review (095dfaa)

No issues found.


Reviewers: 2 done | Synthesis: codex | Total: 6m32s

@wesm

wesm commented Aug 22, 2026

Copy link
Copy Markdown
Member

i'm back looking at this

The pull request workflow comes from the base branch, so it can install a
golangci-lint release that predates Go 1.27 even when this branch pins a newer
release. Make the CI target install and invoke its own pin at the Go toolchain's
configured binary location.

PostgreSQL reconciliation also allowed concurrent workers to collide while
creating the same attachment occurrence or reject an event that a peer had
already consumed. Serialize first writes for one attachment and accept the
peer's durable cursor advance.

Generated with Codex
Co-authored-by: Codex <codex@openai.com>
@roborev-ci

roborev-ci Bot commented Aug 22, 2026

Copy link
Copy Markdown

roborev: Combined Review (5960fe3)

Concurrency handling remains incomplete on SQLite, with two medium-severity transaction races.

Medium

  • internal/store/document_index.go:1195 — Concurrent reconciliations can read the same snapshot. After one commits, the other may fail with SQLITE_BUSY_SNAPSHOT instead of converging because serialization currently covers only PostgreSQL. Retry the whole transaction with retryContendedWriteErr, or acquire SQLite’s writer lock before the initial reads. Add a deterministic test for this read/write interleaving.

  • internal/store/attachment_changes.go:227 — The cursor recheck does not eliminate the analogous SQLite race: a transaction retaining the old snapshot can still see the pruned event, then fail when upgrading its stale snapshot during the conditional update. Reserve the SQLite writer before reading, or retry busy/conflict failures around the entire transaction.


Reviewers: 2 done | Synthesis: codex, 7s | Total: 10m24s

@wesm

wesm commented Aug 22, 2026

Copy link
Copy Markdown
Member

still grinding on this

Concurrent SQLite reconciliation workers could read an old write-ahead log
snapshot and then return a busy error when they tried to update occurrence or
consumer state. That violates the reconciliation contract that duplicate work
converges without exposing database contention to callers.

Reserve SQLite's writer slot before either transaction reads mutable state.
Each worker now reads after earlier writes commit, while PostgreSQL keeps its
existing row and advisory lock behavior.

Generated with Codex
Co-authored-by: Codex <codex@openai.com>
@roborev-ci

roborev-ci Bot commented Aug 22, 2026

Copy link
Copy Markdown

roborev: Combined Review (9421abc)

The change has one medium-severity concurrency flaw; no critical or high-severity issues were found.

Medium

  • Stale attachment occurrence can be reinserted during concurrent reconciliationinternal/store/document_index.go:305,1194

    Reconciliation reads attachment metadata before acquiring the serialization lock, while removals do not share the PostgreSQL advisory lock. A lower-sequence reconciliation can read eligible metadata and pause; a higher-sequence reconciliation can then remove and acknowledge the occurrence; finally, the lower-sequence operation can resume and reinsert stale data because no row remains to enforce the sequence guard.

    Fix: Acquire the backend-specific lock before reading metadata, and perform eligibility evaluation plus upsert/removal within the same transaction using the shared lock. Add a regression test for a concurrent eligible-to-ineligible transition.


Reviewers: 2 done | Synthesis: codex, 8s | Total: 8m19s

A lower-sequence reconciliation could keep eligible attachment metadata while
a newer event removed its occurrence. It could then restore stale document
search authority after the removal committed.

Hold the backend-specific attachment fence across the authority read and the
occurrence write. Eligible and ineligible outcomes now use the same transaction,
so newer removal work cannot be overtaken.

Generated with Codex
Co-authored-by: Codex <codex@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants