Repository navigation
fix(serverless): hand the endpoint path editor to the invoke operations only - #176
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. To trigger a review, include
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are identified for the change limiting endpoint-path rewriting to serverless invocation requests.
No open issues 🎉
What changed in this PR
This follow-up to #175 scopes endpoint-path rewriting to serverless invoke operations, preserving nested endpoint paths without altering unrelated requests.
Changes:
- Replace the client-wide request editor with a per-call editor for synchronous and asynchronous invocation.
- Add tests for URL rewriting, alignment with the vendored API schema, and nested paths sent through both client operations.
- Correct the README example comment to describe multi-segment endpoint paths.
| File | Description |
|---|---|
README.md |
Clarify that endpoint paths can contain multiple segments. |
internal/api/serverless/tasks.go |
Create and attach the endpoint-path editor per invoke call. |
internal/api/serverless/tasks_test.go |
Cover editor behavior, schema consistency, and client request paths. |
internal/api/serverless/client.go |
Remove the client-wide endpoint-path editor. |
Review effort: Balanced
follow-up to #175, which was merged with three comments on it.
the editor is built per call and only the two invoke operations get it. it was registered on the whole client, which searches every request's path for an
/invoke-sync/or/invoke-async/marker.invoke-syncis itself a valid app id (AppId, 6 to 30 chars), sosecrets detach invoke-sync a/bbuilt/v1/apps/invoke-sync/secrets/a%2Fband the editor rewrote the escaped secret name. it is now areqEditorpassed fromInvokeAsyncandInvokeSync, so it knows the value it is looking for, reads the decodedPathto find it, and never touches a request that carries no endpoint path.endpointPathRoutesis gone, and so is the base-url case copilot raised on that pr.a test ties the copied rule to the spec.
TestEndpointPathRuleMatchesTheSpecreadsEndpointPathout of the vendoredopenapi.yamland compares the pattern and themaxLength. the bug #175 fixed was a stale copy of that rule, so a spec change that no table row covers now fails here. this is the same shape asTestEnvironmentFlagAppliesTheSpecsNameRule.and one that drives the real client.
TestInvokeSendsANestedPathUnescapedruns both operations against anhttptestserver and asserts the path it sees. dropping the editor from either call site fails it, which nothing covered before: the old test called the editor function directly.readme fixed too, it still said the path was a bare segment.
make lint,make testandmake check-go-fixclean.