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

The forge button's note door lands: a note files a `from-app` issue, under the same gate as the preview it is sent from #4824

opened this

Merged 44d 17h ago, live in production

The forge button's note door from #4759 is now on main, and it refuses strangers on a sealed preview before anything is filed. The type check and the 109 tests covering the notes, toolbar and reports pass; I didn't run the whole check. What changed Rebase: #4759's three commits are cherry-picked onto main.

Notes

opened this

The forge button's note door from #4759 is now on main, and it refuses strangers on a sealed preview before anything is filed. The type check and the 109 tests covering the notes, toolbar and reports pass; I didn't run the whole check.

What changed

  • Rebase: #4759's three commits are cherry-picked onto main. The panel, POST /__forge/note, the limits, the word filter, the sender's own notes and POST /__forge/note/moderate are all there unchanged.
  • Sealed-preview gate:
    • FeedbackAsk has a new sealed field, set in src/apps/proxy.ts from sealedPull(runtime, target).
    • In src/apps/feedback.ts, a sealed preview admits only a signed-in person who can read the repository. A stranger gets a 404 on /__forge/note and /__forge/notes, before anything is filed. That matches /__forge/measure, whose condition is access === "private" || sealedPull(...).
    • A lapsed grant on a private app or sealed preview no longer counts as a person.
    • A new test shows a visitor refused on a sealed preview with no issue filed, a granted person accepted, and the same app's production still open to visitors.
  • Daily limit is driven:
    • The test that read a constant and a string from the source is gone. A new one posts notes until the per-app daily limit refuses the 101st, with a retry-after over an hour. It asserts the issue count is unchanged by the refused note.
    • The hourly limit (30) is lower than the daily one (100), so over real time the day limit is only reached after several hours. The test therefore moves the limiters' clock: noteClock in src/actions/app_notes.ts is a small new export that defaults to Date.now.
  • README: it now says who may write (public apps, but private apps and sealed previews only admit people they admit), the hourly and daily bounds, and that the owner's only tool is POST /__forge/note/moderate, with no screen yet.

Left out on purpose: the owner's moderation screen, the screenshot, the version in "shipped", and the layout look.

To try it:

  1. Run bun test test/apps-feedback.test.ts.
  2. On a preview, open the forge button and send a note. It should file an issue labelled from-app.
  3. On a sealed pull's preview, the same post as a visitor returns 404.

I didn't run scripts/design-lint.ts.

🤖 Generated with Claude Code

Closes #4818

5 earlier comments
commented

The forge button's note door from #4759 is now on main, and it refuses strangers on a sealed preview before anything is filed. The type check and the 109 tests covering the notes, toolbar and reports pass; I didn't run the whole check.

What changed

  • Rebase: #4759's three commits are cherry-picked onto main. The panel, POST /__forge/note, the limits, the word filter, the sender's own notes and POST /__forge/note/moderate are all there unchanged.
  • Sealed-preview gate:
    • FeedbackAsk has a new sealed field, set in src/apps/proxy.ts from sealedPull(runtime, target).
    • In src/apps/feedback.ts, a sealed preview admits only a signed-in person who can read the repository. A stranger gets a 404 on /__forge/note and /__forge/notes, before anything is filed. That matches /__forge/measure, whose condition is access === "private" || sealedPull(...).
    • A lapsed grant on a private app or sealed preview no longer counts as a person.
    • A new test shows a visitor refused on a sealed preview with no issue filed, a granted person accepted, and the same app's production still open to visitors.
  • Daily limit is driven:
    • The test that read a constant and a string from the source is gone. A new one posts notes until the per-app daily limit refuses the 101st, with a retry-after over an hour. It asserts the issue count is unchanged by the refused note.
    • The hourly limit (30) is lower than the daily one (100), so over real time the day limit is only reached after several hours. The test therefore moves the limiters' clock: noteClock in src/actions/app_notes.ts is a small new export that defaults to Date.now.
  • README: it now says who may write (public apps, but private apps and sealed previews only admit people they admit), the hourly and daily bounds, and that the owner's only tool is POST /__forge/note/moderate, with no screen yet.

Left out on purpose: the owner's moderation screen, the screenshot, the version in "shipped", and the layout look.

To try it:

  1. Run bun test test/apps-feedback.test.ts.
  2. On a preview, open the forge button and send a note. It should file an issue labelled from-app.
  3. On a sealed pull's preview, the same post as a visitor returns 404.

I didn't run scripts/design-lint.ts.

🤖 Generated with Claude Code

commented

Hiding or banning a note, and the rollback when labelling fails, now go through the issue actions instead of the core write. I pushed this to the same branch and ran tsc and the 49 tests in apps-feedback, tui-notes, reports and apps-crew-pill. I did not run the whole check.

What changed (all in src/actions/app_notes.ts unless noted)

  • Hide and ban: moderateNote closes the issue with setIssueStateThrough(app, admin, repo, issue, "closed", { reason: "dropped" }).
    • The close now reaches the bus (issue.closed) and, on a mirrored app, the origin.
    • It closes first and only then hides the note or bans the sender. If the close fails the note stays visible and the caller gets unavailable.
    • The function is now async. The page endpoint answers 503 on unavailable, and the terminal screen toasts after the result.
  • Rollback in sendNote: it closes through the same action, as the owner.
  • Labelling: sendNote labels with setIssueLabelsThrough. A note on a mirror is no longer refused after it was already filed on the origin, so there is no orphaned issue and no duplicate on retry.

Tests (new test/apps-feedback-mirror.test.ts)

  • A note on a mirrored app, served by the fake origin, is filed once and labelled from-app on the origin.
  • A hide on that app closes the origin's issue and the local one, and issue.closed reaches the bus.
  • On a native app, a hide also appends issue.closed.

Both tests fail on the old code. I didn't add a test for the rollback close itself, only for the filed-and-labelled path.

I kept to the fix and added nothing else.

🤖 Generated with Claude Code

commented

A note no longer reaches a builder until a writer adopts it. tsc and the 78 tests across the note, reports, crew-pill and direct suites pass. I did not run the whole check.

  • Voice mark: sendNote marks the issue with the sender's name as origin_author, through markSender in core/app_notes.ts. This happens straight after the issue opens, before the label step.
    • unadoptedAmong then holds the issue back, so the map doesn't call it ready and the clock doesn't pick it.
    • markReaders marks it untrusted.
  • Waiting state: the panel and the terminal show an open, unassigned note as "Waiting for the builders to look". Once it is adopted it reads "In the queue for a builder". Two existing assertions expected queued for a fresh note. They were wrong now that a fresh note is unadopted, so I changed them to waiting.
  • Terminal gate: tui/screens/notes.ts now asks canEnterApp, as the page does, as well as canRead.
  • README: the repeated "30 an hour, 100 a day" sentence is gone from the first bullet.
  • Tests: in test/apps-feedback-mirror.test.ts, a fresh note is in unadoptedAmong, reads waiting, and its voice comes back untrusted.
  • Mirrored apps: the issue is still published on the origin under the owner's account, because the write goes through the owner's token. The title prefix and the body say it holds a stranger's words. A later sync from the origin can set origin_author to the owner again, so the voice mark isn't guaranteed to last on a mirror. I did not change that.
  • Wording: the shared "on the origin" wording will read "visitor-xxxxxx on the origin" for a note's author. That is slightly off but harmless.
  • Report route: I took the voice-mark route you named and did not make notes reports.ts reports that the owner accepts.

🤖 Generated with Claude Code

commented

Handed to a person by the crew: the reviewer asked for changes three times with no approval between, so the planner re-scopes it: split, replaced, or one more round with the reviewer's ask restated.

  1. sentinel: Most of this is right. Identity comes from the signed grant, and a lapsed grant is no grant on a private app or a sealed preview. Every POST
  2. sentinel: The door's HTTP side holds up. Identity comes from the signed grant, and a lapsed grant is re-checked on private apps and sealed previews, s
  3. sentinel: One high finding blocks this. Everything else I read holds up: identity comes from the verified grant (readGrant, plus stillEntitled on
commented

Planner: one more round, with one change. Remove /__forge/note/moderate from the app host. Only POST /__forge/note and GET /__forge/notes are answered there. Add a test that /__forge/note/moderate is a 404 on the app host, even with an admin grant cookie. Hide and ban move to a forge-origin route in #4819, which calls the same moderation function. Keep everything else in this pull as it is. The preview viewerId note is not blocking, so leave it for later.

commented

Planner: replaced. Issue #4818 is closed into #4910, which starts from this branch and takes /__forge/note/moderate off the app host. Nothing more is asked of this pull. A person, please close it.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs