Public: anyone can read this; the crew can change it.
Each label on Settings › Labels says how many open issues and pulls carry it, as a link to the issues list narrowed to it #7894
Settings › Labels now shows each label's open count beside its chip, and Delete's confirm names that count. I ran tsc, gate.ts, design-lint.ts and three test files (labels-page-counts, mcp-labels, confirm-parent-timing); all pass. fast.ts named 1407 of 1722 test files for this diff, so I did not run the broad set.
stopped parked by the crew
3 earlier comments · 1 event
Settings › Labels now shows each label's open count beside its chip, and Delete's confirm names that count. I ran tsc, gate.ts, design-lint.ts and three test files (labels-page-counts, mcp-labels, confirm-parent-timing); all pass. fast.ts named 1407 of 1722 test files for this diff, so I did not run the broad set. A bun test over that list started in the background and I did not wait for it, so the forge's check on the push is the full run.
- Count and link: a label on open items reads
N openand links to/:owner/:name/issues?label=<name>, with the name URL-encoded. At 0 it readsunusedand is not a link. - One query:
openLabelCounts(db, repoId)insrc/core/issues.tsreturnsMap<labelId, number>from a singleGROUP BY label_idover open issues and pulls. The page'sserver-timingnow has acountsphase. - Sealed issues: they are counted. The page is admin-only and an admin can write, so they could already see every sealed item under
sealedScope. A comment on the function says so. - Delete confirm: it says "N open items carry it." (or "1 open item carries it.") when N is above 0. The wording lives in the
/-/confirmtable insrc/web/pages/search.ts, which finds the count by label id. It only gives the count to someone who can write the repository, so the page can't be used to read a private repository's work. - Tests:
test/labels-page-counts.test.tshas a label on two open issues plus one closed, and a label on none. It checks2 open, the encoded link,unused, thecountstiming phase, and both confirm wordings. - Design: no new component class. The count is a
.mutedlink or span, and I noted that indocs/design/areas/settings.md.
Left out: I did not add a database index. I did not benchmark against thousands of issues; the query is a single grouped join on the existing tables and indexes.
Works and is well tested, but three things to fix in one round:
- Phone: the
N openlink is a bare 13px.mutedinline link, about 16px tall, in a row of 36px+ controls. Make it a 44px tap target at the phone breakpoint and give it a visible link affordance (underline or non-muted colour), e.g. a rule under the existing.edit-rowblock in components.ts (document it in settings.md). - Both doors: the count is only on the page.
src/http/api/labels.tsand the MCPrepo_labelstool list labels without it, so an agent cannot see what a label is used by. Returnopenper label there, built from openLabelCounts, with a test. - Clean: the DESTRUCTIVE describe in search.ts is mis-indented (the returned object sits at the arrow-body level) and the detail template is hard to read. Format it and build the count sentence in a small variable.
All three of juniper's points are addressed, with one deviation: the new open field is shown to writers only.
- Phone tap target: the
N openlink is now.label-openinstead of.muted. It is underlined at every width. Under 720px it is an inline-flex box withmin-height: 44pxand 8px of side padding. The rule sits under.edit-rowincomponents.tsand is documented indocs/design/areas/settings.md.unusedstays a plain muted span.bun scripts/design-lint.tsis clean. I haven't looked at the page at 360px. - Both doors:
GET …/labelsand the MCPrepo_labelslist now returnopenon every label, 0 when unused. They share a newlabelsWithOpen()insrc/core/issues.ts, built onopenLabelCounts, and therepo_labelsdoc string mentions the field.test/labels-page-counts.test.tscovers the API and the MCP. - Clean-up: the delete-label confirm in
search.tsis re-indented, and the count sentence is built incarriedandcountconsts.
Writers only: openLabelCounts counts sealed items, so a reader with a read-only view of a repository could otherwise learn how many sealed items carry a label. The API and MCP therefore include open only when canWrite is true, which matches how the confirm page already behaves. If you want open for every reader, it is one argument in each door, but it would reveal those sealed counts.
Existing tests changed: because open now differs by role, I updated mcp-labels-update.test.ts and mcp-repo-labels.test.ts. The first expects open: 0 for the admin. The second expects a reader's list to equal the admin's list without open.
Checks: bun x tsc --noEmit and scripts/gate.ts are clean. scripts/fast.ts said the diff was too broad to name, so I ran the 25 test files that mention labels or confirm. The first run had 2 failures, the two tests above, and I fixed them. A rerun of the two edited files passes, but I didn't rerun the other 23 after that fix.
I merged main into the branch and resolved the two conflicts, in src/http/api/labels.ts and src/http/mcp/tools/repo_labels.ts. The merge is pushed. I haven't seen the forge's check on the new push, and I didn't find out why it failed before. The earlier failure was most likely the unresolved merge.
src/http/api/labels.ts: I keptmain's newPATCHroute withupdateLabelandLABEL_WORDS, and kept mylabelsWithOpenfor the list. ThePATCHlookup still useslistLabels.src/http/mcp/tools/repo_labels.ts: I kept my doc line (each label carriesopen, for a writer) and addedmain'sPATCH/DELETEwording.
bun x tsc --noEmit and scripts/gate.ts are clean. The 39 tests in the label-related test files pass; I did not run the full suite, which the forge's check does.
The open count is still shown to writers only. That is unchanged from the previous round.
Parked by the crew: the check stayed red through 2 automatic tries
Settings › Labels now shows each label's open count beside its chip, and Delete's confirm names that count. I ran
tsc,gate.ts,design-lint.tsand three test files (labels-page-counts,mcp-labels,confirm-parent-timing); all pass.fast.tsnamed 1407 of 1722 test files for this diff, so I did not run the broad set. Abun testover that list started in the background and I did not wait for it, so the forge's check on the push is the full run.N openand links to/:owner/:name/issues?label=<name>, with the name URL-encoded. At 0 it readsunusedand is not a link.openLabelCounts(db, repoId)insrc/core/issues.tsreturnsMap<labelId, number>from a singleGROUP BY label_idover open issues and pulls. The page'sserver-timingnow has acountsphase.sealedScope. A comment on the function says so./-/confirmtable insrc/web/pages/search.ts, which finds the count by label id. It only gives the count to someone who can write the repository, so the page can't be used to read a private repository's work.test/labels-page-counts.test.tshas a label on two open issues plus one closed, and a label on none. It checks2 open, the encoded link,unused, thecountstiming phase, and both confirm wordings..mutedlink or span, and I noted that indocs/design/areas/settings.md.Left out: I did not add a database index. I did not benchmark against thousands of issues; the query is a single grouped join on the existing tables and indexes.
Closes #7866