Skip to content

refactor(permission): split shell analysis by responsibility - #795

Merged
hakula139 merged 4 commits into
mainfrom
refactor/permission-shell-modules
Nov 1, 2026
Merged

hakula139 merged 4 commits into
mainfrom
refactor/permission-shell-modules

Conversation

@hakula139

@hakula139 hakula139 commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

Shell permission analysis combined syntax walking, nested invocation, wrappers, word expansion, pattern parsing, and reader operands in one module. Each concern now has a private child module while command and permission interfaces remain at the parent boundary.

  • Responsibilities: walk, invocation, wrapper, word, pattern, and reader own their production logic and tests. Shell startup and inherited environment handling stay together in invocation.
  • Contracts: visibility reaches only sibling and parent consumers. Command targets and pattern-word contracts remain at the parent boundary.
  • Documentation: the permission design Sources inventory names the children. The top-level architecture boundary is unchanged.

Test plan

  • cargo fmt --check, cargo build, both Clippy runs, cargo doc --no-deps, cargo llvm-cov --show-missing-lines, pnpm format, pnpm lint, and pnpm spellcheck pass on 651e8eb95. All applicable commit and push hooks pass. The macOS run has 3,496 passing tests and five existing ignored paid live tests, with 99.24% line coverage.
  • All 82 shell test functions are retained: 81 pass locally and one is Linux-only. Five real-input table cases cover bare redirects, here-strings, assignments before heredoc-carried commands, globbed tilde reader paths, and missing-token diagnostics. Each targeted mutation failed at runtime and was restored.
  • Production function bodies were mechanically compared with the extraction source, excluding imports, visibility, and comments. The final derive-order correction changes no behavior.
  • Uncovered startup and option constructors run during const evaluation. Runtime tests exercise the resulting tables. Other parser guards enforce bundled-grammar requirements: command names have literal children, compound statements have children, and file redirects have operators and destinations. first_error runs only after has_error, excluding its search-exhaustion return.
  • Dependencies are unchanged, so cargo deny check was not rerun. Current cross-platform CI is reported in the PR checks.

@hakula139 hakula139 added refactor Restructured code that preserves behavior (refactor) area: permission Touches permission rules, modes, or the approval gate labels Oct 30, 2026
@hakula139 hakula139 self-assigned this Oct 30, 2026
@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Base automatically changed from refactor/permission-shipped-rules to main November 1, 2026 09:15
Separate syntax walks, nested shell invocations, wrappers, words, exec patterns, and reader analysis while keeping command and rule contracts in shell.rs.

Move the existing tests with their subjects. Startup files and inherited variables share the invocation parser used by nested shells.
@hakula139
hakula139 force-pushed the refactor/permission-shell-modules branch from 7c02e89 to 651e8eb Compare November 1, 2026 09:20
@hakula139
hakula139 merged commit c64e62a into main Nov 1, 2026
9 checks passed
@hakula139
hakula139 deleted the refactor/permission-shell-modules branch November 1, 2026 09:40
@hakula139 hakula139 added this to the v0.1.0-alpha.10 milestone Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: permission Touches permission rules, modes, or the approval gate refactor Restructured code that preserves behavior (refactor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant