Fix workflow-graph crashes and label layout in the Android client

Running the client on an emulator against a live server exposed real defects in the
workflow graph, all fixed here:

- DrawScope.drawText's string overload measured against the draw scope's constraints
  and threw when a node or edge label fell outside them (wide or panned graphs),
  crashing the pipeline-detail and run-detail screens. Both call sites now draw a
  pre-measured TextLayoutResult.
- The graph Canvas was not clipped, so panning drew nodes and edges over the
  'Versions' row and the 'Workflow graph' heading. The viewport now clips its
  children.
- Outcome labels overprinted when a stage had more than one outgoing edge ('error'
  over 'success'). Labels are now laid out in one row per source edge, with a
  backing rect for legibility.
- Stage columns followed an iterative rank relaxation, so graphs with a back edge
  rendered out of order (planner before reviewer). rankStages now returns
  declaration order, matching internal/tui/graph_layout.go.

Verified: :app:compileDebugKotlin, :app:assembleDebug and :app:testDebugUnitTest
succeed offline with 20 tests and 0 failures (new WorkflowGraphTest covers the
rank order and label slots), and the app was driven on the Pixel_Fold_API_36
emulator against the live server with no FATAL or Compose exception in logcat.
This commit is contained in:
2026-10-13 19:23:10 +01:00
parent 9a94eabaa3
commit 2881256af3
3 changed files with 108 additions and 38 deletions
+18 -6
View File
@@ -117,9 +117,21 @@ ui Compose Material 3 screens, one AppViewModel, navigation.
## Verification status
The project sources, protocol model and unit tests are present, but **no build,
lint, unit test or emulator run has been performed here**: this stage has no
command-execution tool, and no JDK/Gradle/Android SDK was discoverable in the
environment. The exact commands to run are listed above; run them on a machine
with the toolchain and capture the real results. Do not treat this file as
evidence of a successful build.
Verified on macOS with the host toolchain (JDK 17 from Android Studio,
`ANDROID_HOME=/Users/alan/Library/Android/sdk`, Gradle 8.11.1 `--offline`):
- `:app:compileDebugKotlin`, `:app:assembleDebug` and `:app:testDebugUnitTest`
all succeed; **20 unit tests, 0 failures** (protocol model, graph semantics,
server URL, workflow-graph layout). Re-run with `--rerun-tasks` to confirm.
- The debug APK was installed and driven on the `Pixel_Fold_API_36` emulator
(Android 16) against a live server at `ws://10.0.2.2:8080/connect` with
workspace `/Users/alan`. Settings, pipeline list (all 9 pipelines), pipeline
detail, the workflow graph, run history, run detail and the disconnected/
reconnect states were captured to `captures/` (git-ignored) and reviewed.
- `adb logcat` for the app package contained no `FATAL EXCEPTION`, Compose or
other runtime exception during the sweep.
Known limitations of that run: pinch-zoom could not be driven through `adb`
(single-touch pan only), one portrait Fold viewport was used, and the graph is
not fit-to-content on first layout (pan to reach later columns); a panned graph
can still draw an edge curve across a neighbouring outcome label.