Copilot commented on code in PR #2262:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2262#discussion_r4016687390
##########
minifi_rust/extensions/minifi_rs_playground/src/processors/duplicate_text.rs:
##########
@@ -65,6 +73,6 @@ impl ProcessorDefinition for DuplicateStreamText {
const SUPPORTS_DYNAMIC_PROPERTIES: bool = false;
const SUPPORTS_DYNAMIC_RELATIONSHIPS: bool = false;
const OUTPUT_ATTRIBUTES: &'static [OutputAttribute] = &[];
- const RELATIONSHIPS: &'static [Relationship] = &[SUCCESS];
+ const RELATIONSHIPS: &'static [Relationship] = &[SUCCESS, FAILURE];
Review Comment:
Adding `FAILURE` changes the processor's published relationship schema, but
the checked-in generated documentation still lists only `success` for
`DuplicateStreamText`
(`minifi_rust/extensions/minifi_rs_playground/minifi_rs_playground.md:91-95`).
Regenerate and commit the module documentation so users can configure the new
error route from the documented contract.
##########
minifi_rust/minifi_native/src/api/processor_wrappers/flow_file_stream_transform.rs:
##########
@@ -116,13 +125,13 @@ where
session.write_stream(&flow_file, |output_stream| {
let transformed = match transform_fn(&simple_context,
input_stream, output_stream) {
Ok(t) => t,
- Err(ProcessError::Route(route)) => {
- route.log(logger);
-
TransformStreamResult::route_without_changes_by_name(route.relationship)
- }
- Err(ProcessError::Fatal(e)) => {
- return Err(e);
- }
+ Err(err) => match err.into_route(error_relationship) {
+ Ok(route) => {
+ route.log(logger);
+
TransformStreamResult::route_without_changes_by_name(route.relationship)
Review Comment:
This automatic error route relies on `IoState::Cancel` to preserve the
original content, but `MockProcessSession::write_stream` currently ignores that
state and always replaces the FlowFile content
(`mock/mock_process_session.rs:109-113`). A stream transform that writes a
prefix and then bubbles an error will therefore be transferred to the error
relationship with partial content in wrapper-level tests, contrary to
`route_without_changes`. Please make the mock honor cancellation and add a
trigger-level regression test that checks the relationship and unchanged
content.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]