Skip to content

Refactor src/worker/job.rs to reduce Low Cohesion (responsibilities 74 → ≤3) #124

@coderabbitai

Description

@coderabbitai

Low Cohesion in src/worker/job.rs

CodeScene has flagged a significant worsening of the Low Cohesion biomarker in src/worker/job.rs:

The number of different responsibilities increases from 8 to 74, threshold = 3

This was identified during PR #123 (Add regression coverage for worker reload contracts).

Why this matters

High numbers of distinct responsibilities in a single module indicate that the file is doing too much. This makes the code harder to understand, test, and maintain, and increases the risk of unintended coupling between concerns.

Suggested next steps

  • Audit the responsibilities now present in and group related ones.
  • Extract cohesive subsets into dedicated modules (e.g. separate tool invocation, safety checks, state management, and event emission).
  • Review imports such as , ///, and to determine whether they belong in a thinner coordination layer or in dedicated sub-modules.

References

/cc @leynos

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions