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

A maintenance finding shows its age and who last touched it, and the oldest one leads #16079

Merged opened this

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

Merged

Each finding on the board now shows its age ("opened 3 d ago") and the findings list oldest first. I did not add "who last touched it". degradedspan doesn't record a person, so there was nothing true to show.

Notes

shipped production is serving it deploy 3fede26

opened this

Each finding on the board now shows its age ("opened 3 d ago") and the findings list oldest first. I did not add "who last touched it". degraded_span doesn't record a person, so there was nothing true to show. If you want it, the table needs a new column first.

The focused tests pass (39 across the maintenance and findings files) and tsc is clean. I did not run the full suite, so the forge's check will be the first full run. bun scripts/design-lint.ts is clean.

What changed

  • Age on the row: src/maintenance/findings.ts has a new openedWords(openedAt, now). The clock is passed in, so tests are deterministic. A row reads disk-free: … (opened 3 d ago; seen 3 days; still open) on /maintenance and in the terminal.
  • What "opened" means: it is when the cause was first seen in the history kept, not when its latest span opened.
  • JSON: each /maintenance.json finding carries openedAt as an ISO string.
  • Order: the newest 20 causes are still the ones listed, and the list is then sorted oldest first. This keeps the existing "older causes, not listed" line true. The same sort applies on the web, in the terminal and in the JSON.
  • Which file: the issue named src/maintenance/page.ts, but that is the standby page. The board is built in src/web/pages/maintenance.ts, so I changed that instead.

Tests

  • New test/maintenance-finding-age.test.ts covers the age wording and the oldest-first order in the rows, terminal and JSON. It fails without the change.
  • I edited two existing tests because the change alters what they assert: test/maintenance-findings.test.ts (rows and terminal line gain openedAt and the age) and test/maintenance-json.test.ts (findings now list oldest first and carry openedAt).

The pre-push hook refused the push until a commit with a Try: line existed, so there is an empty Try: commit at the end.

To try it: open /maintenance as admin and read the Findings fold, or curl /maintenance.json.

🤖 Generated with Claude Code

Closes #16048

Show 7 earlier items

7 earlier comments · 1 event
commented

Each finding row on /maintenance and in the terminal now shows its age, and the longest-standing finding leads. /maintenance.json carries openedAt for each finding. Issue #16048 asked for the first three of those. I did not add "who last touched it", so the pull title overstates it. The gate, tsc and the maintenance tests (13) pass.

  • Row wording: a row now reads opened 3 d ago; still open. I dropped the old "seen N days" text, since it repeated the age. Under a minute it reads opened just now, not "0 m ago". I kept "d", "m" and "h" because issue #16048 specifies "opened 3 d ago". The board and the terminal build the line through one function, rowWords.
  • Page test: findingsFold in src/web/pages/maintenance.ts is now exported. test/maintenance-finding-age.test.ts renders it with an injected clock and checks the age text and the oldest-first order. test/maintenance-page.test.ts checks the real page for opened 3 d ago. Reverting the page change now fails both. The existing tests that expected "seen N days" now expect the age instead.
  • How-to: docs/features/maintenance-findings.md now covers the age, the oldest-first order, and openedAt in the JSON. The terminal change is documented there.
  • Pipeline question: I can't say which pipeline issue this serves. It is a small feature from #16048, which is labelled P13 Maintainers and has no pipeline dependency. If it should wait behind #6534 and the others, hold the merge. I did not open a split-off issue.
  • "Who last touched it": I did not build this. degraded_span has no person column, so it needs a schema change. It should be its own issue, and the pull description should drop it.

The gate also printed an advisory that openedWords resembles ageWords in src/snapshot/bucket.ts. I left them separate, because that one formats snapshot bucket ages and this one has a different format, including the "just now" case.

To try it, open /maintenance as an admin and expand Findings.

🤖 Generated with Claude Code

commented

I merged main into the branch, resolved the three conflicts and pushed. tsc --noEmit is clean. The two finding test files pass (7 tests): test/maintenance-findings.test.ts and test/maintenance-autoclose.test.ts. I didn't run the rest of the suite, so the forge's full check on this push is the first run of it.

  • src/maintenance/findings.ts:
    • FindingRow now carries both openedAt from this pull and autoClosedAt from main. The query selects swept_at and the first-seen time.
    • rowWords(r, now) is the one place that words a row: opened 3 d ago, then ; closed <date>: no action in 14 days for an auto-closed finding, or ; still open for an open one.
    • Rows still list oldest first, and the auto-closed count from main is kept.
  • src/web/pages/maintenance.ts: the fold uses rowWords and keeps main's auto-closed count and its Reopen button. findingsFold still takes now.
  • test/maintenance-findings.test.ts: I dropped the seenWords assertions, since main's seenWords is gone and rowWords words age now. The row expectations also gain autoClosedAt: null.

I didn't check bun scripts/gate.ts --fix: it timed out at 120s and left no output for me to read, and I didn't rerun it. The part of its output I could see only flagged reopenFinding as similar to nameHeld in src/billing/orders.ts, a note about code main already had. main also brought in the TUI's use of autoClosedCauses, which I didn't touch.

commented

<!-- look-pages 1134015bf014 --> Look pages for 1134015, from the gate:

  • look pages (inferred): this pull changes src/web/pages/maintenance.ts; the forge pictures /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

A maintenance finding now shows its age (opened 3 d ago), and the oldest-standing finding leads the Findings fold, the terminal and /maintenance.json. The merge with main is resolved, and main's auto-close and Reopen are kept.

  • The failing check: two of the three tests that failed were in test/maintenance-finding-age.test.ts. That test creates its own degraded_span table without the swept_at and clock_at columns the merged query reads. I added both columns to the test's schema; that was the only change. The test file and test/maintenance-findings.test.ts pass, as does test/maintenance-autoclose.test.ts (10 tests), and tsc --noEmit is clean.
  • The browser test: I didn't touch the third failure, "in a browser: stranger, sign in page, Sign up, Create account…". It is a sign-in flow that never reaches /maintenance, and it took 21 s in the log, which looks like a timeout. I didn't run it. If it fails again on this push, it needs a separate look.
  • The look-pages note: I read it as informational, since the gate already infers /maintenance from the change. I added a Looks: src/web/pages/maintenance.ts line to the commit message so the picture is explicit.
  • What I left alone: the bun scripts/gate.ts --fix note that reopenFinding resembles nameHeld in src/billing/orders.ts. That code is main's and not part of this change. I also didn't run bun scripts/gate.ts --fix this round.

Try it: open /maintenance and read the Findings fold. Each row ends with its age, and a still-open finding adds ; still open. An auto-closed finding adds ; closed <date>: no action in 14 days and keeps its Reopen button. /maintenance.json gives each finding an openedAt time.

commented

<!-- look-pages 0e7d08d0ee2d --> Look pages for 0e7d08d, from the gate:

  • look pages (inferred): this pull changes src/web/pages/maintenance.ts; the forge pictures /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
Changes requested — before the latest push

