Skip to content

Fuzzer improvements and CondParen formatting fix#323

Merged
ldayton merged 3 commits intomainfrom
fix-cond-paren-formatting
Jan 17, 2026
Merged

Fuzzer improvements and CondParen formatting fix#323
ldayton merged 3 commits intomainfrom
fix-cond-paren-formatting

Conversation

@ldayton
Copy link
Copy Markdown
Owner

@ldayton ldayton commented Jan 17, 2026

Summary

  • Add grammar-based generator with 13 complexity layers for controlled test generation
  • Add layer detection and --filter-layer option to filter discrepancies by complexity
  • Unify CLI with subparsers and aliases (char, struct, gen, min)
  • Add --minimize flag to character and structural fuzzers
  • Fix crash when formatting CondParen nodes inside command substitutions

Details

Grammar-based generator

New uv run fuzzer gen command generates bash scripts with controlled complexity:

  • Layer 0: literals
  • Layer 1-4: expansions and arithmetic
  • Layer 5-6: commands and redirections
  • Layer 7-8: pipelines and lists
  • Layer 9-12: compound commands, loops, case, functions

Layer filtering

All fuzzers now support --filter-layer N to show only discrepancies at or below layer N, useful for focusing on simpler constructs first.

Bug fix

_format_cond_body referenced node.body for cond-paren nodes, but CondParen uses node.inner. This caused crashes on inputs like echo $([[ ( -n x ) ]]).

_format_cond_body (Python) and _formatCondBody (JavaScript) referenced
node.body for cond-paren nodes, but CondParen uses node.inner. This
caused an AttributeError when formatting conditional expressions with
parentheses inside command substitutions, e.g., echo $([[ ( -n x ) ]]).
Add a grammar-based generator that produces bash scripts with controlled
complexity via 13 layers (literals through functions). Also add layer
detection and --filter-layer option to all fuzzers for filtering
discrepancies by complexity.

Changes:
- New generator.py with layered grammar-based generation
- Unified CLI with subparsers (char, struct, gen, min aliases)
- --minimize and --filter-layer flags for character/structural fuzzers
- Shared post_process_discrepancies() in common.py
- Enhanced minimizer CLI supporting stdin and @file input
- Updated documentation
@ldayton ldayton changed the title fix: use correct attribute name in CondParen formatting Fuzzer improvements and CondParen formatting fix Jan 17, 2026
@ldayton ldayton merged commit c558b2c into main Jan 17, 2026
1 check passed
@ldayton ldayton deleted the fix-cond-paren-formatting branch January 17, 2026 08:31
ldayton added a commit that referenced this pull request Mar 25, 2026
Includes fixes for JS backend: constructor defaults (#321), startswith
pos arg (#324), operator precedence (#333), regex escaping (#322),
template literal backticks (#323), destructuring discard (#326),
isinstance primitives (#325, #327), backtick-heredoc (#352), and
UTF-8 encoding (#334).
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.

1 participant