Repository navigation
Add error-aware source stream contract - #10
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The exported interface breaks downstream implementations, and request-scoped errors can permanently fail global health.
3 open findings
What changed in this PR
Adds an error-aware source streaming contract with classified terminal errors, cancellation handling, health transitions, and legacy API compatibility.
Changes:
- Adds
ProducerStream,StreamError, andOnProduceStream. - Implements ordered draining, cancellation, gRPC status mapping, and health updates.
- Adds documentation and source-stream integration tests.
| File | Description |
|---|---|
README.md |
Documents the new producer contract and error mappings. |
pkg/source/stream.go |
Defines stream results and error classification. |
pkg/source/source.go |
Integrates error-aware streaming into sources. |
pkg/source/source_test.go |
Tests compatibility, results, and disconnects. |
pkg/source/cancellation_test.go |
Tests cancellation and registration conflicts. |
docs/modernization-plan.md |
Records modernization requirements and rollout. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+46
to
+47
| // OnProduceStream registers the error-aware producer. | ||
| OnProduceStream(producer ProducerStreamFunc) error |
Comment on lines
+384
to
+387
| var classified *StreamError | ||
| if !errors.Is(err, context.Canceled) && (!errors.As(err, &classified) || classified.Kind != Canceled) { | ||
| s.health.SetHealth(flowctl.HealthStatusUnhealthy) | ||
| } |
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
OnProduceStreamalongside the unchanged legacyOnProduceAPI, with ordered event draining and a single terminal result.Verification
go test ./...go vet ./...go build ./...go test -race ./pkg/sourceFollow-up