Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions src/__tests__/unit/components/BenchmarkRunsHistory.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@
setExpandedId: mockSetExpandedId,
});
render(React.createElement(BenchmarkRunsHistory));
expect(screen.getByText("72/74")).toBeInTheDocument();
expect(screen.getByTestId("passed-cell-count").textContent).toBe("72");

Check failure on line 336 in src/__tests__/unit/components/BenchmarkRunsHistory.test.tsx

View workflow job for this annotation

GitHub Actions / unit-tests

src/__tests__/unit/components/BenchmarkRunsHistory.test.tsx > BenchmarkRunsHistory > renders PASS badge and score when all_pass=true and n_passed/n_total present

TestingLibraryElementError: Unable to find an element by: [data-testid="passed-cell-count"] Ignored nodes: comments, script, style <body> <div> <div class="space-y-3" > <div class="flex items-center gap-2 flex-wrap" > <div data-testid="task-filter" data-value="all" > <div class="w-[340px]" data-testid="task-filter-trigger" > <span> Filter by task </span> </div> <div> <button data-testid="task-filter-option-all" > All tasks </button> <button data-testid="task-filter-option-antitrust/task-1" > Analyze Antitrust Strategy ( 1 ) </button> </div> </div> <div class="ml-auto" > <div data-rows="1" data-testid="summary-strip" data-window="10" > <button data-testid="set-window-25" > Last 25 </button> </div> </div> </div> <div class="rounded-lg border bg-card overflow-hidden" > <table class="w-full text-sm" > <thead> <tr class="border-b bg-muted/50" > <th class="text-left px-4 py-3 font-medium text-muted-foreground" > Task </th> <th class="text-left px-4 py-3 font-medium text-muted-foreground" > <select aria-label="Filter by run type" class="bg-transparent font-medium text-muted-foreground text-sm cursor-pointer focus:outline-none hover:text-foreground [&>option]:bg-popover [&>option]:text-popover-foreground" data-testid="type-filter" > <option value="all" > All types </option> <option value="manual" > Manual </option> <option value="recursion" > Recursion </option> </select> </th> <th class="text-left px-4 py-3 font-medium text-muted-foreground" > Started </th> <th class="text-left px-4 py-3 font-medium text-muted-foreground" > Runner Status </th> <th class="text-left px-4 py-3 font-medium text-muted-foreground" > Score </th> <th class="text-left px-4 py-3 font-medium text-muted-foreground" > <span class="cursor-help" title="Criteria whose definition is flagged as broken. They are excluded from both sides of the score, which is why the denominator can be smaller than the full rubric roster." > Contested </span> </th> <th class="text-left px-4 py-3 font-medium text-muted-foreground" > <span class="cursor-help" title="Verdicts the judge itself flagged for review. Always non-passing criteria — each one is potential score upside." > Disputed </span> </th> <th class="text-left px-4 py-3 font-medium text-muted-foreground" > Chat </th> <th class="text-left px-4 py-3 font-medium tex
expect(screen.getByTestId("total-cell-count").textContent).toBe("74");
expect(screen.getByText("PASS")).toBeInTheDocument();
});

Expand All @@ -347,7 +348,8 @@
setExpandedId: mockSetExpandedId,
});
render(React.createElement(BenchmarkRunsHistory));
expect(screen.getByText("10/20")).toBeInTheDocument();
expect(screen.getByTestId("passed-cell-count").textContent).toBe("10");

Check failure on line 351 in src/__tests__/unit/components/BenchmarkRunsHistory.test.tsx

View workflow job for this annotation

GitHub Actions / unit-tests

src/__tests__/unit/components/BenchmarkRunsHistory.test.tsx > BenchmarkRunsHistory > renders score with no badge when all_pass=false

TestingLibraryElementError: Unable to find an element by: [data-testid="passed-cell-count"] Ignored nodes: comments, script, style <body> <div> <div class="space-y-3" > <div class="flex items-center gap-2 flex-wrap" > <div data-testid="task-filter" data-value="all" > <div class="w-[340px]" data-testid="task-filter-trigger" > <span> Filter by task </span> </div> <div> <button data-testid="task-filter-option-all" > All tasks </button> <button data-testid="task-filter-option-antitrust/task-1" > Analyze Antitrust Strategy ( 1 ) </button> </div> </div> <div class="ml-auto" > <div data-rows="1" data-testid="summary-strip" data-window="10" > <button data-testid="set-window-25" > Last 25 </button> </div> </div> </div> <div class="rounded-lg border bg-card overflow-hidden" > <table class="w-full text-sm" > <thead> <tr class="border-b bg-muted/50" > <th class="text-left px-4 py-3 font-medium text-muted-foreground" > Task </th> <th class="text-left px-4 py-3 font-medium text-muted-foreground" > <select aria-label="Filter by run type" class="bg-transparent font-medium text-muted-foreground text-sm cursor-pointer focus:outline-none hover:text-foreground [&>option]:bg-popover [&>option]:text-popover-foreground" data-testid="type-filter" > <option value="all" > All types </option> <option value="manual" > Manual </option> <option value="recursion" > Recursion </option> </select> </th> <th class="text-left px-4 py-3 font-medium text-muted-foreground" > Started </th> <th class="text-left px-4 py-3 font-medium text-muted-foreground" > Runner Status </th> <th class="text-left px-4 py-3 font-medium text-muted-foreground" > Score </th> <th class="text-left px-4 py-3 font-medium text-muted-foreground" > <span class="cursor-help" title="Criteria whose definition is flagged as broken. They are excluded from both sides of the score, which is why the denominator can be smaller than the full rubric roster." > Contested </span> </th> <th class="text-left px-4 py-3 font-medium text-muted-foreground" > <span class="cursor-help" title="Verdicts the judge itself flagged for review. Always non-passing criteria — each one is potential score upside." > Disputed </span> </th> <th class="text-left px-4 py-3 font-medium text-muted-foreground" > Chat </th> <th class="text-left px-4 py-3 font-medium tex
expect(screen.getByTestId("total-cell-count").textContent).toBe("20");
expect(screen.queryByText("FAIL")).toBeNull();
expect(screen.queryByText("PASS")).toBeNull();
});
Expand Down Expand Up @@ -467,15 +469,15 @@

// ─── colSpan tests ─────────────────────────────────────────────────────────

it("expanded row colSpan is 9 for non-super-admin (Task + Type + Started + Runner Status + Score + Contested + Disputed + Chat + Report)", async () => {
it("expanded row colSpan is 11 for non-super-admin (Task + Type + Started + Runner Status + Passed + Failed + Contested + Disputed + Total + Chat + Report)", async () => {
const user = userEvent.setup();
render(React.createElement(BenchmarkRunsHistory));

const row = screen.getByText("Analyze Antitrust Strategy").closest("tr")!;
await user.click(row);

const expandedCell = screen.getByTestId("results-runner-1").closest("td")!;
expect(expandedCell.getAttribute("colspan")).toBe("9");
expect(expandedCell.getAttribute("colspan")).toBe("11");
});

it("expanded row colSpan is 10 for super-admin (adds Stakwork column)", async () => {
Expand All @@ -492,7 +494,7 @@
await user.click(row);

const expandedCell = screen.getByTestId("results-runner-1").closest("td")!;
expect(expandedCell.getAttribute("colspan")).toBe("10");
expect(expandedCell.getAttribute("colspan")).toBe("12");
});

// ─── Existing interaction tests ────────────────────────────────────────────
Expand Down Expand Up @@ -774,7 +776,7 @@
await user.click(row);

const expandedCell = screen.getByTestId("results-runner-1").closest("td")!;
expect(expandedCell.getAttribute("colspan")).toBe("9");
expect(expandedCell.getAttribute("colspan")).toBe("11");
});

// ─── Chat column tests ─────────────────────────────────────────────────────
Expand Down Expand Up @@ -1236,7 +1238,8 @@
render(<BenchmarkRunsHistory />);

const row = screen.getByTestId("run-row-a-1");
expect(row.textContent).toContain("34/39");
expect(row.querySelector('[data-testid="passed-cell-count"]')?.textContent).toBe("34");

Check failure on line 1241 in src/__tests__/unit/components/BenchmarkRunsHistory.test.tsx

View workflow job for this annotation

GitHub Actions / unit-tests

src/__tests__/unit/components/BenchmarkRunsHistory.test.tsx > BenchmarkRunsHistory — run types > renders score and report link on recursion rows that carry them

AssertionError: expected undefined to be '34' // Object.is equality - Expected: "34" + Received: undefined ❯ src/__tests__/unit/components/BenchmarkRunsHistory.test.tsx:1241:81
expect(row.querySelector('[data-testid="total-cell-count"]')?.textContent).toBe("39");
expect(row.textContent).not.toContain("FAIL");
const links = screen.getAllByTestId("run-report-link");
expect(
Expand Down Expand Up @@ -1363,10 +1366,11 @@

const row = screen.getByTestId("run-row-r-1");
// Graph numerator 8/10 against the roster denominator (10 - 2 contested)
expect(row.textContent).toContain("8/8");
expect(row.querySelector('[data-testid="passed-cell-count"]')?.textContent).toBe("8");

Check failure on line 1369 in src/__tests__/unit/components/BenchmarkRunsHistory.test.tsx

View workflow job for this annotation

GitHub Actions / unit-tests

src/__tests__/unit/components/BenchmarkRunsHistory.test.tsx > BenchmarkRunsHistory — graph-first score numerators > scores a recursion row from the graph output joined by projectId suffix

AssertionError: expected undefined to be '8' // Object.is equality - Expected: "8" + Received: undefined ❯ src/__tests__/unit/components/BenchmarkRunsHistory.test.tsx:1369:81
expect(row.querySelector('[data-testid="total-cell-count"]')?.textContent).toBe("8");
expect(row.textContent).toContain("PASS");
expect(scoreSourceOf("run-row-r-1")).toBe("graph");
expect(screen.getByTestId("score-cell-contested")).toBeInTheDocument();
expect(screen.getByTestId("contested-cell-count")).toBeInTheDocument();
});

it("falls back to the result-table score when no graph output joins", () => {
Expand All @@ -1389,7 +1393,8 @@
render(<BenchmarkRunsHistory />);

const row = screen.getByTestId("run-row-r-1");
expect(row.textContent).toContain("34/39");
expect(row.querySelector('[data-testid="passed-cell-count"]')?.textContent).toBe("34");

Check failure on line 1396 in src/__tests__/unit/components/BenchmarkRunsHistory.test.tsx

View workflow job for this annotation

GitHub Actions / unit-tests

src/__tests__/unit/components/BenchmarkRunsHistory.test.tsx > BenchmarkRunsHistory — graph-first score numerators > falls back to the result-table score when no graph output joins

AssertionError: expected undefined to be '34' // Object.is equality - Expected: "34" + Received: undefined ❯ src/__tests__/unit/components/BenchmarkRunsHistory.test.tsx:1396:81
expect(row.querySelector('[data-testid="total-cell-count"]')?.textContent).toBe("39");
expect(row.textContent).not.toContain("FAIL");
expect(scoreSourceOf("run-row-r-1")).toBe("result");
});
Expand All @@ -1414,7 +1419,8 @@
render(<BenchmarkRunsHistory />);

const row = screen.getByTestId("run-row-m-1");
expect(row.textContent).toContain("60/74");
expect(row.querySelector('[data-testid="passed-cell-count"]')?.textContent).toBe("60");

Check failure on line 1422 in src/__tests__/unit/components/BenchmarkRunsHistory.test.tsx

View workflow job for this annotation

GitHub Actions / unit-tests

src/__tests__/unit/components/BenchmarkRunsHistory.test.tsx > BenchmarkRunsHistory — graph-first score numerators > prefers the graph output over echoed counts on a manual row and requests its trigger ref

