Skip to content

[codex] stamp generated marker with project identity and version - #75

Merged
tinovyatkin merged 1 commit into
mainfrom
codex/generated-marker-version
Jul 14, 2026
Merged

[codex] stamp generated marker with project identity and version#75
tinovyatkin merged 1 commit into
mainfrom
codex/generated-marker-version

Conversation

@tinovyatkin

@tinovyatkin tinovyatkin commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Include the antlr-rust-runtime package name and version in the generated Rust module marker.
  • Include the project repository URL from Cargo package metadata in generated files.
  • Extend the generated-header unit test so the project/version marker and repository URL are covered, using compile-time concat! for the expected marker.

Why

Generated parsers previously only carried // @generated by antlr4-rust-gen - do not edit, which tied the marker to an internal helper binary name. Stamping the stable crate/project identity, version, and repository URL makes GitHub-search based outreach practical for very old generated parser versions after major releases.

Validation

  • cargo test --quiet --bin antlr4-rust-gen generated_modules_start_with_file_level_header
  • cargo test --quiet --test antlr4_rust_gen_cli
  • git diff --check -- src/bin/antlr4-rust-gen.rs

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 986e8871-25fc-4623-a682-6d235f0df3bf

📥 Commits

Reviewing files that changed from the base of the PR and between f8341cd and 0334b06.

📒 Files selected for processing (1)
  • src/bin/antlr4-rust-gen.rs

Walkthrough

The generated module header now uses Cargo package name, version, and repository metadata through a concat! expression and env!. Existing attributes and wrapper lines remain unchanged. The related test now validates the package metadata fragment and repository value in the generated header.

Poem

I’m a rabbit with a header to write,
Package and version now shine bright.
The repository joins the tune,
While wrapper lines remain in bloom.
Tests hop after, precise and clear—
Metadata carrots for every ear!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed It clearly describes updating the generated marker with project identity and version, which matches the main change.
Description check ✅ Passed The description accurately summarizes the header metadata update and the added tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

@github-actions

Copy link
Copy Markdown

Copy/Paste Detection

No duplications found in 1 changed Rust file(s) (threshold: 100 tokens).

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the generated module header in antlr4-rust-gen.rs to dynamically include the generator's version and repository URL at compile time, and adds unit tests to verify this header. The feedback suggests optimizing the test assertion by using concat! instead of format! to avoid runtime string allocation.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/bin/antlr4-rust-gen.rs Outdated
Comment on lines +9955 to +9958
assert!(GENERATED_MODULE_HEADER.contains(&format!(
"@generated by antlr4-rust-gen v{}",
env!("CARGO_PKG_VERSION")
)));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Since env!("CARGO_PKG_VERSION") is a compile-time constant, we can construct the expected string at compile time using concat! instead of allocating a new String at runtime with format!.

Suggested change
assert!(GENERATED_MODULE_HEADER.contains(&format!(
"@generated by antlr4-rust-gen v{}",
env!("CARGO_PKG_VERSION")
)));
assert!(GENERATED_MODULE_HEADER.contains(concat!(
"@generated by antlr4-rust-gen v",
env!("CARGO_PKG_VERSION")
)));

@tinovyatkin
tinovyatkin force-pushed the codex/generated-marker-version branch from 6cddfdd to 0334b06 Compare July 14, 2026 07:21
@tinovyatkin tinovyatkin changed the title [codex] stamp generated marker with repo and version [codex] stamp generated marker with project identity and version Jul 14, 2026
@tinovyatkin
tinovyatkin marked this pull request as ready for review July 14, 2026 08:07
@tinovyatkin
tinovyatkin merged commit f54dee4 into main Jul 14, 2026
11 checks passed
@tinovyatkin
tinovyatkin deleted the codex/generated-marker-version branch July 14, 2026 10:32
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