refactor: simplify job dispatch controller#839
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (24)
Disabled knowledge base sources:
📝 WalkthroughWalkthroughThis PR refactors the job dispatch system to use direct Job-based workflows instead of ReleaseTarget abstractions. It introduces a reconcile Queue-based optional job dispatch mechanism, simplifies data access patterns with granular getters (GetJob, GetRelease, GetDeployment, GetJobAgent), and removes legacy job agent selection logic. Changes
Sequence Diagram(s)sequenceDiagram
participant Controller as Job Dispatch<br/>Controller
participant Getter as PostgresGetter
participant DB as Database
participant Reconcile as Reconcile<br/>Function
participant Dispatcher as Job<br/>Dispatcher
participant Setter as PostgresSetter
Controller->>Getter: GetJob(ctx, jobID)
Getter->>DB: Query job by ID
DB-->>Getter: Job record
Getter-->>Controller: *oapi.Job
Controller->>Reconcile: Reconcile(ctx, getter, setter,<br/>verifier, dispatcher, job)
Reconcile->>Getter: GetRelease(ctx, job.ReleaseId)
Getter->>DB: Query release by ID
DB-->>Getter: Release record
Getter-->>Reconcile: *oapi.Release
Reconcile->>Getter: GetDeployment(ctx, release.DeploymentId)
Getter->>DB: Query deployment by ID
DB-->>Getter: Deployment record
Getter-->>Reconcile: *oapi.Deployment
Reconcile->>Getter: GetJobAgents(ctx, release.Id)
Getter->>DB: Query job agents for release
DB-->>Getter: JobAgent records
Getter-->>Reconcile: []oapi.JobAgent
Reconcile->>Getter: GetVerificationPolicies(ctx, releaseTarget)
Getter->>DB: Query policies & rules
DB-->>Getter: VerificationMetricSpec list
Getter-->>Reconcile: []oapi.VerificationMetricSpec
Reconcile->>Dispatcher: Dispatch(ctx, job)
Dispatcher-->>Reconcile: error (if any)
Reconcile->>Setter: CreateVerifications(ctx, job, specs)
Setter->>DB: Insert verification metrics
DB-->>Setter: Completed
Setter-->>Reconcile: error (if any)
Reconcile-->>Controller: *ReconcileResult
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Suggested reviewers
✨ 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 |
…b-dispatch-controller
…b-dispatch-controller
…b-dispatch-controller
…b-dispatch-controller
Replace panic-prone uuid.MustParse calls with proper uuid.Parse error handling across stable production code in workspace-engine. This prevents runtime panics from invalid UUID strings by returning descriptive errors instead. Follows the pattern established in commit 5888d08. Scope: - pkg/store/ (environment, deployment, resource, system, policies, resources) - svc/controllers/jobverificationmetric/ (getters and setters) - svc/controllers/environmentresourceselectoreval/controller.go - pkg/workspace/releasemanager/policy/evaluator/ (approval, deploymentwindow, environmentprogression, versioncooldown) Excluded: - svc/controllers/jobdispatch/ (in flux from #839) - Functions that don't return error (would require interface changes) - Test files - deploymentdependency evaluator (functions don't return error) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary by CodeRabbit
Release Notes
New Features
Refactor