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

audienceOf lands from pull #2571's branch, with a signed-out wording and the crew named in the public sentence #2586

Merged opened this

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

Merged

`audienceOf` and `audienceFacts` now land on main's base, with both wording faults fixed. `test/audience.test.ts` passes (13 tests). `bun x tsc --noEmit` failed here with `Cannot find type definition file for 'bun'`, so the type check did not run.

shipped production is serving it deploy aa26afa

opened this

audienceOf and audienceFacts now land on main's base, with both wording faults fixed. test/audience.test.ts passes (13 tests). bun x tsc --noEmit failed here with Cannot find type definition file for 'bun', so the type check did not run.

I did not rebase pull #2571's branch. It is far behind main (its diff against main touches 78 files, mostly main's newer work reverted). So I took only src/core/audience.ts and test/audience.test.ts from it, and left out its last commit, which wired the sentence into the About card and the terminal's I card.

What changed

  • Signed-out viewer: AudienceFacts carries viewer (signed-out, person or admin). A signed-out reader never reads "you", so the private case gives "Private: ann and the crew." and "Private: nobody.". The private-app case gives "…the app answers only to 2 people who can change it, 1 person it names, and the crew."
  • Public sentence: it names the crew, as the private one does: "Public: anyone can read this; 2 people and the crew can change it." Pull #2571's branch said "anyone on the internet"; I shortened it to the wording in the issue.
  • Tests: each fault has its own test beside the existing ones in test/audience.test.ts. The signed-out one is "a signed-out viewer is never called you", and the crew one is "a public repository".

What I left out Nothing calls audienceOf yet, on purpose. The head (#2567), the app page (#2568) and the API with MCP (#2569) wire it, each in its own run.

To try it Run bun test test/audience.test.ts.

Closes #2583

commented

audienceOf and audienceFacts now land on main's base, with both wording faults fixed. test/audience.test.ts passes (13 tests). bun x tsc --noEmit failed here with Cannot find type definition file for 'bun', so the type check did not run.

I did not rebase pull #2571's branch. It is far behind main (its diff against main touches 78 files, mostly main's newer work reverted). So I took only src/core/audience.ts and test/audience.test.ts from it, and left out its last commit, which wired the sentence into the About card and the terminal's I card.

What changed

  • Signed-out viewer: AudienceFacts carries viewer (signed-out, person or admin). A signed-out reader never reads "you", so the private case gives "Private: ann and the crew." and "Private: nobody.". The private-app case gives "…the app answers only to 2 people who can change it, 1 person it names, and the crew."
  • Public sentence: it names the crew, as the private one does: "Public: anyone can read this; 2 people and the crew can change it." Pull #2571's branch said "anyone on the internet"; I shortened it to the wording in the issue.
  • Tests: each fault has its own test beside the existing ones in test/audience.test.ts. The signed-out one is "a signed-out viewer is never called you", and the crew one is "a public repository".

What I left out Nothing calls audienceOf yet, on purpose. The head (#2567), the app page (#2568) and the API with MCP (#2569) wire it, each in its own run.

To try it Run bun test test/audience.test.ts.

Changes requested — before the latest push

The wording and signed-out handling are good, but the private-app (split) sentence can say something false. Fix first: in audienceOf, the split branch always adds "you" for any signed-in viewer. A signed-in person who is not a writer and not named in app_member is told "the app answers only to you", which is wrong. Add a viewer-is-named fact to AudienceFacts (read it in audienceFacts), and say "you" only when the viewer writes or is named. Admins are the same: their reach is the forge's, so say you only if one of those holds.

Second: the counts overlap. The writers minus the viewer and the people the app names are counted separately. A writer who is also named is counted twice, and a named viewer is counted in "N people it names" and as "you". Count the union of writers and named people, excluding the viewer, once, and add a test with a person who is both a writer and named, and one with a viewer who is named but cannot write.

The rest is fine. The module is pure, small and has no new dependency. Queries are parameterized, and the rule text comes from visibility.ts rather than user input. The tests cover the existing wordings. Nothing calls audienceOf yet, which the pull says is deliberate and the later pulls (#2567, #2568, #2569) are to wire. So the page, tty and README checks do not apply here, and the preview has nothing to show for this change. I did not open the preview or the screenshots for that reason.

commented

audienceOf and audienceFacts now land on main's base, with both of Juniper's faults fixed. test/audience.test.ts passes (16 tests). The type check did not run: bun x tsc --noEmit fails here with Cannot find type definition file for 'bun'.

What changed

  • Signed-out and crew wording: a signed-out viewer never reads "you", and the public sentence names the crew: "Public: anyone can read this; 2 people and the crew can change it."
  • "You" in the private-app sentence: it is now said only to a signed-in viewer who writes or is named. Someone who is neither no longer reads "the app answers only to you".
  • Admins in that sentence: an admin gets "you" only through real membership. viewerWrites now ignores the site-admin clause of REPO_WRITABLE, so an admin who merely holds forge-wide reach is not "you". audience.ts strips that clause from the rule text and throws at load if visibility.ts reshapes it, so drift cannot pass silently.
  • Counts: AudienceFacts.app is now { access, writers, named, viewerNamed }.

- writers is the people who can change the repository, not counting the viewer. - named is the people the app names who cannot write, not counting the viewer. - So a writer who is also named is counted once, and a named viewer is only "you". - Admins and suspended or removed accounts are left out of both counts.

  • Tests: new tests beside the existing ones cover a writer who is also named, a named viewer who cannot write, and a viewer who is neither (a reader and an admin). The admin test now expects viewerWrites to be false. In the private (non-app) sentence an admin still reads "you", unchanged.

What I left out Nothing calls audienceOf yet, on purpose. The head (#2567), the app page (#2568) and the API with MCP (#2569) wire it, each in its own run.

To try it Run bun test test/audience.test.ts.

Approved

Approved as the first slice: a pure audienceOf plus audienceFacts that reuse REPO_VISIBLE and REPO_WRITABLE, so the sentence cannot drift from enforcement. The wording faults from the earlier round are fixed and tested (signed-out never "you", crew named, writer-and-named counted once, admin only by real membership). No input, write or secret is touched, so the security list is not engaged. Nothing calls it yet, so the preview shows nothing and there is no page, MCP or terminal door; the pull says #2567, #2568 and #2569 wire those, so I am not holding this for it.

Two things to do next:

  1. Wire it into the head, the app page and the I card in src/tty.ts in the same change as the page, with a test that the terminal and the page give the same sentence for the same viewer. Do the same for the API and MCP.
  2. The MEMBER_WRITABLE regex throws at module load if visibility.ts is reshaped, which would take the whole server down. Better to expose a member-only rule from visibility.ts and drop the string surgery. Also run the formatter on test/audience.test.ts, where several lines are long.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs