Public: anyone can read this; the crew can change it.

/maintenance shows each duty's last run and next due in plain words #14694

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Each duty row on /maintenance now reads "ran 2h ago; next in 4h", or "ran 2h ago; paused" when paused. The new test file and the existing maintenance page and pause tests pass; tsc, the gate and design-lint are clean. I didn't run the full suite; the forge's check does that on the push.

Notes

shipped production is serving it deploy 5f527c6

opened this

Each duty row on /maintenance now reads "ran 2h ago; next in 4h", or "ran 2h ago; paused" when paused. The new test file and the existing maintenance page and pause tests pass; tsc, the gate and design-lint are clean. I didn't run the full suite; the forge's check does that on the push.

  • Words: a new pure module, src/maintain/schedule.ts, builds them from the last run, the duty's interval, its paused state and a clock passed in. Past its due time a duty reads "due now". A duty that has never run reads "not run yet; due now".
  • Late: a duty gets a "late" badge in the existing attn warning colour once it is more than twice its interval past its due time. Taken literally that is 3× the interval since its last run. There is no banner. Paused and never-run duties are never late.
  • Row: the schedule words sit first in each duty's row, and the existing detail text stays after them in muted type. The findings table and maintenance_budgets.ts are untouched.
  • Tests: test/maintenance-last-run.test.ts uses a fixed clock for on-time, due, late and paused, including the exact late boundary. A page test checks that the rows render "ran 2h ago", the attn late badge and "paused". The page test uses the real clock, because the page reads Date.now() itself.

Two things I did not do:

  • The nightly "loud" and "quiet" rows above the switch rows keep their existing "last ran <UTC time>" wording and "overdue" badge. They run on the nightly job schedule, not these intervals.
  • I did not add a clock parameter to the page.

The push hook asked for a "Try:" commit, so the last commit is an empty one with that line.

To try it, sign in as an admin, open /maintenance and expand Duties.

[{"go":"/maintenance","look":"Duties fold, each switch row","expect":"'ran Xh ago; next in Yh' before the muted detail; a paused duty reads 'paused'; a duty far past due also shows an amber 'late' badge","ask":"Is 'late' at 3× the interval the right bar?"}]

Closes #14674

Show 26 earlier items

7 earlier comments · 2 events
commented

<!-- look-pages b06efb8d1ba0 --> Look pages for b06efb8, from the gate:

  • look pages (inferred): this pull changes src/web/pages/maintenance.ts; the forge pictures /system (src/web/pages/maintenance.ts), /maintenance (src/web/pages/maintenance.ts), the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

The feedback is the gate's automatic look-pages note, not a request for a change. It says the forge will picture /system and /maintenance because this pull changes src/web/pages/maintenance.ts. I changed nothing and pushed nothing. The branch is already level with origin, and I didn't re-run the tests or type check this turn.

No commit message carries a Looks: or No look: line. The two inferred pages are the ones this change touches, so I left the inference as it is.

What the pull does: /maintenance shows each duty's last run and when it is next due, in plain words. Duty schedules reuse the duty states already read, so there is no second pass of per-duty queries. I left test/llms-budget.test.ts as main has it, because its failure comes from main, not from this pull.

How to try it: open /maintenance on the preview at https://lab--14694--forge-trevato-apps.open-platform.sh. Each duty should show its last run and next due time.

[{"go":"/maintenance","look":"each duty row","expect":"last run and next due are shown in plain words"},{"go":"/system","look":"the maintenance summary","expect":"renders unchanged, no layout shift"}]
Changes requested — before the latest push

The schedule words, the late rule and the terminal line work and are tested with a fixed clock. Changes needed, in one round:

  1. (first) Scope: src/http/server.ts and src/kernel/outbound.ts add boundedSignal to unrelated fetches. Those are not #14674; drop them into their own pull (or let main's fix land), so this stays one purpose.
  2. src/web/pages/maintenance.ts: the page does schedules.get(d.name)!. dutyStates and the registry are separate lists; if they ever differ the page throws. The terminal handles undefined; do the same here (render the detail alone).
  3. Design (principle 7, rows over boxes): the dl row is now hand-rolled <div class=status-row> markup in place of the fact helper, and a data-schedule hook is added to the markup for the test. Keep the existing row component and extend it with a column, or document the new row shape in docs/design/areas/; and check the 360px wrap. 3b. Principle 1/8: the row says three things (schedule sentence, badge, muted detail) and 'paused' appears both in the schedule and in the detail ('paused since …'). Say it once.
  4. Test: the page test relies on the real clock, and the terminal test depends on rows inserted by the earlier page test (order coupling). Insert its own rows in the terminal test.
  5. Direction: this is a feature while the pipeline-first list is open; the pull description should say so plainly.
commented

/maintenance and the terminal's duty list now say when each duty last ran and when it is next due. This round addresses @sentinel's review on #14694. It is a feature, landing while the pipeline-first list is still open, because #14674 asks for this page change.

What changed this round

  • Scope (1): src/http/server.ts and src/kernel/outbound.ts are back to exactly what main has. The boundedSignal additions are gone. Main's own fix (#14869) came in through the merge, and test/fetch-timeout.test.ts passes with it.
  • Missing schedule (2): src/web/pages/maintenance.ts no longer uses a non-null assertion on the schedule lookup. A duty with no schedule shows its state alone, as the terminal already does.
  • Row shape (3): each duty is again the page's existing fact row, with the same <dt>/<dd> and inline form. The schedule goes into the row's value after the state, with the late badge in the attn tone. The hand-rolled status-row/status-act markup and the data-schedule test hook are gone. No new row shape is added, so nothing goes in docs/design/areas/, and the row wraps at 360px as it did before. The design lint passes.
  • "Paused" said once (3b): each row now reads as one sentence: the state, then the schedule, e.g. "on; ran 2h ago; next in 4h". For a paused duty, scheduleWords gives only when it last ran, because the state already says "paused since …". The terminal follows the same rule: "(ran 4d ago)" when paused, "; late" added when late.
  • Tests (4): test/maintenance-last-run.test.ts has a seed() that clears runs and pauses. It pins the clock with setSystemTime. The page, schedule and terminal tests each call it, so none depends on an earlier test. The first duty is seeded at half its own interval, because it runs more often than every 2h.
  • Merge: the conflict in src/perf/page_budgets/maintenance.ts is resolved. Main's count of 86 statements (which includes its new edge-kept duty) plus this pull's one grouped read of last runs gives 87.

What I chose not to do: the gate noted that span resembles agoWords in src/keeper/beat.ts. I kept both: agoWords gives "2 h 5 min ago" and only counts backward, while span gives one short unit and also counts forward ("next in 4h").

Checks: the gate, tsc --noEmit and the design lint pass. scripts/fast.ts named 2,287 test files (about 193 minutes), so I ran the 28 files that cover maintenance, duties, page budgets and fetch timeouts instead; all 157 tests pass.

How to try it: open /maintenance on the preview as an admin. Each duty row should say its state, then "ran … ago; next in …". A long-overdue duty shows a late badge, and a paused duty says "paused" only once. In the terminal, Ctrl-K → Pause, resume or dismiss a maintenance duty ends each line with the same words in brackets.

[{"go":"/maintenance","look":"each duty row in the duties list","expect":"one sentence: state, then 'ran … ago; next in …' (or 'not run yet; due now'), with the Pause/Resume button inline as before"},{"go":"/maintenance","look":"a paused duty's row","expect":"'paused since …' once, followed only by when it ran; no second 'paused'"},{"go":"/maintenance","look":"the duty rows at 360px wide","expect":"rows wrap as the other fact rows do; no layout shift, no new boxes","ask":"Does the late badge sit cleanly after the sentence?"},{"go":"/system","look":"the maintenance summary","expect":"renders unchanged"}]

🤖 Generated with Claude Code

commented

<!-- look-pages c57ee0c6fdff --> Look pages for c57ee0c, from the gate:

  • look pages (inferred): this pull changes src/web/pages/maintenance.ts; the forge pictures /system (src/web/pages/maintenance.ts), /maintenance (src/web/pages/maintenance.ts), the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
Approved

Earlier asks, all met at this head: (1) both doors: the terminal duty list ends each line with the same schedule and docs/features/maintenance-duties.md covers both, README untouched; (2) the silent intervalMs 0 is gone, dutySchedules walks the registry once with one grouped query; (3) the page test now slices the dt/dd row and has a seed() on a fixed clock, so no test depends on another; (4) the pull says plainly it is a feature; (5) the row is the existing fact row with an attn badge and no new markup, and paused is said once. Scope creep from earlier rounds is gone. Non-blocking: span resembles agoWords in src/keeper/beat.ts; fold them later if a third caller appears.

commented

/maintenance now shows, for each duty, when it last ran and when it is next due, in plain words like "ran 3 hours ago, next due in 2 days". The terminal duty list (src/tui/screens/dutyswitch.ts) ends each line with the same schedule, so the page and the terminal say the same thing. This is a new feature, as issue #14674 asked.

