Skip to content

chore: workflows engine working e2e#892

Merged
adityachoudhari26 merged 2 commits intomainfrom
workflows-working-e2e
Mar 30, 2026
Merged

chore: workflows engine working e2e#892
adityachoudhari26 merged 2 commits intomainfrom
workflows-working-e2e

Conversation

@adityachoudhari26
Copy link
Copy Markdown
Member

@adityachoudhari26 adityachoudhari26 commented Mar 30, 2026

Summary by CodeRabbit

Release Notes

  • API Changes

    • Updated WorkflowJobAgent schema: removed required id field; now uses alternative identifier for job agent references.
  • Bug Fixes

    • Enhanced job dispatch validation to properly skip empty and zero-value release identifiers.
  • Tests

    • Added test suite for workflow input resolution logic.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 30, 2026

📝 Walkthrough

Walkthrough

The PR wires a PostgreSQL connection pool through HTTP service initialization layers and updates WorkflowJobAgent schema/implementation to remove the id field, instead using ref for job agent identification and compaction keying. An additional validation check for zero UUID is added to job dispatch logic.

Changes

Cohort / File(s) Summary
Database Pool Dependency Injection
apps/workspace-engine/main.go, apps/workspace-engine/svc/http/http.go, apps/workspace-engine/svc/http/server/server.go, apps/workspace-engine/svc/http/server/openapi/server.go, apps/workspace-engine/svc/http/server/openapi/workflows/workflows.go
Extends HTTP service constructors to accept and propagate *pgxpool.Pool through service initialization chain: main passes pool to httpsvc.New, HTTP service stores and passes to server, server passes to OpenAPI handler, OpenAPI passes to workflows package.
WorkflowJobAgent Schema & Type Definitions
apps/workspace-engine/oapi/openapi.json, apps/workspace-engine/oapi/spec/schemas/workflows.jsonnet, apps/workspace-engine/pkg/oapi/oapi.gen.go
Removes id property from WorkflowJobAgent schema definition and required list across OpenAPI spec, Jsonnet schema source, and generated Go struct.
WorkflowJobAgent Field References
apps/workspace-engine/pkg/oapi/persistence.go, apps/workspace-engine/svc/http/server/openapi/workflows/setters.go
Updates WorkflowJobAgent usage: compaction key now uses Ref instead of Id, and job agent identifier parsing changed from Id field to Ref field.
Job Dispatch Logic
apps/workspace-engine/svc/controllers/jobdispatch/setters_postgres.go
Enhances release ID validation to check for both empty string and all-zero UUID (00000000-0000-0000-0000-000000000000) before dispatching progression targets.
Tests
apps/workspace-engine/svc/http/server/openapi/workflows/workflows_test.go
Adds new test file with helper constructors and 7 unit tests validating resolveInputs function behavior across provided values, defaults, missing inputs, and edge cases.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 The database pool hops through the layers with grace,
From main to workflows—each service finds its place,
The id field retires, ref takes the stage,
A cleaner, smarter schema—a new rabbit-friendly age! 🥕

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.88% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'chore: workflows engine working e2e' is vague and does not clearly convey the specific technical changes made in the changeset, using non-descriptive terms like 'working' that don't explain what was actually modified. Revise the title to be more specific about the main changes, such as 'refactor: wire database connection pool through HTTP service layer' or 'refactor: update WorkflowJobAgent schema and dependency injection for workflow engine'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch workflows-working-e2e

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.

@adityachoudhari26 adityachoudhari26 changed the title Workflows-working-e2e chore: workflows engine working e2e Mar 30, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/workspace-engine/svc/controllers/jobdispatch/setters_postgres.go (1)

102-104: Emit a trace event before returning on empty/zero release ID.

Line 103 returns silently, while other dispatch-skip branches add span events. Add one event here for trace/debug parity.

Suggested patch
 releaseID := existingJob.ReleaseId
 if releaseID == "" || releaseID == "00000000-0000-0000-0000-000000000000" {
+	span.AddEvent("skipping progression dispatch - release id is empty or zero UUID")
 	return nil
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/workspace-engine/svc/controllers/jobdispatch/setters_postgres.go` around
lines 102 - 104, The early return when releaseID == "" || releaseID ==
"00000000-0000-0000-0000-000000000000" returns silently; add a trace/span event
just before the return for parity with other skip branches. In the block that
checks releaseID, call the existing span.AddEvent (or span.Event equivalent used
elsewhere in this file) with a clear message like "dispatch skip: empty/zero
releaseID" and include the releaseID value as an attribute if your span API
supports attributes, then return nil as before.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/workspace-engine/svc/http/server/openapi/workflows/setters.go`:
- Around line 106-109: The error message for the uuid.Parse call should
reference the actual field being parsed: change the fmt.Errorf in the
uuid.Parse(jobAgent.Ref) error branch so it mentions "job agent ref" (or
jobAgent.Ref) instead of "job agent id"; update the error creation where
uuid.Parse(jobAgent.Ref) is used (the block that assigns jobAgentIDUUID) to
return a matching message that includes the underlying error.

---

Nitpick comments:
In `@apps/workspace-engine/svc/controllers/jobdispatch/setters_postgres.go`:
- Around line 102-104: The early return when releaseID == "" || releaseID ==
"00000000-0000-0000-0000-000000000000" returns silently; add a trace/span event
just before the return for parity with other skip branches. In the block that
checks releaseID, call the existing span.AddEvent (or span.Event equivalent used
elsewhere in this file) with a clear message like "dispatch skip: empty/zero
releaseID" and include the releaseID value as an attribute if your span API
supports attributes, then return nil as before.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bc90b208-c83e-4301-84cc-09a4ca3af7d8

📥 Commits

Reviewing files that changed from the base of the PR and between 179c431 and 6b565c0.

📒 Files selected for processing (12)
  • apps/workspace-engine/main.go
  • apps/workspace-engine/oapi/openapi.json
  • apps/workspace-engine/oapi/spec/schemas/workflows.jsonnet
  • apps/workspace-engine/pkg/oapi/oapi.gen.go
  • apps/workspace-engine/pkg/oapi/persistence.go
  • apps/workspace-engine/svc/controllers/jobdispatch/setters_postgres.go
  • apps/workspace-engine/svc/http/http.go
  • apps/workspace-engine/svc/http/server/openapi/server.go
  • apps/workspace-engine/svc/http/server/openapi/workflows/setters.go
  • apps/workspace-engine/svc/http/server/openapi/workflows/workflows.go
  • apps/workspace-engine/svc/http/server/openapi/workflows/workflows_test.go
  • apps/workspace-engine/svc/http/server/server.go
💤 Files with no reviewable changes (2)
  • apps/workspace-engine/pkg/oapi/oapi.gen.go
  • apps/workspace-engine/oapi/openapi.json

Comment on lines +106 to 109
jobAgentIDUUID, err := uuid.Parse(jobAgent.Ref)
if err != nil {
return fmt.Errorf("parse job agent id: %w", err)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Update error message to match the field being parsed.

The error message references "job agent id" but the code now parses jobAgent.Ref. This inconsistency could confuse debugging efforts.

Suggested fix
 	jobAgentIDUUID, err := uuid.Parse(jobAgent.Ref)
 	if err != nil {
-		return fmt.Errorf("parse job agent id: %w", err)
+		return fmt.Errorf("parse job agent ref: %w", err)
 	}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
jobAgentIDUUID, err := uuid.Parse(jobAgent.Ref)
if err != nil {
return fmt.Errorf("parse job agent id: %w", err)
}
jobAgentIDUUID, err := uuid.Parse(jobAgent.Ref)
if err != nil {
return fmt.Errorf("parse job agent ref: %w", err)
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/workspace-engine/svc/http/server/openapi/workflows/setters.go` around
lines 106 - 109, The error message for the uuid.Parse call should reference the
actual field being parsed: change the fmt.Errorf in the uuid.Parse(jobAgent.Ref)
error branch so it mentions "job agent ref" (or jobAgent.Ref) instead of "job
agent id"; update the error creation where uuid.Parse(jobAgent.Ref) is used (the
block that assigns jobAgentIDUUID) to return a matching message that includes
the underlying error.

@adityachoudhari26 adityachoudhari26 merged commit 8d0fa3f into main Mar 30, 2026
11 of 12 checks passed
@adityachoudhari26 adityachoudhari26 deleted the workflows-working-e2e branch March 30, 2026 21:48
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.

1 participant