Skip to content
Merged
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
8 changes: 6 additions & 2 deletions src/scenarios/scenario-summary.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { sanitizePublicComment } from "../github/commands";

Check warning on line 1 in src/scenarios/scenario-summary.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

Possible duplicate overlap

Items reference the same linked issue #624.

Check notice on line 1 in src/scenarios/scenario-summary.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

Possible duplicate overlap

Open PR work references issue #624.

Check notice on line 1 in src/scenarios/scenario-summary.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

Issue discovery is disabled for this repo

This repo is configured for direct contribution review rather than issue-discovery flow.
import type { EligibilityPlan } from "../services/eligibility-plan";
import type { OpenPrPressureSimulation, OpenPrStrategyOption } from "../services/open-pr-pressure-scenarios";
import type { ScoreGateBlocker } from "../scoring/preview";
Expand Down Expand Up @@ -178,8 +178,12 @@
}

function assertPublicSummaryClean(summary: PublicScenarioSummary): void {
Comment thread
JSONbored marked this conversation as resolved.
const serialized = JSON.stringify(summary);
/* v8 ignore start -- All text fields are sanitized before this guard; defensive check for future fields. */
// Scan only rendered free-text fields. repoFullName/generatedAt are structural identifiers (the repo
// the summary is about), not sanitized content -- a legitimately named repo (e.g. "owner/hotkey-vault")
// must not make this guard throw and fail the whole summary.
const { repoFullName: _repoFullName, generatedAt: _generatedAt, ...renderedContent } = summary;
const serialized = JSON.stringify(renderedContent);
/* v8 ignore start -- Defensive: every rendered field is individually sanitized; this guards a future unsanitized field. */
if (FORBIDDEN_PUBLIC_LANGUAGE.test(serialized)) {
throw new Error("Public scenario summary still contains forbidden language.");
}
Expand Down
10 changes: 10 additions & 0 deletions test/unit/scenario-summary.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, expect, it } from "vitest";

Check warning on line 1 in test/unit/scenario-summary.test.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

Possible duplicate overlap

Items reference the same linked issue #624.

Check notice on line 1 in test/unit/scenario-summary.test.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

Possible duplicate overlap

Open PR work references issue #624.

Check notice on line 1 in test/unit/scenario-summary.test.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

Issue discovery is disabled for this repo

This repo is configured for direct contribution review rather than issue-discovery flow.
import { sanitizePublicComment } from "../../src/github/commands";
import { buildScenarioInput, createScenarioSignalEntry } from "../../src/scenarios/input-model";
import { renderPublicScenarioSummary } from "../../src/scenarios/scenario-summary";
Expand Down Expand Up @@ -162,6 +162,16 @@
expect(summary.advisoryOnly).toBe(true);
});

it("renders for a repo whose name contains a forbidden term without throwing", () => {
// "hotkey"/"wallet" are Bittensor protocol terms; a legitimately named repo must not fail the guard.
const summary = renderPublicScenarioSummary({
repoFullName: "octo/hotkey-wallet",
generatedAt: "2026-06-12T00:00:00.000Z",
});
expect(summary.repoFullName).toBe("octo/hotkey-wallet");
expect(summary.headline).toMatch(/Advisory scenario summary generated from available repo signals/i);
});

it("renders pressure options, eligibility notes, blockers, and data classification", () => {
const pressureSimulation = simulateOpenPrPressure({
repoFullName: "octo/demo",
Expand Down