Skip to content

fix(truncate): block --help in read-only mode, consistent with disallowed commands#534

Merged
julesmcrt merged 2 commits into
mainfrom
jules.macret/truncate-help-readonly
Jun 22, 2026
Merged

fix(truncate): block --help in read-only mode, consistent with disallowed commands#534
julesmcrt merged 2 commits into
mainfrom
jules.macret/truncate-help-readonly

Conversation

@julesmcrt

@julesmcrt julesmcrt commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Issue

Inconsistency in the READ-ONLY mode: truncate --help works but not truncate as the builtin is blocked

Screenshot 2026-06-22 at 14 29 14

Summary

  • truncate --help in read-only mode previously printed full help text and exited 0,
    even though the command is completely blocked
  • When a command is absent from the allow-list, --help is rejected at the interpreter
    level before the handler runs — this fix makes the mode-based block behave the same way
  • The capability check now fires before flag parsing, so truncate --help returns the
    same error as truncate itself:
    truncate: filesystem capability not available (remediation mode required) with exit 1

Test plan

  • New scenario tests/scenarios/cmd/truncate/errors/readonly_mode_help.yaml verifies
    that truncate --help in read-only mode exits 1 with the capability error on stderr and
    nothing on stdout
  • Existing readonly_mode.yaml scenario continues to verify that truncate -s 0 f.txt
    fails the same way

🤖 Generated with Claude Code

julesmcrt and others added 2 commits June 22, 2026 16:05
When truncate --help is run outside remediation mode the command is
fully blocked, yet --help previously printed full usage and exited 0
with no indication that the command is unavailable. Now a note is
appended to the help output so users understand why truncate does
nothing if they try to run it.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…owed commands

When a command is not in the allow-list, --help is blocked at the
interpreter level before the handler runs. truncate --help in read-only
mode now behaves the same way: the capability check fires first, so
--help returns the same error as invoking truncate itself.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@julesmcrt julesmcrt changed the title fix(truncate): show note in --help output when in read-only mode fix(truncate): block --help in read-only mode, consistent with disallowed commands Jun 22, 2026
@julesmcrt
julesmcrt marked this pull request as ready for review June 22, 2026 14:45
@julesmcrt
julesmcrt added this pull request to the merge queue Jun 22, 2026
Merged via the queue into main with commit 427c8c6 Jun 22, 2026
41 checks passed
@julesmcrt
julesmcrt deleted the jules.macret/truncate-help-readonly branch June 22, 2026 14:47
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.

2 participants