Skip to content

fix: strip bare integers from shell approval patterns (#1331)#1332

Merged
Aaronontheweb merged 4 commits into
devfrom
fix-1331-integer-verb-chain
Jun 6, 2026
Merged

fix: strip bare integers from shell approval patterns (#1331)#1332
Aaronontheweb merged 4 commits into
devfrom
fix-1331-integer-verb-chain

Conversation

@Aaronontheweb

Copy link
Copy Markdown
Collaborator

Problem

Bare integer tokens (ticket IDs, port numbers, timeouts) were being baked into approval verb patterns via the display/retry-key path, causing every unique value to require a separate approval prompt.

Example:

  • freshdesk ticket get 123 → pattern: freshdesk ticket get 123
  • freshdesk ticket get 456 → pattern: freshdesk ticket get 456

Two unrelated entries. Two approval prompts. No generalization.

Root Cause

The AST parser (ShellSyntaxTree) already correctly excludes integers from VerbChain via IsVerbLikeToken (requires [a-z] start). The matching path works fine. The gap is in ReconstructClauseText() which iterates all clause.Args — including bare integers — for display and retry-exact key generation.

Fix

  • IsBareIntegerToken() — detects pure-digit strings, excludes flags (which start with -)
  • ReconstructClauseText()break on bare integer args (termination, not skip — everything after the integer is outside the approval intent)

Specs & Tests

  • 4 new POSIX-only tests (strip, generalize, timeout, candidates)
  • OpenSpec change set + delta spec synced to main spec
  • 566/566 tests pass, zero regressions

Scope

POSIX-only. Windows uses the legacy ShellTokenizer path which retains the old behavior. PwshParser integration is a separate change.

Fixes #1331

Bare integer tokens (ticket IDs, port numbers, timeouts) were being
baked into approval verb patterns via the display/retry-key path, causing
every unique value to require a separate approval prompt.

The AST parser already correctly excludes integers from VerbChain (via
IsVerbLikeToken requiring [a-z] start). The gap was in ReconstructClauseText
which iterates all clause.Args — including bare integers — for display and
retry-exact key generation.

Fix: IsBareIntegerToken() predicate + break in ReconstructClauseText when
an integer is encountered (termination, not skip — everything after the
integer is outside the approval intent).

Changes:
- IsBareIntegerToken() — detects pure-digit strings, excludes flags
- ReconstructClauseText() — break on bare integer args
- 4 new POSIX-only tests (strip, generalize, timeout, candidates)
- OpenSpec change set + delta spec synced to main spec

POSIX-only: Windows uses the legacy ShellTokenizer path which retains
the old behavior. PwshParser integration is a separate change.

Test results: 566/566 pass, zero regressions.
…ation

The integer-positional-argument tests use [Fact(SkipUnless = ..., Skip =
"...")] which triggers slopwatch SW001 (disabled test violation).

Replace with plain [Fact] + early-return on Windows. Tests run on all
platforms, pass on Windows, assert on POSIX. No disabled tests, no SW001.

This is the correct pattern: tests should be active everywhere they
compile, just conditional in behavior — not disabled via SkipUnless.
@Aaronontheweb Aaronontheweb enabled auto-merge (squash) June 6, 2026 13:04
@Aaronontheweb Aaronontheweb merged commit d3f4c23 into dev Jun 6, 2026
21 checks passed
@Aaronontheweb Aaronontheweb deleted the fix-1331-integer-verb-chain branch June 6, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Verb chain extraction includes bare integer positional arguments, creating overly-specific approval patterns

1 participant