Skip to content

Commit de3272c

Browse files
sahrizviclaude
andcommitted
test: v0.12.9 adversarial tests, and a length cap on the rule classifier
- `test/skill/release-v0.12.9-adversarial.test.ts`: hard-denied SQL however spelled, the CLI permission handler, the tool allow-list, runner argument validation, rule classification, the telemetry opt-out marker and identity cache, endpoint masking, sign-out removing the identity cache, the analyst denies and `Filesystem.realLocation` - the rule classifier reads the first 2,000 characters: two of its patterns backtrack, and a 450 KB request took about 16 s - help snapshot keeps its `altimate_change` markers Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XM3J9mB75wZRnzTSGcW2kc
1 parent 68561e2 commit de3272c

3 files changed

Lines changed: 935 additions & 1 deletion

File tree

‎packages/opencode/src/altimate/rules/classify.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ const RULE_CUES: readonly [RegExp, string][] = [
4141
[/\b(?:name|prefix|suffix|alias)\s+\S+(?:\s+\S+)?\s+(?:as|with|like)\b/i, "a naming convention"],
4242
]
4343

44-
export function classify(text: string): { kind: Kind; cue?: string } {
44+
// The cues are read from the start of the text: some patterns backtrack, and a request to remember is short.
45+
const MAX_CLASSIFIED_CHARS = 2000
46+
47+
export function classify(input: string): { kind: Kind; cue?: string } {
48+
const text = input.slice(0, MAX_CLASSIFIED_CHARS)
4549
if (ASKED_RULE.test(text)) return { kind: "rule", cue: "asked for a rule" }
4650
if (ASKED_MEMORY.test(text)) return { kind: "memory", cue: "asked to remember it for themselves" }
4751
const memory = MEMORY_CUES.find(([pattern]) => pattern.test(text))

‎packages/opencode/test/cli/help/__snapshots__/help-snapshots.test.ts.snap‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ Options:
8282
[string]"
8383
`;
8484
85+
// altimate_change start — document the committed-answer echo allowance in run help
8586
exports[`opencode CLI help-text snapshots every documented command emits stable help text: opencode run --help 1`] = `
8687
"altimate-code run [message..]
8788
@@ -143,6 +144,7 @@ Options:
143144
--dangerously-skip-permissions auto-approve permissions that are not explicitly denied
144145
(dangerous!) [boolean] [default: false]"
145146
`;
147+
// altimate_change end
146148
147149
exports[`opencode CLI help-text snapshots every documented command emits stable help text: opencode debug --help 1`] = `
148150
"altimate-code debug

0 commit comments

Comments
 (0)