AssertionError: expected undefined to be '60' // Object.is equality - Expected: "60" + Received: undefined ❯ src/__tests__/unit/components/BenchmarkRunsHistory.test.tsx:1422:81
expect(row.querySelector('[data-testid="total-cell-count"]')?.textContent).toBe("74");
expect(scoreSourceOf("run-row-m-1")).toBe("graph");
// The hook was asked for this task's trigger ref (the requirement-hosted
// trigger only the row knows about).
Expand Down Expand Up @@ -1451,9 +1457,10 @@

const row = screen.getByTestId("run-row-m-1");
// Node counts verbatim: NOT contested-adjusted, NOT the result-column 50/74
expect(row.textContent).toContain("9/10");
expect(row.querySelector('[data-testid="passed-cell-count"]')?.textContent).toBe("9");

Check failure on line 1460 in src/__tests__/unit/components/BenchmarkRunsHistory.test.tsx

View workflow job for this annotation

GitHub Actions / unit-tests

src/__tests__/unit/components/BenchmarkRunsHistory.test.tsx > BenchmarkRunsHistory — graph-first score numerators > a stored evalOutputRef pointer scores verbatim from the node — both numbers, no roster overlay

AssertionError: expected undefined to be '9' // Object.is equality - Expected: "9" + Received: undefined ❯ src/__tests__/unit/components/BenchmarkRunsHistory.test.tsx:1460:81
expect(row.querySelector('[data-testid="total-cell-count"]')?.textContent).toBe("10");
expect(scoreSourceOf("run-row-m-1")).toBe("output-ref");
expect(screen.queryByTestId("score-cell-contested")).toBeNull();
expect(screen.queryByTestId("contested-cell-count")).toBeNull();
// The pointer was requested from the graph-scores hook
expect(mockGraphScoresMapHook).toHaveBeenCalledWith([
{ taskSlug: TASK, triggerRefs: ["trig-1"], outputRefs: ["out-9"] },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* The runs-history rows no longer render the RubricBreakdownStrip — contested
* and disputed detail lives in the run report instead. These tests verify that
* no strip chips appear in rows on any path, and that the invisible
* score-cell-contested data anchor (used to verify contested-exclusion score
* contested-cell-count data anchor (used to verify contested-exclusion score
* derivation) is still applied when the row's score excludes contested criteria.
*
* NOTE: Because the adjusted* arrays are internal to the component, we test
Expand Down Expand Up @@ -191,7 +191,7 @@ describe("BenchmarkRunsHistory — ScoreCell breakdown strip", () => {
expect(screen.queryByTestId("rubric-breakdown-disputed")).not.toBeInTheDocument();
});

it("scoring path: no strip chips render; score-cell-contested anchor present exactly once", () => {
it("scoring path: no strip chips render; contested-cell-count anchor present exactly once", () => {
const roster = [
{ ref_id: "r1", id: "C-001", name: "Criterion 1", contested: false },
{ ref_id: "r2", id: "C-002", name: "Criterion 2", contested: false },
Expand Down Expand Up @@ -224,6 +224,6 @@ describe("BenchmarkRunsHistory — ScoreCell breakdown strip", () => {
expect(screen.queryByTestId("rubric-breakdown-contested")).toBeNull();
expect(screen.queryByTestId("rubric-breakdown-disputed")).toBeNull();
// The invisible data anchor still marks rows whose score excludes contested criteria.
expect(screen.getAllByTestId("score-cell-contested").length).toBe(1);
expect(screen.getAllByTestId("contested-cell-count").length).toBe(1);
});
});
2 changes: 1 addition & 1 deletion src/components/legal/BenchmarkRunsHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ export function BenchmarkRunsHistory({

// colSpan: Task + Type + Started + Runner Status + Score + Contested +
// Disputed + Chat + Report + (Stakwork if super admin)
const colSpan = isSuperAdmin ? 10 : 9;
const colSpan = isSuperAdmin ? 12 : 11;

return (
<div className="space-y-3">
Expand Down
Loading