Registry Mirror
Skip to content

Conversation

@yuminn-k

@yuminn-k yuminn-k commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Changes

Remaining follow-ups from the second-pass review on #3347, listed when #3346 was reopened. The dead branch, malformed -e foo, and range iteration items were already handled in #3839, #3852 and #3913.

  • 🐛 func invoke --extension now rejects names that are not [a-z0-9]+, which the CloudEvents spec requires for attribute names. Before this change, -e my-ext=v only failed after the function had been resolved, with the SDK's message wrapped as unable to invoke: .... -e MyExt=v was lower-cased without warning. Both now fail early with a flag-specific error.
  • 🧹 Test the cloudevent-only guard for --extension: with invoke set in func.yaml, with the -f flag overriding it in both directions, and with the fallback to f.Invoke when -f is not given.
  • 🧹 Assert that extensions round-trip through sendEvent, so the receiver gets myext=myvalue. This extends the existing TestClient_Invoke_CloudEvent.

/kind bug

Fixes #3346

Testing

  • go test ./cmd/ ./pkg/functions/ -count=1 and go vet ./cmd/ ./pkg/functions/ pass.
  • The new invalid-name cases in TestInvokeExtensionsMapMalformed (hyphen, underscore, upper case) fail on main and pass with this change.
  • TestInvokeExtensionsRequireCloudEvent fails if the guard is disabled (the http cases) or if the f.Invoke fallback is removed (the func.yaml cloudevent case).
  • TestClient_Invoke_CloudEvent fails with expected extension myext=myvalue, got <nil> if the SetExtension loop in sendEvent is removed.

Release Note

`func invoke --extension` now rejects extension names that contain anything other than lower-case letters and digits, as the CloudEvents spec requires. Upper-case names were previously lower-cased without warning.

Docs


Assisted-by: Claude Opus 5.5 (Claude Code)

@knative-prow knative-prow Bot added the kind/bug Bugs label Nov 5, 2026
@knative-prow

knative-prow Bot commented Nov 5, 2026

Copy link
Copy Markdown

Welcome @yuminn-k! It looks like this is your first PR to knative/func 🎉

@knative-prow knative-prow Bot added size/M 🤖 PR changes 30-99 lines, ignoring generated files. needs-ok-to-test 🤖 Needs an org member to approve testing labels Nov 5, 2026
@knative-prow

knative-prow Bot commented Nov 5, 2026

Copy link
Copy Markdown

Hi @yuminn-k. 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.

Regular contributors should join the org to skip this step.

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.

@lkingland

Copy link
Copy Markdown
Member

Thanks @yuminn-k. This covers the remaining follow-ups from #3346. I've opened #4191 for rejecting reserved attribute names (id, type, source…) up front, as a separate small change.

/ok-to-test
/lgtm
/approve

@knative-prow knative-prow Bot added ok-to-test 🤖 Non-member PR verified by an org member that is safe to test. lgtm 🤖 PR is ready to be merged. and removed needs-ok-to-test 🤖 Needs an org member to approve testing labels Nov 24, 2026
@knative-prow

knative-prow Bot commented Nov 24, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lkingland, yuminn-k

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

The pull request process is described 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

@knative-prow knative-prow Bot added the approved 🤖 PR has been approved by an approver from all required OWNERS files. label Nov 24, 2026
@lkingland lkingland closed this Nov 24, 2026
@lkingland lkingland reopened this Nov 24, 2026
Follow-ups from knative#3346:

- Reject --extension names that are not [a-z0-9]+ as required by the
  CloudEvents spec, before the function is resolved or contacted.
- Test the cloudevent-only guard for --extension, including the
  fallback to the func.yaml invoke format.
- Assert extensions round-trip through sendEvent to the receiver.

Signed-off-by: YuMin Kim <kim.yumin@nextbeat.net>
@lkingland
lkingland force-pushed the invoke-extension-tests branch from 56d667c to f312681 Compare November 25, 2026 07:22
@knative-prow knative-prow Bot removed the lgtm 🤖 PR is ready to be merged. label Nov 25, 2026
@lkingland

Copy link
Copy Markdown
Member

Rebased onto main after #4142 merged. Both added a test at the same spot in cmd/invoke_test.go, and both are kept; your change is otherwise as you wrote it.

/lgtm

@knative-prow knative-prow Bot added the lgtm 🤖 PR is ready to be merged. label Nov 25, 2026
@knative-prow
knative-prow Bot merged commit 1bbfe7a into knative:main Nov 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved 🤖 PR has been approved by an approver from all required OWNERS files. kind/bug Bugs lgtm 🤖 PR is ready to be merged. ok-to-test 🤖 Non-member PR verified by an org member that is safe to test. size/M 🤖 PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow us to set extensions on func invoke

2 participants