fix: sync event refresh blocking updates when Spock node is not configured#273
Conversation
…gured Add license entries for github.com/jackc/pgerrcode which was added as a direct dependency in go.mod. The package has two licenses: MIT (for the Go code) and PostgreSQL (for the embedded error code data). Generated via: docker run --platform linux/amd64 golang:1.25rc2 with GOTOOLCHAIN=auto Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdds third-party license notices, introduces a postgres error helper to detect unconfigured Spock nodes with tests, updates database resource error handling to return standardized not-found errors, adds a changelog entry, and updates go.mod with an indirect dependency. Changes
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@go.mod`:
- Line 49: The go.mod entry for github.com/jackc/pgerrcode is marked "//
indirect" but it's actually imported directly in
server/internal/postgres/errors.go (the import of github.com/jackc/pgerrcode),
so remove the "// indirect" annotation and place that require line into the
direct-dependencies section of go.mod; after editing go.mod run "go mod tidy" to
update the module graph and ensure the dependency is recorded as direct.
In `@NOTICE.txt`:
- Around line 3976-3986: The second github.com/jackc/pgerrcode entry erroneously
labels the block as “[PostgreSQL]” while the content is the MIT license; locate
the duplicated github.com/jackc/pgerrcode block and either correct the SPDX
label to reflect MIT (change “[PostgreSQL]” to “[MIT]”) or, if you cannot alter
the tool output, insert a single-line explanatory HTML comment immediately above
the second block (e.g., <!-- The single LICENSE file covers both licenses; full
text repeated per tool output -->) so auditors understand the repetition is
intentional.
In `@server/internal/postgres/errors_test.go`:
- Around line 44-51: The test case titled "returns true when wrapped with
fmt.Errorf" doesn't actually wrap the PgError; update the err function to return
a wrapped error using fmt.Errorf with %w (e.g. create pgErr :=
&pgconn.PgError{Code: pgerrcode.ObjectNotInPrerequisiteState} then return
fmt.Errorf("wrapped: %w", pgErr)) so the test exercises errors.As chain
traversal used by IsSpockNodeNotConfigured; keep expected: true.
| ## github.com/jackc/pgerrcode | ||
|
|
||
| * Name: github.com/jackc/pgerrcode | ||
| * Version: v0.0.0-20250907135507-afb5586c32a6 | ||
| * License: [PostgreSQL](https://github.com/jackc/pgerrcode/blob/afb5586c32a6/LICENSE) | ||
|
|
||
| ``` | ||
| Copyright (c) 2019 Jack Christensen | ||
|
|
||
| MIT License | ||
|
|
There was a problem hiding this comment.
Second pgerrcode entry is labeled [PostgreSQL] but its content block opens with MIT license text.
Lines 3976–4030 duplicate the first entry (lines 3920–3974) byte-for-byte — the content block starts with "MIT License" / "Copyright (c) 2019 Jack Christensen" under a header that advertises the PostgreSQL license. Anyone auditing the [PostgreSQL] section for compliance would immediately encounter the wrong license header.
This looks like a tool artifact where the generator repeats the full LICENSE file content under every detected SPDX identifier. If the tooling cannot be changed, a brief explanatory comment above the second block (e.g., <!-- The single LICENSE file covers both licenses; full text repeated per tool output -->) would reduce confusion during legal review.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@NOTICE.txt` around lines 3976 - 3986, The second github.com/jackc/pgerrcode
entry erroneously labels the block as “[PostgreSQL]” while the content is the
MIT license; locate the duplicated github.com/jackc/pgerrcode block and either
correct the SPDX label to reflect MIT (change “[PostgreSQL]” to “[MIT]”) or, if
you cannot alter the tool output, insert a single-line explanatory HTML comment
immediately above the second block (e.g., <!-- The single LICENSE file covers
both licenses; full text repeated per tool output -->) so auditors understand
the repetition is intentional.
jason-lynch
left a comment
There was a problem hiding this comment.
Nice! I'd ignore the NOTICE.txt comment, but the other two code rabbit comments in errors_test.go and go.mod are valid. They're definitely minor issues, but could you please fix them up before you merge?
There was a problem hiding this comment.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@go.mod`:
- Around line 47-50: The go.mod currently has github.com/gohugoio/hashstructure
listed as indirect while github.com/jackc/pgerrcode remains in the wrong block;
run `go mod tidy` to let Go reorder dependencies so pgerrcode moves into the
primary require block and hashstructure is marked as indirect, or manually move
github.com/jackc/pgerrcode into the main direct-deps require block and restore
github.com/gohugoio/hashstructure to an indirect entry (// indirect) so the file
follows standard direct/indirect grouping.
Summary
This PR fixes hard errors returned by
SyncEventResourceandWaitForSyncEventResourcerefresh methods when the database is not configured as aSpock node, which previously blocked follow-up update operations.Changes
resource.ErrNotFoundfromSyncEventResource.Refreshwhenspock.sync_event()failsWaitForSyncEventResource.Refreshwhenspock.sub_show_status() or spock.wait_for_sync_event() failsSyncEventLsnasErrNotFoundinstead of a hard errorobject_not_in_prerequisite_stateTesting
Verification:
Checklist
PLAT-420