Changes needed, in one round:

  1. Direction: the owner put the pipeline first (#6534, #6611, #5276, #3316, #6217, #6428, #1242, #1073) before any feature. This is a feature pull for a P13 issue; name the pipeline issue it serves or hold it behind them.
  2. Dead code: days on FindingRow and the COUNT(DISTINCT ...) AS days in the query are no longer read by the page, terminal or JSON now that seenWords is gone. Remove them (and the matching test fields).
  3. Docs: the two long lines in docs/features/maintenance-findings.md are not wrapped like the rest; rewrap them.
  4. Semantics: openedAt is MIN(opened_at) over kept spans, so a cause that cleared and re-opened shows the age of its first span beside "still open". Say in the how-to that age counts from the first kept span (it does), or count from the current open stretch; pick one and test the re-open case.
  5. The pull title still promises "who last touched it", which is not built. Fix the description and open a separate issue for it. The age words, oldest-first order and openedAt JSON work and are tested.
commented

Every finding row now shows how old it is ("opened 3 d ago"), and the oldest finding is listed first. That holds on the /maintenance board, in the terminal's Maintenance screen and in /maintenance.json, which now gives each finding an openedAt time. This pull does not show who last touched a finding, so the title promises more than it delivers. That part is now its own issue, #16187. Nothing records who acted on a finding today, so it needs a database change.

This round of review fixes, in src/maintenance/findings.ts, the docs and the tests:

  • Unused day count removed: the days field on FindingRow and the day count in the query had no reader once the age words replaced the "seen N days" words. Both are gone, along with the matching test fields and a stale comment in src/web/pages/maintenance.ts.
  • Re-opened findings: age counts from the first kept span of a cause. A cause that cleared and opened again shows its first kept span's age next to "still open". docs/features/maintenance-findings.md now says so, and a new test in test/maintenance-finding-age.test.ts checks it in the rows, the terminal and the JSON.
  • Docs: the long lines in docs/features/maintenance-findings.md are rewrapped to the file's width.

Not done:

  • Which pipeline issue this serves: #16048 is a P13 Maintainers issue. Atlas filed it as a one-pull task with no dependencies, and it was assigned to me. It doesn't serve any of the pipeline issues named in the review. If those should come first, the owner can hold this pull; I didn't reorder the plan.
  • Shared age helper: the gate says openedWords looks like ageWords in src/snapshot/bucket.ts. I kept them separate because their units and cut-offs differ ("m" vs "min", days from 24 h vs from 48 h), so sharing one would change what one of those pages shows.

The type check, the design lint and the 84 tests in test/maintenance-*.test.ts pass.

To try it: open /maintenance as an admin (/maintenance.json for the JSON) on https://lab--16079--forge-trevato-apps.open-platform.sh.

[{"go":"/maintenance","look":"Findings fold","expect":"each row ends with \"opened N m/h/d ago\" and, while open, \"; still open\"; the oldest finding is first"},
 {"go":"/maintenance.json","look":"findings[].openedAt","expect":"an ISO time on every finding, oldest first"}]

🤖 Generated with Claude Code

commented

<!-- look-pages c4f0b22e7c95 --> Look pages for c4f0b22, from the gate:

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

The look-pages comment lists the page the gate will review, /maintenance; it doesn't report a fault. The review block below already covers /maintenance and /maintenance.json. Nothing in the code needed to change, so this round has no new commit. On the preview, / answers 200. /maintenance and /maintenance.json redirect with a 303 when called without an admin session, which is how admin-only pages are meant to behave.

---

Each maintenance finding now shows how old it is ("opened 3 d ago"), and the oldest finding is listed first. This holds on the /maintenance board, on the terminal's Maintenance screen and in /maintenance.json, which now gives each finding an openedAt time. This pull does not show who last touched a finding, so the title promises more than it delivers. Nothing records who acted on a finding today, so that needs a database change; it is now its own issue, #16187.

What changed

  • Age wording: src/maintenance/findings.ts gains openedWords(openedAt, now). The clock is passed in, so tests get the same answer every run.
  • Where age counts from: the first kept span of a cause. A cause that cleared and opened again shows that first span's age next to "still open". docs/features/maintenance-findings.md says so.
  • Order: the newest 20 causes are still the ones listed, now sorted oldest first, so the "older causes, not listed" line stays true.
  • Removed: the days field on FindingRow and the day count in the query. Nothing read them once the age words replaced "seen N days".
  • Which file: the issue names src/maintenance/page.ts, but that is the standby page. The board itself is built in src/web/pages/maintenance.ts, so that is the file changed.

Tests

  • New test/maintenance-finding-age.test.ts checks the age wording, the oldest-first order and the re-opened case in the rows, the terminal and the JSON.
  • Two existing tests changed because what they check changed: test/maintenance-findings.test.ts (rows gain openedAt and the age) and test/maintenance-json.test.ts (findings are oldest first and carry openedAt).

Not done

  • Shared age helper: openedWords stays separate from ageWords in src/snapshot/bucket.ts. Their units and cut-offs differ ("m" vs "min", and days start at 24 h vs 48 h), so merging them would change what one of those pages shows.

The type check, the design lint and the 84 tests in test/maintenance-*.test.ts pass.

To try it, open /maintenance as an admin, or /maintenance.json for the JSON, on https://lab--16079--forge-trevato-apps.open-platform.sh.

[{"go":"/maintenance","look":"Findings fold","expect":"each row ends with \"opened N m/h/d ago\" and, while open, \"; still open\"; the oldest finding is first"},
 {"go":"/maintenance.json","look":"findings[].openedAt","expect":"an ISO time on every finding, oldest first"}]

🤖 Generated with Claude Code

Closes #16048

Approved

Earlier asks, against the diff since 2698501: dead days field and query count removed (met); docs rewrapped (met); re-open semantics stated in the how-to and tested in the rows, terminal and JSON (met); "who last touched it" split to #16187 and the box list does not ask for it (met). Pipeline direction: the pull names no pipeline issue it serves; it is small and single-purpose, so I do not block on it, but a person may want to hold the merge behind the pipeline list. Design: the row reuses statusRow and the muted span, no new component, no new accent, works with JavaScript off. The terminal reads the same findingLines, so both doors agree. Next, non-blocking: (1) fold openedWords and ageWords in src/snapshot/bucket.ts once the two pages can agree on wording; (2) add the last-actor column in #16187.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs