refactor(worker): code quality phase 3 - centralized config and tests#405
Merged
refactor(worker): code quality phase 3 - centralized config and tests#405
Conversation
…mprehensive tests - Extract magic numbers to config/constants.ts for better maintainability - Consolidate error handling utility in helpers/errors.ts (eliminates duplication) - Add comprehensive test coverage for critical infrastructure: - mongo-utils.ts: 100% coverage (11 tests) - job-utils.ts: 63.57% coverage (15 tests) - workerControl.ts: 100% coverage (13 tests) - Improve runPythonStep.ts coverage from 88% to 92% - Remove dead/commented code across worker files - Update all files to use centralized constants and shared utilities This is Phase 3 of worker code quality improvements following PRs #403 and #404. All tests passing (100 tests), build successful, lint clean. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add changeset for worker code quality phase 3 improvements - Enhance CLAUDE.md with manual changeset creation instructions - Include examples and semver guidelines for non-TTY environments Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 5248e04 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Summary
This PR completes Phase 3 of worker code quality improvements (following #403 and #404), focusing on maintainability and test coverage:
config/constants.ts(worker concurrency, polling intervals, retry settings, progress calculation weights)helpers/errors.tsutility, eliminating duplication across 3 filesmongo-utils.ts: 100% coverage (11 tests) - database operationsworkerControl.ts: 100% coverage (13 tests) - NERSC worker controljob-utils.ts: 63.57% coverage (15 tests) - job lifecycle managementrunPythonStep.tsfrom 88% → 92%,helpersfrom 94.66% → 96%Test plan
pnpm -F @bilbomd/worker build)pnpm lint)Files Changed
New files (6):
apps/worker/src/config/constants.ts- Centralized configurationapps/worker/src/helpers/errors.ts- Shared error utilityapps/worker/src/services/functions/__tests__/mongo-utils.test.tsapps/worker/src/services/functions/__tests__/job-utils.test.tsapps/worker/src/workers/__tests__/workerControl.test.ts.changeset/worker-code-quality-phase-3.mdModified files (7):
CLAUDE.mdenhanced with changeset creation instructions14 files changed, 1,028 insertions(+), 72 deletions(-)
🤖 Generated with Claude Code