Skip to content

fix(mcp): use result in error message instead of nil err in create test#3825

Merged
knative-prow[bot] merged 1 commit into
knative:mainfrom
Ankitsinghsisodya:fix/mcp-create-test-nil-err-message
Jun 11, 2026
Merged

fix(mcp): use result in error message instead of nil err in create test#3825
knative-prow[bot] merged 1 commit into
knative:mainfrom
Ankitsinghsisodya:fix/mcp-create-test-nil-err-message

Conversation

@Ankitsinghsisodya

@Ankitsinghsisodya Ankitsinghsisodya commented May 21, 2026

Copy link
Copy Markdown
Contributor

Note: Re-submission of #3763, accidentally closed when the head repository was deleted.

Problem

In TestTool_Create_Args, after a successful client.CallTool call, the error branch reads:

if result.IsError {
    t.Fatal(err) // err is nil here
}

CallTool returned (result, nil)err is guaranteed nil at this point since it was already checked on the lines above. If result.IsError ever triggers, t.Fatal(nil) prints <nil>, giving zero diagnostic information about what actually failed.

Fix

Replace with the pattern used consistently across every other tool test in this package:

if result.IsError {
    t.Fatalf("unexpected error result: %v", result)
}

No behaviour change — this only affects the failure message when the test fails.

Updated the error handling in the TestTool_Create_Args test to provide a more descriptive message when an unexpected error result occurs. This enhances the clarity of test failures and aids in debugging.
Copilot AI review requested due to automatic review settings May 21, 2026 11:20
@knative-prow knative-prow Bot requested review from dsimansk and jrangelramos May 21, 2026 11:20
@knative-prow knative-prow Bot added the size/XS 🤖 PR changes 0-9 lines, ignoring generated files. label May 21, 2026
@knative-prow

knative-prow Bot commented May 21, 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.

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.

@knative-prow knative-prow Bot added the needs-ok-to-test 🤖 Needs an org member to approve testing label May 21, 2026

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.

Pull request overview

Note

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

Fixes an incorrect fatal assertion in TestTool_Create_Args so the test reports the actual tool result when the tool execution returns an error.

Changes:

  • Replace t.Fatal(err) (which may be nil/stale) with a descriptive failure message that includes result.

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

@lkingland lkingland 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 May 22, 2026
@lkingland lkingland added the status/new Accepted to Traige label Jun 2, 2026
@matejvasek

Copy link
Copy Markdown
Contributor

/approve
/lgtm

@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:

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 Jun 11, 2026
@knative-prow knative-prow Bot merged commit f435de5 into knative:main Jun 11, 2026
83 of 84 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. lgtm 🤖 PR is ready to be merged. ok-to-test 🤖 Non-member PR verified by an org member that is safe to test. size/XS 🤖 PR changes 0-9 lines, ignoring generated files. status/new Accepted to Traige

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants