Skip to content

fix(serverless): hand the endpoint path editor to the invoke operations only - #176

Merged
danmrichards merged 2 commits into
mainfrom
fix/serverless-invoke-endpoint-path-editor
Nov 6, 2026
Merged

danmrichards merged 2 commits into
mainfrom
fix/serverless-invoke-endpoint-path-editor

Conversation

@felixsanz

Copy link
Copy Markdown
Contributor

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-sync is itself a valid app id (AppId, 6 to 30 chars), so secrets detach invoke-sync a/b built /v1/apps/invoke-sync/secrets/a%2Fb and the editor rewrote the escaped secret name. it is now a reqEditor passed from InvokeAsync and InvokeSync, so it knows the value it is looking for, reads the decoded Path to find it, and never touches a request that carries no endpoint path. endpointPathRoutes is gone, and so is the base-url case copilot raised on that pr.

a test ties the copied rule to the spec. TestEndpointPathRuleMatchesTheSpec reads EndpointPath out of the vendored openapi.yaml and compares the pattern and the maxLength. 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 as TestEnvironmentFlagAppliesTheSpecsNameRule.

and one that drives the real client. TestInvokeSendsANestedPathUnescaped runs both operations against an httptest server 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 test and make check-go-fix clean.

@coderabbitai

coderabbitai Bot commented Nov 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. To trigger a review, include coderabbit-review in the PR description. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 79758414-d5c0-4629-b3da-05c73d3fa888

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

@danmrichards
danmrichards merged commit 8dcda80 into main Nov 6, 2026
5 checks passed
@danmrichards
danmrichards deleted the fix/serverless-invoke-endpoint-path-editor branch November 6, 2026 13:09
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.

3 participants