GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: return error for malformed --extension flag values by Ankitsinghsisodya · Pull Request #3852 · knative/func

Conversation

@Ankitsinghsisodya

@Ankitsinghsisodya Ankitsinghsisodya commented May 25, 2026

Copy link
Copy Markdown
Contributor

Problem

extensionsMap() in cmd/invoke.go silently dropped any --extension value that did not contain =. The invocation proceeded with fewer extensions than the user specified, with no feedback — particularly confusing when debugging CloudEvent routing.

Changes

cmd/invoke.go

  • Changed extensionsMap() signature from map[string]string to (map[string]string, error).
  • Returns a descriptive error for any entry missing = (e.g. invalid --extension "badformat": must be in key=value format).
  • Renamed the shadowing local variable extensionsMap → result for clarity.
  • Updated the call site to propagate the error before constructing InvokeMessage.

cmd/invoke_test.go

  • TestInvokeExtensionsMapValid: verifies correct parsing including values that themselves contain = (e.g. base64 strings like foo=bar=baz).
  • TestInvokeExtensionsMapMalformed: verifies that a missing = produces an error rather than a silent drop.

Testing

go test ./cmd/... -run TestInvokeExtensionsMap

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Copilot AI review requested due to automatic review settings May 25, 2026 17:55
@knative-prow
knative-prow Bot requested review from dsimansk and jrangelramos May 25, 2026 17:55
@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 May 25, 2026
@knative-prow

knative-prow Bot commented May 25, 2026

Copy link
Copy Markdown

Hi @Ankitsinghsisodya. 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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Ankitsinghsisodya
Implement extension parsing in invokeConfig with validation tests
3fbb349
- Added `extensionsMap` method to `invokeConfig` to parse key=value extensions and return a map.
- Introduced error handling for malformed extension entries.
- Created unit tests `TestInvokeExtensionsMapValid` and `TestInvokeExtensionsMapMalformed` to validate the parsing logic and error conditions.

This enhances the robustness of the extension handling in the invoke command.
Copilot AI reviewed May 25, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds strict parsing/validation for --extension CLI entries so malformed values error out instead of being silently ignored, and introduces tests for the new behavior.

Changes:

  • Parse Extensions as key=value with strings.SplitN(..., 2) and return an error when malformed.
  • Wire parsing errors into runInvoke so invoke fails fast on invalid extensions.
  • Add unit tests covering valid values (including values containing =) and malformed entries.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
cmd/invoke.go Changes extensions parsing to return (map, error) and propagates parsing errors into invoke execution.
cmd/invoke_test.go Adds tests to validate correct parsing behavior and erroring on malformed extensions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread cmd/invoke.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread cmd/invoke.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

@Ankitsinghsisodya
Ankitsinghsisodya force-pushed the fix/extensionsmap-malformed-input branch from 788bb83 to 3fbb349 Compare May 25, 2026 17:55
@Ankitsinghsisodya
Refactor extension handling in invokeConfig with improved validation
c806ceb
- Renamed `extensionsMap` method to `parseExtensions` for clarity.
- Enhanced validation to check for empty keys in extension entries.
- Updated unit tests to cover cases for missing '=' and empty keys in extensions.

This change improves the robustness and clarity of extension parsing in the invoke command.
@codecov

codecov Bot commented May 25, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.47%. Comparing base (e7d7dcf) to head (c806ceb).
⚠️ Report is 30 commits behind head on main.

Files with missing lines Patch % Lines
cmd/invoke.go 72.72% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3852      +/-   ##
==========================================
+ Coverage   53.44%   53.47%   +0.02%     
==========================================
  Files         200      200              
  Lines       23450    23455       +5     
==========================================
+ Hits        12533    12542       +9     
+ Misses       9662     9659       -3     
+ Partials     1255     1254       -1     
Flag Coverage Δ
e2e 33.71% <45.45%> (-0.01%) ⬇️
e2e go 29.65% <0.00%> (-0.01%) ⬇️
e2e node 25.95% <0.00%> (-0.01%) ⬇️
e2e python 29.98% <0.00%> (-0.01%) ⬇️
e2e quarkus 26.05% <0.00%> (-0.02%) ⬇️
e2e rust 25.53% <0.00%> (-0.01%) ⬇️
e2e springboot 24.20% <0.00%> (-0.01%) ⬇️
e2e typescript 26.05% <0.00%> (-0.01%) ⬇️
e2e-config-ci 26.77% <0.00%> (-0.01%) ⬇️
integration 15.77% <0.00%> (+0.02%) ⬆️
unit macos-14 42.25% <80.00%> (+0.02%) ⬆️
unit macos-latest 42.25% <80.00%> (+0.02%) ⬆️
unit ubuntu-24.04-arm 42.54% <72.72%> (+0.02%) ⬆️
unit ubuntu-latest 43.11% <80.00%> (+0.02%) ⬆️
unit windows-latest 42.32% <80.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

matejvasek
matejvasek reviewed Jun 11, 2026
View reviewed changes
Comment thread cmd/invoke.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

@matejvasek

matejvasek commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

/approve
/lgtm

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@knative-prow knative-prow Bot assigned matejvasek Jun 11, 2026
@knative-prow knative-prow Bot added the lgtm 🤖 PR is ready to be merged. label Jun 11, 2026
@knative-prow

knative-prow Bot commented Jun 11, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Ankitsinghsisodya, matejvasek

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:
  • OWNERS [matejvasek]

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@knative-prow knative-prow Bot added the approved 🤖 PR has been approved by an approver from all required OWNERS files. label Jun 11, 2026
@matejvasek

matejvasek commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

/ok-to-test

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@knative-prow knative-prow Bot added ok-to-test 🤖 Non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test 🤖 Needs an org member to approve testing labels Jun 11, 2026
@knative-prow
knative-prow Bot merged commit b06458b into knative:main Jun 11, 2026
41 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@shreyaabaranwal shreyaabaranwal mentioned this pull request Jun 20, 2026
fix(invoke): validate extension format and remove dead branch #3912
Closed
@yuminn-k yuminn-k mentioned this pull request Nov 5, 2026
Validate invoke extension names and test extension handling #4130
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@matejvasek matejvasek matejvasek left review comments
Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@dsimansk dsimansk Awaiting requested review from dsimansk
@jrangelramos jrangelramos Awaiting requested review from jrangelramos

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@matejvasek matejvasek

Labels

approved 🤖 PR has been approved by an approver from all required OWNERS files. 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

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Ankitsinghsisodya @matejvasek
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.