You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "wzhero1 (via GitHub)" <gi...@apache.org> on 2026/06/05 08:44:10 UTC

[PR] [bugfix][examples] Point quickstart FileSource at product_review.txt instead of the resources dir [flink-agents]

wzhero1 opened a new pull request, #782:
URL: https://github.com/apache/flink-agents/pull/782

   Linked issue: #776
   
   ### Purpose of change
   
   The three product-review quickstart examples build a `FileSource` over the whole
   `resources/` directory. Flink's default file enumerator recurses into
   subdirectories, so after #707 added `skills/math-calculator/SKILL.md` under
   `resources/`, the source reads that markdown file and feeds each line to
   `ProductReview.model_validate_json()`, which raises a `ValidationError` and fails
   the job.
   
   This affects all three Python quickstart examples that read the directory, not
   just the one in the issue:
   - `workflow_single_agent_example.py`
   - `yaml_workflow_agent_example.py`
   - `react_agent_example.py`
   
   The fix points each `FileSource` at the specific `resources/product_review.txt`
   file — the same single-file targeting the Java examples already use via
   `copyResource`. The `skills/` resources and packaging are left untouched, so the
   skills example keeps working.
   
   For reference, the following are **not** affected and need no change:
   - The 3 Java examples (`WorkflowSingleAgentExample` / `ReActAgentExample` /
     `YamlWorkflowAgentExample`) — their `resources/` is polluted the same way, but
     they copy a single `input_data.txt` to a temp dir and target that one file.
   - The e2e tests — each `FileSource` targets a dedicated single-record input
     subdir (`execute_test_input/`, `input/`, `java_chat_module_input/`, …).
   
   ### Tests
   
   - `ruff check` and `ruff format --check` pass on the changed examples.
   - `python -m py_compile` passes on the three examples.
   - Root cause verified against the bundled Flink 2.2.1 `flink-connector-files`
     jar: the default `NonSplittingRecursiveEnumerator` + `DefaultFileFilter`
     recurse into `skills/` and emit `SKILL.md` (only names starting with `.`/`_`
     are skipped). Narrowing the source to the single file avoids it.
   
   ### API
   
   No public API changes.
   
   ### Documentation
   
   - [ ] `doc-needed`
   - [ ] `doc-not-needed`
   - [x] `doc-included` <!-- the matching Python snippets in docs/.../quickstart/{workflow_agent,yaml_agent,react_agent}.md are updated in this PR -->
   


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [bugfix][examples] Point quickstart FileSource at product_review.txt instead of the resources dir [flink-agents]

Posted by "weiqingy (via GitHub)" <gi...@apache.org>.
weiqingy commented on code in PR #782:
URL: https://github.com/apache/flink-agents/pull/782#discussion_r3366811712


##########
python/flink_agents/examples/quickstart/react_agent_example.py:
##########
@@ -76,7 +76,7 @@ def main() -> None:
     product_review_stream = env.from_source(
         source=FileSource.for_record_stream_format(
             StreamFormat.text_line_format(),
-            f"file:///{current_dir}/resources/",
+            f"file:///{current_dir}/resources/product_review.txt",

Review Comment:
   Optional: a one-line note on *why* this targets the file rather than `resources/` would stop someone from later broadening it back to the dir and rehitting #776 — e.g. `# Target the specific file so non-record resources (e.g. skills/) aren't read as reviews`. Same applies to the other two examples.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [bugfix][examples] Point quickstart FileSource at product_review.txt instead of the resources dir [flink-agents]

Posted by "wenjin272 (via GitHub)" <gi...@apache.org>.
wenjin272 merged PR #782:
URL: https://github.com/apache/flink-agents/pull/782


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [bugfix][examples] Point quickstart FileSource at product_review.txt instead of the resources dir [flink-agents]

Posted by "weiqingy (via GitHub)" <gi...@apache.org>.
weiqingy commented on code in PR #782:
URL: https://github.com/apache/flink-agents/pull/782#discussion_r3366811712


##########
python/flink_agents/examples/quickstart/react_agent_example.py:
##########
@@ -76,7 +76,7 @@ def main() -> None:
     product_review_stream = env.from_source(
         source=FileSource.for_record_stream_format(
             StreamFormat.text_line_format(),
-            f"file:///{current_dir}/resources/",
+            f"file:///{current_dir}/resources/product_review.txt",

Review Comment:
   Optional: a one-line note on *why* this targets the file rather than `resources/` would stop someone from later broadening it back to the dir and rehitting #776 — e.g. `# Target the specific file so non-record resources (e.g. skills/) aren't read as reviews`. Same applies to the other two examples.
   
   One optional note inline, LGTM



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [bugfix][examples] Point quickstart FileSource at product_review.txt instead of the resources dir [flink-agents]

Posted by "weiqingy (via GitHub)" <gi...@apache.org>.
weiqingy commented on code in PR #782:
URL: https://github.com/apache/flink-agents/pull/782#discussion_r3366811712


##########
python/flink_agents/examples/quickstart/react_agent_example.py:
##########
@@ -76,7 +76,7 @@ def main() -> None:
     product_review_stream = env.from_source(
         source=FileSource.for_record_stream_format(
             StreamFormat.text_line_format(),
-            f"file:///{current_dir}/resources/",
+            f"file:///{current_dir}/resources/product_review.txt",

Review Comment:
   One optional note inline, LGTM
   
   Optional: a one-line note on *why* this targets the file rather than `resources/` would stop someone from later broadening it back to the dir and rehitting #776 — e.g. `# Target the specific file so non-record resources (e.g. skills/) aren't read as reviews`. Same applies to the other two examples.
   



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [bugfix][examples] Point quickstart FileSource at product_review.txt instead of the resources dir [flink-agents]

Posted by "wzhero1 (via GitHub)" <gi...@apache.org>.
wzhero1 commented on PR #782:
URL: https://github.com/apache/flink-agents/pull/782#issuecomment-4644987533

   Good call — added the rationale inline at all three examples (and the matching doc snippets) so the single-file targeting isn't accidentally broadened back to `resources/`. Thanks!


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [bugfix][examples] Point quickstart FileSource at product_review.txt instead of the resources dir [flink-agents]

Posted by "wenjin272 (via GitHub)" <gi...@apache.org>.
wenjin272 commented on PR #782:
URL: https://github.com/apache/flink-agents/pull/782#issuecomment-4645057972

   LGTM


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org