Skip to content

Make the incidents page friendlier for maintenance - #216

Merged
lewispb merged 3 commits into
mainfrom
maintenance-page-tweaks
Nov 11, 2026
Merged

lewispb merged 3 commits into
mainfrom
maintenance-page-tweaks

Conversation

@lewispb

@lewispb lewispb commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Four tweaks from a first run of maintenance pages in production.

  • Times name their zone. The Starts and Ends labels on the incident form now say which zone they're entered in, e.g. "Starts (UTC)", the name of the app's Time.zone. A hint under Starts gives the current time in that zone when the page loads: "It’s 14:29 UTC now." I went with labels rather than a timezone picker.
  • History is the default view. /incidents is now the history, with the type, service and search filters, and New incident and New maintenance buttons in the upper right. Active and Upcoming sections sit above the month-by-month list of resolved incidents and completed maintenances, so a live incident never sinks below future maintenances. Both sections follow the filters, and Upcoming is sorted soonest first. /incidents/history 301-redirects to /incidents, passing on only kind, service, q and page.
  • New maintenance starts empty. Choosing services used to autofill the title and first update with the top suggestion, which was usually the last mail-in maintenance. The suggestions Stimulus controller gains an autofillUnless value (a CSS selector), and the new form passes #kind_maintenance:checked. Autofill pauses for maintenances, and switching from Incident to Maintenance clears any text autofill put there. Suggestions still open on focus, and incidents autofill as before. A blank first update still saves as "Maintenance scheduled.", which keeps internal services off the public page.
  • "Incidents" reads "Events". The header link is now "Events" and back links read "← All events". I didn't add separate Incidents and Maintenances links, since the filters on the page cover that.

CHANGELOG is updated under Unreleased → Changed.

Testing

The pausing and clearing of autofill is untested: the repo has no JS or system test harness, and I haven't tried it in a browser. It needs a manual check, please.

New integration tests cover the page sections and their order, the buttons, the filters, the redirect (including that it drops unknown keys such as script_name), the zone labels and hint, and the autofill attribute on the maintenance form.

bin/rails test passes except three Playwright probe tests, which fail locally because Chromium isn't installed on this machine and fail the same way on main. Rubocop and Brakeman are clean.

Copilot AI balanced review requested due to automatic review settings November 11, 2026 09:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The status enum overrides the timestamp-based resolved scope, causing completed maintenances to disappear from both Active/Upcoming and incident history.

3 open issues
What changed in this PR

Makes the Upright engine’s incident workflow friendlier for maintenance by consolidating event history and clarifying the creation form.

Changes:

  • Moves filtered, paginated history to /incidents, with Active and Upcoming sections above resolved events.
  • Adds time-zone labels and a current-time hint, and pauses automatic suggestions for new maintenance.
  • Renames navigation to “Events” and adds integration coverage and changelog entries.

[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

File Description
test/​integration/​incidents/​histories_controller_test.rb Tests the legacy redirect and allowed query parameters.
test/​integration/​incidents_controller_test.rb Covers event sections, filters, navigation, and form markup.
CHANGELOG.md Documents the maintenance workflow changes.
app/​views/​upright/​incidents/​new.html.erb Renames the back link to “All events.”
app/​views/​upright/​incidents/​index.html.erb Combines active, upcoming, and paginated historical events.
app/​views/​upright/​incidents/​histories/​show.html.erb Removes the separate history template.
app/​views/​upright/​incidents/​edit.html.erb Renames the back link to “All events.”
app/​views/​upright/​incidents/​_form.html.erb Adds zone labels, a time hint, and maintenance autofill controls.
app/​views/​layouts/​upright/​_header.html.erb Renames the navigation link to “Events.”
app/​javascript/​upright/​controllers/​suggestions_controller.js Pauses autofill conditionally and clears previously autofilled text.
app/​helpers/​upright/​incidents_helper.rb Supports conditional autofill and time-zone labels.
app/​controllers/​upright/​incidents/​histories_controller.rb Redirects legacy history requests with permitted filters.
app/​controllers/​upright/​incidents_controller.rb Loads filtered event sections and paginated history.
app/​assets/​stylesheets/​upright/​incidents.css Adjusts filter spacing and removes obsolete history styles.

Review effort: Balanced

Comment thread app/helpers/upright/incidents_helper.rb Resolved
From a first run of maintenance pages in production:

- The incidents page is now the history: every incident and maintenance
  by month, with the filters and the New incident and New maintenance
  buttons. /incidents/history redirects there, keeping its filters.
- The header link reads Events, since maintenances aren't incidents.
- The form labels its start and end times with the zone they're entered
  in, and shows the time in that zone now.
- A new maintenance's title and first update start empty. Choosing its
  services filled them in with the last maintenance's text, which read as
  if the form had loaded someone else's maintenance. Incidents still
  autofill, and switching an incident to a maintenance clears what was
  filled in. The suggestions still open on focus.
Folding everything into one list by start time pushed a live incident
below future maintenances, and could push it to a later page, and listed
upcoming maintenances furthest first. Active and upcoming events now
lead the page again, soonest maintenance first, with the filters applied
to them too; the month-by-month history below holds what's resolved.

Also:
- The history redirect passes on only its filters, so a query key such
  as script_name can't steer it to another host.
- The zone in a time's label is the zone at that time, not today's, so
  it stays right across a daylight saving change.
- Switching to maintenance clears autofilled text before the suggestions
  load, so a failed request doesn't leave an incident's text behind.
- Name what the tests check, not what used to happen.
@lewispb
lewispb force-pushed the maintenance-page-tweaks branch from d20c67d to 0b17bdf Compare November 11, 2026 10:03
The status enum's resolved scope (status = "resolved") replaces the
lifecycle's timestamp scope, so a completed maintenance matched neither
the Active, Upcoming nor history lists. The history now asks for
resolved_at directly.

The time labels name the app's zone, as UTC, rather than the
abbreviation at the time in the field, which went stale once someone
changed the dates.
@lewispb
lewispb merged commit cafbcf1 into main Nov 11, 2026
8 checks passed
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