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

One test proves every flow read with `publicOnly` hides a private repository #6485

Merged opened this

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

Merged

`test/flow-public-only.test.ts` is added. It shows that none of the eight reads leaks a private repository's pull when `publicOnly` is true. No read needed fixing, so I changed no source. The new test and the type check pass; I did not run the rest of the suite or the forge's full check.

shipped production is serving it deploy 4db86a7

opened this

test/flow-public-only.test.ts is added. It shows that none of the eight reads leaks a private repository's pull when publicOnly is true. No read needed fixing, so I changed no source. The new test and the type check pass; I did not run the rest of the suite or the forge's full check.

  • Seed: each of two repositories (one public, one private) gets a pull in every state the reads count. The states are approved and quiet, a red check, a conflict run, a queued check, changes requested with a review in flight, a landed pull, and a red batch. Each also gets a pull the finishing pass has noted as waiting to finish.
  • Reads covered: alarmStuck, readChecksPile, conflictedPulls, readOldestApproved, readRedBatches, requestedWaits, reviewersBusy and readVitals.
  • Checks:

- Unfiltered baseline: with publicOnly off, each read does see the private seed, so a pass can't come from an empty seed. - publicOnly on: each read returns only the public repository's numbers. - Private-only forge: with the public repository deleted, every read comes back empty. - Oldest-wait reads: the private pull is seeded as the oldest wait, so a leak would change the answer of alarmStuck and readOldestApproved.

I left out the other reads that take publicOnly (readGateMinutes, readLeadTime, readOpeners, readOutsiders). They are not in this issue's list; their own tests may cover them.

Run it with bun test test/flow-public-only.test.ts.

Closes #6476

commented

test/flow-public-only.test.ts is added. It shows that none of the eight reads leaks a private repository's pull when publicOnly is true. No read needed fixing, so I changed no source. The new test and the type check pass; I did not run the rest of the suite or the forge's full check.

  • Seed: each of two repositories (one public, one private) gets a pull in every state the reads count. The states are approved and quiet, a red check, a conflict run, a queued check, changes requested with a review in flight, a landed pull, and a red batch. Each also gets a pull the finishing pass has noted as waiting to finish.
  • Reads covered: alarmStuck, readChecksPile, conflictedPulls, readOldestApproved, readRedBatches, requestedWaits, reviewersBusy and readVitals.
  • Checks:

- Unfiltered baseline: with publicOnly off, each read does see the private seed, so a pass can't come from an empty seed. - publicOnly on: each read returns only the public repository's numbers. - Private-only forge: with the public repository deleted, every read comes back empty. - Oldest-wait reads: the private pull is seeded as the oldest wait, so a leak would change the answer of alarmStuck and readOldestApproved.

I left out the other reads that take publicOnly (readGateMinutes, readLeadTime, readOpeners, readOutsiders). They are not in this issue's list; their own tests may cover them.

Run it with bun test test/flow-public-only.test.ts.

Approved

Approved. The test file covers the issue's eight reads (alarm_stuck, checks_pile, conflicted, oldest_approved, red_batches, requested, reviewing, vitals). It adds no source, no dependency and no dead code. The preview has nothing to exercise because the change is test-only. The file is not in my working tree, so I could not run it. I judged it by reading it against the read signatures in src/flow, and they match.

The design is sound. The unfiltered baseline proves the seed is not empty. The private pull is seeded as the oldest wait, so a leak would change the alarmStuck and readOldestApproved answers. A private-only forge reads empty.

Two things I would do next:

  1. Add readGateMinutes, readLeadTime, readOpeners and readOutsiders to the same file. They take publicOnly too, and the title says every flow read. The issue's list leaves them out, so this is a follow-up and not a blocker. A new publicOnly read would otherwise ship untested, so the file could also check src/flow for exported functions that take publicOnly.
  2. The third test deletes the public repository and so depends on the order of the tests above it. Seed a fresh private-only database in that test so it can run alone.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs