BCH-1155: Populate ExecutionStreamUUID in WorkflowExecution.GetByID#401
Conversation
Add a computed ExecutionStreamUUID field to WorkflowExecution and derive it deterministically in GetByID using a pure SHA256-based helper that mirrors the algorithm already used by EvidenceIntegration. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Caution Review failedFailed to post review comments 📝 WalkthroughWalkthroughThis PR introduces a computed ChangesExecution Stream UUID Feature
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/swagger.json`:
- Around line 40223-40226: The schema for the computed field
execution_stream_uuid currently only declares "type": "string" but should
declare a UUID format to enforce the intended shape; update the JSON schema for
the execution_stream_uuid property to add "format": "uuid" alongside "type":
"string" so generated clients and validators will treat it as a UUID.
In `@docs/swagger.yaml`:
- Around line 8922-8924: The OpenAPI schema entry for execution_stream_uuid is
too permissive; update the execution_stream_uuid property (in docs/swagger.yaml)
to include format: uuid and readOnly: true while keeping type: string and the
existing description ("Computed field (not persisted)") so generated clients and
validators treat it as a server-computed UUID-only, read-only field.
In `@internal/service/relational/workflows/stream_uuid.go`:
- Around line 23-24: The code currently ignores the error from uuid.Parse when
building streamUUID (streamUUID, _ := uuid.Parse(...)); change it to capture and
handle the error (streamUUID, err := uuid.Parse(...)) and propagate it by
updating the function signature to return (uuid.UUID, error) or otherwise return
uuid.Nil with a wrapped error; update callers to handle the error so a malformed
UUID assembly cannot silently produce a uuid.Nil used for execution_stream_uuid.
In `@internal/service/relational/workflows/workflow_execution_service_test.go`:
- Around line 119-127: The test currently only asserts stability of
ExecutionStreamUUID across fetches; update it to also assert the canonical
expected UUID and guard against nil on the second retrieval. After calling
retrieved2, require.NoError(t, err) (already present) and add require.NotNil(t,
retrieved2.ExecutionStreamUUID) before dereferencing it, then compute the
expected UUID using the same deterministic generator the service uses (e.g., the
function that produces the execution stream UUID in your implementation — call
it directly, e.g., computeExecutionStreamUUID(execution) or
ExecutionStreamUUIDFor(execution)) and assert assert.Equal(t, expectedUUID,
*retrieved2.ExecutionStreamUUID) instead of only comparing retrieved to
retrieved2.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: d1e82e79-2c59-4f5d-a466-1f6014476acc
📒 Files selected for processing (7)
docs/docs.godocs/swagger.jsondocs/swagger.yamlinternal/service/relational/workflows/stream_uuid.gointernal/service/relational/workflows/workflow_execution.gointernal/service/relational/workflows/workflow_execution_service.gointernal/service/relational/workflows/workflow_execution_service_test.go
- Return error from ComputeExecutionStreamUUID instead of discarding it - Propagate the error in GetByID - Assert canonical computed UUID value in test and add nil guard for second retrieval pointer - Add format:uuid and readOnly:true to ExecutionStreamUUID struct tag so generated swagger docs tighten the API contract Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add a computed ExecutionStreamUUID field to WorkflowExecution and derive it deterministically in GetByID using a pure SHA256-based helper that mirrors the algorithm already used by EvidenceIntegration.
Summary by CodeRabbit
New Features
Documentation
Tests