Compare changes
Choose two branches to see what one has that the other does not, then open a pull request for it.
3 commits
- Agents no longer count not having run CI as a doubt: the workflows run as checks after the pushChase Pierce24ac7a4
- A file named test.js or spec.rb counts as a test: confidence no longer says tests not added when they wereChase Pierce207bee0
- An issue being worked on no longer offers Bring your own agent beside the pull request doing itChase Pierce1b205e2
5 files+15−40/5 viewed
| 159 | 159 | assert.ok(isTestFile("pkg/store_test.go")); | |
| 160 | 160 | assert.ok(!isTestFile("src/testing-utils.ts")); | |
| 161 | 161 | assert.ok(!isTestFile("src/contest.ts")); | |
| 162 | + | assert.ok(isTestFile("test.js")); | |
| 163 | + | assert.ok(isTestFile("lib/spec.rb")); | |
| 162 | 164 | }); | |
| 163 | 165 | ||
| 164 | 166 | const merged = (daysAgo: number, mergedBy: string | null, number = 1, authoredByAgent = true): Merged => ({ |
| 183 | 183 | ||
| 184 | 184 | /** Test files, by the names test runners look for. */ | |
| 185 | 185 | 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 | + | ); | |
| 187 | 193 | } | |
| 188 | 194 | ||
| 189 | 195 | const plural = (n: number, one: string, many = `${one}s`) => `${n.toLocaleString("en-US")} ${n === 1 ? one : many}`; |
| 569 | 569 | )} | |
| 570 | 570 | </section> | |
| 571 | 571 | ||
| 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") && ( | |
| 573 | 574 | <section className="rounded-xl border border-line bg-surface p-4"> | |
| 574 | 575 | <h3 className="text-sm font-medium">Bring your own agent</h3> | |
| 575 | 576 | <p className="mt-1 text-xs text-muted"> |
| 18 | 18 | const MAX_ITEM_CHARS: usize = 160; | |
| 19 | 19 | ||
| 20 | 20 | /// 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."; | |
| 22 | 22 | ||
| 23 | 23 | /// The prompt with the question added. | |
| 24 | 24 | pub fn ask(prompt: &str) -> String { |
| 123 | 123 | lower.split('/').any(|dir| matches!(dir, "test" | "tests" | "__tests__" | "spec" | "specs" | "testdata")) | |
| 124 | 124 | || [".test.", ".spec.", "_test.", "-test.", "_spec."].iter().any(|mark| file.contains(mark)) | |
| 125 | 125 | || 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('.') | |
| 126 | 128 | } | |
| 127 | 129 | ||
| 128 | 130 | /// Files that change nothing that runs: prose and pictures. | |
| 967 | 969 | ||
| 968 | 970 | #[test] | |
| 969 | 971 | 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"] { | |
| 971 | 973 | assert!(is_test(path), "{path}"); | |
| 972 | 974 | } | |
| 973 | 975 | for path in ["src/testing.ts", "src/contest.rs", "attest/a.rs"] { |