fix(operator, v1.2): interpolate desc.url so failure message shows the URL - #6996
Open
Yicong-Huang wants to merge 1 commit into
Open
fix(operator, v1.2): interpolate desc.url so failure message shows the URL #6996Yicong-Huang wants to merge 1 commit into
Yicong-Huang wants to merge 1 commit into
Conversation
…6800) ### What changes were proposed in this PR? Fixes a Scala string-interpolation bug in `URLFetcherOpExec`'s fetch-failure fallback. The failure branch built its message with `s"Fetch failed for URL: $desc.url"`. In an `s"..."` interpolator, `$desc` expands only the identifier `desc` (the `URLFetcherOpDesc` instance) and `.url` is appended as literal text. Because `LogicalOp` overrides `toString` with `ToStringBuilder.reflectionToString`, the resulting `URL content` cell contained the entire descriptor dump instead of the URL: ``` Fetch failed for URL: org.apache.texera.amber.operator.source.fetcher.URLFetcherOpDesc@5624b9e8[decodingMethod=UTF_8,url=https://this-host-does-not-exist.invalid/x,dummyPropertyList=List(),inputPorts=<null>,operatorId=URLFetcherOpDesc-...,operatorVersion=N/A,outputPorts=<null>].url ``` This both malforms the message and leaks internal operator fields (`operatorId`, `inputPorts`, `dummyPropertyList`, …) into user-facing output. The fix wraps the member access in braces so only `desc.url` is interpolated: ```diff - case None => IOUtils.toInputStream(s"Fetch failed for URL: $desc.url", "UTF-8") + case None => IOUtils.toInputStream(s"Fetch failed for URL: ${desc.url}", "UTF-8") ``` Now the message reads as intended: ``` Fetch failed for URL: https://this-host-does-not-exist.invalid/x ``` ### Any related issues, documentation, discussions? Closes #6755 ### How was this PR tested? Added an automated regression test to `URLFetcherOpExecSpec` that exercises the fetch-failure branch **offline and deterministically**: pointing the operator at a `file://` URL for a nonexistent path makes `URLFetchUtil.getInputStreamFromURL` return `None` with no network dependency. The test asserts the fallback cell is exactly `Fetch failed for URL: <url>` and does **not** contain the descriptor dump (`URLFetcherOpDesc`, `operatorId`, …), so it fails on the pre-fix `$desc.url` behavior and passes with the fix. ``` sbt "WorkflowOperator/testOnly org.apache.texera.amber.operator.source.fetcher.URLFetcherOpExecSpec" ... Tests: succeeded 3, failed 0, canceled 0, ignored 0, pending 0 All tests passed. ``` Also reproduced end-to-end before the fix by pointing a **URL Fetcher** operator at an unreachable address (`https://this-host-does-not-exist.invalid/x`) and inspecting the `URL content` output cell: it showed the full `URLFetcherOpDesc[...]` dump followed by `.url`; after the fix it shows `Fetch failed for URL: https://this-host-does-not-exist.invalid/x`. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 4.8) --------- (backported from commit 97f0fdb) Signed-off-by: Kary Zheng <150742834+kz930@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Xinyuan Lin <xinyual3@uci.edu> Co-authored-by: Yicong Huang <17627829+Yicong-Huang@users.noreply.github.com>
Contributor
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release/v1.2 #6996 +/- ##
==================================================
- Coverage 53.95% 52.40% -1.56%
- Complexity 1441 2493 +1052
==================================================
Files 809 1077 +268
Lines 34144 42265 +8121
Branches 3448 4546 +1098
==================================================
+ Hits 18421 22147 +3726
- Misses 14815 18813 +3998
- Partials 908 1305 +397
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
What changes were proposed in this PR?
Backport of #6800 to
release/v1.2, cherry-picked from 97f0fdb. The cherry-pick applied cleanly.Follows the Direct Backport Push convention; opened as a PR (rather than a direct push) per a backport-coverage audit.
Any related issues, documentation, discussions?
Backport of #6800. Originally linked #6755.
How was this PR tested?
Release-branch CI runs on this PR. Cherry-pick applied cleanly onto
release/v1.2; no manual conflict resolution was needed.Was this PR authored or co-authored using generative AI tooling?
Yes — backport prepared with Claude Code (mechanical cherry-pick; the change itself is #6800 by its original author).
🤖 Generated with Claude Code