Repository navigation
feat(server): declare private transparent proxy contracts - #2404
Conversation
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: NVIDIA-NeMo/Guardrails/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (8)
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe experimental server package adds guarded-message and buffered-operation declarations. It also adds content-checker data types, a protocol, validation functions, and tests for these contracts and package imports. ChangesGuard contracts
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Feature Merge Risk: ⚪ Minimal · up to No actionable issue is established for this PR’s private contracts; it is mergeable after normal checks. 🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
tgasser-nv
left a comment
There was a problem hiding this comment.
Looks good, can you are you address the following before merging:
- The directory is named
experimental. When this changes from to the default, you'll have to move files around as it becomes the default rather than experimental. Recommend picking a directory that describes the operation instead (maybe justproxy?). This will churn every PR in the stack so you could move/rename as a new PR at the end - Could you add tests to get patch coverage up to 100%?
- Can you take a look at Mac's (@m-misiura ) comments?
Reject roles outside user and assistant and non-string content when a GuardedMessage is constructed, matching the validation already applied to the other checker boundary values. Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Exercise UnsupportedContentCheckerConfiguration through a checker whose inspection policy rejects its configuration, instead of only asserting its base class. Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Description
Phase A establishes the private provider-neutral foundations for transparent provider proxying. It separates content checking from provider payloads and HTTP behavior before any provider integration is added.
This PR introduces the small private contracts used to check content while transparently proxying provider requests and responses.
It defines:
GuardedMessagevalue without exposing a provider API;Why these private interfaces exist
ContentCheckeris a dependency-inversion boundary. Transparent proxy execution depends on this small protocol instead of importing the existing Guardrails checking APIs, which do not yet model all proxy requirements and may continue to evolve. An adapter can follow those changes without forcing them through provider parsing, proxy ordering, and HTTP forwarding.ContentInspectionPolicyis not a Rails configuration. A Rails configuration describes guardrail behavior. This type is only the validated runtime snapshot of whether one checker instance examines input, output, or both.GuardedMessageProjectionlets a provider select content for checking without moving provider payload types into the checker contract.BufferedGuardedOperationgives each internal operation a stable identity and its two provider-owned projections without deciding HTTP routing or provider composition.Stable and temporary parts
The private checker dependency direction and provider-neutral message, check-input, and decision shapes are intended to remain.
The deliberately narrow parts are:
ContentInspectionPolicycurrently captures only input and output checks; streaming adds its own inspection requirements without exposing provider events to the checker;InvalidContentCheckervalidates the structural protocol.UnsupportedContentCheckerConfigurationseparately represents a valid checker configuration that the proxy cannot execute.Review focus
ContentCheckerinvert the dependency on evolving Guardrails checking APIs without becoming a public abstraction?Non-goals
Phase A stack
Review every PR against its parent branch rather than against
develop, except for PR 1.pouyanpi/transparent-proxy-kernel-1developpouyanpi/transparent-proxy-buffered-kernel-2pouyanpi/transparent-proxy-kernel-1pouyanpi/transparent-proxy-http-kernel-3pouyanpi/transparent-proxy-buffered-kernel-2pouyanpi/transparent-proxy-projection-outcomes-4pouyanpi/transparent-proxy-http-kernel-3AI Assistance
Checklist