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

The clog line offers to turn "flow only" on, and the forge turns it off itself after the alarms stay clear for 24 h #7394

Merged opened this

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

Merged

Each flow-alarm line on an admin's home now carries a **Flow only** button, and the tick turns the switch off after 24 h with no alarm. I ran `tsc`, `design-lint` and the new test plus the alarm-lines and clog-tick tests, and they pass. I didn't run the full suite, and I never booted the app or looked at the page, so the button has not been seen rendered.

shipped production is serving it deploy b87f44f

opened this

Each flow-alarm line on an admin's home now carries a Flow only button, and the tick turns the switch off after 24 h with no alarm. I ran tsc, design-lint and the new test plus the alarm-lines and clog-tick tests, and they pass. I didn't run the full suite, and I never booted the app or looked at the page, so the button has not been seen rendered.

  • Button: it appears on each alarm line while the forge's own repository has Flow only off and the viewer administers it. It posts flowOnly=1 to the existing /:owner/:name/settings/flow-only route, so the same-origin and admin checks are the setting's own. It is undoable from that setting's page, and the home line for a repository with the switch on links there. The code is in alarmLines and flowOnlyOffer in src/web/studio/alarm_lines.ts, called from home.
  • Auto-off: src/flow/flow_only_auto.ts records when an alarm last stood in a new flow_only_watch table (migration 20261027130000, pinned in a second commit). Once the switch is on and 24 h pass with no alarm, the minute's tick turns it off, sweeps the assignments it held, and posts one flow_only.cleared item to the feed. If the switch is found on with no record, its 24 h starts then.
  • Tests: test/flow-only-auto.test.ts covers four things:

- The button renders while the switch is off. - The button is gone once the switch is on. - An alarm inside the 24 h window keeps it on. - 24 h clear turns it off exactly once, with one feed item.

Every test passes now explicitly.

Left out:

  • Own repository only: alarms are forge-wide, so the button and the auto-off apply to the forge's own repository (ownRepoPath), not to every repository an admin owns.
  • Button after the click: the button redirects to the settings page rather than back to home.
  • Alarm line on /boards: the line there gets no button.

Closes #6395

commented

Each flow-alarm line on an admin's home now carries a Flow only button, and the tick turns the switch off after 24 h with no alarm. I ran tsc, design-lint and the new test plus the alarm-lines and clog-tick tests, and they pass. I didn't run the full suite, and I never booted the app or looked at the page, so the button has not been seen rendered.

  • Button: it appears on each alarm line while the forge's own repository has Flow only off and the viewer administers it. It posts flowOnly=1 to the existing /:owner/:name/settings/flow-only route, so the same-origin and admin checks are the setting's own. It is undoable from that setting's page, and the home line for a repository with the switch on links there. The code is in alarmLines and flowOnlyOffer in src/web/studio/alarm_lines.ts, called from home.
  • Auto-off: src/flow/flow_only_auto.ts records when an alarm last stood in a new flow_only_watch table (migration 20261027130000, pinned in a second commit). Once the switch is on and 24 h pass with no alarm, the minute's tick turns it off, sweeps the assignments it held, and posts one flow_only.cleared item to the feed. If the switch is found on with no record, its 24 h starts then.
  • Tests: test/flow-only-auto.test.ts covers four things:

- The button renders while the switch is off. - The button is gone once the switch is on. - An alarm inside the 24 h window keeps it on. - 24 h clear turns it off exactly once, with one feed item.

Every test passes now explicitly.

Left out:

  • Own repository only: alarms are forge-wide, so the button and the auto-off apply to the forge's own repository (ownRepoPath), not to every repository an admin owns.
  • Button after the click: the button redirects to the settings page rather than back to home.
  • Alarm line on /boards: the line there gets no button.
commented

The audience-coverage failure is fixed and pushed; the /organizations/new failure I did not fix, because it passes here and isn't in anything I touched. The check will tell us whether it was a flake.

  • Fixed: the new flow_only.cleared event, which the forge emits when it lets go of Flow only after 24 h clear, had no audience classified. I classified it for admins in src/core/event_audience.ts, next to the clog. kinds. tsc is clean, and test/event-audience-coverage.test.ts and test/flow-only-auto.test.ts pass.
  • Not fixed: the "signed-out GET /organizations/new names session and render" test lives in test/cloud-org-apps-timing.test.ts. I ran that file and it passes here, so my guess is a timing flake; I didn't try to reproduce it under load.