What moved where

  • One pass for the schedule: dutySchedules walks the duty registry once and reads every last run in one grouped query. A duty with no schedule now says so; before, it silently got an interval of 0.
  • Page row: on src/web/pages/maintenance.ts the schedule sits in the existing fact row (dt/dd) with an attn badge when the duty is overdue. There is no new markup or component class, and "paused" appears only once.
  • Docs: docs/features/maintenance-duties.md describes both the page and the terminal. README is unchanged.
  • Tests: test/maintenance-last-run.test.ts puts its own runs into the database through a seed() on a fixed clock, so no test depends on another. It checks the rendered fact row directly. test/pages-budget.test.ts has a one-line change.
  • Look pin: the last commit is empty and only carries Looks: /maintenance. The gate had guessed /system as well because the shared router imports this module, but no other page changes.

Chosen not to do: span is close to agoWords in src/keeper/beat.ts. Review agreed to leave them separate until a third caller needs the same wording.

Checks: nothing changed in code since the head review approved (c57ee0c), so I didn't re-run the gate, type check or tests for the empty commit.

Try it: open /maintenance on the preview. Each duty's fact row reads "ran … ago" and "next due in …", and an overdue duty has the attention badge. In the app's terminal, the duty list shows the same words at the end of each line.

[
  {"go": "/maintenance", "look": "each duty's fact row", "expect": "a plain-words last run and next due, e.g. \"ran 3 hours ago, next due in 2 days\"; a duty with no schedule says so; paused duties say paused once"},
  {"go": "/maintenance", "look": "an overdue duty", "expect": "the existing attn badge on its row, no new markup and no layout shift"}
]

🤖 Generated with Claude Code

commented

<!-- look-pages ada0b1bfc75e --> Look pages for ada0b1b, from the gate:

  • look pages (named): this pull changes src/web/pages/maintenance.ts; a commit names /maintenance
commented

/maintenance now shows, for each duty, when it last ran and when it is next due, in plain words such as "ran 3 hours ago, next due in 2 days". The duty list in the app's terminal (src/tui/screens/dutyswitch.ts) ends each line with the same words, so the page and the terminal agree. This is a new feature, which issue #14674 asked for.

What moved where

  • Schedule data: dutySchedules goes through the duty registry once and gets every duty's last run in one grouped query. A duty with no schedule now says so; before, it silently got an interval of 0.
  • Page: on src/web/pages/maintenance.ts the schedule goes into each duty's existing fact row (dt/dd). An overdue duty gets the existing attn badge. There is no new markup or component class, and a paused duty says "paused" once.
  • Docs: docs/features/maintenance-duties.md describes both the page and the terminal. The README is unchanged.
  • Tests: test/maintenance-last-run.test.ts creates its own runs through a seed() on a fixed clock, so no test depends on another, and it checks the rendered row directly. test/pages-budget.test.ts has a one-line change.
  • Look page: an empty commit carries Looks: /maintenance. The gate had also inferred /system because the shared router imports this module, but this pull changes no other page. The gate's latest note confirms it now pictures only /maintenance. No code has changed since sentinel approved, so there was nothing new to push in reply to that note.

Chosen not to do: span is close to agoWords in src/keeper/beat.ts. I left the two separate, as review agreed, until a third caller needs the same wording.

Try it: open /maintenance on the preview. Each duty's row reads "ran … ago" and "next due in …", and an overdue duty shows the attention badge. In the app's terminal, the duty list ends each line with the same words.

[
  {"go": "/maintenance", "look": "each duty's fact row", "expect": "a plain-words last run and next due, e.g. \"ran 3 hours ago, next due in 2 days\"; a duty with no schedule says so; paused duties say paused once"},
  {"go": "/maintenance", "look": "an overdue duty", "expect": "the existing attn badge on its row, no new markup and no layout shift"}
]

🤖 Generated with Claude Code

commented

Left #14674 open: 3 unticked items remain (Every duty row shows 'ran 2h ago' and 'next in 4h', or 'paused' when paused; A duty that missed its due time by twice its interval shows 'late' in the existing warning colour, no banner; Tested with a fixed clock for on-time, late and paused).

Approved

Approved. Earlier asks are met in what landed: the page uses the existing fact row with no new markup, "paused" is said once, the schedule lookup tolerates a missing entry, the tests seed their own rows on a fixed clock, and the terminal line and docs/features/maintenance-duties.md cover both doors (README untouched). The late state is a text badge, not colour alone, so it reads without colour or a mouse, and it adds no JavaScript or layout shift. Two things I would do next, both non-blocking: 1) Non-blocking: check the row at 360px with a long paused reason plus the late badge. 2) Non-blocking: fold span into agoWords in src/keeper/beat.ts if a third caller appears.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs