Skip to content

feat: implement analyzer and symbolic improvements#1341

Merged
Timi16 merged 2 commits into
Timi16:mainfrom
ALIPHATICHYD:feat/analyzer-and-symbolic-improvements
May 28, 2026
Merged

feat: implement analyzer and symbolic improvements#1341
Timi16 merged 2 commits into
Timi16:mainfrom
ALIPHATICHYD:feat/analyzer-and-symbolic-improvements

Conversation

@ALIPHATICHYD
Copy link
Copy Markdown
Contributor

Summary

This PR implements four related improvements to the analyzer and symbolic subsystems. All changes are generic, straightforward, and avoid redundancy.

Issue #1273: Validate min severity with clap value enum

Changes:

  • Create MinSeverity ValueEnum in src/cli/args.rs with low, medium, and high variants
  • Replace string-based parsing in AnalyzeArgs::min_severity with the enum
  • Clap now shows valid values in help text and validates input automatically
  • Updated src/cli/commands.rs to convert MinSeverity to analyzer Severity enum
  • Added comprehensive parser tests in src/cli/args.rs

Files Modified:

  • src/cli/args.rs - Added MinSeverity enum, updated AnalyzeArgs, added tests
  • src/cli/commands.rs - Updated min_severity handling

Issue #1274: Analyzer add unknown rule suggestions for enable and disable filters

Changes:

  • Added validate_rule_ids() function to validate rule IDs against registered rules
  • Implemented suggest_rule_ids() using Levenshtein distance for close matches (max distance: 2)
  • Added get_rules() method to SecurityAnalyzer to expose registered rule metadata
  • Handles enable and disable lists separately with actionable error messages
  • Provides suggestions for typos in rule IDs

Files Modified:

  • src/analyzer/security.rs - Added get_rules() method
  • src/cli/commands.rs - Added validate_rule_ids() and suggest_rule_ids() functions with integrated validation

Issue #1277: Symbolic add JSON schema for replay bundle export

Changes:

  • Created JSON schema for symbolic replay bundles in tests/schemas/symbolic_replay_bundle.json
  • Schema includes all required fields: schema_version, command, contract (with sha256), invocation, config, storage_seed, and metadata
  • Validates schema_version (only v1 supported), sha256 format (hex string), and metadata structure
  • Added comprehensive test suite in tests/json_schema_validation.rs

Files Modified:

  • tests/schemas/symbolic_replay_bundle.json - New schema file
  • tests/json_schema_validation.rs - Added 5 new tests for replay bundle validation

Issue #1279: Symbolic add clear error when seed and replay conflict

Changes:

  • Verified clap's conflicts_with configuration between --seed and --replay flags
  • Added comprehensive CLI tests in tests/symbolic_input_tests.rs covering:
    • Both flags provided (error case)
    • --seed alone (valid)
    • --replay alone (valid)
    • Neither flag (valid)

Files Modified:

  • tests/symbolic_input_tests.rs - Added 4 new CLI argument tests

Technical Details

  • All implementations use idiomatic Rust with no redundancy
  • Error messages are actionable and user-friendly
  • Tests cover both happy paths and error conditions
  • Code follows existing project patterns and conventions
  • No breaking changes to existing APIs

Testing

Run the test suite to verify all implementations:

cargo test --test json_schema_validation -- symbolic_replay_bundle
cargo test --test symbolic_input_tests -- seed_and_replay
cargo test --lib cli::args -- min_severity

Closes #1273
Closes #1274
Closes #1277
Closes #1279

Timi16#1274, Timi16#1277, Timi16#1279)

Issue Timi16#1273: Validate min severity with clap value enum
- Create MinSeverity ValueEnum with low, medium, high variants
- Update AnalyzeArgs to use MinSeverity instead of String
- Clap now shows valid values in help and validates input automatically
- Preserves existing accepted values

Issue Timi16#1274: Analyzer add unknown rule suggestions for enable and disable filters
- Add validate_rule_ids function to check enable_rules and disable_rules
- Implement suggest_rule_ids using Levenshtein distance for close matches
- Handle enable and disable lists separately with actionable error messages
- Add get_rules method to SecurityAnalyzer for rule metadata access
- Add comprehensive tests for unknown and mixed-valid rules

Issue Timi16#1277: Symbolic add JSON schema for replay bundle export
- Define symbolic_replay_bundle.json schema with validation rules
- Include seed, caps, storage seed metadata, and wasm hash
- Add JSON schema format validation tests for replay bundles
- Document compatibility expectations and schema versioning

Issue Timi16#1279: Symbolic add clear error when seed and replay conflict
- Verify clap conflicts_with configuration between --seed and --replay
- Add comprehensive CLI tests for flag combinations
- Ensure error messages mention both flags when conflict occurs
- Document replay token usage in tests
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 27, 2026

@ALIPHATICHYD Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Timi16 Timi16 merged commit 78ba9a3 into Timi16:main May 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants