Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (10)
📝 WalkthroughWalkthroughRenames passthrough config keys and adds ENABLED_PASSTHROUGH_PROVIDERS; replaces transport/semantic carriers and many semantic types: IngressFrame → RequestSnapshot, SemanticEnvelope → WhiteBoxPrompt, SelectorHints → RouteHints, Batch/File semantics → RouteInfo; updates code, tests, docs, and swagger to match renamed APIs and env keys. Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
| Derived Meaning (gateway interpretation)
Route-Specific Sparse Metadata
Canonical Decode + Caching
Passthrough
Config (external surface)
|
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (10)
internal/server/handlers_test.go (2)
761-833: 🧹 Nitpick | 🔵 TrivialTest name inconsistency with new naming convention.
The test function
TestChatCompletion_UsesIngressFrameForDecodingstill references the old "IngressFrame" terminology while the implementation now usesNewRequestSnapshot. Consider renaming toTestChatCompletion_UsesRequestSnapshotForDecodingfor consistency with the refactor.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/server/handlers_test.go` around lines 761 - 833, Rename the test function TestChatCompletion_UsesIngressFrameForDecoding to use the new naming convention (e.g., TestChatCompletion_UsesRequestSnapshotForDecoding) so it matches the refactor that replaced "IngressFrame" with NewRequestSnapshot; update the test function identifier and any references to the old name (in this file's test definition) to the new name, leaving the test body and assertions (provider, frame creation via core.NewRequestSnapshot, and semantics checks) unchanged.
915-982: 🧹 Nitpick | 🔵 TrivialTest names reference old terminology.
Similar to the chat completions test, these test functions still reference "IngressFrame" in their names:
TestResponses_UsesIngressFrameForDecoding(Line 915)TestEmbeddings_UsesIngressFrameForDecoding(Line 984)TestBatches_UsesIngressFrameForDecoding(Line 1050)TestGetBatch_UsesSemanticEnvelopeRouteMetadata(Line 1130)TestListBatches_UsesSemanticEnvelopeQueryMetadata(Line 1176)Consider renaming these to use "RequestSnapshot" and "RequestSemantics" terminology for consistency. The implementation code itself is correct.
Also applies to: 984-1048, 1050-1128, 1130-1174
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/server/handlers_test.go` around lines 915 - 982, Rename the tests that still reference old "IngressFrame" terminology to use "RequestSnapshot" and "RequestSemantics" as suggested: change TestResponses_UsesIngressFrameForDecoding -> TestResponses_UsesRequestSnapshotForDecoding, TestEmbeddings_UsesIngressFrameForDecoding -> TestEmbeddings_UsesRequestSnapshotForDecoding, TestBatches_UsesIngressFrameForDecoding -> TestBatches_UsesRequestSnapshotForDecoding, TestGetBatch_UsesSemanticEnvelopeRouteMetadata -> TestGetBatch_UsesRequestSemanticsRouteMetadata, and TestListBatches_UsesSemanticEnvelopeQueryMetadata -> TestListBatches_UsesRequestSemanticsQueryMetadata; update the function names and any internal references/calls to those symbols (test function identifiers and any t.Run strings or comments) so names are consistent while leaving test logic unchanged.internal/server/semantic_requests_test.go (8)
230-257: 🧹 Nitpick | 🔵 TrivialTest function name inconsistency:
TestFileRequestFromSemanticEnvelope_InvalidLimitFromIngressReturnsError.Consider renaming to
TestFileRouteInfoFromSemantics_InvalidLimitReturnsError. "Ingress" terminology could be updated to "Snapshot" or removed.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/server/semantic_requests_test.go` around lines 230 - 257, Rename the test function TestFileRequestFromSemanticEnvelope_InvalidLimitFromIngressReturnsError to TestFileRouteInfoFromSemantics_InvalidLimitReturnsError to match naming conventions and the function under test (fileRouteInfoFromSemantics); update the test function declaration accordingly and any references to it so the name no longer uses "Ingress" or "Envelope" and instead reflects "RouteInfoFromSemantics" and "InvalidLimit".
109-137: 🧹 Nitpick | 🔵 TrivialTest function name inconsistency:
TestCanonicalJSONRequestFromSemanticEnvelope_FallsBackToLiveBodyWhenIngressBodyMissing.Consider renaming to use "Semantics" instead of "SemanticEnvelope". The phrase "IngressBody" could also be updated to "SnapshotBody" or "CapturedBody" for full consistency.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/server/semantic_requests_test.go` around lines 109 - 137, Rename the test function TestCanonicalJSONRequestFromSemanticEnvelope_FallsBackToLiveBodyWhenIngressBodyMissing to use consistent terminology (e.g., TestCanonicalJSONRequestFromSemantics_FallsBackToSnapshotBodyWhenIngressBodyMissing or TestCanonicalJSONRequestFromSemantics_FallsBackToCapturedBodyWhenSnapshotMissing); update the function declaration and any references to it (test name strings, usages in other tests or CI configurations) and ensure the new name still follows Go test naming conventions and matches the intent in canonicalJSONRequestFromSemantics and core.RequestSnapshot/ingress terminology.
18-61: 🧹 Nitpick | 🔵 TrivialTest function name still references old terminology.
The test function is named
TestCanonicalJSONRequestFromSemanticEnvelope_CachesChatRequestbut the implementation now usesRequestSemantics. Consider renaming toTestCanonicalJSONRequestFromSemantics_CachesChatRequestfor consistency with the internal helper rename (canonicalJSONRequestFromSemantics).The internal logic correctly uses the new types and field names (
RequestSnapshot,RequestSemantics,RoutingHints).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/server/semantic_requests_test.go` around lines 18 - 61, Rename the test function to match the updated terminology: change TestCanonicalJSONRequestFromSemanticEnvelope_CachesChatRequest to TestCanonicalJSONRequestFromSemantics_CachesChatRequest so it aligns with the helper canonicalJSONRequestFromSemantics and the new RequestSemantics types; update any references or comments in the file that mention "SemanticEnvelope" to "Semantics" and ensure the test still asserts env.CachedChatRequest(), GetRequestSemantics, and RoutingHints behavior unchanged.
299-338: 🧹 Nitpick | 🔵 TrivialTest function name inconsistency:
TestFileRequestFromSemanticEnvelope_CachesListMetadata.Consider renaming to
TestFileRouteInfoFromSemantics_CachesListMetadata. The internal implementation correctly uses new terminology.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/server/semantic_requests_test.go` around lines 299 - 338, Rename the test function TestFileRequestFromSemanticEnvelope_CachesListMetadata to TestFileRouteInfoFromSemantics_CachesListMetadata to match the new terminology; update the test declaration (the func name) and any references to it, keeping the test body and assertions intact (the test uses fileRouteInfoFromSemantics, core.FileActionList, and related fields like Provider, Purpose, After, HasLimit, Limit).
189-228: 🧹 Nitpick | 🔵 TrivialTest function name inconsistency:
TestBatchRequestMetadataFromSemanticEnvelope_CachesListMetadata.Consider renaming to
TestBatchRouteInfoFromSemantics_CachesListMetadatato align with the helper rename (batchRouteInfoFromSemantics) and the return type (BatchRouteInfo).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/server/semantic_requests_test.go` around lines 189 - 228, Rename the test function TestBatchRequestMetadataFromSemanticEnvelope_CachesListMetadata to TestBatchRouteInfoFromSemantics_CachesListMetadata so the name matches the helper batchRouteInfoFromSemantics and the returned type BatchRouteInfo; update the function declaration and any references to the old test name in the test file to the new name to keep naming consistent.
259-297: 🧹 Nitpick | 🔵 TrivialTest function name inconsistency:
TestFileRequestFromSemanticEnvelope_EnrichesCreateMetadata.Consider renaming to
TestFileRouteInfoFromSemantics_EnrichesCreateMetadata. Internal logic correctly uses the new types.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/server/semantic_requests_test.go` around lines 259 - 297, Rename the test function TestFileRequestFromSemanticEnvelope_EnrichesCreateMetadata to TestFileRouteInfoFromSemantics_EnrichesCreateMetadata; update the function declaration and any references or test names so they match the new identifier, ensuring it still calls fileRouteInfoFromSemantics, core.GetRequestSemantics, and asserts on env.CachedFileRouteInfo() unchanged so the test compiles and runs under the new name.
139-187: 🧹 Nitpick | 🔵 TrivialTest function name inconsistency:
TestCanonicalJSONRequestFromSemanticEnvelope_CachesBatchRequest.Consider renaming to
TestCanonicalJSONRequestFromSemantics_CachesBatchRequest. The internal logic is correct.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/server/semantic_requests_test.go` around lines 139 - 187, Rename the test function TestCanonicalJSONRequestFromSemanticEnvelope_CachesBatchRequest to TestCanonicalJSONRequestFromSemantics_CachesBatchRequest to match naming conventions; update the function declaration (the test func name) so callers and test runner use the new name while leaving the body intact—the test still exercises canonicalJSONRequestFromSemantics[*core.BatchRequest] and env.CachedBatchRequest() behavior.
63-107: 🧹 Nitpick | 🔵 TrivialTest function name inconsistency:
TestCanonicalJSONRequestFromSemanticEnvelope_CachesResponsesRequest.Same as above - consider renaming to align with the new terminology. The internal implementation is correct.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/server/semantic_requests_test.go` around lines 63 - 107, Rename the test function to use the updated terminology: change TestCanonicalJSONRequestFromSemanticEnvelope_CachesResponsesRequest to a name like TestCanonicalJSONRequestFromSemantics_CachesResponsesRequest (or TestCanonicalJSONRequestFromRequestSemantics_CachesResponsesRequest) so it matches the implementation that calls canonicalJSONRequestFromSemantics and core.DecodeResponsesRequest; update the test function declaration and any references accordingly and re-run tests to ensure there are no remaining name mismatches.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@cmd/gomodel/docs/docs.go`:
- Line 541: Update the passthrough endpoint descriptions to mention the provider
allowlist: state that passthrough routes are not only controlled by
server.enable_passthrough_routes but also restricted by
server.allowed_passthrough_providers (the default allowlist), so clients know
access depends on that list; apply the same wording change to the other endpoint
description strings referenced (the other occurrences around the same
passthrough descriptions). Locate the description strings in
cmd/gomodel/docs/docs.go (the JSON-like description values for the
/p/{provider}/{endpoint} passthrough methods) and edit them to include a brief
clause about server.allowed_passthrough_providers governing which providers are
permitted.
In `@docs/adr/0002-ingress-frame-and-semantic-envelope.md`:
- Line 67: Replace the retired phrases "ingress frame" and "semantic envelope"
in the sentence containing RequestSemantics with the ADR's canonical terms used
elsewhere in this document (use the established canonical names for the ingress
frame and the semantic extraction — e.g., ingressFrame and RequestSemantics) so
both occurrences match the new terminology consistently.
In `@internal/auditlog/middleware.go`:
- Around line 77-82: The audit middleware currently calls
snapshot.CapturedBody() twice which triggers two defensive copies; to fix it,
call core.GetRequestSnapshot(req.Context()) as before but assign
snapshot.CapturedBody() to a local variable once (e.g., body :=
snapshot.CapturedBody()), check body for nil and set
entry.Data.RequestBodyTooBigToHandle if snapshot.BodyNotCaptured, and pass that
single local body to captureLoggedRequestBody(entry, body) so the full request
body is only cloned once; update the branch that references
snapshot.BodyNotCaptured, CapturedBody(), and captureLoggedRequestBody
accordingly.
---
Outside diff comments:
In `@internal/server/handlers_test.go`:
- Around line 761-833: Rename the test function
TestChatCompletion_UsesIngressFrameForDecoding to use the new naming convention
(e.g., TestChatCompletion_UsesRequestSnapshotForDecoding) so it matches the
refactor that replaced "IngressFrame" with NewRequestSnapshot; update the test
function identifier and any references to the old name (in this file's test
definition) to the new name, leaving the test body and assertions (provider,
frame creation via core.NewRequestSnapshot, and semantics checks) unchanged.
- Around line 915-982: Rename the tests that still reference old "IngressFrame"
terminology to use "RequestSnapshot" and "RequestSemantics" as suggested: change
TestResponses_UsesIngressFrameForDecoding ->
TestResponses_UsesRequestSnapshotForDecoding,
TestEmbeddings_UsesIngressFrameForDecoding ->
TestEmbeddings_UsesRequestSnapshotForDecoding,
TestBatches_UsesIngressFrameForDecoding ->
TestBatches_UsesRequestSnapshotForDecoding,
TestGetBatch_UsesSemanticEnvelopeRouteMetadata ->
TestGetBatch_UsesRequestSemanticsRouteMetadata, and
TestListBatches_UsesSemanticEnvelopeQueryMetadata ->
TestListBatches_UsesRequestSemanticsQueryMetadata; update the function names and
any internal references/calls to those symbols (test function identifiers and
any t.Run strings or comments) so names are consistent while leaving test logic
unchanged.
In `@internal/server/semantic_requests_test.go`:
- Around line 230-257: Rename the test function
TestFileRequestFromSemanticEnvelope_InvalidLimitFromIngressReturnsError to
TestFileRouteInfoFromSemantics_InvalidLimitReturnsError to match naming
conventions and the function under test (fileRouteInfoFromSemantics); update the
test function declaration accordingly and any references to it so the name no
longer uses "Ingress" or "Envelope" and instead reflects
"RouteInfoFromSemantics" and "InvalidLimit".
- Around line 109-137: Rename the test function
TestCanonicalJSONRequestFromSemanticEnvelope_FallsBackToLiveBodyWhenIngressBodyMissing
to use consistent terminology (e.g.,
TestCanonicalJSONRequestFromSemantics_FallsBackToSnapshotBodyWhenIngressBodyMissing
or
TestCanonicalJSONRequestFromSemantics_FallsBackToCapturedBodyWhenSnapshotMissing);
update the function declaration and any references to it (test name strings,
usages in other tests or CI configurations) and ensure the new name still
follows Go test naming conventions and matches the intent in
canonicalJSONRequestFromSemantics and core.RequestSnapshot/ingress terminology.
- Around line 18-61: Rename the test function to match the updated terminology:
change TestCanonicalJSONRequestFromSemanticEnvelope_CachesChatRequest to
TestCanonicalJSONRequestFromSemantics_CachesChatRequest so it aligns with the
helper canonicalJSONRequestFromSemantics and the new RequestSemantics types;
update any references or comments in the file that mention "SemanticEnvelope" to
"Semantics" and ensure the test still asserts env.CachedChatRequest(),
GetRequestSemantics, and RoutingHints behavior unchanged.
- Around line 299-338: Rename the test function
TestFileRequestFromSemanticEnvelope_CachesListMetadata to
TestFileRouteInfoFromSemantics_CachesListMetadata to match the new terminology;
update the test declaration (the func name) and any references to it, keeping
the test body and assertions intact (the test uses fileRouteInfoFromSemantics,
core.FileActionList, and related fields like Provider, Purpose, After, HasLimit,
Limit).
- Around line 189-228: Rename the test function
TestBatchRequestMetadataFromSemanticEnvelope_CachesListMetadata to
TestBatchRouteInfoFromSemantics_CachesListMetadata so the name matches the
helper batchRouteInfoFromSemantics and the returned type BatchRouteInfo; update
the function declaration and any references to the old test name in the test
file to the new name to keep naming consistent.
- Around line 259-297: Rename the test function
TestFileRequestFromSemanticEnvelope_EnrichesCreateMetadata to
TestFileRouteInfoFromSemantics_EnrichesCreateMetadata; update the function
declaration and any references or test names so they match the new identifier,
ensuring it still calls fileRouteInfoFromSemantics, core.GetRequestSemantics,
and asserts on env.CachedFileRouteInfo() unchanged so the test compiles and runs
under the new name.
- Around line 139-187: Rename the test function
TestCanonicalJSONRequestFromSemanticEnvelope_CachesBatchRequest to
TestCanonicalJSONRequestFromSemantics_CachesBatchRequest to match naming
conventions; update the function declaration (the test func name) so callers and
test runner use the new name while leaving the body intact—the test still
exercises canonicalJSONRequestFromSemantics[*core.BatchRequest] and
env.CachedBatchRequest() behavior.
- Around line 63-107: Rename the test function to use the updated terminology:
change TestCanonicalJSONRequestFromSemanticEnvelope_CachesResponsesRequest to a
name like TestCanonicalJSONRequestFromSemantics_CachesResponsesRequest (or
TestCanonicalJSONRequestFromRequestSemantics_CachesResponsesRequest) so it
matches the implementation that calls canonicalJSONRequestFromSemantics and
core.DecodeResponsesRequest; update the test function declaration and any
references accordingly and re-run tests to ensure there are no remaining name
mismatches.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 84cf9209-6d2d-40ac-8851-6d0f3cee012d
⛔ Files ignored due to path filters (1)
docs/adr/assets/0002-ingress-frame-flow.svgis excluded by!**/*.svg
📒 Files selected for processing (34)
.env.templateREADME.mdcmd/gomodel/docs/docs.gocmd/gomodel/docs/swagger.jsonconfig/config.example.yamlconfig/config.goconfig/config_helpers_test.goconfig/config_test.godocs/adr/0002-ingress-frame-and-semantic-envelope.mddocs/adr/0003-policy-resolved-execution-plan.mdinternal/app/app.gointernal/auditlog/auditlog_test.gointernal/auditlog/middleware.gointernal/core/batch.gointernal/core/context.gointernal/core/files.gointernal/core/passthrough.gointernal/core/request_snapshot.gointernal/core/request_snapshot_test.gointernal/core/semantic.gointernal/core/semantic_canonical.gointernal/core/semantic_canonical_test.gointernal/core/semantic_test.gointernal/guardrails/provider.gointernal/server/handlers.gointernal/server/handlers_test.gointernal/server/http.gointernal/server/http_test.gointernal/server/model_validation.gointernal/server/model_validation_test.gointernal/server/request_snapshot.gointernal/server/request_snapshot_test.gointernal/server/semantic_requests.gointernal/server/semantic_requests_test.go
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
internal/core/semantic_test.go (1)
8-49: 🧹 Nitpick | 🔵 TrivialRename these core semantic tests to the new API surface.
The bodies now validate
DeriveWhiteBoxPrompt, but theTestBuildSemanticEnvelope_*names still point grep results and failure output at removed terminology. The sibling cases in this file have the same drift.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/core/semantic_test.go` around lines 8 - 49, Rename the test functions to reflect the new API surface: change TestBuildSemanticEnvelope_OpenAICompat to TestDeriveWhiteBoxPrompt_OpenAICompat (and similarly rename the other sibling TestBuildSemanticEnvelope_* tests in this file) so their names match the function under test DeriveWhiteBoxPrompt; update any references in test names and test failure messages if they still mention "BuildSemanticEnvelope" to use "DeriveWhiteBoxPrompt" to keep grep/failure output consistent with the current implementation.internal/server/handlers_test.go (1)
789-807: 🧹 Nitpick | 🔵 TrivialExtract the snapshot/prompt request setup into a test helper.
The
NewRequestSnapshot→WithRequestSnapshot→WithWhiteBoxPromptwiring is repeated throughout this file. A small helper will make the next context-shape or naming change much cheaper.♻️ Possible helper
+func withSnapshotAndPrompt(req *http.Request, snapshot *core.RequestSnapshot) *http.Request { + ctx := core.WithRequestSnapshot(req.Context(), snapshot) + if prompt := core.DeriveWhiteBoxPrompt(snapshot); prompt != nil { + ctx = core.WithWhiteBoxPrompt(ctx, prompt) + } + return req.WithContext(ctx) +} ... -ctx := core.WithRequestSnapshot(req.Context(), frame) -ctx = core.WithWhiteBoxPrompt(ctx, core.DeriveWhiteBoxPrompt(frame)) -req = req.WithContext(ctx) +req = withSnapshotAndPrompt(req, frame)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/server/handlers_test.go` around lines 789 - 807, Extract the repeated snapshot/prompt setup into a single test helper (e.g., makeTestRequestContext or buildSnapshotContext) that accepts the original *http.Request or parameters and returns a context with core.NewRequestSnapshot, core.WithRequestSnapshot and core.WithWhiteBoxPrompt applied (using core.DeriveWhiteBoxPrompt). Replace each occurrence of the three-line sequence in handlers_test.go with a call to this helper and update tests to use the returned context (or req.WithContext) so callers no longer duplicate NewRequestSnapshot, WithRequestSnapshot, WithWhiteBoxPrompt wiring.internal/core/semantic.go (1)
239-278: 🧹 Nitpick | 🔵 TrivialFinish the rename in the transport classifiers.
DeriveFileRouteInfoFromTransportandDeriveBatchRouteInfoFromTransportstill depend onfileActionFromIngress/batchActionFromIngress, so the old term remains in the core route-derivation path. Renaming those helpers in the same sweep will keep grep/search and follow-up refactors consistent.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/core/semantic.go` around lines 239 - 278, The two transport-derived helpers were partially renamed but callers still use fileActionFromIngress and batchActionFromIngress; update the helpers and all call sites to the new names (e.g., rename fileActionFromIngress -> fileActionFromTransport and batchActionFromIngress -> batchActionFromTransport) and change the calls inside DeriveFileRouteInfoFromTransport and DeriveBatchRouteInfoFromTransport accordingly; ensure you also rename the function declarations, update any imports/tests/other references to the old names, and run tests to confirm no remaining references to the old identifiers remain.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@internal/server/semantic_requests.go`:
- Around line 69-70: The code currently calls
core.EnrichFileCreateRouteInfo(req, echoFileMultipartReader{ctx: c}) for all
file routes; restrict this so enrichment only runs for create requests by
checking req.Action == core.FileActionCreate before calling
EnrichFileCreateRouteInfo (leave core.CacheFileRouteInfo(env, req) unchanged).
Update the block around EnrichFileCreateRouteInfo and echoFileMultipartReader to
run only when the action equals core.FileActionCreate.
In `@README.md`:
- Around line 153-155: Update the Configuration Reference section in CLAUDE.md
to add entries for the three new passthrough settings:
ENABLE_PASSTHROUGH_ROUTES, ALLOW_PASSTHROUGH_V1_ALIAS, and
ENABLED_PASSTHROUGH_PROVIDERS; for each include the default value and short
description matching README.md (ENABLE_PASSTHROUGH_ROUTES — true — Enable
provider-native passthrough routes under /p/{provider}/...,
ALLOW_PASSTHROUGH_V1_ALIAS — true — Allow /p/{provider}/v1/... aliases while
keeping /p/{provider}/... canonical, ENABLED_PASSTHROUGH_PROVIDERS —
openai,anthropic — Comma-separated list of enabled passthrough providers) so
CLAUDE.md stays in sync with README.md.
---
Outside diff comments:
In `@internal/core/semantic_test.go`:
- Around line 8-49: Rename the test functions to reflect the new API surface:
change TestBuildSemanticEnvelope_OpenAICompat to
TestDeriveWhiteBoxPrompt_OpenAICompat (and similarly rename the other sibling
TestBuildSemanticEnvelope_* tests in this file) so their names match the
function under test DeriveWhiteBoxPrompt; update any references in test names
and test failure messages if they still mention "BuildSemanticEnvelope" to use
"DeriveWhiteBoxPrompt" to keep grep/failure output consistent with the current
implementation.
In `@internal/core/semantic.go`:
- Around line 239-278: The two transport-derived helpers were partially renamed
but callers still use fileActionFromIngress and batchActionFromIngress; update
the helpers and all call sites to the new names (e.g., rename
fileActionFromIngress -> fileActionFromTransport and batchActionFromIngress ->
batchActionFromTransport) and change the calls inside
DeriveFileRouteInfoFromTransport and DeriveBatchRouteInfoFromTransport
accordingly; ensure you also rename the function declarations, update any
imports/tests/other references to the old names, and run tests to confirm no
remaining references to the old identifiers remain.
In `@internal/server/handlers_test.go`:
- Around line 789-807: Extract the repeated snapshot/prompt setup into a single
test helper (e.g., makeTestRequestContext or buildSnapshotContext) that accepts
the original *http.Request or parameters and returns a context with
core.NewRequestSnapshot, core.WithRequestSnapshot and core.WithWhiteBoxPrompt
applied (using core.DeriveWhiteBoxPrompt). Replace each occurrence of the
three-line sequence in handlers_test.go with a call to this helper and update
tests to use the returned context (or req.WithContext) so callers no longer
duplicate NewRequestSnapshot, WithRequestSnapshot, WithWhiteBoxPrompt wiring.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 4615d5cc-c797-48e7-95ea-c0cdc6350877
⛔ Files ignored due to path filters (1)
docs/adr/assets/0002-ingress-frame-flow.svgis excluded by!**/*.svg
📒 Files selected for processing (22)
.env.templateREADME.mdconfig/config.example.yamlconfig/config.goconfig/config_test.godocs/adr/0002-ingress-frame-and-semantic-envelope.mddocs/adr/0003-policy-resolved-execution-plan.mdinternal/app/app.gointernal/core/context.gointernal/core/semantic.gointernal/core/semantic_canonical.gointernal/core/semantic_canonical_test.gointernal/core/semantic_test.gointernal/server/handlers.gointernal/server/handlers_test.gointernal/server/http.gointernal/server/model_validation.gointernal/server/model_validation_test.gointernal/server/request_snapshot.gointernal/server/request_snapshot_test.gointernal/server/semantic_requests.gointernal/server/semantic_requests_test.go
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
internal/core/semantic.go (1)
239-279: 🧹 Nitpick | 🔵 TrivialDeduplicate transport
limitparsing to prevent drift between file and batch paths.Lines 249-254 and Lines 269-274 repeat the same parsing block. A shared helper would reduce maintenance overhead and keep behavior consistent.
♻️ Suggested refactor
func DeriveFileRouteInfoFromTransport(method, path string, routeParams map[string]string, queryParams map[string][]string) *FileRouteInfo { req := &FileRouteInfo{ Action: fileActionFromTransport(method, path), Provider: firstTransportValue(queryParams, "provider"), Purpose: firstTransportValue(queryParams, "purpose"), After: firstTransportValue(queryParams, "after"), LimitRaw: firstTransportValue(queryParams, "limit"), FileID: fileIDFromTransport(path, routeParams), } - if req.LimitRaw != "" { - if parsed, err := strconv.Atoi(req.LimitRaw); err == nil { - req.Limit = parsed - req.HasLimit = true - } - } + req.Limit, req.HasLimit = parseTransportLimit(req.LimitRaw) if req.Action == "" && req.Provider == "" && req.Purpose == "" && req.After == "" && req.LimitRaw == "" && req.FileID == "" { return nil } return req } // DeriveBatchRouteInfoFromTransport derives sparse batch route info from transport metadata. func DeriveBatchRouteInfoFromTransport(method, path string, routeParams map[string]string, queryParams map[string][]string) *BatchRouteInfo { req := &BatchRouteInfo{ Action: batchActionFromTransport(method, path), BatchID: batchIDFromTransport(path, routeParams), After: firstTransportValue(queryParams, "after"), LimitRaw: firstTransportValue(queryParams, "limit"), } - if req.LimitRaw != "" { - if parsed, err := strconv.Atoi(req.LimitRaw); err == nil { - req.Limit = parsed - req.HasLimit = true - } - } + req.Limit, req.HasLimit = parseTransportLimit(req.LimitRaw) if req.Action == "" && req.BatchID == "" && req.After == "" && req.LimitRaw == "" { return nil } return req } + +func parseTransportLimit(raw string) (int, bool) { + if raw == "" { + return 0, false + } + parsed, err := strconv.Atoi(raw) + if err != nil { + return 0, false + } + return parsed, true +}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/core/semantic.go` around lines 239 - 279, The repeated limit-parsing logic in DeriveFileRouteInfoFromTransport and DeriveBatchRouteInfoFromTransport should be pulled into a small helper (e.g., parseLimit or parseLimitFromRaw) that accepts the LimitRaw string and returns (int, bool) or similar; replace the duplicated blocks that set req.Limit and req.HasLimit with a single call to that helper, and use the returned values to populate req.Limit and req.HasLimit for both FileRouteInfo and BatchRouteInfo (refer to the LimitRaw, Limit, HasLimit fields and the two functions named DeriveFileRouteInfoFromTransport and DeriveBatchRouteInfoFromTransport).internal/core/semantic_test.go (1)
169-250: 🧹 Nitpick | 🔵 TrivialConsider updating legacy assertion labels for consistency.
A few failure messages still reference pre-rename labels (e.g.,
FileRequest,BatchMetadata). Updating those strings would improve debugging clarity during failures.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/core/semantic_test.go` around lines 169 - 250, Update the test failure message strings to use the current, consistent labels instead of legacy names: replace occurrences like "FileRequest = nil" and "FileRequest.Action" with names matching CachedFileRouteInfo or FileRouteInfo, and replace "BatchMetadata = nil" and "BatchMetadata.Action" with BatchRouteInfo or CachedBatchRouteInfo in the tests (see TestDeriveWhiteBoxPrompt_BatchesListMetadata, TestDeriveWhiteBoxPrompt_BatchResultsMetadata and the earlier file-content test that calls CachedFileRouteInfo); keep the validation logic and t.Fatal/t.Fatalf calls but change only the human-readable strings to the new labels for consistent debugging output.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@CLAUDE.md`:
- Line 89: The list item starting with "**Server:** `PORT` (8080),
`GOMODEL_MASTER_KEY`..." is prefixed by a leading tab which causes it to render
as a code block; remove the leading tab so the line aligns with the surrounding
bullet list (use a single space or no leading whitespace before the "-
**Server:** ..." bullet) to restore proper Markdown list rendering and satisfy
MD046.
In `@internal/server/handlers_test.go`:
- Around line 1162-1164: The test duplicates manual snapshot+prompt wiring using
core.NewRequestSnapshot, core.WithRequestSnapshot and core.WithWhiteBoxPrompt
with core.DeriveWhiteBoxPrompt; replace that block with the shared helper
withRequestSnapshotAndPrompt(...) to avoid setup drift—locate the code that
creates "frame" and calls core.WithRequestSnapshot/getReq.Context() and
core.WithWhiteBoxPrompt(core.DeriveWhiteBoxPrompt(frame)) and swap it to call
withRequestSnapshotAndPrompt(ctxOrGetReq, frame-like inputs) so the test uses
the centralized helper (also apply the same change to the similar block at lines
1205-1220).
---
Outside diff comments:
In `@internal/core/semantic_test.go`:
- Around line 169-250: Update the test failure message strings to use the
current, consistent labels instead of legacy names: replace occurrences like
"FileRequest = nil" and "FileRequest.Action" with names matching
CachedFileRouteInfo or FileRouteInfo, and replace "BatchMetadata = nil" and
"BatchMetadata.Action" with BatchRouteInfo or CachedBatchRouteInfo in the tests
(see TestDeriveWhiteBoxPrompt_BatchesListMetadata,
TestDeriveWhiteBoxPrompt_BatchResultsMetadata and the earlier file-content test
that calls CachedFileRouteInfo); keep the validation logic and t.Fatal/t.Fatalf
calls but change only the human-readable strings to the new labels for
consistent debugging output.
In `@internal/core/semantic.go`:
- Around line 239-279: The repeated limit-parsing logic in
DeriveFileRouteInfoFromTransport and DeriveBatchRouteInfoFromTransport should be
pulled into a small helper (e.g., parseLimit or parseLimitFromRaw) that accepts
the LimitRaw string and returns (int, bool) or similar; replace the duplicated
blocks that set req.Limit and req.HasLimit with a single call to that helper,
and use the returned values to populate req.Limit and req.HasLimit for both
FileRouteInfo and BatchRouteInfo (refer to the LimitRaw, Limit, HasLimit fields
and the two functions named DeriveFileRouteInfoFromTransport and
DeriveBatchRouteInfoFromTransport).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: b026db21-fff1-4145-9a73-5c31adceba20
📒 Files selected for processing (5)
CLAUDE.mdinternal/core/semantic.gointernal/core/semantic_test.gointernal/server/handlers_test.gointernal/server/semantic_requests.go
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
# Conflicts: # internal/core/context.go
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@CLAUDE.md`:
- Line 89: The Server configuration bullet is overcrowded and hard to scan;
split that single bullet into nested sub-bullets listing each environment
variable separately (PORT, GOMODEL_MASTER_KEY, BODY_SIZE_LIMIT,
ENABLE_PASSTHROUGH_ROUTES, ALLOW_PASSTHROUGH_V1_ALIAS,
ENABLED_PASSTHROUGH_PROVIDERS), include a short description for each variable
and default value, and keep the original boolean/default text (e.g.,
"ENABLE_PASSTHROUGH_ROUTES (true: Enable provider-native passthrough routes
under /p/{provider}/...)" ) so the CLAUDE.md line becomes one parent "Server:"
bullet with six tidy child bullets for readability.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Naming Review (ADR-0002 Refactor Concepts)
This document summarizes proposed renames for the new concepts introduced by the ADR-0002 refactor (ingress snapshot + semantic extraction + passthrough). Goal: names that are easier to guess from first principles and communicate scope/lifecycle.
Transport Capture (as received at HTTP boundary)
IngressFrameRequestSnapshotNewIngressFrame(...)NewRequestSnapshot(...)IngressCapture()(middleware)CaptureRequestSnapshot()orRequestSnapshotMiddleware()RawBodyTooLargeBodyNotCapturedorBodyTruncatedGetRawBody()CapturedBody()orBodyBytes()Derived Meaning (gateway interpretation)
SemanticEnvelopeRequestSemanticsBuildSemanticEnvelope(...)DeriveRequestSemantics(...)SelectorHintsRoutingHintsorRouteHintsDialectRouteKindorAPIDialectOperationOperationKindorEndpointKindJSONBodyParsedSelectorHintsFromJSON(or similar)Route-Specific Sparse Metadata
FileRequestSemanticFileRouteInfoorFileRouteSemanticsBatchRequestSemanticBatchRouteInfoorBatchRouteSemanticsBuildFileRequestSemanticFromTransportDeriveFileRouteInfoFromTransportBuildBatchRequestSemanticFromTransportDeriveBatchRouteInfoFromTransportCacheFileRequestSemanticCacheFileRouteInfoCanonical Decode + Caching
cachedValuescacheCachedCanonicalSelector()CanonicalSelectorFromCachedRequest()Passthrough
PassthroughRoutableProviderPassthroughRouterorRoutablePassthroughConfig (external surface)
EnableProviderPassthroughEnablePassthroughRoutesSupportedPassthroughProvidersAllowedPassthroughProvidersNormalizePassthroughV1PrefixAllowPassthroughV1AliasProposed Convention (so names stay predictable)
Request...and use “Snapshot/Capture”....RouteInfo.Summary by CodeRabbit
Configuration Changes
Documentation