Skip to content

Run monitor: show what a submitted job is doing - #9

Open
timurbazhirov wants to merge 1 commit into
mainfrom
feature/SOF-8023-run-monitor
Open

Run monitor: show what a submitted job is doing#9
timurbazhirov wants to merge 1 commit into
mainfrom
feature/SOF-8023-run-monitor

Conversation

@timurbazhirov

Copy link
Copy Markdown
Member

Summary

Phase 3.2 of the Job Designer UX update (SOF-8023, plan).

A submitted job disappeared. The designer stayed on the editing view, and the only way to learn whether anything was happening was to reload and read a status string. Every unit already carries a statusTrack of { status, trackedAt } — nothing read it.

Needs a @mat3ra/cove release carrying LogViewer, MetricTile and SegmentedMeter (mat3ra/cove#97). Merge order is cove → this.

What's here

  • src/runMonitor.ts — pure derivation: per-unit rows (status, start, duration) and a run summary. 25 unit tests.
  • RunMonitor — a MetricTile strip over a progress meter, one row per unit with its status chip and duration, and a log tail.
  • ResultsTab gains showRunMonitor, opt-in like the rest of the guided designer. It settles rather than switching: when the last unit reaches a terminal status the same rows become the record of the run, so the reader isn't moved elsewhere at the moment they most want to look.

Four judgements worth a reviewer's attention

  • A failed run is not 100% complete. progressPercent counts finished units only. Showing 100% beside a red unit would be the wrong kind of reassuring.
  • A queued unit has not started. "Started" is the first non-idle track entry, so a unit waiting in the queue doesn't report a duration for work it hasn't done.
  • A retried unit is timed from its current attempt. Units keep the failed attempt's track too; timing from the original start would report a duration spanning the failure.
  • now is a prop, not Date.now(). A component reading the clock itself would report a different elapsed time on every unrelated re-render — and would be untestable.

Verification

npm test green (25 tests), tsc clean, eslint clean, prettier clean.

The demo runs a simulated job — units starting in order, the log growing with them — so the monitor can be reviewed before the webapp feeds the real thing through the same props. Measured in it:

early 20s later
units 0/5 finished, 1 running 1/5 finished, 1 running
first unit 4s so far · Running 12s · Finished
elapsed 4s 22s
meter 20%

That simulation immediately caught a bug worth calling out: isRunning tested the start time for truthiness, so a unit starting at timestamp 0 reported itself as pending while visibly running. Real timestamps are never 0, so this would have survived into production and only misbehaved in tests and demos. Fixed, with a test that pins it.

Also in here

A pre-existing prettier violation in UnitResult.tsx that had npm run lint failing on main before any of this.

Still open

The webapp data adapter, which the plan expected to be half of this item. Nothing publishes a log tail yet; getJobLogTail is read from setDependencies(), and without it the monitor says the deployment provides no log feed rather than showing an empty box that reads as a silent job. Unit status tracks come from the job document and need no new endpoint.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DK8KomMescJvMQNSEfeRR8


Generated by Claude Code

A submitted job disappeared. The designer stayed on the editing view,
and the only way to learn whether anything was happening was to reload
and read a status string. Every unit already carries a `statusTrack`;
nothing read it.

- `src/runMonitor.ts` — pure derivation: per-unit rows (status, start,
  duration) and a run summary. 25 unit tests.
- `RunMonitor` — a MetricTile strip over a progress meter, one row per
  unit with its status chip and duration, and a log tail.
- `ResultsTab` gains `showRunMonitor`, opt-in like the rest of the
  guided designer. It settles rather than switching: when the last unit
  reaches a terminal status the same rows become the record of the run,
  so the reader is not moved elsewhere at the moment they most want to
  look.

Judgements worth review:

- **A failed run is not 100% complete.** `progressPercent` counts
  finished units only; showing 100% beside a red unit would be the
  wrong kind of reassuring.
- **A queued unit has not started.** "Started" is the first non-idle
  entry, so a unit waiting in the queue does not report a duration for
  work it has not done.
- **A retried unit is timed from its current attempt.** Units keep the
  failed attempt's track too; timing from the original start would
  report a duration spanning the failure.
- **`now` is a prop.** A component reading the clock itself would report
  a different elapsed time on every unrelated re-render.

The demo runs a simulated job — units starting in order, the log growing
with them — so the monitor can be reviewed before the webapp feeds the
real thing through the same props. That simulation immediately caught a
bug: `isRunning` tested the start time for truthiness, so a unit
starting at timestamp 0 reported itself as pending while visibly
running. Fixed and covered.

Also fixes a pre-existing prettier violation in UnitResult.tsx that had
`npm run lint` failing before any of this.

Needs a @mat3ra/cove release carrying LogViewer, MetricTile and
SegmentedMeter.

Refs SOF-8023.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DK8KomMescJvMQNSEfeRR8

Copy link
Copy Markdown
Member Author

run-js-tests is red, and will stay red until mat3ra/cove#97 merges and publishes. Flagging it so nobody looks for a defect that isn't there.

The whole failure is tsc resolving four imports against the published cove (2026.7.18-4), which predates the primitives this PR uses:

src/components/RunMonitor.tsx(1,23): error TS2307: Cannot find module
  '@mat3ra/cove/dist/mui/components/log-viewer/LogViewer'
src/components/RunMonitor.tsx(2,24): … '@mat3ra/cove/dist/mui/components/metric/MetricTile'
src/components/RunMonitor.tsx(3,28): … '@mat3ra/cove/dist/mui/components/metric/SegmentedMeter'
src/components/RunMonitor.tsx(4,31): … '@mat3ra/cove/dist/mui/components/status/StatusChip'

Note the fourth: StatusChip shipped in cove#97 as part of phase 1.5, so this PR is blocked on that release regardless of the two primitives added for phase 3.2. There are no other errors — Test never ran because Build exits first.

I'm deliberately not working around it. An ambient module declaration would shadow cove's real types once it does publish, and vendoring the primitives here would duplicate what cove#97 exists to own. Against a local cove build the typecheck is clean, all 25 tests pass, eslint and prettier are clean, and the behaviour in the PR description was measured in the running demo.

Sequence: merge and publish cove#97, bump the pin here, re-run. mat3ra/ive#6 is blocked on exactly the same thing.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants