Skip to content

feat(codegen): add TestRig command - #302

Merged
tinovyatkin merged 9 commits into
mainfrom
feat/issue-289-testrig
Aug 5, 2026
Merged

feat(codegen): add TestRig command#302
tinovyatkin merged 9 commits into
mainfrom
feat/issue-289-testrig

Conversation

@tinovyatkin

@tinovyatkin tinovyatkin commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add antlr4-rust-testrig as a second binary in antlr-rust-codegen
  • generate and compile a temporary grammar-specific runner for combined, split, and lexer-only grammars
  • support token, tree, trace, diagnostics, and SLL output modes over stdin or multiple input files
  • render codegen, input, lexer, and parser failures with Miette fancy diagnostics and enable Clap colors
  • keep parse-only runs tree-free, reject conflicting prediction modes, and isolate generated recognizer names
  • return a non-zero status for generation, compilation, input, lexer, and parser errors
  • document installing and running TestRig directly in a non-Rust, grammar-only project

Design

TestRig stays in antlr-rust-codegen rather than a dedicated crate. Rust cannot
reflectively load a generated recognizer or invoke a parser rule by name, so the
command needs codegen's grammar metadata and rule-name normalization to emit
static dispatch. A separate crate would expose or duplicate those internals and
would only move the existing Clap dependency.

The generated runner lives below src/__antlr4_rust_testrig/ so grammars named
Main cannot collide with its entry point. Named inputs are all attempted and
their results are aggregated, making recovered lexer and parser syntax errors
fail test automation even when a tree can still be produced.

Generated recognizers are imported through private aliases so valid grammar
names cannot collide with runner helpers. Parse trees are built only for
--tree, and --diagnostics conflicts with --sll rather than silently
changing prediction mode. Cargo artifacts are shared through the current
user's cache, with ANTLR4_RUST_TESTRIG_TARGET_DIR as an override and a
per-run private fallback when no user cache is available. The generated
project root is created atomically with mode 0700 on Unix so grammar sources
and embedded actions are not exposed through a shared temporary directory.

Codegen diagnostics retain their structured codes and source spans through
Miette. The temporary runner uses the same reporting style for input I/O,
lexer, and parser failures. It retains the runtime's Rc-backed input and only
copies the full source into Miette's Arc-backed representation when a
diagnostic is rendered. Snapshot subprocesses force color off through the
standard color-control environment variables, while normal terminal use keeps
the fancy renderer and Clap styling.

This does not change the generated recognizer/runtime interface, so the
generated-code API revision remains unchanged.

Closes #289.

Validation

  • cargo test --locked --workspace --all-features
  • cargo clippy --locked --workspace --all-targets --all-features -- -D warnings
  • cargo fmt --all -- --check
  • git diff --check
  • ANTLR_RUST_RELEASE_ALLOW_DIRTY=1 tools/release/verify-package-contents.sh antlr-rust-codegen
  • cargo package --locked -p antlr-rust-codegen --allow-dirty
  • forced-color smoke checks for Clap and generated TestRig diagnostics

Summary by CodeRabbit

  • New Features

    • Added the antlr4-rust-testrig command for running generated lexer and parser grammars.
    • Supports combined or split grammars, stdin or file inputs, lexer-only mode, parser rules, token/tree/trace output, diagnostics, and prediction options.
    • Provides clear success and failure statuses with detailed diagnostics.
  • Documentation

    • Added comprehensive usage documentation covering installation, configuration, caching, temporary artifacts, and error handling.

Add antlr4-rust-testrig to generate and compile a temporary grammar-specific runner for combined, split, and lexer-only grammars. Rust cannot dispatch parser rules reflectively, so keep runner generation inside codegen and select rule methods from grammar metadata.

Forward the standard token, tree, trace, diagnostics, and SLL modes. Process every named input and return a non-zero status for generation, compilation, I/O, lexer, or parser errors so the command is suitable for test automation.

Document installation and split-grammar usage, cover success and failure paths end to end, and verify the new binary is included in the published codegen package.
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Copy/Paste Detection

Found 2 duplication(s) across 17 changed non-generated Rust file(s) (threshold: 100 tokens).

Show duplications

Found a 23 line (139 tokens) duplication in the following files:

  • Starting at line 1018 of crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/compatibility.rs
  • Starting at line 1077 of crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/compatibility.rs
         ID: [a-z]+;\n",
    )
    .expect("delegate grammar should be writable");

    let output = run_antlr4_rust_gen(&[
        root.as_os_str(),
        OsStr::new("-I"),
        temp.path().as_os_str(),
        OsStr::new("--actions"),
        OsStr::new("embedded"),
        OsStr::new("--sem-unknown"),
        OsStr::new("error"),
        OsStr::new("--require-full-semantics"),
        OsStr::new("--out-dir"),
        out.as_os_str(),
    ]);
    assert!(
        output.status.success(),
        "stdout: {}\nstderr: {}",
        utf8(&output.stdout),
        utf8(&output.stderr)
    );
    let parser = fs::read_to_string(out.join("root_parser.rs")).expect("parser should be emitted");
```rust

---

Found a 20 line (107 tokens) duplication in the following files:
* Starting at line 1159 of crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/compatibility.rs
* Starting at line 1205 of crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/compatibility.rs

```rust
    .expect("type-position grammar should be writable");

    let output = run_antlr4_rust_gen(&[
        grammar.as_os_str(),
        OsStr::new("--actions"),
        OsStr::new("embedded"),
        OsStr::new("--sem-unknown"),
        OsStr::new("error"),
        OsStr::new("--require-full-semantics"),
        OsStr::new("--out-dir"),
        out.as_os_str(),
    ]);
    assert!(
        output.status.success(),
        "stdout: {}\nstderr: {}",
        utf8(&output.stdout),
        utf8(&output.stderr)
    );
    let parser =
        fs::read_to_string(out.join("type_position_parser.rs")).expect("parser should be emitted");

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@tinovyatkin, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 50 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: bab9ab97-8f3f-4fe0-a72d-af9be080722e

📥 Commits

Reviewing files that changed from the base of the PR and between 757f8d4 and 154382f.

📒 Files selected for processing (1)
  • crates/antlr-rust-codegen/README.md
📝 Walkthrough

Walkthrough

This change adds the antlr4-rust-testrig binary. It generates temporary lexer or parser runners, supports runtime options and multiple inputs, reports failures through exit codes, and adds diagnostics, documentation, integration tests, and package verification.

Changes

TestRig CLI

Layer / File(s) Summary
Test-rig generation contract
crates/antlr-rust-codegen/src/config.rs, crates/antlr-rust-codegen/src/driver.rs, crates/antlr-rust-codegen/src/test_rig.rs, crates/antlr-rust-codegen/src/lib.rs, crates/antlr-rust-codegen/src/builder.rs
Adds TestRigConfig, collects lexer and parser metadata, and emits the generated test-rig artifact when configured.
Generated lexer and parser runners
crates/antlr-rust-codegen/src/test_rig.rs
Adds start-rule selection, lexer and parser runner templates, input processing, runtime options, diagnostics, tracing, parse trees, and error status handling.
Test-rig CLI orchestration
crates/antlr-rust-codegen/src/testrig_cli.rs, crates/antlr-rust-codegen/src/bin/*, crates/antlr-rust-codegen/Cargo.toml
Adds CLI argument parsing, temporary Cargo project creation, runtime resolution, recognizer generation, runner execution, and exit-code propagation.
Diagnostics and CLI validation
crates/antlr-rust-codegen/src/cli.rs, crates/antlr-rust-codegen/src/cli_report.rs, crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/*
Adds miette-based code-generation diagnostics and integration coverage for runner modes, inputs, failures, and path-stable output.
Distribution and usage documentation
README.md, crates/antlr-rust-codegen/README.md, tools/release/verify-package-contents.sh
Documents the command and verifies that the binary is included in the package.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant TestrigCLI
  participant CodeGenerator
  participant TemporaryCargoProject
  participant GeneratedRunner
  User->>TestrigCLI: provide grammar, inputs, and options
  TestrigCLI->>CodeGenerator: generate recognizer and test-rig entry point
  CodeGenerator->>TemporaryCargoProject: write source and Cargo manifest
  TestrigCLI->>GeneratedRunner: run generated binary
  GeneratedRunner-->>TestrigCLI: report lexer or parser result
  TestrigCLI-->>User: return exit code
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 41.98% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR implements the requested TestRig feature with generation, execution modes, error handling, documentation, and comprehensive tests.
Out of Scope Changes check ✅ Passed The changes support TestRig implementation, diagnostics, packaging, documentation, and testing; no unrelated changes are evident.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the addition of the antlr4-rust-testrig command, which is the main change.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/issue-289-testrig

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@claude

claude Bot commented Aug 5, 2026

Copy link
Copy Markdown

Claude Code is working…

I'll analyze this and get back to you.

View job run

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/antlr-rust-codegen/src/test_rig.rs`:
- Around line 439-448: Add unit tests around select_lexer covering zero lexers,
multiple lexers with matching Parser/Lexer stems, and multiple lexers without a
stem match. Add a tokens start-rule case that exercises rendering of the
lexer-only template, reusing the existing lexer and parser helpers and asserting
the expected selection or generated output.
- Around line 306-311: Remove the discard tuple in the lexer runner and stop
using it to silence unused-field analysis. Prefer moving tree, trace,
diagnostics, and sll out of the shared Options definition into the
parser-specific template so lexer options no longer accept parser-only flags;
otherwise apply per-field dead-code attributes to the shared Options fields.
- Around line 450-488: Replace the hand-written contains assertions in
renders_rule_dispatch_with_generated_method_name with a named external
insta::assert_snapshot! covering the complete rendered runner. In
rejects_unknown_and_ambiguous_rules, snapshot each diagnostic string inline
using insta::assert_snapshot! or an approved debug variant. Add
#[allow(clippy::disallowed_methods)] to the containing test module, and place
the external snapshot in the sibling snapshots directory.

In `@crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/testrig.rs`:
- Line 128: Replace the full parse-tree equality assertion around the
`output.stdout` check with a named `insta::assert_snapshot!` assertion, using
the UTF-8 output as the snapshot content and preserving the existing expected
parse-tree dump through the external snapshot file.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: cf1bd133-7106-4c4b-a5fa-12fe6b95b394

📥 Commits

Reviewing files that changed from the base of the PR and between c4343ef and 7f6a086.

⛔ Files ignored due to path filters (3)
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/snapshots/antlr4_rust_gen_cli__testrig__antlr4_rust_testrig_help.snap is excluded by !**/*.snap
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/snapshots/antlr4_rust_gen_cli__testrig__parser_runner_stdout.snap is excluded by !**/*.snap
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/snapshots/antlr4_rust_gen_cli__testrig__parser_runner_trace.snap is excluded by !**/*.snap
📒 Files selected for processing (15)
  • README.md
  • crates/antlr-rust-codegen/Cargo.toml
  • crates/antlr-rust-codegen/README.md
  • crates/antlr-rust-codegen/src/bin/antlr4-rust-testrig.rs
  • crates/antlr-rust-codegen/src/builder.rs
  • crates/antlr-rust-codegen/src/cli.rs
  • crates/antlr-rust-codegen/src/config.rs
  • crates/antlr-rust-codegen/src/driver.rs
  • crates/antlr-rust-codegen/src/lib.rs
  • crates/antlr-rust-codegen/src/test_rig.rs
  • crates/antlr-rust-codegen/src/testrig_cli.rs
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli.rs
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/support.rs
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/testrig.rs
  • tools/release/verify-package-contents.sh

Comment thread crates/antlr-rust-codegen/src/test_rig.rs Outdated
Comment thread crates/antlr-rust-codegen/src/test_rig.rs
Comment thread crates/antlr-rust-codegen/src/test_rig.rs
Comment thread crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/testrig.rs Outdated
@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.51701% with 44 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/antlr-rust-codegen/src/testrig_cli.rs 87.13% 31 Missing ⚠️
crates/antlr-rust-codegen/src/cli_report.rs 90.82% 10 Missing ⚠️
crates/antlr-rust-codegen/src/test_rig.rs 99.00% 2 Missing ⚠️
crates/antlr-rust-codegen/src/driver.rs 93.75% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Snapshot complete lexer and parser runners plus split-grammar tree output, and cover missing, ambiguous, and stem-matched lexer selection paths.

Replace the lexer runner's discard tuple with an explicit allowance that documents why parser-only TestRig flags remain accepted in lexer-only mode.
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

📊 Source Code Metrics (this PR vs main)

File Cyclomatic Cognitive Functions LLOC MI
crates/antlr-rust-codegen/src/builder.rs 46 ⚪ 10 ⚪ 24 ⚪ 55 ⚪ 13.71 (main: 13.76) 🔴
crates/antlr-rust-codegen/src/testrig_cli.rs 75 🆕 34 🆕 21 🆕 88 🆕 2.48 🆕
crates/antlr-rust-codegen/src/error.rs 26 (main: 30) 🟢 2 (main: 6) 🟢 16 (main: 17) 🟢 20 (main: 25) 🟢 22.97 (main: 21.39) 🟢
crates/antlr-rust-codegen/src/test_rig.rs 43 🆕 14 🆕 16 🆕 61 🆕 3.80 🆕
crates/antlr-rust-codegen/src/cli_report.rs 43 🆕 8 🆕 13 🆕 40 🆕 18.39 🆕
crates/antlr-rust-codegen/src/driver.rs 79 (main: 74) 🔴 61 (main: 52) 🔴 7 ⚪ 115 (main: 107) 🔴 5.20 (main: 6.68) 🔴
crates/antlr-rust-codegen/src/cli.rs 14 ⚪ 6 (main: 5) 🔴 4 ⚪ 17 ⚪ 21.34 (main: 21.55) 🔴
crates/antlr-rust-codegen/src/lib.rs 3 (main: 2) 🔴 0 ⚪ 2 (main: 1) 🔴 4 (main: 1) 🔴 38.77 (main: 41.40) 🔴
crates/antlr-rust-codegen/src/bin/antlr4-rust-gen.rs 2 ⚪ 0 ⚪ 1 ⚪ 1 ⚪ 77.21 (main: 75.51) 🟢
crates/antlr-rust-codegen/src/bin/antlr4-rust-testrig.rs 2 🆕 0 🆕 1 🆕 1 🆕 76.23 🆕
crates/antlr-rust-codegen/src/config.rs 1 ⚪ 0 ⚪ 0 ⚪ 0 ⚪ 43.23 (main: 45.49) 🔴

Generated by mehen v1.8.0 — the code quality watcher.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3aca3903d1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/antlr-rust-codegen/src/test_rig.rs Outdated
Comment thread crates/antlr-rust-codegen/src/test_rig.rs Outdated
Comment thread crates/antlr-rust-codegen/src/test_rig.rs Outdated
Comment thread crates/antlr-rust-codegen/src/testrig_cli.rs Outdated
Render code-generation failures with Miette source diagnostics and enable Clap colors for the public CLI binaries.

Generated TestRig runners now report input, lexer, and parser failures through Miette while preserving multi-input aggregation and non-zero exits. Snapshot subprocesses force colors off for deterministic output.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/diagnostics.rs`:
- Around line 99-102: Update the grammar-path normalization used by the Miette
snapshots in
crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/diagnostics.rs:99-102 and
crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/transforms.rs:353-356 to
call replace_miette_path before snapshot normalization. Replace the direct path
substitutions at both sites while preserving the existing snapshot assertions.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a184aa91-3614-4f7c-a31e-388c82a89262

📥 Commits

Reviewing files that changed from the base of the PR and between 7f6a086 and 8980a08.

⛔ Files ignored due to path filters (13)
  • Cargo.lock is excluded by !**/*.lock
  • crates/antlr-rust-codegen/src/snapshots/antlr_rust_codegen__test_rig__tests__lexer_runner_rendered.snap is excluded by !**/*.snap
  • crates/antlr-rust-codegen/src/snapshots/antlr_rust_codegen__test_rig__tests__parser_runner_rendered.snap is excluded by !**/*.snap
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/snapshots/antlr4_rust_gen_cli__compatibility__unsupported_antlr4rust_surface_diagnostics.snap is excluded by !**/*.snap
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/snapshots/antlr4_rust_gen_cli__diagnostics__lexer_left_recursion_diagnostics.snap is excluded by !**/*.snap
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/snapshots/antlr4_rust_gen_cli__semantics__parser_action_hook_signature_conflict_diagnostic.snap is excluded by !**/*.snap
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/snapshots/antlr4_rust_gen_cli__testrig__lexer_only_syntax_error.snap is excluded by !**/*.snap
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/snapshots/antlr4_rust_gen_cli__testrig__lexer_syntax_error.snap is excluded by !**/*.snap
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/snapshots/antlr4_rust_gen_cli__testrig__parser_syntax_error.snap is excluded by !**/*.snap
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/snapshots/antlr4_rust_gen_cli__testrig__split_parser_tree.snap is excluded by !**/*.snap
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/snapshots/antlr4_rust_gen_cli__testrig__unknown_start_rule_diagnostic.snap is excluded by !**/*.snap
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/snapshots/antlr4_rust_gen_cli__transforms__configured_entry_rule_not_found.snap is excluded by !**/*.snap
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/snapshots/antlr4_rust_gen_cli__transforms__precedence_ladder_authored_semantic_errors.snap is excluded by !**/*.snap
📒 Files selected for processing (16)
  • README.md
  • crates/antlr-rust-codegen/Cargo.toml
  • crates/antlr-rust-codegen/README.md
  • crates/antlr-rust-codegen/src/bin/antlr4-rust-gen.rs
  • crates/antlr-rust-codegen/src/bin/antlr4-rust-testrig.rs
  • crates/antlr-rust-codegen/src/cli.rs
  • crates/antlr-rust-codegen/src/cli_report.rs
  • crates/antlr-rust-codegen/src/error.rs
  • crates/antlr-rust-codegen/src/lib.rs
  • crates/antlr-rust-codegen/src/test_rig.rs
  • crates/antlr-rust-codegen/src/testrig_cli.rs
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/compatibility.rs
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/diagnostics.rs
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/support.rs
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/testrig.rs
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/transforms.rs
💤 Files with no reviewable changes (1)
  • crates/antlr-rust-codegen/src/error.rs

Comment thread crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/diagnostics.rs
Disable parse-tree construction unless requested and reject conflicting exact-diagnostics and SLL modes.

Alias generated recognizer imports so grammar names cannot collide with runner helpers, and keep the shared Cargo target under a user-specific cache with an explicit override and private fallback.
Route every Miette snapshot path replacement through the wrapper-aware normalizer so line-wrapped paths remain deterministic.
Honor an exported COLUMNS value in the codegen CLIs and generated TestRig runners. Pin the CLI snapshot harness to a wide terminal so checkout path length cannot change Miette wrapping before dynamic paths are normalized.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 97ecca0fbc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/antlr-rust-codegen/src/testrig_cli.rs Outdated
Comment thread crates/antlr-rust-codegen/src/test_rig.rs Outdated
Create generated runner projects with private Unix permissions so grammar sources and embedded actions are not exposed through shared temporary directories.

Retain the runtime's Rc-backed input and buffer raw diagnostics, converting source text to Miette's Arc-backed representation only when an error is rendered.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/antlr-rust-codegen/README.md`:
- Around line 63-68: Update the command-mode documentation in the package README
to include the supported --trace parser mode alongside --diagnostics and --sll,
preserving the existing statement that --diagnostics and --sll are mutually
exclusive.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 70a8f89a-6d8f-49e7-9a31-81c522eafb09

📥 Commits

Reviewing files that changed from the base of the PR and between 8980a08 and 757f8d4.

⛔ Files ignored due to path filters (7)
  • crates/antlr-rust-codegen/src/snapshots/antlr_rust_codegen__test_rig__tests__lexer_runner_rendered.snap is excluded by !**/*.snap
  • crates/antlr-rust-codegen/src/snapshots/antlr_rust_codegen__test_rig__tests__parser_runner_rendered.snap is excluded by !**/*.snap
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/snapshots/antlr4_rust_gen_cli__compatibility__unsupported_antlr4rust_surface_diagnostics.snap is excluded by !**/*.snap
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/snapshots/antlr4_rust_gen_cli__semantics__parser_action_hook_signature_conflict_diagnostic.snap is excluded by !**/*.snap
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/snapshots/antlr4_rust_gen_cli__testrig__colliding_recognizer_names_tree.snap is excluded by !**/*.snap
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/snapshots/antlr4_rust_gen_cli__testrig__conflicting_prediction_modes.snap is excluded by !**/*.snap
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/snapshots/antlr4_rust_gen_cli__testrig__unknown_start_rule_diagnostic.snap is excluded by !**/*.snap
📒 Files selected for processing (10)
  • README.md
  • crates/antlr-rust-codegen/README.md
  • crates/antlr-rust-codegen/src/cli_report.rs
  • crates/antlr-rust-codegen/src/lib.rs
  • crates/antlr-rust-codegen/src/test_rig.rs
  • crates/antlr-rust-codegen/src/testrig_cli.rs
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/diagnostics.rs
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/support.rs
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/testrig.rs
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/transforms.rs

Comment thread crates/antlr-rust-codegen/README.md Outdated
Keep the package-level TestRig usage guide aligned with the root README by listing every supported parser mode and the diagnostics/SLL conflict.
@tinovyatkin

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 154382fdb6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@tinovyatkin
tinovyatkin merged commit e03e75c into main Aug 5, 2026
16 of 17 checks passed
@tinovyatkin
tinovyatkin deleted the feat/issue-289-testrig branch August 5, 2026 08:42
@ophiarch ophiarch Bot mentioned this pull request Aug 5, 2026
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.

TestRig

1 participant