Skip to content

feat(orm): add support for raw (r#) model and field names#485

Merged
seqre merged 5 commits intomasterfrom
raw-field-names
Mar 13, 2026
Merged

feat(orm): add support for raw (r#) model and field names#485
seqre merged 5 commits intomasterfrom
raw-field-names

Conversation

@m4tx
Copy link
Member

@m4tx m4tx commented Feb 21, 2026

No description provided.

@github-actions github-actions bot added C-cli Crate: cot-cli (issues and Pull Requests related to Cot CLI) C-macros Crate: cot-macros C-codegen Crate: cot-codegen labels Feb 21, 2026
@github-actions
Copy link

github-actions bot commented Feb 21, 2026

🐰 Bencher Report

Branchraw-field-names
Testbedgithub-ubuntu-latest
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
microseconds (µs)
(Result Δ%)
Upper Boundary
microseconds (µs)
(Limit %)
empty_router/empty_router📈 view plot
🚷 view threshold
6,494.90 µs
(+9.91%)Baseline: 5,909.54 µs
6,995.49 µs
(92.84%)
json_api/json_api📈 view plot
🚷 view threshold
1,074.90 µs
(+5.09%)Baseline: 1,022.84 µs
1,166.50 µs
(92.15%)
nested_routers/nested_routers📈 view plot
🚷 view threshold
1,009.90 µs
(+7.09%)Baseline: 943.02 µs
1,069.78 µs
(94.40%)
single_root_route/single_root_route📈 view plot
🚷 view threshold
968.61 µs
(+7.17%)Baseline: 903.84 µs
1,028.72 µs
(94.16%)
single_root_route_burst/single_root_route_burst📈 view plot
🚷 view threshold
18,340.00 µs
(+4.99%)Baseline: 17,468.02 µs
20,584.77 µs
(89.09%)
🐰 View full continuous benchmarking report in Bencher

@codecov
Copy link

codecov bot commented Feb 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
rust 90.01% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cot-codegen/src/model.rs 94.52% <100.00%> (+0.42%) ⬆️
cot-codegen/src/symbol_resolver.rs 98.53% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@m4tx m4tx marked this pull request as ready for review February 26, 2026 13:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for Rust raw identifiers (r#...) in ORM model/field names so database identifiers (table/column names) are generated without the r# prefix while the Rust Ident is preserved.

Changes:

  • Use quote::format_ident! in the symbol resolver when constructing PathSegment idents (supports raw identifiers).
  • Strip raw-ident prefixes via IdentExt::unraw() when deriving model table names and field column names.
  • Add unit/integration tests covering keyword/raw identifier scenarios in model parsing and migration generation.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
cot-codegen/src/symbol_resolver.rs Builds path segments with format_ident! to correctly handle raw identifiers in resolved paths.
cot-codegen/src/model.rs Uses unraw() for table/column name derivation and adds unit tests for raw names.
cot-cli/tests/migration_generator/keywords.rs Adds a keyword/raw-identifier model fixture used by migration generator tests.
cot-cli/tests/migration_generator.rs Adds integration tests validating generated migrations and source contain correct identifiers for keyword/raw names.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@m4tx m4tx force-pushed the raw-field-names branch from 404d462 to 4a27ab2 Compare March 12, 2026 11:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@seqre seqre merged commit 3bdb47a into master Mar 13, 2026
40 checks passed
@seqre seqre deleted the raw-field-names branch March 13, 2026 08:37
@cotbot cotbot bot mentioned this pull request Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-cli Crate: cot-cli (issues and Pull Requests related to Cot CLI) C-codegen Crate: cot-codegen C-macros Crate: cot-macros

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants