Skip to content

fix: add word boundary to RAW_STR regexes to prevent false matches#262

Merged
corvid-agent merged 2 commits intomainfrom
fix/raw-str-word-boundary
Apr 29, 2026
Merged

fix: add word boundary to RAW_STR regexes to prevent false matches#262
corvid-agent merged 2 commits intomainfrom
fix/raw-str-word-boundary

Conversation

@corvid-agent
Copy link
Copy Markdown
Collaborator

Summary

  • Adds \b word boundary anchor before r in all four RAW_STR_* regex patterns (RAW_STR_0 through RAW_STR_3) in src/exports/rust_lang.rs
  • Prevents identifiers ending in r adjacent to " (e.g. "pre_pr") from being misinterpreted as raw string literal starts, which could span many lines and swallow pub declarations
  • Adds regression test reproducing the exact scenario from the issue

Test plan

  • All 15 rust_lang tests pass (including new regression test)
  • Existing raw string stripping still works correctly (tested via test_ignores_pub_inside_string_literals and test_pub_after_raw_string_with_hash_in_content)
  • Real file tests (test_real_ai_rs, test_real_registry_rs) still pass

Fixes #261

🤖 Generated with Claude Code

The RAW_STR_0 through RAW_STR_3 regexes lacked a word boundary anchor,
causing identifiers ending in `r` adjacent to a `"` (e.g. `"pre_pr"`)
to be misinterpreted as raw string literal starts. This could span many
lines and eat pub declarations, leading to false spec-check failures.

Adds `\b` before `r` in all four patterns and a regression test for the
exact scenario from #261.

Fixes #261

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

❌ Corvin says...

      _
    <(;\  .oO(oh no...)
     |/(\
      \(\\
      " "\\

"I'm pecking through the errors..."

CI Summary

Check Status
Validate action.yml ✅ Passed
Dependency Audit ✅ Passed
Code Coverage ✅ Passed
Format Check ❌ failure
Spec Validation ✅ Passed
Tests (build, test, clippy) ✅ Passed
📋 Spec Validation Details

✅ SpecSync: Passed

Metric Value
Specs checked 57
Passed 57
Errors 0
Warnings 0
File coverage 97% (73/75)
LOC coverage 98% (32594/32954)

Unspecced Files

The following source files have no spec coverage:

  • src/exports/ast/tests.rs
  • src/util.rs

Run specsync generate to scaffold specs for these files.


Generated by specsync · Run specsync check --format github to reproduce


Powered by corvid-pet

@corvid-agent
Copy link
Copy Markdown
Collaborator Author

👋 CorvidAgent is looking into this.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@corvid-agent
Copy link
Copy Markdown
Collaborator Author

Fixed in e871b69 — ran rustfmt to collapse RAW_STR_1 and RAW_STR_0 to single lines. Format check should pass now.

@github-actions github-actions Bot dismissed their stale review April 29, 2026 22:31

Superseded by updated review.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

✅ Corvin says...

      _
    <(^\  .oO(Caw! ^v^)
     |/(\
      \(\\
      " "\\

"Caw! Found a shiny new spec!"

CI Summary

Check Status
Validate action.yml ✅ Passed
Dependency Audit ✅ Passed
Code Coverage ✅ Passed
Format Check ✅ Passed
Spec Validation ✅ Passed
Tests (build, test, clippy) ✅ Passed
📋 Spec Validation Details

✅ SpecSync: Passed

Metric Value
Specs checked 57
Passed 57
Errors 0
Warnings 0
File coverage 97% (73/75)
LOC coverage 98% (32592/32952)

Unspecced Files

The following source files have no spec coverage:

  • src/exports/ast/tests.rs
  • src/util.rs

Run specsync generate to scaffold specs for these files.


Generated by specsync · Run specsync check --format github to reproduce


Powered by corvid-pet

@corvid-agent
Copy link
Copy Markdown
Collaborator Author

👋 CorvidAgent is looking into this.

@corvid-agent
Copy link
Copy Markdown
Collaborator Author

All green — format issue was already fixed in e871b69. CI is passing across the board. Ready to merge.

@corvid-agent
Copy link
Copy Markdown
Collaborator Author

👋 CorvidAgent is looking into this.

1 similar comment
@corvid-agent
Copy link
Copy Markdown
Collaborator Author

👋 CorvidAgent is looking into this.

@corvid-agent
Copy link
Copy Markdown
Collaborator Author

👋 CorvidAgent is looking into this.

@corvid-agent
Copy link
Copy Markdown
Collaborator Author

Thanks for the review, Leif! Merging now.

@corvid-agent corvid-agent merged commit 58c38a7 into main Apr 29, 2026
14 checks passed
@corvid-agent corvid-agent deleted the fix/raw-str-word-boundary branch April 29, 2026 23:00
@corvid-agent
Copy link
Copy Markdown
Collaborator Author

Thanks for the review and approval, @0xLeif! This one's already merged. 🤝

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.

RAW_STR_0 regex false-matches identifier trailing r + adjacent quote

2 participants