Repository navigation
docs(help): point verification at read-only commands, not bare find #4497
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
7 commits
Select commit
Hold shift + click to select a range
69e1724
docs(help): point verification at read-only commands, not bare find
thymikee 4c7a756
docs(help): drop bare find from every verification line
thymikee de5c32c
test(help): accept escaped quotes in a find ... exists query
thymikee fde2b54
docs(help): show a concrete find ... exists example
thymikee 9651c3e
test(help): classify find verification with parseFindArgs
thymikee 26b520f
test(help): keep scoring a find with an unsupported action
thymikee 955ebd0
test(help): parse find commands in the TS command validator
thymikee 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
26 changes: 26 additions & 0 deletions
26
scripts/__tests__/help-conformance-find-verification.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,26 @@ | ||
| import assert from 'node:assert/strict'; | ||
| import { test } from 'vitest'; | ||
| import { hasFindExists } from '../help-conformance-expectations.mjs'; | ||
| import { validatePlanCommands } from '../help-conformance-plan-validator.mjs'; | ||
|
|
||
| // The find verification check reads plan commands through the real plan tokenizer, so quoting is | ||
| // the tokenizer's job and the find grammar is parseFindArgs'. | ||
| async function verifies(command: string, subject?: string): Promise<boolean> { | ||
| return hasFindExists(await validatePlanCommands([command]), subject); | ||
| } | ||
|
|
||
| test('find ... exists verifies, whatever quotes its query holds', async () => { | ||
| assert.equal(await verifies(`agent-device find text "Today's" exists`), true); | ||
| assert.equal(await verifies(String.raw`agent-device find text "Welcome \"back\"" exists`), true); | ||
| assert.equal(await verifies('agent-device find "Welcome back" exists', 'welcome'), true); | ||
| }); | ||
|
|
||
| test('a find that acts, or names another subject, does not verify', async () => { | ||
| assert.equal(await verifies('agent-device find text "Sent"'), false); | ||
| assert.equal(await verifies('agent-device find text Sent fill exists'), false); | ||
| assert.equal(await verifies('agent-device find text "Orders" exists', 'welcome'), false); | ||
| }); | ||
|
|
||
| test('a find with an unsupported action scores false instead of throwing', async () => { | ||
| assert.equal(await verifies('agent-device find text Sent swipe'), false); | ||
| }); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,14 @@ | ||
| // Type surface for the plain-Node expectation scorers (they must stay runnable by bare `node`). | ||
| // Keep it in step with the exports of `./help-conformance-expectations.mjs`. | ||
| import type { PlanCommandValidation } from './help-conformance-plan-validator.mjs'; | ||
|
|
||
| export type ExpectationContext = Readonly<{ commands: readonly string[] }>; | ||
|
|
||
| export function opensAndCloses(context: ExpectationContext): boolean; | ||
|
|
||
| export function usesValidationPrep(context: ExpectationContext): boolean; | ||
|
|
||
| export function hasFindExists( | ||
| commandValidation: readonly PlanCommandValidation[], | ||
| subject?: string, | ||
| ): boolean; |
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
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
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.