Registry Mirror
Skip to content

Conversation

@divyani-22

Copy link
Copy Markdown
Contributor

Description

In pkg/functions/invoke.go, CloudEvent construction had three inconsistencies between HTTP POST (sendEvent) and GET (sendGetEvent):

  1. Extensions silently dropped on GET: sendGetEvent omitted m.Extensions, so CloudEvents GET invocations silently lost all extension attributes.
  2. Missing CloudEvent extension validation in core package: Library callers supplying invalid CloudEvent extension attribute names (non-[a-z0-9]+ or reserved CloudEvents context attributes such as id, source, type, datacontenttype, specversion) were not rejected at event creation time.
  3. Duplicated event construction / request logic: sendEvent did not generate a default UUID when m.ID == "" (unlike sendGetEvent), and both functions duplicated client.Request result handling.

Changes

  • pkg/functions/invoke.go:
    • Extracted shared newCloudEvent(m InvokeMessage) helper used by both sendEvent and sendGetEvent, ensuring m.Extensions are applied for both POST and GET requests, empty m.ID defaults to a UUID, and extension attribute names satisfy CloudEvents v1.0 naming rules without colliding with reserved context attributes.
    • Extracted shared requestCloudEvent helper to eliminate duplicated CloudEvent request/error handling between sendEvent and sendGetEvent.
  • pkg/functions/invoke_unit_test.go:
    • Added Test_newCloudEvent verifying UUID generation, extension assignment, and rejection of invalid or reserved extension keys.
    • Added Test_sendCloudEventMethodsAndExtensions verifying end-to-end HTTP POST and GET invocations both deliver Ce-* extension headers.

Testing

  • Test_newCloudEvent in pkg/functions/invoke_unit_test.go
  • Test_sendCloudEventMethodsAndExtensions in pkg/functions/invoke_unit_test.go

Copilot AI balanced review requested due to automatic review settings December 1, 2026 03:20
@knative-prow

knative-prow Bot commented Dec 1, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: divyani-22
Once this PR has been reviewed and has the lgtm label, please assign evankanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@knative-prow knative-prow Bot added size/L 🤖 PR changes 100-499 lines, ignoring generated files. needs-ok-to-test 🤖 Needs an org member to approve testing labels Dec 1, 2026
@knative-prow

knative-prow Bot commented Dec 1, 2026

Copy link
Copy Markdown

Hi @divyani-22. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

…sion keys

Signed-off-by: Divyani <divyanipapalkar22@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test 🤖 Needs an org member to approve testing size/L 🤖 PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants