Add grammar-based payload generation via barkus#1838
Draft
GeorgeHahn wants to merge 5 commits intomainfrom
Draft
Add grammar-based payload generation via barkus#1838GeorgeHahn wants to merge 5 commits intomainfrom
GeorgeHahn wants to merge 5 commits intomainfrom
Conversation
9b5b1cf to
f179a8b
Compare
Integrates barkus as a new payload type in lading_payload, enabling any existing generator (TCP, UDP, HTTP, file, unix socket, etc.) to send grammar-generated structured data (JSON, CSV, SQL, arbitrary formats) from EBNF, PEG, or ANTLR v4 grammar files. Key design decisions: - Bridges rand 0.9 (lading) to rand 0.8 (barkus) by seeding a local SmallRng from the lading RNG, preserving determinism - Validates at construction time that the grammar's start production is reachable within the configured depth budget - Caps consecutive generation failures to prevent infinite loops on pathological grammars Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix ast-grep no-long-paths: shorten 4+ segment paths via imports - Fix ast-grep no-as-imports: use helper fn instead of `as _` import - Fix clippy unnecessary_wraps: replace default_max_depth() with const - Add barkus to deny.toml allow-git and clarify license entries - Add example config (examples/lading-grammar.yaml) with sample EBNF - Add payload README (lading_payload/README.grammar.md) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Barkus updated from rand 0.8 to rand 0.10. Update the pinned rev to 45e307e and switch the renamed dependency from rand_0_8 to rand_0_10. The rand 0.9 (lading) -> rand 0.10 (barkus) bridge still uses the same seed_from_u64 approach since rand_core 0.9 and 0.10 are incompatible. This bridge can be removed entirely once lading upgrades to rand 0.10. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix comment saying "rand 0.8" to correctly say "rand 0.10" - Add DEFAULT_MAX_TOTAL_NODES (20000) constant and always apply it, matching the documented default instead of relying on barkus internal default - Add comment documenting barkus invariant for productions[start] (ADR-0010) - Fix example YAML blackhole port (8080 → 8282) to match generator target Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The grammar generator should not inject delimiters between samples — the grammar itself defines the output format. Users who want newline-delimited output can include "\n" in their start production. Updated example grammars, tests, and docs accordingly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
f179a8b to
5f267b9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
grammarpayload type inlading_payloadSmallRng, preserving determinismConfig example