Skip to content

Commit 79482de

Browse files
committed
chore(webapp): drop the comments the tests already say
1 parent 7a645e5 commit 79482de

8 files changed

Lines changed: 1 addition & 34 deletions

File tree

apps/webapp/app/components/dashboard-agent/investigation-winners.test.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
// The map itself is built in `DashboardAgentMessages.tsx`, which can't be imported
2-
// here (it pulls the chart components and an unbuilt package). What matters for the
3-
// re-render is the identity rule, which is this module's job.
41
import { readFileSync } from "node:fs";
52
import { describe, expect, it } from "vitest";
63
import { reuseWinners, sameOccurrences } from "./investigation-winners";
74

85
const source = readFileSync(new URL("./DashboardAgentMessages.tsx", import.meta.url), "utf8");
96

10-
/** A recompute over a fresh `messages` array: same content, new Map. */
117
function recompute(entries: Array<[string, string]>): Map<string, string> {
128
return new Map(entries.map(([id, occurrence]) => [id, occurrence]));
139
}
@@ -48,7 +44,6 @@ describe("investigation winners identity", () => {
4844
expect(source).toMatch(/useMemo\(\(\) => winningInvestigationOccurrences\(messages\)/);
4945
expect(source).toContain("reuseWinners(previous.current, next)");
5046
expect(source).toContain("useInvestigationWinners(stripped)");
51-
// The unmemoized call must be gone from the render path.
5247
expect(source).not.toMatch(/=\s*winningInvestigationOccurrences\(stripped\)/);
5348
});
5449
});

apps/webapp/app/components/dashboard-agent/model-markdown.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// Rendered, not just string-matched: the claim is that the markdown renderer the
2-
// transcript uses emits no element that fetches a URL.
31
import { createElement } from "react";
42
import { renderToStaticMarkup } from "react-dom/server";
53
import { Streamdown } from "streamdown";
@@ -22,7 +20,6 @@ describe("stripModelImages", () => {
2220
it("renders no fetching element for a reference-style remote image", () => {
2321
const markdown = `Look: ![chart][beacon]\n\n[beacon]: ${BEACON}\n`;
2422
const stripped = stripModelImages(markdown);
25-
// The image reference is gone, so the definition below it renders nothing.
2623
expect(stripped).not.toContain("![");
2724
const html = render(stripped);
2825
expect(html).not.toMatch(/<img\b/i);

apps/webapp/app/components/dashboard-agent/watch-card.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,6 @@ describe("the persisted blocks (§2.2)", () => {
344344
expect(body.followUp).toEqual(["If it turns out badly, I'll investigate straight away."]);
345345
});
346346

347-
// The user asked for email and didn't get it. Saying nothing would leave them believing
348-
// an alert is coming.
349347
it("says out loud when the email the user asked for couldn't be added", () => {
350348
const body = watchConfirmationBlockBody({
351349
spec: queueWatchRecommendation("email-sends"),

apps/webapp/test/dashboardAgentClientMetadata.test.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
import { beforeEach, describe, expect, it, vi } from "vitest";
22

3-
// The `in` proxy is the one path a browser reaches the agent through, and it injects the turn's
4-
// identity, tenancy and delegated token. Whatever the browser sends must not be able to set any of
5-
// those fields — not by overwriting them, and not by smuggling in a field the server doesn't own.
6-
73
const mocks = vi.hoisted(() => ({
84
fetch: vi.fn(),
95
}));
@@ -112,7 +108,6 @@ describe("dashboard agent `in` proxy — client metadata", () => {
112108
expect(metadata.environmentName).toBe("dev");
113109
expect(metadata.apiOrigin).toBe("https://api.trigger.dev");
114110
expect(metadata.userActorToken).toBe("tr_uat_real");
115-
// Not resolved for this project, so the client's pointer must not stand in for it.
116111
expect(metadata.repoSnapshot).toBeUndefined();
117112
});
118113

apps/webapp/test/dashboardAgentWatchInvestigate.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ vi.mock("~/db.server", () => ({
8787
$replica: {},
8888
sqlDatabaseSchema: undefined,
8989
}));
90-
// Stub the lookup, not the row: the route only reads id and type, while a raw
91-
// Prisma row has to satisfy every column `toAuthenticated` reads.
9290
vi.mock("~/models/runtimeEnvironment.server", () => ({
9391
findEnvironmentBySlug: async () => ({ id: "env_1", type: "PRODUCTION" }),
9492
}));

apps/webapp/test/dashboardAgentWatchWording.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ describe("renderBlockAsText", () => {
122122
);
123123
});
124124

125-
// The watch is active either way, so the block still confirms it; the email line states
126-
// the failure rather than going missing.
127125
it("renders a confirmation whose email couldn't be attached", () => {
128126
const spec = specFor("backlog_drain");
129127
const block = {

apps/webapp/test/rbacFallbackBranch.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -584,8 +584,6 @@ describe("RBAC fallback — branch header guards", () => {
584584
);
585585
});
586586

587-
// A delegated user-actor token is a downgrade of its user, so the fallback must not hand it the
588-
// blanket ability it hands a PAT — even though neither has a role to consult without a plugin.
589587
const USER_ACTOR_SECRET = "test-user-actor-secret";
590588

591589
function userActorController(prisma: PrismaClient) {
@@ -630,7 +628,6 @@ describe("RBAC fallback — user-actor tokens", () => {
630628

631629
expect(result.ok).toBe(true);
632630
if (!result.ok) return;
633-
// Reads still work, so the token can reach its own JWT exchange.
634631
expect(result.ability.can("read", { type: "apiKeys" })).toBe(true);
635632
expect(result.ability.can("read", { type: "runs" })).toBe(true);
636633
expect(result.ability.can("write", { type: "envvars" })).toBe(false);
@@ -655,7 +652,6 @@ describe("RBAC fallback — user-actor tokens", () => {
655652
expect(result.subject).toMatchObject({ type: "userActor", environmentId: "env_1" });
656653
});
657654

658-
// The non-UAT fallback path is unchanged: a PAT (the CLI / MCP exchange) stays permissive.
659655
postgresTest("leaves a personal access token permissive", async ({ prisma }) => {
660656
const { user } = await createTestOrgProjectWithMember(prisma);
661657
const rbac = userActorController(prisma);

internal-packages/tsql/src/read-only.test.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ import { describe, expect, it } from "vitest";
22
import { compileTSQL, parseTSQLSelect, SyntaxError as TSQLSyntaxError } from "./index.js";
33
import { column, type TableSchema } from "./query/schema.js";
44

5-
// TSQL has no write statements at all, so a mutating query cannot parse.
6-
// These tests pin that, so extending the grammar can't quietly add a write path.
7-
85
const taskRunsSchema: TableSchema = {
96
name: "task_runs",
107
clickhouseName: "trigger_dev.task_runs_v2",
@@ -45,7 +42,6 @@ const mutating = [
4542
["SYSTEM", "SYSTEM SHUTDOWN"],
4643
];
4744

48-
// Shapes that defeat a keyword deny-list but not a grammar without write statements.
4945
const evasions = [
5046
["lower case", "delete from task_runs where id = 'run_1'"],
5147
["mixed case", "DeLeTe FROM task_runs WHERE id = 'run_1'"],
@@ -68,15 +64,12 @@ describe("TSQL is read-only by construction", () => {
6864
expect(() => compileTSQL(query, compileOptions as never)).toThrow();
6965
});
7066

71-
// Positive control: the negatives above must fail because they mutate,
72-
// not because the parser rejects everything.
67+
// Positive control: the negatives must fail because they mutate, not because everything does.
7368
it("still parses an ordinary SELECT", () => {
7469
const ast = parseTSQLSelect("SELECT id, status FROM task_runs WHERE status = 'FAILED'");
7570
expect(ast.expression_type).toBe("select_query");
7671
});
7772

78-
// TRUNCATE is a keyword in the lexer because it is a rounding function,
79-
// not because a TRUNCATE statement exists.
8073
it("treats TRUNCATE as a function, not a statement", () => {
8174
const ast = parseTSQLSelect("SELECT truncate(1.9) FROM task_runs");
8275
expect(ast.expression_type).toBe("select_query");
@@ -90,9 +83,6 @@ describe("a mutation cannot ride along behind a valid SELECT", () => {
9083
["two semicolons", "SELECT id FROM task_runs;; TRUNCATE TABLE task_runs"],
9184
];
9285

93-
// The parser is anchored to EOF, so a trailing statement is rejected rather
94-
// than silently dropped. Silently dropping it would also be safe, but it
95-
// would hide the smuggling attempt from the caller.
9686
it.each(smuggled)("rejects a mutation appended after a %s", (_label, query) => {
9787
expect(() => parseTSQLSelect(query)).toThrow(TSQLSyntaxError);
9888
expect(() => compileTSQL(query, compileOptions as never)).toThrow();

0 commit comments

Comments
 (0)