|
| 1 | +# Review 3 — Edge Cases and Robustness |
| 2 | + |
| 3 | +- **Task:** `task-fatal-cleanup`, attempt 1 | **Round:** 3 | **Model:** claude-opus-5 |
| 4 | +- **Branch:** master sync worktree, delta relative to HEAD `02272e0a5d` |
| 5 | +- **Trigger:** Copilot finding on microsoft/SynapseML#2734, comment 4066689707 |
| 6 | + |
| 7 | +## Scope |
| 8 | + |
| 9 | +The three-file uncommitted follow-up only: |
| 10 | +`core/src/test/scala/com/microsoft/azure/synapse/ml/nbtest/FabricTestArtifactTracker.scala` |
| 11 | +(one catch clause), `.../FabricTestArtifactTrackerFailureTests.scala` (+33), and |
| 12 | +`docs/Reference/Developer Setup.md` (+2). No wider sync or history re-audit. |
| 13 | + |
| 14 | +## Verdict |
| 15 | + |
| 16 | +**ISSUES_FOUND — 1 Low.** The reported bug is genuinely fixed and the regression is a |
| 17 | +real one. The Low is the mirror-image information loss the narrowed catch introduces. |
| 18 | + |
| 19 | +## Priority matrix after the change |
| 20 | + |
| 21 | +"Excluded" means anything `NonFatal` rejects: interrupts, `VirtualMachineError`, |
| 22 | +`ThreadDeath`, `LinkageError`, `ControlThrowable`. |
| 23 | + |
| 24 | +| body outcome | cleanup outcome | result | |
| 25 | +| --- | --- | --- | |
| 26 | +| success | success | body value returned | |
| 27 | +| success | NonFatal | cleanup error thrown | |
| 28 | +| success | excluded | cleanup throwable thrown | |
| 29 | +| any failure | NonFatal | body error thrown, cleanup attached as suppressed | |
| 30 | +| any failure | excluded | cleanup throwable thrown, **body error discarded** | |
| 31 | + |
| 32 | +The last row is correct on priority — the interrupt or fatal now wins, which is the |
| 33 | +point of the fix — but the body error is not merely deprioritised. Because the throw |
| 34 | +leaves a `finally`, the in-flight body exception is replaced outright: it is neither |
| 35 | +rethrown nor attached, so nothing records it. |
| 36 | + |
| 37 | +## L1 (Low) — body failure vanishes when cleanup throws an excluded throwable |
| 38 | + |
| 39 | +`withArtifact` still assigns `failure = Some(error)` in the body catch, but on the |
| 40 | +excluded-throwable path nothing reads it. The single production caller is |
| 41 | +`FabricNotebookTests.withTrackedArtifact`, where the body error is the notebook |
| 42 | +failure and the cleanup error is an artifact DELETE. A pipeline timeout that |
| 43 | +interrupts the DELETE after a notebook has already failed therefore surfaces only |
| 44 | +the `InterruptedException`, and the notebook failure that triggered triage is gone. |
| 45 | + |
| 46 | +This is the same class of defect the earlier rounds of this work fixed, and the |
| 47 | +repository already has the idiom for it: rethrow the winner with the loser attached |
| 48 | +under an `ne` guard, exactly as `FabricArtifactCleanup.run` and this method's own |
| 49 | +`NonFatal` branch do. A second catch clause preserves the new priority while keeping |
| 50 | +the body error visible, and the 15-case regression asserts only |
| 51 | +`thrown eq cleanupFailure`, so it would stay green: |
| 52 | + |
| 53 | +```scala |
| 54 | +case cleanupError: Throwable => |
| 55 | + failure.filterNot(_ eq cleanupError).foreach(cleanupError.addSuppressed) |
| 56 | + throw cleanupError |
| 57 | +``` |
| 58 | + |
| 59 | +If this is instead accepted as a deliberate trade-off, the new documentation sentence |
| 60 | +should say so, because "never suppresses an interrupt or fatal error behind a notebook |
| 61 | +failure" does not tell a reader that the notebook failure is then dropped. |
| 62 | + |
| 63 | +## Verified correct |
| 64 | + |
| 65 | +- The narrowed catch is the only production edit. `NonFatal` was already imported and |
| 66 | + used by `cleanup()`, so no import churn and no unused symbol. |
| 67 | +- Identity is exact in all 15 combinations: `assert(thrown eq cleanupFailure)` pins the |
| 68 | + same instance rather than the type, which is what the red log disproved. |
| 69 | +- The `original ne cleanupError` self-suppression guard on the `NonFatal` path is |
| 70 | + untouched, so a shared instance is still never suppressed into itself. |
| 71 | +- Tracking and retry: `artifactIds.remove` sits after `deleteTrackedArtifact`, so any |
| 72 | + throwing cleanup leaves the id tracked. The test proves the retry precisely — |
| 73 | + `attempts == 1` after `withArtifact`, `2` after the first `cleanup()`, and `2` again |
| 74 | + after a second `cleanup()`, so the deque drains and nothing is deleted twice. |
| 75 | +- `deleteTrackedArtifact` still treats `PowerBIEntityNotFound` as success, so a |
| 76 | + concurrently deleted artifact is untracked rather than retried. |
| 77 | +- Body fatals are still recorded and rethrown by `case error: Throwable`, so a fatal |
| 78 | + body error keeps priority over a `NonFatal` cleanup error. |
| 79 | +- Both documentation sentences are accurate: cleanup no longer hides an interrupt or |
| 80 | + fatal, and an unsuccessful per-job deletion does stay tracked. |
| 81 | + |
| 82 | +## Evidence |
| 83 | + |
| 84 | +- `master-fatal-cleanup-red.log`: the new test alone, 1 run, 0 succeeded, 1 failed, |
| 85 | + with `IllegalStateException: job failed was not the same instance as |
| 86 | + java.lang.InterruptedException: cleanup interrupted`. A true red on old behaviour. |
| 87 | +- `master-fatal-cleanup-green.log`: `core/compile`, `core/Test/compile`, main and test |
| 88 | + scalastyle each `Found 0 errors`, and 47 of 47 tests passing across |
| 89 | + `FabricTestArtifactTrackerSuite` and `FabricArtifactNamesSuite`, with the new case |
| 90 | + listed by name. 47 is the expected 46 plus one. |
| 91 | +- `FabricTestArtifactTrackerFailureTests.scala` is 76 lines and |
| 92 | + `FabricTestArtifactTrackerSuite.scala` is unchanged at 790. |
| 93 | + |
| 94 | +## Non-blocking |
| 95 | + |
| 96 | +Tracking the same artifact id through `withArtifact` twice would leave a duplicate in |
| 97 | +the deque, since `ConcurrentLinkedDeque.remove` drops one occurrence. That predates |
| 98 | +this delta and is unaffected by it; noted only because retry behaviour was in scope. |
| 99 | + |
| 100 | +## Coverage limitations |
| 101 | + |
| 102 | +Round 1 and the parent's round 2 fallback were both GPT-family and found no concrete |
| 103 | +issues. No Gemini version has executed at any point in this task — every attempt has |
| 104 | +returned a backend HTTP 400 with zero execution — so the three-family review gate is |
| 105 | +**unfulfilled** and this is not a full-gauntlet green. This report covers round 3 only. |
| 106 | +Azure Pipelines and current-head GitHub review have not run against this delta, and the |
| 107 | +ports do not carry it yet, so no port proof is claimed. |
| 108 | + |
| 109 | +## L1 resolution |
| 110 | + |
| 111 | +The parent accepted L1. A separate excluded-throwable handler now attaches the |
| 112 | +earlier body error under an identity guard and immediately rethrows the cleanup |
| 113 | +throwable. This preserves fatal priority and diagnostics without wrapping it. |
| 114 | +The documentation states that attachment depends on throwable suppression support. |
| 115 | + |
| 116 | +The strengthened matrix failed before this handler was added: |
| 117 | +`master-fatal-cleanup-diagnostics-red.log` reports an empty suppressed list instead |
| 118 | +of the original `IllegalStateException`. The matrix now checks suppressed errors |
| 119 | +as well as identity. A fresh throwable probes suppression support independently, |
| 120 | +because `ControlThrowable` support differs across the supported Scala versions. |
| 121 | +A separate shared-instance interrupt case guards against self-suppression. |
| 122 | +Updated green validation and reviewer verification follow below. |
| 123 | + |
| 124 | +## Round 3 verification of the L1 resolution |
| 125 | + |
| 126 | +Verified against the current worktree; the original verdict and history above stand |
| 127 | +unchanged. **L1 is resolved. No new issue.** |
| 128 | + |
| 129 | +- **Catch order is safe.** `case NonFatal(cleanupError)` precedes |
| 130 | + `case cleanupError: Throwable`, so the broad clause cannot shadow the narrow one and |
| 131 | + only excluded throwables reach it. Reversing them would have silently restored the |
| 132 | + original bug. |
| 133 | +- **Priority is unchanged; only diagnostics changed.** The excluded path still ends in |
| 134 | + `throw cleanupError`, so the interrupt or fatal still wins and still replaces the body |
| 135 | + error as the propagating exception. The only difference is that the body error is now |
| 136 | + attached instead of vanishing, which is exactly the narrow repair L1 asked for. |
| 137 | +- **Identity guard is correct in both directions.** |
| 138 | + `failure.filterNot(_ eq cleanupError)` yields `None` both when the body succeeded and |
| 139 | + when the body threw the same instance, so `addSuppressed` is never called on self and |
| 140 | + cannot raise `IllegalArgumentException`. |
| 141 | +- **The probe cannot contaminate the assertion.** `newCleanupFailure()` builds a fresh |
| 142 | + instance, so `thrown.getSuppressed` is read from an object the probe never touched. |
| 143 | + Deriving `expectedSuppressed` from `jobFailure.toSeq` also keeps the body-success rows |
| 144 | + expecting an empty list, and the probe makes the matrix portable across the Scala |
| 145 | + versions that differ on `ControlThrowable` suppression rather than hard-coding either. |
| 146 | +- **The same-instance test is a real negative control.** Without the `filterNot` guard |
| 147 | + the tracker would call `addSuppressed` on self and fail with `IllegalArgumentException` |
| 148 | + rather than returning the shared `InterruptedException` with an empty suppressed list. |
| 149 | +- **Docs are accurate.** All three sentences hold: the cleanup throwable escapes, the |
| 150 | + earlier notebook failure is attached, and the qualifier "where that throwable permits |
| 151 | + suppression" honestly covers categories that disable suppression instead of |
| 152 | + over-promising. |
| 153 | +- **Evidence.** `master-fatal-cleanup-diagnostics-red.log` is a true red for the new |
| 154 | + assertion — `Array() did not equal List(java.lang.IllegalStateException: job failed)`, |
| 155 | + 1 run, 0 succeeded, 1 failed. `master-fatal-cleanup-green-v2.log` has completed: |
| 156 | + `core/compile`, `core/Test/compile`, main and test scalastyle each `Found 0 errors`, |
| 157 | + `Run completed`, and 48 of 48 tests passing across both suites, with both new cases |
| 158 | + listed by name. 48 is the expected 47 plus the same-instance test. The log carries no |
| 159 | + `[error]` line and no `*** FAILED ***`; its nine keyword hits are test names and the |
| 160 | + tracker's own expected `println` diagnostics. All three edited files were last written |
| 161 | + before that run, so the log describes this source. |
| 162 | + |
| 163 | +Round 3 verification only. No Gemini version has executed at any point in this task, so |
| 164 | +the three-family gate remains **unfulfilled** and this is not a full-gauntlet green. |
0 commit comments