Repository navigation
Conversation
…sertOpts InsertOpts passed at insertion time are documented to override the defaults from a JobArgsWithInsertOpts implementation, but no test passed both at once, so the precedence of MaxAttempts, Priority, Queue, and Tags could flip without a failure. Add a subtest that pins it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
If the precedence in
insertParamsFromConfigArgsAndOptionsever flipped so that a job args type's ownInsertOpts()won over theInsertOptspassed toInsert, a job inserted with an explicitQueuewould silently land in the args type's default queue instead (and the same forMaxAttempts,PriorityandTags), and no test would notice.Tests only: one subtest (+18 lines) in
client_test.go. No change to library code.Changes
client_test.go: addInsertOptsOverrideWorkerInsertOptstoTestInsertParamsFromJobArgsAndOptions. It passescustomInsertOptsJobArgs(whoseInsertOpts()setsMaxAttempts: 42,Priority: 2,Queue: "other", tagstag1, tag2) together with insert-time options, and checks the insert-time values win. The existing subtests cover each source on its own, but none passes both at once.The precedence is documented on
InsertOpts("These will override any default InsertOpts settings provided by JobArgsWithInsertOpts") and onJobArgsWithInsertOpts.InsertOpts("These can also be overridden at insertion time").Testing
On master
1f19003:All subtests pass; this test needs no database.
With the queue line changed to
cmp.Or(jobInsertOpts.Queue, insertOpts.Queue, rivercommon.QueueDefault), the new subtest is the only one that fails (expected: "explicit",actual: "other"). In an earlier run of the root module's full suite against Postgres (atfc6c1d5), no existing test caught that change.gofmtandgolangci-lintare clean on the file.This test was written with Claude Code during a planted-bug run by SK @ Trenyx.