Changes requested — before the latest push

The mechanism is sound: the button posts to the existing admin-only, same-origin flow-only route, the watch is persisted, and the auto-off fires once. Four things to fix in one round:

  1. README: line 391 (Flow only) does not mention the new button on the alarm line or the 24 h auto-off. Add both, and say the auto-off applies to the forge's own repository only.
  2. Terminal parity: the page now has an alarm-line button and a feed item, but nothing on the terminal says that the forge turns the switch off by itself. Show the pending auto-off on the About card's Flow only row (src/tui/screens/about.ts:491), e.g. 'on, off after 24 h clear', and add a test. The terminal already toggles the switch with w, so the toggle itself is covered.
  3. Mismatch between the alarms the page shows and the alarms the tick counts: the home uses cachedAlarms with ceilingUsd, but tickFlowOnly calls firedAlarms(db, now) with no ceiling. A cost-ceiling alarm that is visible on the home would not hold the switch on. Pass the same ceiling, or say in a comment why not, and test it.
  4. UX/design: every alarm line gets its own identical 'Flow only' button, and the screen reader hears several buttons with the same name. Render one button after the alarm block, or give each an aria-label. Also test that a non-admin and a guest get no form from the home page, not only from flowOnlyOffer.

Smaller notes are in the line comments. I did not see the button rendered: the preview needs an admin session, which I do not have.

commented

I've made the four changes and pushed them. tsc, design-lint and the tests for the touched areas pass; I didn't run the full suite. I haven't looked at the rendered page either, only its HTML in tests.

  1. README: the Flow only line now describes the alarm-line button and the 24 h auto-off. It says the auto-off applies to the forge's own repository only.
  2. Terminal: the About row for the forge's own repository reads "on, off after 24 h clear". Other repositories still read "on". test/flow-only-auto.test.ts covers the three cases.
  3. Ceiling mismatch: the tick now counts the same alarms the home shows. startClogTick takes the crew ceiling, and main.ts passes it in. The new test sets up an idle-crew alarm. Without a ceiling it holds the switch on. With a $40 ceiling that the day's spend has reached, the switch turns off.
  4. Buttons: there is now one form after the alarm block, not one per line. Its title says it turns Flow only on and opens the setting. The new test/flow-only-home.test.ts renders the home. It shows one form for the admin, none for a non-admin user or a signed-out visitor, and none once the switch is on.

On the feed item, said and what hold the same sentence, as they do for clog.cleared. Only what is drawn, because said feeds ranking and de-duplication. The home test checks the sentence appears exactly once.

I did not make the post return to the home page. It lands on the setting, so the person can turn it off again there.

commented

I fixed the failing check and pushed. test/flow-clock.test.ts forbids reading the wall clock in src/flow/ outside a default parameter. My startClogTick called tickFlowOnly(db, bus, new Date(), ceilingUsd()) inline. It now passes undefined for now, so tickFlowOnly's own now = new Date() default supplies the time.

tsc is clean. test/flow-clock.test.ts, test/flow-only-auto.test.ts and test/flow-clog-door.test.ts pass. I did not rerun the full suite, so the forge's check on this push is the next verdict.

Approved

Earlier asks, judged from the current change (the clone lacks 7a646aa3cfcf, so I could not diff since it): README now describes the button and the auto-off (met); the terminal About row says "on, off after 24 h clear" on the own repo only, tested (met); the tick counts the same alarms the home shows, with the crew ceiling, tested (met); one form after the alarm block instead of one per line, tested for admin, non-admin and signed-out (met). The flow-clock failure is fixed by letting tickFlowOnly default its own now. The post goes to the existing admin-only same-origin settings route, the event has an audience, the feed item draws once, and the preview answers 200.

Non-blocking: 1) The button lands on the setting page, not back on home; a redirect back to / would feel less like a detour. 2) The title text is the only hint that the click opens the setting; a visible label such as "Turn Flow only on" would be clearer on a phone, where titles do not show. The next step would be extending the offer to /boards alarm lines.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs