Skip to content

[codex] Return hosted string accessors as string_view#29

Merged
anthonyprintup merged 5 commits into
mainfrom
codex/string-view-accessors
May 1, 2026
Merged

[codex] Return hosted string accessors as string_view#29
anthonyprintup merged 5 commits into
mainfrom
codex/string-view-accessors

Conversation

@anthonyprintup
Copy link
Copy Markdown
Owner

@anthonyprintup anthonyprintup commented May 1, 2026

Summary

  • Return immutable generated string accessors as std::string_view when PROTOCYTE_ENABLE_STD_STRING_VIEW is set to a nonzero value, while preserving Span<const char> for default and =0 builds.
  • Keep runtime ownership of the opt-in <string_view> include; generated headers only include <string_view> for string constants when the runtime opt-in is disabled.
  • Simplify Span<char> conversion to construct std::string_view directly from data_ and size_.
  • Add debug kernel smoke shims for MSVC STL assertion hooks used by std::string_view in PROTOCYTE_ENABLE_STD_STRING_VIEW=1 Debug driver builds.
  • Regenerate checked smoke headers and update runtime/generator/smoke coverage.

Test Plan

  • uv run python smoke/tools/generate_checked_outputs.py
  • clang-format on touched C++ runtime/smoke files
  • uv run python -m compileall src tests
  • uv run pytest -q (97 passed)
  • MSVC host smoke build and ctest --test-dir smoke/build/msvc --output-on-failure (25/25 passed)
  • MSVC kernel smoke build (protocyte_kernel_smoke) links
  • PR CI passed after the previous pushed revision; fresh checks are running for the latest macro-guard commit.

Emit immutable string field accessors as std::string_view when PROTOCYTE_ENABLE_STD_STRING_VIEW is enabled while preserving Span<const char> for default builds.

Simplify Span<char> conversion to construct std::string_view directly from data and size, treating null non-empty spans as a contract violation.

Regenerate checked smoke headers and add generator/smoke coverage for the hosted accessor surface.
Add smoke-driver-only fallback symbols for the MSVC debug STL CRT assertion hooks pulled in by std::string_view when PROTOCYTE_ENABLE_STD_STRING_VIEW is enabled.

Route unexpected shim calls through DbgPrintEx and KeBugCheckEx, and cover the guard with a source-level regression test.
@anthonyprintup
Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

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

ℹ️ 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".

@anthonyprintup anthonyprintup marked this pull request as ready for review May 1, 2026 19:36
Rely on the runtime header for PROTOCYTE_ENABLE_STD_STRING_VIEW accessor support instead of emitting a guarded string_view include from generated message headers.

Keep string-constant headers self-contained when the opt-in macro is off by emitting string_view only under the inverse guard, and update checked smoke outputs.
Switch PROTOCYTE_ENABLE_STD_STRING_VIEW guards from definedness checks to value checks so -DPROTOCYTE_ENABLE_STD_STRING_VIEW=0 uses the non-string_view accessor path.

Update inverse generated string constant includes, kernel smoke guards, documentation, tests, and regenerated smoke outputs.
Add protocyte::StringView as the runtime-selected string view type.

Use the alias in generated immutable string accessors so string and oneof bodies are no longer duplicated across the string_view feature branch.

Regenerate smoke checked outputs and update generator assertions.
@anthonyprintup anthonyprintup merged commit 76608a6 into main May 1, 2026
8 checks passed
@anthonyprintup anthonyprintup deleted the codex/string-view-accessors branch May 1, 2026 20:46
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