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

A note's sender gets the issue's link whenever they can read the repository #10697

Merged opened this

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

Merged

A note's sender now gets the issue's link and the repository's link whenever they can read the repository, private or public. Everyone else gets the number only. Tests and `tsc` pass; I did not run the gate script. The sandbox has no `keep_plan` tool, so I kept no plan on the issue.

shipped production is serving it deploy 7ab3f87

opened this

A note's sender now gets the issue's link and the repository's link whenever they can read the repository, private or public. Everyone else gets the number only. Tests and tsc pass; I did not run the gate script. The sandbox has no keep_plan tool, so I kept no plan on the issue.

What changed

  • Link rule: view() in src/actions/app_notes.ts now checks canRead(repo, viewer) instead of "app public and repo public". A signed-in sender who can read the repo gets url and repoUrl. A signed-out visitor of a public app on a private repo gets the number but no link.
  • Note fields: every note now carries number. url and repoUrl appear only for a reader.
  • Signatures: sendNote and notesFor take an optional trailing viewer. The existing callers in src/tui/screens/notes.ts and the tests are unchanged.
  • Wiring: the note door in src/apps/feedback.ts passes the door's viewer to both calls.
  • Forge button: after a send, the panel in src/apps/toolbar.ts appends "Filed as #N", linked, plus "The repository". For a non-reader it shows plain "Filed as #N." Links are only built when their origin matches the forge's.
  • Tests: the new test/app_notes.test.ts covers a private app's owner getting the issue and repository URLs on send and in the list. It also covers a signed-out visitor of a public app on a private repo getting the number and no URL. I ran it with the existing feedback, TUI notes and mirror suites.

Not done

  • The panel's "Filed as" line has no browser-level test, because the toolbar script is a string.
  • I didn't run scripts/design-lint.ts, as nothing under src/web/ changed.

Push hook The repo's pre-push hook asks for a "Try:" commit message, so I added an empty commit to satisfy it.

Try it Open a private app, send a note from the forge button, and the confirmation links to the issue and the repository.

🤖 Generated with Claude Code

Closes #10560

commented

A note's sender now gets the issue's link and the repository's link whenever they can read the repository, private or public. Everyone else gets the number only. Tests and tsc pass; I did not run the gate script. The sandbox has no keep_plan tool, so I kept no plan on the issue.

What changed

  • Link rule: view() in src/actions/app_notes.ts now checks canRead(repo, viewer) instead of "app public and repo public". A signed-in sender who can read the repo gets url and repoUrl. A signed-out visitor of a public app on a private repo gets the number but no link.
  • Note fields: every note now carries number. url and repoUrl appear only for a reader.
  • Signatures: sendNote and notesFor take an optional trailing viewer. The existing callers in src/tui/screens/notes.ts and the tests are unchanged.
  • Wiring: the note door in src/apps/feedback.ts passes the door's viewer to both calls.
  • Forge button: after a send, the panel in src/apps/toolbar.ts appends "Filed as #N", linked, plus "The repository". For a non-reader it shows plain "Filed as #N." Links are only built when their origin matches the forge's.
  • Tests: the new test/app_notes.test.ts covers a private app's owner getting the issue and repository URLs on send and in the list. It also covers a signed-out visitor of a public app on a private repo getting the number and no URL. I ran it with the existing feedback, TUI notes and mirror suites.

Not done

  • The panel's "Filed as" line has no browser-level test, because the toolbar script is a string.
  • I didn't run scripts/design-lint.ts, as nothing under src/web/ changed.

Push hook The repo's pre-push hook asks for a "Try:" commit message, so I added an empty commit to satisfy it.

Try it Open a private app, send a note from the forge button, and the confirmation links to the issue and the repository.

🤖 Generated with Claude Code

commented

A note's sender now gets the issue's link and the repository's link whenever they can read the repository, private or public. The three failing checks came from the toolbar script growing past its 22 KB size budget. I fixed that and pushed. I did not rerun the full suite. I reran the toolbar, pill, feedback and pull-quiet tests and they pass, and tsc is clean. I never saw the third failure, the pull list one, fail locally; it reads the same toolbar script, so the size is my best guess for its cause.

What changed

  • Link rule: view() in src/actions/app_notes.ts now links when canRead(repo, viewer). Before, it linked only for a public app on a public repo.
  • Reader: a signed-in sender who can read the repo gets url and repoUrl. A signed-out visitor of a public app on a private repo gets the number and no link. Every note view now carries number.
  • Signatures: sendNote and notesFor take an optional trailing viewer, which src/apps/feedback.ts passes in. Existing callers are unchanged.
  • Forge button: after a send, the panel in src/apps/toolbar.ts adds "Filed as #N", linked, and "The repository". A non-reader sees plain "Filed as #N." The existing "See it" link in the notes list reuses the same helper, and links are built only for the forge's own origin.
  • Size fix: toolbarJs now strips comment-only lines when it is built. The source comments stay and about 2 KB less is shipped, which brings it under the budget. No test needed changing.
  • Tests: the new test/app_notes.test.ts covers the private app's owner getting the issue and repository URLs on send and in the list. It also covers the signed-out visitor getting the number and no URL.

Left out

  • The panel's "Filed as" line has no browser-level test, because the toolbar script is a string.

Try it Open a private app, send a note from the forge button, and the confirmation links to the issue and the repository.

🤖 Generated with Claude Code

Changes requested — before the latest push

The rule change in view() (canRead instead of public app + public repo) is right, and the two tests cover box 3. Three things to fix in one round:

  1. The toolbar size fix is a hack. .replace(/^[ \t]\/\/.\n/gm, "") runs over the whole script string and will also delete any line inside a string or template literal that starts with // (a URL line, a regex). Pick one: move the comments out of the string, or raise the 22 KB budget in the test with the reason in the pull. Do not strip by regex.
  2. Box 1 ("Filed as #N", linked, shown at once) has no test. filed() and link() are new behaviour, and nothing would fail if they were deleted. Add a test that asserts on toolbarJs and on the JSON the /__forge/notes door returns with number, url and repoUrl for a signed-in reader. The feedback door change (passing door.viewer) is also untested: add a test through the door, not only through sendNote/notesFor.
  3. The terminal is a door too. src/tui/screens/notes.ts calls sendNote and notesFor without a viewer or forgeUrl, so a sender in the terminal gets neither number nor link, though they are signed in and can read the repository. Pass the SSH user as viewer, show "#N" in the list and in the confirmation, and add a test. Update docs/features/notes.md for the link and the number.
commented

A note's sender now gets the issue's number, and the issue's link and the repository's whenever they can read the repository. I ran tsc, the gate, the design lint and the five test files this touches, which pass. I did not run the full suite; the forge runs that on push.

  • Toolbar size: I removed the regex that stripped // lines from the script string, so the script keeps its comments. That puts it at about 22.8 KB, over the 22 KB budget, so I raised the budget to 24 KB in test/apps-crew-pill.test.ts and test/apps-toolbar.test.ts. The filed number and links account for about 0.8 KB of that.
  • Box 1 tests: The /__forge/note and /__forge/notes tests in test/apps-feedback.test.ts now run a signed-in reader through the door on a private app. They assert the JSON carries number, url and repoUrl, in the send response and in the list. A new toolbar test asserts toolbarJs contains "Filed as #" + n.number, the filed(...) call after a send, the repoUrl link and the forge-origin check. door.viewer is passed to notesFor, so the list test fails without it.
  • Terminal: src/tui/screens/notes.ts passes the SSH user as viewer. The confirmation reads "Sent as #N, owner/repo/issues/N", and the list, the moderation body and the status toast carry #N. test/tui-notes.test.ts asserts on all three.
  • Docs: docs/features/notes.md has a new section for the link and the number.

Terminal link: the terminal prints the issue path, not a clickable link, because the TUI has no forge URL to build one from. Adding one would mean threading the public URL into the session, which I left out.

Placement of the new test: I added the door assertions to the existing private-app test instead of a new one, because a second note from the same sender broke the rate-limit and count assertions in later tests.

Approved

Earlier asks (terminal door with the number, docs/features/notes.md section, door-level assertions for number/url/repoUrl, toolbar size budget handled explicitly) are met in this head. The link rule is now canRead(repo, viewer), the viewer is passed from both the web door and the SSH session, and the number is shown to everyone. Next, non-blocking: (1) Non-blocking: the toolbar assertions are string-contains checks; add a small DOM-level test of the Filed-as line when a harness exists. (2) Non-blocking: give the terminal a clickable forge URL by threading the public URL into the session, instead of printing a path.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs