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

Every event kind the forge emits is classified for its audience, and a test fails on one that is not #3627

Merged opened this

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

Merged

An event of a kind nobody classified now goes to admins instead of every reader. A new test fails, naming the kind, when the source emits a kind that isn't classified. The audience, stream, upstream, origin, sealed and fleet suites pass. I ran only those, not the whole `bun test` or `tsc`; the forge's check covers both on this push.

shipped production is serving it deploy fc82d1a

opened this

An event of a kind nobody classified now goes to admins instead of every reader. A new test fails, naming the kind, when the source emits a kind that isn't classified. The audience, stream, upstream, origin, sealed and fleet suites pass. I ran only those, not the whole bun test or tsc; the forge's check covers both on this push.

  • Classification: src/core/event_audience.ts now has an explicit READER_KINDS set beside the admins, actor and app rules. A new classifiedAudience(kind) returns undefined for a kind in none of them, and eventAudience turns that into admins. I listed every kind the source emits that reached readers before, so those still reach readers.
  • Test: test/event-audience-coverage.test.ts scans every .append({ kind … }) in src/ and fails, naming the kind and file:line, when the kind is unclassified. It reads plain literals, ternaries and ${issue.kind}.… templates. Any other kind expression fails the scan, reported as unreadable, instead of being skipped. The one such site, announceRun's kind in src/actions/runs.ts, is spelled out by hand in the test's COMPUTED table.
  • Old test changed: test/event-audience.test.ts asserted that an unclassified kind is for readers. That was the old default, so I changed it to expect admins.

Kinds moved from readers to admins, because their payloads carry configuration:

  • forge.upstream: carries the upstream repo link.
  • forge.updates_taken: carries the upstream.
  • cloud.write_allowed: a cloud provider's write switch.
  • origin.connected, origin.disconnected, origin.refreshed, origin.needs_reauth, origin.app_registered: carry the connected host's URL. origin.mirror_reattached was already admins-only.

The scan covers only .append({ … }) calls. A kind written some other way, such as SQL in a migration, is not scanned.

Closes #3612

commented

An event of a kind nobody classified now goes to admins instead of every reader. A new test fails, naming the kind, when the source emits a kind that isn't classified. The audience, stream, upstream, origin, sealed and fleet suites pass. I ran only those, not the whole bun test or tsc; the forge's check covers both on this push.

  • Classification: src/core/event_audience.ts now has an explicit READER_KINDS set beside the admins, actor and app rules. A new classifiedAudience(kind) returns undefined for a kind in none of them, and eventAudience turns that into admins. I listed every kind the source emits that reached readers before, so those still reach readers.
  • Test: test/event-audience-coverage.test.ts scans every .append({ kind … }) in src/ and fails, naming the kind and file:line, when the kind is unclassified. It reads plain literals, ternaries and ${issue.kind}.… templates. Any other kind expression fails the scan, reported as unreadable, instead of being skipped. The one such site, announceRun's kind in src/actions/runs.ts, is spelled out by hand in the test's COMPUTED table.
  • Old test changed: test/event-audience.test.ts asserted that an unclassified kind is for readers. That was the old default, so I changed it to expect admins.

Kinds moved from readers to admins, because their payloads carry configuration:

  • forge.upstream: carries the upstream repo link.
  • forge.updates_taken: carries the upstream.
  • cloud.write_allowed: a cloud provider's write switch.
  • origin.connected, origin.disconnected, origin.refreshed, origin.needs_reauth, origin.app_registered: carry the connected host's URL. origin.mirror_reattached was already admins-only.

The scan covers only .append({ … }) calls. A kind written some other way, such as SQL in a migration, is not scanned.

Approved

Private by default now: an unclassified kind goes to admins, and a scan test names any emitted kind nobody classified. I found no .append( of a non-literal object in src/, so the scan sees every bus write. The scan fails on unreadable kind expressions instead of skipping them, and the changed old assertion was the old default, so changing it was right. Moving the forge.upstream, origin.* and cloud.write_allowed kinds to admins matches how webhook config is treated. This is no UI change, so the preview has nothing visible to check.

Two things I would do next:

  1. Fold READER_KINDS and the admins prefixes into one table keyed by kind, so a kind is classified in a single place; the 90-line set is long and unordered.
  2. Scan the non-.append({ writers (migrations, SQL inserts) or state in the README that they are out of scope, so a quiet admin-only kind has a visible cause.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs