Skip to content

fix NamespacesExampleTest: Refactor headerValueEncode to use toText for string conversion#2967

Merged
predic8 merged 2 commits into
masterfrom
fix-namespaces-example-test
Jun 1, 2026
Merged

fix NamespacesExampleTest: Refactor headerValueEncode to use toText for string conversion#2967
predic8 merged 2 commits into
masterfrom
fix-namespaces-example-test

Conversation

@christiangoerdes

@christiangoerdes christiangoerdes commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added NullPolicies, a new policy implementation for the LLM gateway interceptor that provides no-op request handling and token management.
  • Improvements

    • Enhanced HTTP header safety by properly escaping carriage returns, line feeds, and null characters in serialized header values to prevent protocol violations.
  • Chores

    • Added Apache License 2.0 copyright headers to multiple source and test files for proper licensing compliance.

@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR extends the LLM gateway with a new NullPolicies no-op implementation, adds Apache 2.0 license headers to five Java source files for compliance, and improves HTTP header encoding safety in SerializationUtil by using ToTextSerializer.toText before escaping control characters.

Changes

LLM Gateway Extension and Serialization Improvements

Layer / File(s) Summary
NullPolicies implementation with license header
core/src/main/java/com/predic8/membrane/core/interceptor/llmgateway/NullPolicies.java
New public class implementing Policies interface with no-op request handling always returning Outcome.CONTINUE, zero max output tokens, and no-op initialization and setter methods.
Apache 2.0 license headers for related source files
core/src/main/java/com/predic8/membrane/core/interceptor/llmgateway/Policies.java, core/src/main/java/com/predic8/membrane/core/interceptor/llmgateway/SystemPrompt.java, core/src/test/java/com/predic8/membrane/core/interceptor/llmgateway/provider/AbstractLLMRequestTest.java, core/src/test/java/com/predic8/membrane/core/lang/ScriptingUtilsTest.java
Apache 2.0 copyright and license header blocks added to four related source files for licensing compliance.
SerializationUtil header encoding with ToTextSerializer
core/src/main/java/com/predic8/membrane/core/util/text/SerializationUtil.java
Static import of ToTextSerializer.toText added; headerValueEncode method now safely converts values using toText before escaping CR, LF, and NUL characters for HTTP header safety.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers

  • t-burch
  • rrayst

Poem

A rabbit hops through code so clean,
With license headers, now pristine,
NullPolicies sleeps, passing requests by,
While headers dance safe—no CR, LF, or sigh! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The PR title references fixing 'NamespacesExampleTest' and refactoring 'headerValueEncode', which matches the actual changes in SerializationUtil.java, but the changes include multiple unrelated additions like NullPolicies class and license headers. The title describes only one specific change (headerValueEncode refactoring) but the PR includes several other changes (NullPolicies implementation and license headers). Clarify whether the PR should focus on the headerValueEncode fix or provide a broader title encompassing all changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-namespaces-example-test

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 and usage tips.

@christiangoerdes christiangoerdes changed the title Update XPath expression to ensure string conversion for id header fix NamespacesExampleTest: Update XPath expression to ensure string conversion for id header Jun 1, 2026
@membrane-ci-server

Copy link
Copy Markdown

This pull request needs "/ok-to-test" from an authorized committer.

@christiangoerdes christiangoerdes changed the title fix NamespacesExampleTest: Update XPath expression to ensure string conversion for id header fix NamespacesExampleTest: Refactor headerValueEncode to use toText for string conversion Jun 1, 2026
@christiangoerdes

Copy link
Copy Markdown
Collaborator Author

/ok-to-test

@christiangoerdes christiangoerdes changed the title fix NamespacesExampleTest: Refactor headerValueEncode to use toText for string conversion fix NamespacesExampleTest: Refactor headerValueEncode to use toText for string conversion Jun 1, 2026
@predic8 predic8 merged commit bb22179 into master Jun 1, 2026
4 of 5 checks passed
@predic8 predic8 deleted the fix-namespaces-example-test branch June 1, 2026 09:56
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.

2 participants