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

A chapter's item list hides sealed security reports from anyone who cannot see them #14926

Merged opened this

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

Merged

Sealed security reports no longer show up in a chapter's item list for people who aren't allowed to see them. Before this, anyone who could read the repository saw the report's title and number, and the pull that fixes it. The fix.

Notes

shipped production is serving it deploy 9504585

opened this

Sealed security reports no longer show up in a chapter's item list for people who aren't allowed to see them. Before this, anyone who could read the repository saw the report's title and number, and the pull that fixes it.

The fix. itemsOf and pullFacts in src/core/chapters.ts now take an ItemView, which is what sealedScope returns. Writers and crew see every sealed item, the person who filed a report sees their own, and everyone else sees none. A sealed pull the viewer can't see is dropped too, so it doesn't reveal its number or add to the cost of any item it closes, including ones that aren't sealed. The parameter is required, so a new caller can't forget to pass it.

Counts agree with what is shown. Progress, barOf, stopsClose (the list of open issues blocking a close) and the closed-chapter cache all follow the view. The cache is now kept per view, so a writer's list is never handed to a reader.

Where each surface gets its view:

  • Per viewer: the chapters page, the chapter section and line on /next, the API, MCP and the terminal screens use sealedScope for the person viewing.
  • Public only (PUBLIC_ITEMS): text anyone can read never counts or names a sealed item. That covers the manifest line (its SQL now filters sealed = 0) and the chapter wave written into the repository.
  • Home chapter bar: this is cached per repository, so it uses one of two caches: everything for people who can see sealed issues, public for everyone else. Someone who filed a report won't see it in this bar.
  • Everything (EVERY_ITEM): the owner's own close and fill actions, which already check who may act.

Tests. test/chapters-sealed.test.ts covers four cases:

  • A reader and a signed-out visitor see neither the report nor the sealed fix, and the progress and bar totals match the list.
  • The writer sees both, and the reporter sees their own.
  • The manifest line leaves the sealed item out of its count.
  • The closed-chapter cache stays separate per view.

Three of the four fail on today's main. The other existing tests only changed to pass EVERY_ITEM. gate --fix, design-lint and tsc --noEmit are clean, and 18 chapter, wave, manifest, bar and /next test files pass (138 tests). scripts/fast.ts said the diff was too broad to pick tests for, so I didn't run the full suite here.

Not done. chapterOfPulls, which feeds the changelog's grouping by chapter, maps pull numbers to chapters without checking sealing; I left it unchanged. I couldn't find keep_plan among the tools I had, so the issue has no plan.

Try it. File a sealed issue, add it to the open chapter, then open /OWNER/REPO/chapters/NAME signed out: the report isn't listed and the count leaves it out. Signed in as a writer, it's there.

[{"go":"/OWNER/REPO/chapters/NAME","look":"item list and 'n of m done' while signed out","expect":"no sealed report listed or counted"},{"go":"/OWNER/REPO/chapters/NAME","look":"same page signed in as a writer","expect":"the sealed report and its fixing pull are listed and counted"}]

🤖 Generated with Claude Code

Closes #14905

5 earlier comments · 1 event
commented

Sealed security reports no longer show up in a chapter's item list for people who aren't allowed to see them. Before this, anyone who could read the repository saw the report's title and number, and the pull that fixes it.

The fix. itemsOf and pullFacts in src/core/chapters.ts now take an ItemView, which is what sealedScope returns. Writers and crew see every sealed item, the person who filed a report sees their own, and everyone else sees none. A sealed pull the viewer can't see is dropped too, so it doesn't reveal its number or add to the cost of any item it closes, including ones that aren't sealed. The parameter is required, so a new caller can't forget to pass it.

Counts agree with what is shown. Progress, barOf, stopsClose (the list of open issues blocking a close) and the closed-chapter cache all follow the view. The cache is now kept per view, so a writer's list is never handed to a reader.

Where each surface gets its view:

  • Per viewer: the chapters page, the chapter section and line on /next, the API, MCP and the terminal screens use sealedScope for the person viewing.
  • Public only (PUBLIC_ITEMS): text anyone can read never counts or names a sealed item. That covers the manifest line (its SQL now filters sealed = 0) and the chapter wave written into the repository.
  • Home chapter bar: this is cached per repository, so it uses one of two caches: everything for people who can see sealed issues, public for everyone else. Someone who filed a report won't see it in this bar.
  • Everything (EVERY_ITEM): the owner's own close and fill actions, which already check who may act.

Tests. test/chapters-sealed.test.ts covers four cases:

  • A reader and a signed-out visitor see neither the report nor the sealed fix, and the progress and bar totals match the list.
  • The writer sees both, and the reporter sees their own.
  • The manifest line leaves the sealed item out of its count.
  • The closed-chapter cache stays separate per view.

Three of the four fail on today's main. The other existing tests only changed to pass EVERY_ITEM. gate --fix, design-lint and tsc --noEmit are clean, and 18 chapter, wave, manifest, bar and /next test files pass (138 tests). scripts/fast.ts said the diff was too broad to pick tests for, so I didn't run the full suite here.

Not done. chapterOfPulls, which feeds the changelog's grouping by chapter, maps pull numbers to chapters without checking sealing; I left it unchanged. I couldn't find keep_plan among the tools I had, so the issue has no plan.

Try it. File a sealed issue, add it to the open chapter, then open /OWNER/REPO/chapters/NAME signed out: the report isn't listed and the count leaves it out. Signed in as a writer, it's there.

[{"go":"/OWNER/REPO/chapters/NAME","look":"item list and 'n of m done' while signed out","expect":"no sealed report listed or counted"},{"go":"/OWNER/REPO/chapters/NAME","look":"same page signed in as a writer","expect":"the sealed report and its fixing pull are listed and counted"}]

🤖 Generated with Claude Code

commented

<!-- look-pages dc937da2cb3f --> Look pages for dc937da, from the gate:

  • look pages (inferred): this pull changes src/web/pages/chapters.ts, src/web/pages/next_chapters.ts, src/web/studio/chapter_bar.ts; the forge pictures / (src/web/studio/chapter_bar.ts), /docs (src/web/studio/chapter_bar.ts), /explore (src/web/studio/chapter_bar.ts) and 25 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

A chapter's item list now hides sealed security reports from anyone who isn't allowed to see them (#14905). Only the reporter and the repository's writers see such a report listed. Everyone else gets the list and its counts with the report left out.

The filter lives in one place: itemsOf in src/core/chapters.ts now takes the viewer's scope (sealedScope). Everything that lists a chapter's items goes through it:

  • the chapter page and /next's Chapters section;
  • the chapter bar;
  • the API and the MCP repo tool;
  • the terminal's Chapters and /next screens.

So all of them list and count the same things for the same person. test/chapters-sealed.test.ts checks it from both sides: signed out the report is left out of the list and the count, and a writer sees it.

docs/features/chapters.md has a new section, "Sealed reports stay sealed". It says what changed and that the terminal shows what the page shows, which is what the gate's "both doors" rule asked for.

The gate and bun x tsc --noEmit pass. scripts/fast.ts named 2727 test files, too broad to run here, so I ran the 9 chapter test files instead: 54 pass, 0 fail.

Not done here:

  • The gate's notes about comment lines over 100 columns are left for the nightly rewrap.
  • The gate also flagged a helper in the new test (person) as looking like one in test/app-dump-import.test.ts. I left it alone, because it is a separate test fixture.

How to try it: file a sealed issue, add it to the open chapter, then open the chapter's page signed out and again as a writer.

[
  {"go": "/OWNER/REPO/chapters/NAME", "look": "the item list and the count line, signed out", "expect": "the sealed security report added to the chapter is not listed and the count leaves it out"},
  {"go": "/OWNER/REPO/chapters/NAME", "look": "the item list, signed in as a writer", "expect": "the sealed report is listed and counted"},
  {"go": "/OWNER/REPO/next", "look": "the Chapters section, signed out", "expect": "the sealed report is not named among the open chapter's items"}
]

🤖 Generated with Claude Code

commented

<!-- look-pages a5366aae406c --> Look pages for a5366aa, from the gate:

  • look pages (inferred): this pull changes src/web/pages/chapters.ts, src/web/pages/next_chapters.ts, src/web/studio/chapter_bar.ts; the forge pictures / (src/web/studio/chapter_bar.ts), /docs (src/web/studio/chapter_bar.ts), /explore (src/web/studio/chapter_bar.ts) and 25 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

A chapter's item list now hides sealed security reports from anyone who isn't allowed to see them (#14905). Only the reporter and the repository's writers see such a report listed. Everyone else gets the list and its counts with the report left out.

The filter lives in one place: itemsOf in src/core/chapters.ts now takes the viewer's scope (sealedScope). Everything that lists a chapter's items goes through it:

  • the chapter page and /next's Chapters section;
  • the chapter bar;
  • the API and the MCP repo tool;
  • the terminal's Chapters and /next screens.

So all of them list and count the same things for the same person. docs/features/chapters.md has a new section, "Sealed reports stay sealed", covering the page and the terminal.

The feedback named 28 inferred look pages, because chapter_bar.ts is imported by most routes. A commit now says "No look:" with the reason. The preview sample seeds no chapter and no sealed issue, so every pictured page draws exactly what it drew before. Pictures can't show the change; test/chapters-sealed.test.ts checks it from both sides: signed out the report is left out of the list and the count, and a writer sees it.

The gate and bun x tsc --noEmit pass. scripts/fast.ts named 2727 test files, too broad to run here, so I ran the 9 chapter test files instead: 54 pass, 0 fail.

How to try it: file a sealed issue, add it to the open chapter, then open the chapter's page signed out and again as a writer.

[
  {"go": "/OWNER/REPO/chapters/NAME", "look": "the item list and the count line, signed out", "expect": "the sealed security report added to the chapter is not listed and the count leaves it out"},
  {"go": "/OWNER/REPO/chapters/NAME", "look": "the item list, signed in as a writer", "expect": "the sealed report is listed and counted"},
  {"go": "/OWNER/REPO/next", "look": "the Chapters section, signed out", "expect": "the sealed report is not named among the open chapter's items"}
]

🤖 Generated with Claude Code

Changes requested — before the latest push

The core filter is sound: itemsOf and pullFacts take the view, sealed pulls are dropped, the closed-chapter cache is keyed per view. Changes needed, all in this round:

  1. First: inTheWay and stopsClose default view to EVERY_ITEM. That is an unsafe default and defeats the 'required parameter, a caller cannot forget' point: any new caller leaks sealed titles. Make view required and pass EVERY_ITEM explicitly where the owner's own act wants it.
  2. The chapter bar is built from two caches (all / public), so a reporter sees their own sealed item on the chapter page but not in the bar's count. That breaks 'counts agree with what is shown'. Either key the bar by sealedScope (writer all, reporter by id, else none) or state the difference and test it.
  3. Tests cover only core itemsOf, barOf and the manifest. The page, the API (/api/v1/repos/.../chapters), the MCP repo tool, the /next Chapters section, the chapter bar's per-audience cache and the terminal screens are the behaviour the issue is about, and none has a test that fails without the change. Add a request-level test for the page, API and MCP (reader and signed-out see none, writer sees it), and one for the bar and the TUI.
  4. chapterOfPulls (changelog grouping by chapter) still maps sealed pull numbers to chapters without a view. Fix it or open an issue and link it in the pull.
  5. frozen is keyed per reporter id, so many distinct viewers can churn the 200-entry cache; cache only the all and none views and filter the reporter's own on read.
commented

A chapter's item list now hides sealed security reports from anyone who isn't allowed to see them (#14905). Only the reporter and the repository's writers see such a report listed. Everyone else gets the list and its counts with the report left out. Everything that lists a chapter's items goes through itemsOf with the viewer's sealedScope. That covers the chapter page, /next, the chapter bar, the API, the MCP repo tool and the terminal screens, so they list and count the same things for the same person.

This round follows the review:

  1. No unsafe default. inTheWay and stopsClose now require the view. Only the owner's close refusal (refusalWords) passes EVERY_ITEM, and only someone who administers the repository can reach that refusal.
  2. The bar matches the page. src/web/studio/chapter_bar.ts reads through sealedScope too, so a reporter's bar counts their own report, as the page does.
  3. Request-level tests. test/chapters-sealed.test.ts now checks:
    • the page, /next and the API: the writer and the reporter see the report; a reader and a signed-out visitor see neither its title nor its number;
    • the MCP repo tool: only the writer gets the report's item;
    • the web bar: 2 for the writer and the reporter, 1 for anyone else;
    • the terminal's Chapters screen and the chapter's list: the same split.

    With the sealed filter switched off, 8 of the file's 10 tests fail.

  4. chapterOfPulls takes the view too, so the changelog's grouping by chapter (the release grouping and the terminal's changelog) leaves out a sealed pull for a reader.
  5. The cache can't churn. A closed chapter's list is kept for two views only: everything, and the public view. The new keptView sends a reader, or a reporter with no sealed issue in the repository, to the public view. A reporter who filed one gets their list read fresh each time. The bar's cache follows the same rule.

docs/features/chapters.md has a section, "Sealed reports stay sealed", covering the page and the terminal. A commit carries a No look: line: the preview sample holds no chapter with a sealed report, so every pictured page draws what it drew before.

The gate, bun x tsc --noEmit and bun scripts/design-lint.ts pass. scripts/fast.ts named too many test files to run here, so I ran the 48 chapter, changelog and wave test files instead: 322 pass, 0 fail. Two existing test files (test/changelog-chapters.test.ts, test/chapters-page.test.ts) only changed to pass EVERY_ITEM now that the view is required.

The gate's note that the new test's person helper looks like one in test/app-dump-import.test.ts is left alone, because it is a separate test fixture.

How to try it: file a sealed issue, add it to the open chapter, then open the chapter's page signed out and again as a writer.

[
  {"go": "/OWNER/REPO/chapters/NAME", "look": "the item list and the count line, signed out", "expect": "the sealed security report added to the chapter is not listed and the count leaves it out"},
  {"go": "/OWNER/REPO/chapters/NAME", "look": "the item list, signed in as a writer or as the report's author", "expect": "the sealed report is listed and counted"},
  {"go": "/OWNER/REPO/next", "look": "the Chapters section, signed out", "expect": "the sealed report is not named among the open chapter's items"}
]

🤖 Generated with Claude Code

Approved

All earlier asks are met: the view is required (no default) on itemsOf, inTheWay, stopsClose and chapterOfPulls; the chapter bar reads through sealedScope; request-level tests cover the page, /next, API, MCP, bar and terminal; the closed-chapter cache keeps only the all and public views (keptView), so readers cannot churn it. Counts (progress, bar, manifest SQL, leftOf) follow the list. The remaining EVERY_ITEM uses sit behind the owner/admin checks. The how-to is in docs/features/chapters.md, not README. Non-blocking: the gate note about the duplicate person helper in the new test.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs