Skip to content

chore(trunk): run lint on Go 1.27.3 with golangci-lint 2.15.0 - #9868

Merged
matthewmcneely merged 1 commit into
mainfrom
matthewmcneely/trunk-go-1.27.3
Oct 23, 2026
Merged

matthewmcneely merged 1 commit into
mainfrom
matthewmcneely/trunk-go-1.27.3

Conversation

@matthewmcneely

@matthewmcneely matthewmcneely commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR bumps trunk's Go runtime to go@1.27.3 and golangci-lint to 2.15.0, so trunk check can lint the module again.

#9864 moved go.mod to go 1.27.3, but trunk still pins go@1.27.0 and golangci-lint 2.13.1. CI switches to the 1.27.3 toolchain automatically, and 1.27.3 writes export data version 5. The x/tools v0.49.0 importer inside golangci-lint 2.13.1 only reads up to version 4:

could not import internal/cpu (... export data version 5 is greater than maximum supported version 4)

So package x fails to load, every promoted x.SafeMutex method reports as undefined, and trunk flags whichever of those land in a changed hunk. #9747 hit it first:

dgraph/cmd/zero/oracle.go:602:8  s.orc.RLock undefined (type *Oracle has no field or method RLock)  golangci-lint2/typecheck

#9864 itself passed because it changed no Go code. Any PR that touches Go files using SafeMutex (or anything else in x) will fail the same way until this lands.

golangci-lint 2.15.0 is built on x/tools v0.52.0 and reads the new export data. I reproduced the failure locally with 2.13.1, then ran 2.15.0 under Go 1.27.3 with the repo config: no new issues on #9747 under the default, integration and integration2 build tags.

Checklist

  • The PR title follows the
    Conventional Commits syntax, leading
    with fix:, feat:, chore:, ci:, etc.
  • Code compiles correctly and linting (via trunk) passes locally

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Summary by CodeRabbit

  • Chores
    • Updated the versions of the Go runtime and Go linting tools used in the project. These are internal tooling updates and do not introduce user-facing changes.

go.mod has required go 1.27.3 since #9864, but trunk still ran the go
1.27.0 runtime with golangci-lint 2.13.1. CI auto-switches to the 1.27.3
toolchain, which writes export data version 5, and the x/tools v0.49.0
importer inside golangci-lint 2.13.1 only reads up to version 4. Package x
then fails to load, so every promoted x.SafeMutex method reports as
undefined, and trunk flags whichever of those land in a changed hunk:

  s.orc.RLock undefined (type *Oracle has no field or method RLock)

golangci-lint 2.15.0 is built on x/tools v0.52.0 and reads the new export
data; locally it reports no new issues on #9747 under the default,
integration and integration2 build tags.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@matthewmcneely
matthewmcneely requested a review from a team as a code owner October 22, 2026 20:02
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b4636e39-9a52-4fd0-b141-3d01cd5d546e
📥 Commits

Reviewing files that changed from the base of the PR and between 7f7a7e3 and 06a608e.

📒 Files selected for processing: 1
  • .trunk/trunk.yaml

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📝 Walkthrough

The Trunk configuration updates the enabled Go runtime from 1.27.0 to 1.27.3 and golangci-lint2 from 2.13.1 to 2.15.0.

Changes: Toolchain versions

Layer / File(s) Summary
Update enabled tool versions
.trunk/trunk.yaml
The configured Go version changes from 1.27.0 to 1.27.3, and golangci-lint2 changes from 2.13.1 to 2.15.0.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Other

Suggested reviewers: mlwelles

Merge Risk: ⚪ Minimal · up to 06a60

The configured Go and golangci-lint2 versions match the intended compatibility update and are ready to merge.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: updating the Go runtime and golangci-lint versions used by trunk.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@matthewmcneely
matthewmcneely merged commit 1714bf3 into main Oct 23, 2026
35 checks passed
@matthewmcneely
matthewmcneely deleted the matthewmcneely/trunk-go-1.27.3 branch October 23, 2026 16:57
matthewmcneely pushed a commit that referenced this pull request Oct 27, 2026
**Description**

`dgraph restore -z` (offline restore) never bumps Zero's uid or
namespace lease.

`RunOfflineRestore` ran the map phase with `if _, err :=
RunMapper(...)`, which discarded the
`mapResult` that carries `maxUid` and `maxNs`. It then returned
`LoadResult{Version: ...}` under
`// TODO: Fix this return value.`, so `MaxLeaseUid` and `MaxLeaseNsId`
were always 0. `backup/run.go`
prints `Restore max uid: 0`, and its `leaseID` helper treats 0 as
"backup taken on an empty DB" and
skips the `AssignIds` call. Only the timestamp lease is bumped.

As a result, after an offline restore of a non-empty backup into a fresh
cluster, Zero's `maxUID`
stays 0. The first new node can be assigned a uid that already belongs
to a restored node (we saw
`0x1`), and the new predicates merge into that node. Nothing reports an
error, and restored data
reads back correctly; the corruption only appears on the next write. The
online `/admin` restore
is not affected, because it bumps both leases from the same mapper
result.

With ACL enabled, the colliding uids belong to ACL nodes. In a local
v25.5.0 reproduction (a backup taken
with `--acl`, offline-restored with `-z` into a fresh cluster), Zero
reported `maxUID: 0` and the first new
nodes were assigned `0x1` to `0x4`. Those uids hold the guardians group,
groot, another user and a rule, and
each merged node then carried both the application type and its ACL type
(for example
`["Item", "dgraph.type.Group"]` on the guardians node). The same backup
restored through `/admin` assigned
new uids above the backup's maximum.

The fix keeps the mapper's `maxUid` and `maxNs` across groups and
returns them in the `LoadResult`.

A second commit changes how `dgraph restore` hands those values to Zero.
It sent them as a plain
`AssignIds` request, which leases that many *more* ids instead of
raising the lease to that value. On a
fresh Zero the two are the same. But every further restore against the
same Zero moved the lease again,
by the backup's max each time. The online restore's bump (`Bump: true`,
with "Nothing to be leased"
treated as a no-op) now lives in `worker.BumpLease`, and both restore
paths use it.

Regression test: `TestRunOfflineRestoreReportsMaxLease`
(`worker/offline_restore_test.go`) writes a
real full backup through `BackupProcessor` (uids up to `0x2711` across
namespaces 0 and 2). It checks
that `RunMapper` sees both maxima, then that `RunOfflineRestore` reports
them. Before the fix it fails:

```
Error: "0" is not greater than or equal to "10001"
Error: "0" is not greater than or equal to "2"
--- FAIL: TestRunOfflineRestoreReportsMaxLease
```

After the fix it passes, as do `go test ./worker/ -run
'Restore|Backup|Manifest'`. The existing
systest backup suites call `RunOfflineRestore` but never read the lease
fields, which is why this
went unnoticed.

`TestBumpLeaseIsIdempotent` (`worker/lease_test.go`, `integration` tag,
run with
`make test-integration TEST=TestBumpLeaseIsIdempotent`) bumps a real
Zero's uid lease, then bumps it again
to the same value and to a lower one, and checks that the lease does not
move. It passes. With
`BumpLease` temporarily changed back to the old plain lease, it fails on
the repeated bump:

```
Error: "2506" is not less than "1103"
--- FAIL: TestBumpLeaseIsIdempotent
```

Docker integration suite `systest/backup/filesystem`, run locally on the
first commit, before rebasing onto
#9864 and #9868, both chore commits (each test by name, since
`-failfast` stops the package at the
first failure):

- `TestBackupFilesystem` passes. It runs `RunOfflineRestore` over a full
backup and four
  incrementals.
- `TestBackupOfOldRestore`, `TestBackupSummaryManifest` and all six
`TestListBackups*` tests pass.
- `TestRestoreOfOldBackup/backup_of_21.03` fails by timing out in
`WaitForRestore`. It fails the same
way on unmodified `main` (b9d2c9c). It uses the online restore, which
this change does not touch.

Not run locally: the other backup suites (minio, encryption, nfs,
multi-tenancy, advanced-scenarios),
and an end-to-end `dgraph restore -z` followed by a check of Zero's
`/state`. That end-to-end path
was how we first found this, on v25.5.0, where Zero reported `maxUID: 0`
after the restore.

**Checklist**

- [x] The PR title follows the
[Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) syntax,
leading
      with `fix:`, `feat:`, `chore:`, `ci:`, etc.
- [x] Code compiles correctly and linting (via trunk) passes locally
- [x] Tests added for new functionality, or regression tests for bug
fixes added as applicable

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- codesmith:footer -->
---
<a
href="https://app.blacksmith.sh/dgraph-io/codesmith/dgraph/pr/9869?autoLogin=true&ref=codesmith_pr_footer"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-light-v3.svg"><img
alt="View with [code]smith"
src="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3-3x.png"
width="162" height="28"></picture></a> <a
href="https://backend.blacksmith.sh/track/enable-autofix?expires=1795451831&installation_model_id=8575&pr_number=9869&ref=codesmith_pr_footer&repository=dgraph-io%2Fdgraph&return_to=https%3A%2F%2Fgithub.com%2Fdgraph-io%2Fdgraph%2Fpull%2F9869&signature=4e6d921a95550c19003351bd5921d7ba2eaec4d6bdf9b5e3baaa830edd463ca7"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-light.svg"><img
alt="Autofix with [code]smith"
src="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png"
width="190" height="28"></picture></a>
<sup>Need help on this PR? Tag <code>@codesmith-bot</code> with what you
need.</sup>

<!-- codesmith:autofix:disabled -->
<!-- /codesmith:footer -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Offline restore results now include the highest UID and namespace
values found across restored groups, along with the backup’s read
timestamp.
* Restore operations now advance UID and namespace leases beyond the
highest restored values, helping ensure subsequent assignments do not
reuse IDs already present in restored data.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.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.

1 participant