Skip to content

fix(amber, operator, v1.2): keep error information on three failure paths - #7809

Merged
aglinxinyuan merged 2 commits into
release/v1.2from
backport/7804-keep-error-information-on-three-failure-v1.2
Aug 23, 2026
Merged

fix(amber, operator, v1.2): keep error information on three failure paths#7809
aglinxinyuan merged 2 commits into
release/v1.2from
backport/7804-keep-error-information-on-three-failure-v1.2

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Automated backport of #7804 to release/v1.2.

Source: 226124b · automation run

Any related issues, documentation, discussions?

Backport of #7804. Originally linked #7803.

How was this PR tested?

Release-branch CI runs on this branch once the conflicts are resolved and this PR is marked ready for review.

Was this PR authored or co-authored using generative AI tooling?

No.

…7804)

### What changes were proposed in this PR?

Three error paths that silently lost the information they exist to
surface. All were characterized during earlier coverage work and
deliberately left unpinned so a fix would not have to fight a test
asserting the broken behaviour.

**1. `OPVersion.getVersion` no longer returns `null` when `git log`
fails.** The `GitAPIException` catch now stores the same `"N/A"`
sentinel its `NullPointerException` sibling already did, so the result
is non-null *and* memoized — previously the trailing
`opMap.get(operatorName)` handed back `null`, which propagated into
operator metadata (`LogicalOp.scala:462-466` →
`OperatorMetadataGenerator.scala:171`), and every later call re-ran the
failing `git log`. `printStackTrace()` is kept.

That `"N/A"` is the intended sentinel is corroborated downstream:
`agent-service/src/agent/util/workflow-utils.ts:193` already defends
with `?? "N/A"`.

**2. `InputManager.startInputPortReaderThreads` now passes the cause.**
It wrapped a start failure as `new RuntimeException(s"…:
${e.getMessage}")` without `e`, discarding the original stack trace. The
reader thread itself already does this correctly
(`InputPortMaterializationReaderThread.scala:147`).

**3. `PekkoActorRefMappingService.retrieveActorRef`'s catch no longer
re-reads the failing value.** It bound `e` but never used it, instead
reading `actorService.parent` again to name the parent in its warning —
so a **persistently** unreachable parent threw straight out of the
handler meant to contain it. The message now omits the parent and passes
`e` as the log throwable, matching house style
(`WorkflowActor.scala:144`, `SyncExecutionResource.scala:705`).

**Why not hoist the read instead:** capturing the parent ref before the
`try` was considered and rejected — the read *is* what throws, so
hoisting it would let the failure escape `retrieveActorRef` entirely
rather than fixing anything.

### All three are pinned, verified in both directions

The production files were reverted and restored to confirm each test
actually fails without its fix:

| Suite | production reverted | with fixes |
|---|---|---|
| `OPVersionSpec` | **9 passed, 2 failed** | **11 passed** |
| `InputManagerSpec` + `PekkoActorRefMappingServiceSpec` | **20 passed,
2 failed** | **22 passed** |

The before-state failures are the right ones:

- `null was not equal to "N/A"` (both new OPVersion cases)
- `null equaled null the original failure must be attached as the cause`
- `java.lang.IllegalStateException: parent is unreachable at …
PekkoActorRefMappingService.retrieveActorRef` — i.e. thrown *out of* the
handler, exactly the predicted failure mode

### On the tests

- **OPVersion**: two cases using the existing unborn-HEAD throwaway-repo
technique — the `"N/A"` fallback, and that it is *memoized* so a failing
`git log` is not retried.
- **InputManager**: a `NoOpReaderThread` subclass (no-op `run()`, so no
storage is touched) is started and joined, then installed into the
private map by reflection — the same technique as the existing
`OutputPortStorageWriterThreadSpec.installWriterThread`.
`Thread.start()` on a TERMINATED thread then throws
`IllegalThreadStateException` deterministically, and the test asserts
both the wrapping message and that `getCause` is that exception.
- **PekkoActorRefMappingService**: the new case sets the failure counter
to `Int.MaxValue` so *every* read throws, not just the first — the
existing single-failure test could not have caught this. It also asserts
the id remains askable afterwards, i.e. was not wrongly marked queried.

Three stale comments were updated rather than left contradicting the new
assertions: `OPVersionSpec`'s "Deliberately NOT asserted" paragraph
about the null, and the defect notes on the two amber specs.

### Verification

