Skip to content

Commit 7c57d3b

Browse files
authored
Merge pull request #7145 from shin-core/fix/command-table-role-summary-7096
fix(ui): document chat and generate-tests default roles in the command table
2 parents 9fb0baf + 61a8722 commit 7c57d3b

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

apps/loopover-ui/src/components/site/command-table.test.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import { render, screen, within } from "@testing-library/react";
22
import { describe, expect, it } from "vitest";
33

44
import { CommandTable } from "@/components/site/command-table";
5+
import {
6+
ACTION_COMMAND_ENTRIES,
7+
MAINTAINER_COMMAND_ENTRIES,
8+
PUBLIC_COMMAND_ENTRIES,
9+
} from "@/lib/command-reference";
510

611
// #6986: pinned after migrating the hand-rolled <table> markup onto the shared Table primitive --
712
// confirms the real table structure, columns, and default-role lookup still render correctly.
@@ -43,4 +48,24 @@ describe("CommandTable", () => {
4348
render(<CommandTable title="Commands reference" entries={[]} />);
4449
expect(screen.getByRole("heading", { name: "Commands reference" })).toBeTruthy();
4550
});
51+
52+
it("has a DEFAULT_ROLE_SUMMARY entry for every generated command id, never the generic fallback (#7096)", () => {
53+
// Drift guard: a new command added to any of the three src/github/commands.ts catalogs without a matching
54+
// DEFAULT_ROLE_SUMMARY entry must fail here rather than silently render "see policy" on the live docs page.
55+
const allEntries = [
56+
...PUBLIC_COMMAND_ENTRIES,
57+
...MAINTAINER_COMMAND_ENTRIES,
58+
...ACTION_COMMAND_ENTRIES,
59+
];
60+
expect(allEntries.length).toBeGreaterThan(0);
61+
const { container } = render(<CommandTable title="All commands" entries={allEntries} />);
62+
const missing = allEntries
63+
.filter((entry) => within(container).queryByText(`@loopover ${entry.id}`))
64+
.filter((entry) => {
65+
const row = within(container).getByText(`@loopover ${entry.id}`).closest("tr");
66+
return row?.textContent?.includes("see policy");
67+
})
68+
.map((entry) => entry.id);
69+
expect(missing).toEqual([]);
70+
});
4671
});

apps/loopover-ui/src/components/site/command-table.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
const DEFAULT_ROLE_SUMMARY: Record<string, string> = {
1111
help: "maintainer, collaborator, confirmed_miner (default policy)",
1212
ask: "maintainer, collaborator, confirmed_miner",
13+
chat: "maintainer, collaborator, pr_author (rate-limited; opt-in per repo)",
1314
preflight: "maintainer, collaborator, confirmed_miner",
1415
blockers: "maintainer, collaborator, confirmed_miner",
1516
"duplicate-check": "maintainer, collaborator, confirmed_miner",
@@ -34,6 +35,7 @@ const DEFAULT_ROLE_SUMMARY: Record<string, string> = {
3435
resolve: "maintainer, collaborator",
3536
configuration: "maintainer, collaborator",
3637
explain: "maintainer, collaborator",
38+
"generate-tests": "maintainer",
3739
};
3840

3941
export function CommandTable({

0 commit comments

Comments
 (0)