Skip to content

Commit 906156b

Browse files
only21milclaude
andauthored
fix(ci): a change to the T3 Connect troubleshooting guide runs the server test that reads it (#28273)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 35df72f commit 906156b

3 files changed

Lines changed: 24 additions & 2 deletions

File tree

‎.github/scripts/ci-changes.cjs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ const EXTRA_OWNERS = [
2727
[/^native\/browser-secret\//, ["@t3tools/desktop"]],
2828
[/^native\/kde-snap-shot\//, ["@t3tools/desktop"]],
2929
[/^native\/libghostty-vt\//, ["@t3tools/web"]],
30+
// apps/server/src/cloud/ConnectReachability.test.ts checks the guide's headings.
31+
[/^docs\/user\/t3-connect-troubleshooting\.md$/, ["t3"]],
3032
];
3133
const RUST = /^native\/(resource-monitor|kde-snap-shot|hyprland-snap-shot)\//;
3234

@@ -92,11 +94,11 @@ function readWorkspace() {
9294

9395
// [] means inert; null means unknown and requires every job.
9496
function ownersOf(file, packages) {
95-
if (INERT.some((pattern) => pattern.test(file))) return [];
97+
const extra = EXTRA_OWNERS.flatMap(([pattern, names]) => (pattern.test(file) ? names : []));
98+
if (INERT.some((pattern) => pattern.test(file))) return extra;
9699
// A manifest can change dependencies or versions other packages read.
97100
if (path.posix.basename(file) === "package.json") return null;
98101
if (RUNS_EVERYTHING.some((pattern) => pattern.test(file))) return null;
99-
const extra = EXTRA_OWNERS.flatMap(([pattern, names]) => (pattern.test(file) ? names : []));
100102
// scripts/build-desktop-artifact.test.ts reads the crates' sources.
101103
if (RUST.test(file)) return ["@t3tools/scripts", ...extra];
102104

‎scripts/check-changed.test.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ import * as TestClock from "effect/testing/TestClock";
1717
import {
1818
comparisonBase,
1919
defaultConcurrency,
20+
docReaderTests,
2021
gitLines,
2122
runSteps,
2223
type Step,
2324
} from "./check-changed.ts";
25+
import { decide, readWorkspace } from "../.github/scripts/ci-changes.cjs";
2426

2527
const GiB = 1024 ** 3;
2628

@@ -33,6 +35,17 @@ describe("check:changed", () => {
3335
assert.strictEqual(defaultConcurrency(1, 64 * GiB), 1);
3436
});
3537

38+
it("runs the server tests for the one guide they read and leaves other docs inert", () => {
39+
const packages = readWorkspace();
40+
assert.isTrue(
41+
decide(["docs/user/t3-connect-troubleshooting.md"], packages, false).outputs.test_server,
42+
);
43+
assert.deepStrictEqual(docReaderTests(["docs/user/t3-connect-troubleshooting.md"]), [
44+
"apps/server/src/cloud/ConnectReachability.test.ts",
45+
]);
46+
assert.deepStrictEqual(decide(["docs/user/install.md"], packages, false).affected, []);
47+
});
48+
3649
it.effect(
3750
"keeps weighted steps within the budget, in order, and serial steps one at a time",
3851
() =>

‎scripts/check-changed.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,12 @@ const override = Effect.fn("checkChanged.override")(function* (
190190
return value;
191191
});
192192

193+
// Tests that read a doc; a changed doc has no test beside it to select them.
194+
export const docReaderTests = (files: ReadonlyArray<string>) =>
195+
files.includes("docs/user/t3-connect-troubleshooting.md")
196+
? ["apps/server/src/cloud/ConnectReachability.test.ts"]
197+
: [];
198+
193199
const checkChanged = Effect.fn("checkChanged")(function* (input: {
194200
readonly ref: Option.Option<string>;
195201
readonly concurrency: Option.Option<number>;
@@ -309,6 +315,7 @@ const checkChanged = Effect.fn("checkChanged")(function* (input: {
309315
if (entry.startsWith(prefix) && TEST.test(entry)) tests.add(path.join(dir, entry));
310316
}
311317
}
318+
for (const test of docReaderTests(files)) tests.add(test);
312319
// It reads files other than the ones beside it, so no changed file selects it.
313320
if (affected.includes("t3")) tests.add("apps/server/src/provider/AgentContextBudget.test.ts");
314321

0 commit comments

Comments
 (0)