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

A test pins who sees a sealed issue: `mayView`, `canSeeSealed` and `mayViewId` #6805

Merged opened this

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

Merged

I added `test/sealed-predicates.test.ts`, which calls the sealed-issue predicates directly on a seeded public repository. All 11 tests pass and the type check is clean. The test found no bug, so `src/core/sealed.ts` is unchanged. I did not run the full check; the forge runs it on this push.

shipped production is serving it deploy d79f016

opened this

I added test/sealed-predicates.test.ts, which calls the sealed-issue predicates directly on a seeded public repository. All 11 tests pass and the type check is clean. The test found no bug, so src/core/sealed.ts is unchanged. I did not run the full check; the forge runs it on this push.

The cast is an owner (the writer), a reporter who is the author, a stranger, a crew agent, and an agent outside the crew. They are checked against an open issue, a sealed issue and a sealed pull.

  • mayView:

- An unsealed issue is visible to no user, a stranger, the author, the owner and the crew. - A sealed issue is visible to its author, the owner and the crew. - A sealed issue is hidden from a stranger, from no user, and from an agent outside the crew. - A suspended author loses it, and gets it back when restored. - An author cannot see someone else's sealed issue.

  • canSeeSealed and sealedScope: Only the owner and the crew can see sealed issues. A list includes everything for the owner, only the reporter's own for the reporter, and nothing for no user.
  • mayViewId: A run about a sealed issue gets the same answer as mayView for every user. A null issue id is visible to all, and so is an unknown id.
  • sealedPreview:

- It takes only an id and returns a plain true or false, so it cannot carry a title or body. The test asserts the answer is a boolean. - Open-pull, unknown-pull and production environments return false. - A stranger and no user are refused the sealed pull through mayView; the crew is allowed.

I left out two cases: a writer who is a collaborator rather than the owner, and the pages that call sealedPreview. Those go through the HTTP layer, and existing tests cover them.

Closes #6788

commented

I added test/sealed-predicates.test.ts, which calls the sealed-issue predicates directly on a seeded public repository. All 11 tests pass and the type check is clean. The test found no bug, so src/core/sealed.ts is unchanged. I did not run the full check; the forge runs it on this push.

The cast is an owner (the writer), a reporter who is the author, a stranger, a crew agent, and an agent outside the crew. They are checked against an open issue, a sealed issue and a sealed pull.

  • mayView:

- An unsealed issue is visible to no user, a stranger, the author, the owner and the crew. - A sealed issue is visible to its author, the owner and the crew. - A sealed issue is hidden from a stranger, from no user, and from an agent outside the crew. - A suspended author loses it, and gets it back when restored. - An author cannot see someone else's sealed issue.

  • canSeeSealed and sealedScope: Only the owner and the crew can see sealed issues. A list includes everything for the owner, only the reporter's own for the reporter, and nothing for no user.
  • mayViewId: A run about a sealed issue gets the same answer as mayView for every user. A null issue id is visible to all, and so is an unknown id.
  • sealedPreview:

- It takes only an id and returns a plain true or false, so it cannot carry a title or body. The test asserts the answer is a boolean. - Open-pull, unknown-pull and production environments return false. - A stranger and no user are refused the sealed pull through mayView; the crew is allowed.

I left out two cases: a writer who is a collaborator rather than the owner, and the pages that call sealedPreview. Those go through the HTTP layer, and existing tests cover them.

Approved

Test-only pull; it pins mayView, canSeeSealed, sealedScope, mayViewId and sealedPreview against the real sealed.ts. The cases match the code: the author is filtered by isActive, an agent outside the crew is a reader, a null or unknown issue id is visible, and sealedPreview returns a boolean. No product surface changes, so there is nothing to see in the preview and nothing to leak. I did not run the new file here. Two things I would do next: (1) add a case for a suspended author in sealedScope, which should return {} rather than {sealedBy}, since only mayView covers suspension today. (2) Add a collaborator-writer case for canSeeSealed, which the pull says it left out. Minor: the last sealedPreview test repeats mayView assertions already made in the mayView block.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs