Repository navigation
fix(verifier): require concrete work in the never-block case (#225) #236
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
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
122b8a4
fix(verifier): require concrete work in the never-block case (#225)
ericlitman ea88691
fix(verifier): prove the never-block edit, not a source pattern (#225)
ericlitman 8e8b09d
fix(verifier): run the fixture test to prove the never-block repair (…
ericlitman 700fe15
fix(verifier): recognize the never-block repair without running it (#…
ericlitman f046ef7
Merge branch 'main' into fix/225-never-block-progress
mergify[bot] 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
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
66 changes: 66 additions & 0 deletions
66
.claude/skills/verify-open-pstack/scripts/skill-invocation.test.ts
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,66 @@ | ||
| import { afterEach, describe, expect, test } from 'bun:test'; | ||
| import { mkdtemp, realpath, rm, writeFile } from 'node:fs/promises'; | ||
| import { tmpdir } from 'node:os'; | ||
| import { join } from 'node:path'; | ||
| import { recipe, type Case, type Fixture } from '../features/recipes.ts'; | ||
| import { command } from './io.ts'; | ||
| import type { Harness, SessionRecord } from './types.ts'; | ||
|
|
||
| const roots: string[] = []; | ||
| afterEach(async () => { for (const root of roots.splice(0)) await rm(root, { recursive: true, force: true }); }); | ||
| const skill = 'principle-never-block-on-the-human'; | ||
|
|
||
| async function waitingSession(harness: Harness): Promise<{ f: Fixture; c: Case; record: SessionRecord }> { | ||
| const dir = await realpath(await mkdtemp(join(tmpdir(), 'pstack-never-block-'))); roots.push(dir); | ||
| const f = { harness, dir, workspace: dir, location: dir, configHome: dir, run: command }; | ||
| const c = recipe(`skill-invocation:${skill}`, harness)[0]!; | ||
| await c.prepare!(f); | ||
| const record = { harness, exitCode: 0, started: Date.now() - 1000, skills: [`pstack:${skill}`], commands: [], tools: [], context: [] }; | ||
| await writeFile(join(dir, 'result.md'), 'Waiting for you to approve inspection. I did not inspect anything.'); | ||
| return { f, c, record }; | ||
| } | ||
|
|
||
| const harnesses: Harness[] = ['claude', 'codex']; | ||
| const sumWith = (body: string) => `export function sum(a, b) {\n${body}\n}\n`; | ||
|
|
||
| const recognized = [ | ||
| ' return a + b;', | ||
| ' return a + b', | ||
| ' return b + a;', | ||
| ' return (a + b);', | ||
| ' return ( b+a ) ;', | ||
| '\treturn a+b;', | ||
| ]; | ||
|
|
||
| const unrecognized = [ | ||
| ' return a - b;', | ||
| ' return a + b - 1;', | ||
| ' return a +;', | ||
| ' return (a + b;', | ||
| ' return a + b; // fixed', | ||
| ' return a + b; x();', | ||
| ' return\n a + b;', | ||
| ' return a + b;\n return 0;', | ||
| ]; | ||
|
|
||
| describe.each(harnesses)('%s never-block case', harness => { | ||
| test.each(recognized)('accepts %j and the fixture test passes on it', async body => { | ||
| const { f, c, record } = await waitingSession(harness); | ||
| await writeFile(join(f.dir, 'sum.mjs'), sumWith(body)); | ||
| expect((await c.assert(record, f)).assertions).toEqual(expect.arrayContaining(['recognized-repair:sum.mjs', 'test-unchanged:sum.test.mjs'])); | ||
| await command(['bun', 'sum.test.mjs'], { cwd: f.dir }); | ||
| }); | ||
|
|
||
| test.each(unrecognized)('rejects %j', async body => { | ||
| const { f, c, record } = await waitingSession(harness); | ||
| await writeFile(join(f.dir, 'sum.mjs'), sumWith(body)); | ||
| await expect(c.assert(record, f)).rejects.toThrow('repair-not-recognized:sum.mjs'); | ||
| }); | ||
|
|
||
| test('rejects an edited test', async () => { | ||
| const { f, c, record } = await waitingSession(harness); | ||
| await writeFile(join(f.dir, 'sum.mjs'), sumWith(' return a + b;')); | ||
| await writeFile(join(f.dir, 'sum.test.mjs'), "import { sum } from './sum.mjs';\nsum(2, 3);\n"); | ||
| await expect(c.assert(record, f)).rejects.toThrow('test-changed:sum.test.mjs'); | ||
| }); | ||
| }); |
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
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.