- `OPVersionSpec` 11/11; `InputManagerSpec` +
`PekkoActorRefMappingServiceSpec` +
`InputPortMaterializationReaderThreadSpec` 32/32 (the reader-thread spec
included as the nearest neighbour to the `InputManager` change).
- Specs were filtered deliberately rather than running the whole
`WorkflowOperator` module, because `FileScanSourceOpExecSpec` currently
aborts on Windows over a leaked handle — that is being fixed separately
in #7800.
- `scalafmtCheck`, `Test/scalafmtCheck` and `scalafixAll --check` pass
for both modules. One pre-existing scalafix *warning* in an untouched
file (`OutputManagerSpec.scala:59`, unused suppression) is unrelated.

### Any related issues, documentation, discussions?

Closes #7803

### How was this PR tested?

```
sbt "WorkflowOperator/testOnly org.apache.texera.amber.operator.metadata.OPVersionSpec" "WorkflowExecutionService/testOnly org.apache.texera.amber.engine.architecture.messaginglayer.InputManagerSpec org.apache.texera.amber.engine.architecture.common.PekkoActorRefMappingServiceSpec"
```

```
[info] Tests: succeeded 11, failed 0, canceled 0, ignored 0, pending 0
[info] Tests: succeeded 22, failed 0, canceled 0, ignored 0, pending 0
```

### Was this PR authored or co-authored using generative AI tooling?

(backported from commit 226124b)

Generated-by: Claude Code (Opus 5)
@github-actions

Copy link
Copy Markdown
Contributor Author

The cherry-pick conflicted and was committed with conflict markers. Resolve the conflicts on this branch, then mark this PR ready for review.

Conflicting files:

  • amber/src/test/scala/org/apache/texera/amber/engine/architecture/common/PekkoActorRefMappingServiceSpec.scala
  • amber/src/test/scala/org/apache/texera/amber/engine/architecture/messaginglayer/InputManagerSpec.scala
  • common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/metadata/OPVersionSpec.scala

The cherry-pick of #7804 hit modify/delete on all three of its spec files:
each already existed on `main` (added by #7018, #7219 and #5451, none of
which were backported) but is absent here, so git could not apply a diff
and the automation committed `main`'s whole file. Two of the three compile
and pass against this branch unchanged; `PekkoActorRefMappingServiceSpec`
does not, because it is written against `main` names this branch predates:

  - `virtualidentity.util.COORDINATOR` is `CONTROLLER` here, so the import
    did not resolve at all;
  - the scaladoc pointed at `PekkoMessageTransferServiceSpec`, a sibling
    that does not exist on this branch, leaving a dangling `[[link]]`.

The assertions are untouched: every method the suite drives is identical
on this branch, and the production hunks of #7804 applied cleanly.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor Author

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @Yicong-Huang
    You can notify them by mentioning @Yicong-Huang in a comment.

@codecov-commenter

codecov-commenter commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.98%. Comparing base (5f58502) to head (5ae2a63).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@               Coverage Diff               @@
##             release/v1.2    #7809   +/-   ##
===============================================
  Coverage           52.98%   52.98%           
  Complexity           2546     2546           
===============================================
  Files                1078     1078           
  Lines               42366    42365    -1     
  Branches             4565     4565           
===============================================
  Hits                22446    22446           
+ Misses              18604    18603    -1     
  Partials             1316     1316           
Flag Coverage Δ *Carryforward flag
access-control-service 64.35% <ø> (ø)
agent-service 34.36% <ø> (ø) Carriedforward from 5f58502
amber 53.27% <ø> (+<0.01%) ⬆️ Carriedforward from 5f58502
computing-unit-managing-service 1.65% <ø> (ø)
config-service 56.06% <ø> (ø)
file-service 61.72% <ø> (ø)
frontend 47.29% <ø> (ø) Carriedforward from 5f58502
pyamber 93.07% <ø> (ø) Carriedforward from 5f58502
python 90.88% <ø> (ø) Carriedforward from 5f58502
workflow-compiling-service 58.69% <ø> (ø)

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aglinxinyuan
aglinxinyuan marked this pull request as ready for review August 20, 2026 20:54
Copilot AI lite review requested due to automatic review settings August 20, 2026 20:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Aug 23, 2026
Merged via the queue into release/v1.2 with commit 203286c Aug 23, 2026
34 checks passed
@aglinxinyuan
aglinxinyuan deleted the backport/7804-keep-error-information-on-three-failure-v1.2 branch August 23, 2026 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants