Skip to content

chore: simplify, modernize (Go 1.26), update deps#148

Merged
rustatian merged 2 commits into
masterfrom
chore/cleanup-modernize-deps
Jun 2, 2026
Merged

chore: simplify, modernize (Go 1.26), update deps#148
rustatian merged 2 commits into
masterfrom
chore/cleanup-modernize-deps

Conversation

@rustatian

@rustatian rustatian commented May 29, 2026

Copy link
Copy Markdown
Member

Applied fixes

Simplify (S) — 5 applied

  • commands.go: pipe.String(createdWithConfig, "") != ""pipe.Has(createdWithConfig)
  • pipeline.go: deduplicate Int()/Priority() numeric type-switch into shared toInt64 helper
  • worker_pool.go: errors() clears slice with clear + reslice instead of reallocating
  • plugin.go: drop redundant len(Consume)>0 guard; use var jst instead of make([]*State,0,2)
  • rpc.go: remove rpc.mu — the RPC methods delegate straight to Plugin which manages its own lock

Modernize (M) — 3 applied

  • metrics.go: *uint64 fields → atomic.Uint64 value fields; drop new(uint64(0)) init; use .Add(1) / .Load()
  • worker_pool.go: rename context context.Context field → ctx (shadowed the context import)
  • plugin.go: index-range over cfg.Consume → value range

Review / bugs (R) — 3 applied

  • pipeline.go: remove dead post-ParseInt(...,32) bounds guard (ParseInt already enforces int32 range)
  • job.go: add nil-Options guards in Delay() and AutoAck() (would panic on a job without options)
  • plugin.go: Declare now returns an error when no constructor is registered for the requested driver (previously returned nil silently)

- metrics: *uint64 fields → atomic.Uint64 value fields; remove new(uint64(0)) init
- pipeline: extract toInt64 helper to deduplicate Int/Priority type-switch; remove dead ParseInt bounds guard
- job: add nil-Options guards in Delay/AutoAck
- plugin: fix Declare to return error when constructor is missing; drop redundant len>0+index-range; use var for jst slice
- worker_pool: rename context field → ctx (shadowed import); clear+reslice errs instead of reallocating
- rpc: remove redundant per-call mutex (delegates to Plugin methods that own their lock)
- commands: use pipe.Has(createdWithConfig) instead of String(...) != ""
Copilot AI review requested due to automatic review settings May 29, 2026 12:33
@coderabbitai

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@rustatian, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 24 minutes and 1 second. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1f6bd4f8-1e2a-4cd5-a3ec-3223da07bfef

📥 Commits

Reviewing files that changed from the base of the PR and between 3f24a2a and 1af44e4.

📒 Files selected for processing (7)
  • commands.go
  • job.go
  • metrics.go
  • pipeline.go
  • plugin.go
  • rpc.go
  • worker_pool.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/cleanup-modernize-deps

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 and usage tips.

Comment thread pipeline.go Fixed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes the jobs plugin for Go 1.26, simplifies several internal helpers, updates dependencies, and fixes a few small correctness issues around nil job options and dynamic pipeline declaration errors.

Changes:

  • Modernizes metrics counters to use atomic.Uint64 and updates Go/dependency versions.
  • Simplifies pipeline/job processing code and command handling.
  • Adds safer behavior for nil Job.Options and missing driver constructors during Declare.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
worker_pool.go Renames context field and reuses the processor error slice when clearing errors.
rpc.go Removes RPC-level locking around delegated plugin operations.
plugin.go Simplifies consume initialization and makes missing dynamic driver constructors return errors.
pipeline.go Deduplicates numeric conversion logic for Int and Priority.
metrics.go Replaces pointer-based atomic counters with atomic.Uint64 fields.
job.go Adds nil Options guards for Delay and AutoAck.
commands.go Uses Pipeline.Has for config-created pipeline detection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pipeline.go Outdated
Comment thread rpc.go
On 32-bit platforms int is 32-bit, so casting an unchecked int64 from
toInt64 directly to int could silently truncate values that fit in int64
but not int. Add math.MinInt/math.MaxInt bounds check before the cast
so out-of-range values fall through to the default instead of wrapping.

Resolves CodeQL "Incorrect conversion between integer types" finding.
@rustatian rustatian self-assigned this Jun 2, 2026
@rustatian rustatian merged commit dd3c924 into master Jun 2, 2026
6 of 7 checks passed
@rustatian rustatian deleted the chore/cleanup-modernize-deps branch June 2, 2026 20:30
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.

3 participants