-
Notifications
You must be signed in to change notification settings - Fork 2
fix(server): harden practice review execution pipeline #979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
FelixTJDietrich
merged 4 commits into
main
from
fix/server-practice-review-execution-pipeline
Apr 10, 2026
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
5593538
fix(server): harden practice review execution pipeline
FelixTJDietrich 4a94e1a
fix(server): improve pi-runner retry logic and precompute grep robust…
FelixTJDietrich 3895659
fix(server): harden pi-runner, grep glob recursion, and diff-scope fi…
FelixTJDietrich cda89eb
Update .gitignore
FelixTJDietrich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| import { afterEach, describe, expect, it } from "bun:test"; | ||
| import { mkdtemp, mkdir, rm } from "node:fs/promises"; | ||
| import { join } from "node:path"; | ||
| import { tmpdir } from "node:os"; | ||
| import { findFiles, grep } from "./grep"; | ||
|
|
||
| const tempDirs: string[] = []; | ||
|
|
||
| async function createTempDir(): Promise<string> { | ||
| const dir = await mkdtemp(join(tmpdir(), "grep helper ")); | ||
| tempDirs.push(dir); | ||
| return dir; | ||
| } | ||
|
|
||
| afterEach(async () => { | ||
| await Promise.all(tempDirs.splice(0).map((dir) => rm(dir, { recursive: true, force: true }))); | ||
| }); | ||
|
|
||
| describe("grep", () => { | ||
| it("treats fixed-string patterns literally without shell interpretation", async () => { | ||
| const dir = await createTempDir(); | ||
| const nestedDir = join(dir, "nested dir"); | ||
| await mkdir(nestedDir, { recursive: true }); | ||
| await Bun.write( | ||
| join(nestedDir, "example.ts"), | ||
| "const marker = \"literal $(echo nope) 'quotes'\";\n", | ||
| ); | ||
|
|
||
| const matches = await grep("literal $(echo nope) 'quotes'", dir, { | ||
| fixedString: true, | ||
| glob: "**/*.ts", | ||
| }); | ||
|
|
||
| expect(matches).toHaveLength(1); | ||
| expect(matches[0]?.file).toBe("nested dir/example.ts"); | ||
| }); | ||
|
|
||
| it("enforces maxResults globally across files", async () => { | ||
| const dir = await createTempDir(); | ||
| await Bun.write(join(dir, "one.txt"), "needle\nneedle\n"); | ||
| await Bun.write(join(dir, "two.txt"), "needle\nneedle\n"); | ||
| await Bun.write(join(dir, "three.txt"), "needle\nneedle\n"); | ||
|
|
||
| const matches = await grep("needle", dir, { | ||
| fixedString: true, | ||
| maxResults: 2, | ||
| }); | ||
|
|
||
| expect(matches).toHaveLength(2); | ||
| expect(matches.every((match) => match.content === "needle")).toBe(true); | ||
| }); | ||
|
|
||
| it("applies path-aware glob filters instead of basename-only includes", async () => { | ||
| const dir = await createTempDir(); | ||
| const nestedDir = join(dir, "src", "nested"); | ||
| await mkdir(nestedDir, { recursive: true }); | ||
| await Bun.write(join(nestedDir, "match.ts"), "needle\n"); | ||
| await Bun.write(join(nestedDir, "skip.js"), "needle\n"); | ||
|
|
||
| const matches = await grep("needle", dir, { | ||
| fixedString: true, | ||
| glob: "src/**/*.ts", | ||
| }); | ||
|
|
||
| expect(matches).toHaveLength(1); | ||
| expect(matches[0]?.file).toBe("src/nested/match.ts"); | ||
| }); | ||
|
|
||
| it("finds extension matches without shelling out and skips ignored paths", async () => { | ||
| const dir = await createTempDir(); | ||
| await mkdir(join(dir, "src", "nested"), { recursive: true }); | ||
| await mkdir(join(dir, ".hidden"), { recursive: true }); | ||
| await mkdir(join(dir, "node_modules", "pkg"), { recursive: true }); | ||
| await mkdir(join(dir, ".build"), { recursive: true }); | ||
|
|
||
| await Bun.write(join(dir, "src", "nested", "match.swift"), "struct Match {}\n"); | ||
| await Bun.write(join(dir, ".hidden", "hidden.swift"), "struct Hidden {}\n"); | ||
| await Bun.write(join(dir, "node_modules", "pkg", "dep.swift"), "struct Dep {}\n"); | ||
| await Bun.write(join(dir, ".build", "generated.swift"), "struct Generated {}\n"); | ||
|
|
||
| const files = await findFiles(dir, "swift"); | ||
|
|
||
| expect(files).toHaveLength(1); | ||
| expect(files[0]).toBe(join(dir, "src", "nested", "match.swift")); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.