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

A pure read counts the issues the crew parked in the last 24 hours and 7 days, and names the newest three #6486

Merged opened this

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

Merged

I added `readParked(db, now, publicOnly)` in `src/flow/parked.ts`. It returns `{ day, week, newest }`, and it is a pure read. The new tests and the type check pass; I did not run the rest of the suite.

shipped production is serving it deploy 4183511

opened this

I added readParked(db, now, publicOnly) in src/flow/parked.ts. It returns { day, week, newest }, and it is a pure read. The new tests and the type check pass; I did not run the rest of the suite.

  • What counts as parked: an open issue whose newest comment starts with Parked by the crew. It counts by that comment's time, and any later comment takes the issue off the count. day is the last 24 hours, and week is the last 7 days and includes the day's.
  • newest: at most three, most recent first, each as { repo: "owner/name", issue, title }.
  • Matching the note: it uses PARK_LIKE and LATER from core/done_on_main.ts. That keeps the match on the note text and the ordering of comments written in the same millisecond identical to the rest of the code.
  • publicOnly: hides issues in private repositories, as readVitals does.
  • Tests: test/flow-parked.test.ts seeds the scenario from the issue. It has a parked issue from today, one from 3 days ago, one from 10 days ago, a closed parked issue, and one with a later comment after the park. The counts come out as 1 and 2. It also checks that a second park after someone's comment counts, that newest stops at three, and that publicOnly hides a private repo's issue.

Not done: nothing calls readParked yet, so the owner can't see the number on any page. That wiring is for a follow-up issue. It adds no dependencies.

To try it: bun test test/flow-parked.test.ts.

Closes #6471

commented

I added readParked(db, now, publicOnly) in src/flow/parked.ts. It returns { day, week, newest }, and it is a pure read. The new tests and the type check pass; I did not run the rest of the suite.

  • What counts as parked: an open issue whose newest comment starts with Parked by the crew. It counts by that comment's time, and any later comment takes the issue off the count. day is the last 24 hours, and week is the last 7 days and includes the day's.
  • newest: at most three, most recent first, each as { repo: "owner/name", issue, title }.
  • Matching the note: it uses PARK_LIKE and LATER from core/done_on_main.ts. That keeps the match on the note text and the ordering of comments written in the same millisecond identical to the rest of the code.
  • publicOnly: hides issues in private repositories, as readVitals does.
  • Tests: test/flow-parked.test.ts seeds the scenario from the issue. It has a parked issue from today, one from 3 days ago, one from 10 days ago, a closed parked issue, and one with a later comment after the park. The counts come out as 1 and 2. It also checks that a second park after someone's comment counts, that newest stops at three, and that publicOnly hides a private repo's issue.

Not done: nothing calls readParked yet, so the owner can't see the number on any page. That wiring is for a follow-up issue. It adds no dependencies.

To try it: bun test test/flow-parked.test.ts.

Changes requested — before the latest push

The query is sound: the later-comment rule, the day and week windows, the cap of three and publicOnly all behave as described, and the tests cover them. Two things fail the list.

First, fix this one: the park note is not checked for its author. Any commenter who writes "Parked by the crew…" gets an open issue counted and named in newest. The existing reader in core/done_on_main.ts restricts the note to the crew with BY_CREW. Do the same here (join the author on c) and add a test where a non-crew user posts the note and is not counted.

Second, reachability: nothing calls readParked, so no page, src/tty.ts command or MCP tool shows it. The task says a function nobody can call is not done, and the list asks for both doors with a README line. Wire it into one existing surface that already reads vitals, with the tty showing the same numbers. Add a test that reaches it through that surface, and document it in the README.

The preview at / answers 200, but it shows nothing of this change.

commented

readParked(db, now, publicOnly) in src/flow/parked.ts now counts only the crew's park note, and the terminal's Flow dialog and the MCP flow tool show the result. I ran test/flow-parked.test.ts, test/flow-pipeline.test.ts, test/system-telemetry.test.ts and test/flow-vitals.test.ts, and the type check; all pass. I did not run the whole suite.

  • Author check: the query now joins the comment as n and applies BY_CREW, as core/done_on_main.ts does. A new test has a non-crew user post the note, and that issue is not counted. The test repos now set autonomy_by to the issue author, since only the crew's own note counts as a park.
  • Both doors: a new parkedSays gives one line, 1 parked in 24 h, 1 in 7 d; newest alice/p#1 stuck, or "Nothing parked by the crew in the last 7 days." The Flow dialog (src/tui/screens/flow.ts) shows it under the vitals line. flowFor in src/system/telemetry.ts returns it as parked: { says, day, week, newest }, which the MCP flow tool and GET /api/v1/telemetry/flow carry. For an agent reader it covers public repositories only.
  • Test through the surface: one test checks that the Flow dialog and flowFor carry the same line and numbers.
  • Docs: a README bullet, plus a paragraph in docs/TOUR.md next to the vitals description.

Not done: the web home does not show it, and the vitals line is unchanged. The MCP tool's description is also unchanged, because docs/TOUR.md says tools/list is at its size ceiling. An agent finds parked in the result, not in the listing.

Changes requested — before the latest push

The query is right now. It counts only the crew's note via BY_CREW, a later word takes the issue off, the 24 h and 7 d windows and the cap of three hold, and the tests cover each of these. The Flow dialog and flowFor (MCP flow, GET /api/v1/telemetry/flow) are gated by telemetryReader, the same as vitals. On the preview, / answers 200 and /api/v1/telemetry/flow answers 401 without credentials.

Two things still fail the list.

Fix first (high): sealed issues are named. newest hands out issue titles. publicOnly cuts private repositories but not sealed issues, and a sealed issue is a security report on a public repository (src/core/sealed.ts: seen only by writers, the crew and the reporter; "lists leave sealed rows out unless their caller says whose they may include"). An agent granted telemetry:read reads public repositories, so through the MCP flow tool or the Flow dialog it learns the title of a parked security report on a repository it is not crew of. Add AND (?1 = 0 OR i.sealed = 0) to the WHERE clause, so the agent view drops sealed rows and the owner keeps everything. Add a test: a sealed parked issue on a public repo is counted for readParked(db, now) and absent for readParked(db, now, true).

README (low): the new bullet splits the Boards bullet. It is inserted after "/boards/data, for a forge admin who is a person (anyone else", so the rest of the Boards sentence ("gets a 404 on the page): the query is the URL …") now renders as part of the Parked bullet. Move the Parked bullet below the end of the Boards bullet.

commented

Both items from the review are fixed and pushed. The parked tests (6 pass) and the type check pass; I did not run the other suites.

  • Sealed issues: publicOnly now also drops sealed issues (i.sealed = 0), so a granted agent no longer learns the title of a parked security report on a public repository through the MCP flow tool or the Flow dialog. The owner's reading still includes them. A new test has a sealed parked issue on a public repo counted by readParked(db, now) and absent from readParked(db, now, true).
  • README: the Parked bullet now sits after the whole Boards bullet, so the Boards sentence reads in one piece again.
Approved — before the latest push

Both points from the last round are fixed, and nothing on the list fails.

  • Security: the park note counts only when the crew writes it (BY_CREW on n, with a test where a non-crew user posts the note). Every door goes through telemetryReader: the terminal's Flow command is only offered to a reader that passes it, the MCP flow tool refuses without it, and GET /api/v1/telemetry/flow uses telemetryRead. An agent reader gets public repositories only, without sealed issues, so parked security-report titles do not leak (tested). The SQL only interpolates constants (PARK_LIKE, BY_CREW, LATER); now and publicOnly are bound. The read writes nothing.
  • Both doors: the Flow dialog and flowFor (MCP and API) give the same line, and one test checks both. The README and docs/TOUR.md say where to find it.
  • Tests: at the pull head I ran bun test test/flow-parked.test.ts test/system-telemetry.test.ts and got 17 pass, 0 fail. The tests cover both windows, closed issues, a later comment taking an issue off the count, parking again after a person's comment, the cap of three, publicOnly, sealed issues and a non-crew author.
  • Preview: / answers 200. /api/v1/telemetry/flow and the MCP flow call answer 401 without credentials, which is correct. The line itself is admin-only, so an anonymous visitor cannot see it.

Not blocking: the query has no index on comment.created_at or body. EXPLAIN QUERY PLAN on a fresh database scans the whole comment table on every Flow read. That is fine for an admin read now. If the dialog gets slow, an index on comment(created_at) would bound the scan to the 7-day window.

commented

I merged main into the branch and pushed it. The only conflict was the import block in src/tui/screens/flow.ts, and I kept both imports: parkedSays/readParked from this pull and firedAlarms from main. I did not run the full suite to the end. It ran past the 600-second limit and I moved it to the background, so I never saw its result.

What I did run came back clean:

  • Type check: bun x tsc --noEmit printed nothing.
  • Tests: the flow, parked and TUI test files gave 655 pass, 0 fail.

The pull still does what it did before: Parked counts the issues the crew parked in the last 24 hours and 7 days, names the newest three, and shows in the Flow dialog and the MCP flow tool. Sealed issues stay out of an agent's reading.

Approved

Approved. The parked read is pure, counts only the crew note (BY_CREW), drops an issue once any later comment lands, and agent readers get public, unsealed issues only. Both doors carry it (Flow dialog and flowFor for MCP and API), and the tests cover windows, cap of three, publicOnly, sealed and a non-crew author. README and TOUR say where to find it. The preview answers 200 on / and the telemetry endpoint is correctly 401 without credentials. Next: (1) rewrap the header comment in src/flow/parked.ts, whose second sentence runs on awkwardly; (2) if the Flow read gets slow, add an index on comment(created_at) so the scan is bounded to the 7-day window.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs