Skip to content

fix(plugin): preserve declarations around C++ raw strings - #1279

Merged
mldangelo-oai merged 3 commits into
openai:mainfrom
WenJing95:fix/cpp-raw-string-preview
Oct 5, 2026
Merged

mldangelo-oai merged 3 commits into
openai:mainfrom
WenJing95:fix/cpp-raw-string-preview

Conversation

@WenJing95

@WenJing95 WenJing95 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

C++ raw strings can contain quotes and braces that currently confuse source previews, hiding real declarations or showing functions written inside strings. Recognize these literals so previews retain the surrounding code.

Changes

  • Match C++ raw-string prefixes and custom delimiters, then reuse the existing raw-terminator handling.
  • Require an opener boundary so a macro such as ERROR immediately before a quoted string is not mistaken for a raw literal. Cover ASCII and Unicode macro names.
  • Exercise source/header suffixes, encoding prefixes, multiline bodies, and rank-input generation.

Testing

  • python -m pytest -q plugins/codex-security/tests/test_rank_preview.py plugins/codex-security/tests/test_generate_rank_input.py: 212 passed.
  • Plugin Ruff lint and format checks passed.
  • pnpm --dir sdk/typescript run build:ci passed.
  • Plugin source compatibility checker and its 9 tests passed.
  • Compiled macro-boundary examples with GCC and Clang; confirmed the original patch hides the following function and the corrected patch preserves it.
  • git diff --check passed. Source-checker tests used NODE_NO_WARNINGS=1 to suppress the local Node proxy warning.

Risk and rollout

Limited to source-preview masking for C++ and Objective-C++ file suffixes, including shared headers. Uses the existing masking state and preserves line positions. No public CLI changes.

Public disclosure review

  • No customer, partner, prospect, or user identities, data, or identifying details are included.
  • No credentials, personal data, private source, scan findings, or nonpublic links or tickets are included.
  • I reviewed the branch name, title, description, commits, changes, comments, logs, screenshots, attachments, and links for public disclosure.

@github-actions github-actions Bot added the bug Something isn't working label Oct 5, 2026

@mldangelo-oai mldangelo-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for finding this. I reproduced the missing declarations, and reusing the existing raw-string handling keeps the fix small.

I added one boundary correction: a macro such as ERROR followed immediately by a string was being mistaken for a raw-string opener, hiding the next function. The regression tests now cover that, including Unicode identifiers, and I removed a redundant assertion.

The 212 focused tests and all portable source checks pass. This is a useful correction to the previews and looks good to merge once CI is green.

@mldangelo-oai
mldangelo-oai merged commit f1ff761 into openai:main Oct 5, 2026
55 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 5, 2026
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants