Skip to content

Compare changes

Choose two branches to see what one has that the other does not, then open a pull request for it.

Open a pull request

3 commits

5 files+15−40/5 viewed
+2−0
159159 assert.ok(isTestFile("pkg/store_test.go"));
160160 assert.ok(!isTestFile("src/testing-utils.ts"));
161161 assert.ok(!isTestFile("src/contest.ts"));
162+ assert.ok(isTestFile("test.js"));
163+ assert.ok(isTestFile("lib/spec.rb"));
162164 });
163165
164166 const merged = (daysAgo: number, mergedBy: string | null, number = 1, authoredByAgent = true): Merged => ({
+7−1
183183
184184 /** Test files, by the names test runners look for. */
185185 export function isTestFile(path: string): boolean {
186− return /(^|\/)(__tests__|tests?|spec)\//i.test(path) || /[._-](test|spec)\.[a-z0-9]+$/i.test(path) || /_test\.(go|rs|py)$/i.test(path);
186+ return (
187+ /(^|\/)(__tests__|tests?|spec)\//i.test(path) ||
188+ /[._-](test|spec)\.[a-z0-9]+$/i.test(path) ||
189+ /_test\.(go|rs|py)$/i.test(path) ||
190+ // A file named for what it is: test.js, tests.py, spec.rb.
191+ /(^|\/)(tests?|specs?)\.[a-z0-9]+$/i.test(path)
192+ );
187193 }
188194
189195 const plural = (n: number, one: string, many = `${one}s`) => `${n.toLocaleString("en-US")} ${n === 1 ? one : many}`;
+2−1
569569 )}
570570 </section>
571571
572− {open && (
572+ {/* Another way to start the work: not once a pull request is doing it. */}
573+ {open && !pulls.some((pull) => pull.status === "open" || pull.status === "draft") && (
573574 <section className="rounded-xl border border-line bg-surface p-4">
574575 <h3 className="text-sm font-medium">Bring your own agent</h3>
575576 <p className="mt-1 text-xs text-muted">
+1−1
1818 const MAX_ITEM_CHARS: usize = 160;
1919
2020 /// What the agent is asked, after its task.
21−pub const ASK: &str = "Also end your final message with how sure you are that your change is right and complete, as JSON inside <g1t-confidence></g1t-confidence> tags: {\"confidence\": \"high\" | \"medium\" | \"low\", \"uncertain_about\": [\"a few words for each thing you could not verify or had to guess\"]}. Say high only if you ran the checks and tests and they passed and nothing was guessed. The block is taken out of your summary.";
21+pub const ASK: &str = "Also end your final message with how sure you are that your change is right and complete, as JSON inside <g1t-confidence></g1t-confidence> tags: {\"confidence\": \"high\" | \"medium\" | \"low\", \"uncertain_about\": [\"a few words for each thing you could not verify or had to guess\"]}. Say high only if you ran the project's tests (and any other check you can run here) and they passed and nothing was guessed. The repository's CI workflows run as checks on the pull request after you push, and count on their own, so not having run them is not something to be unsure about. The block is taken out of your summary.";
2222
2323 /// The prompt with the question added.
2424 pub fn ask(prompt: &str) -> String {
+3−1
123123 lower.split('/').any(|dir| matches!(dir, "test" | "tests" | "__tests__" | "spec" | "specs" | "testdata"))
124124 || [".test.", ".spec.", "_test.", "-test.", "_spec."].iter().any(|mark| file.contains(mark))
125125 || file.starts_with("test_")
126+ // A file named for what it is: test.js, tests.py, spec.rb.
127+ || matches!(file.split('.').next(), Some("test" | "tests" | "spec" | "specs")) && file.contains('.')
126128 }
127129
128130 /// Files that change nothing that runs: prose and pictures.
967969
968970 #[test]
969971 fn tests_prose_and_sensitive_paths_are_told_apart() {
970− for path in ["src/__tests__/a.ts", "tests/test_api.py", "pkg/api_test.go", "src/a.spec.tsx", "crates/x/tests/it.rs"] {
972+ for path in ["src/__tests__/a.ts", "tests/test_api.py", "pkg/api_test.go", "src/a.spec.tsx", "crates/x/tests/it.rs", "test.js", "lib/spec.rb"] {
971973 assert!(is_test(path), "{path}");
972974 }
973975 for path in ["src/testing.ts", "src/contest.rs", "attest/a.rs"] {