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 — pkg/mcp: add tests for readonly enforcement, delete validation, and help resources by Ankitsinghsisodya · Pull Request #3831 · knative/func

Conversation

@Ankitsinghsisodya

@Ankitsinghsisodya Ankitsinghsisodya commented May 21, 2026 •
edited by lkingland
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor
  • tools_deploy_test.go and tools_delete_test.go each had a single happy-path test that manually set server.readonly = false, leaving the readonly guard in both handlers completely untested.
  • The mutual-exclusion validation in deleteHandler (exactly one of path or name must be provided) had no test coverage for either branch.
  • All 14 func://help/* resources registered in mcp.go had zero tests; the newHelpResource handler — URI construction, executor dispatch, args assembly, and response shape — was entirely unexercised.

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 21, 2026 11:22
@knative-prow
knative-prow Bot requested review from dsimansk and jrangelramos May 21, 2026 11:23
@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 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.

All reactions

Sorry, something went wrong.

Uh oh!

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

Copilot AI reviewed May 21, 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 negative-path test coverage for MCP deploy and delete tools to ensure correct behavior in readonly mode and for invalid argument combinations.

Changes:

  • Add readonly-mode test for the deploy tool.
  • Add readonly-mode and argument-validation tests for the delete tool.

Reviewed changes

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

File Description
pkg/mcp/tools_deploy_test.go Adds a readonly-mode test for the deploy tool.
pkg/mcp/tools_delete_test.go Adds readonly-mode and validation tests for invalid delete arguments.

💡 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 pkg/mcp/tools_deploy_test.go Resolved

Uh oh!

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

Comment thread pkg/mcp/tools_delete_test.go Resolved

Uh oh!

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

Comment thread pkg/mcp/tools_delete_test.go Resolved

Uh oh!

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

Comment thread pkg/mcp/tools_delete_test.go Resolved

Uh oh!

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

@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
@knative-prow knative-prow Bot added size/L 🤖 PR changes 100-499 lines, ignoring generated files. and removed size/M 🤖 PR changes 30-99 lines, ignoring generated files. labels May 22, 2026
Ankitsinghsisodya added 4 commits May 22, 2026 11:05
@Ankitsinghsisodya
Add unit tests for resource help and tool delete functionality
582c2e6
- Implemented TestResource_Help to validate help command behavior for various subcommands.
- Added tests for the delete tool to ensure it handles readonly mode and validation errors correctly when both path and name are provided, or neither is provided.
- Included TestTool_Delete_Readonly, TestTool_Delete_BothPathAndName, and TestTool_Delete_NeitherPathNorName to cover these scenarios.

These tests enhance the coverage and reliability of the MCP resource and tool functionalities.
@Ankitsinghsisodya
Refactor test setup in tool delete tests
fff70e6
- Simplified the test setup in TestTool_Delete_BothPathAndName and TestTool_Delete_NeitherPathNorName by removing the unused server variable from newTestPair.
- This change enhances code clarity and maintains the focus on testing the delete tool's functionality.
@Ankitsinghsisodya
Enhance error message validation in delete and deploy tool tests
c10245f
- Updated TestTool_Delete_Readonly and TestTool_Deploy_Readonly to verify that the error messages returned when the server is in readonly mode contain the phrase "readonly mode".
- Modified TestTool_Delete_BothPathAndName and TestTool_Delete_NeitherPathNorName to ensure that mutual-exclusion validation errors are correctly checked for the phrases "exactly one of 'path' or 'name'".
- These changes improve the robustness of the tests by ensuring that the error messages are not only returned but also contain the expected content.
@Ankitsinghsisodya
Remove unused readonly mode tests for delete and deploy tools
a07cc5e
- Deleted TestTool_Delete_Readonly and TestTool_Deploy_Readonly as they were redundant following recent enhancements to error message validation.
- This cleanup improves test maintainability and focuses on essential test cases for the delete and deploy functionalities.
@Ankitsinghsisodya
Ankitsinghsisodya force-pushed the fix/mcp-missing-test-coverage branch from d03185b to a07cc5e Compare May 22, 2026 05:36
@codecov

codecov Bot commented May 22, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.46%. Comparing base (aca4f21) to head (a07cc5e).
⚠️ Report is 106 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3831      +/-   ##
==========================================
+ Coverage   51.23%   53.46%   +2.23%     
==========================================
  Files         200      200              
  Lines       23441    23450       +9     
==========================================
+ Hits        12009    12537     +528     
+ Misses      10272     9659     -613     
- Partials     1160     1254      +94     
Flag Coverage Δ
e2e 33.72% <ø> (-0.01%) ⬇️
e2e go 29.66% <ø> (-0.01%) ⬇️
e2e node 25.96% <ø> (-0.01%) ⬇️
e2e python 29.99% <ø> (-0.01%) ⬇️
e2e quarkus 26.06% <ø> (-0.01%) ⬇️
e2e rust 25.53% <ø> (-0.01%) ⬇️
e2e springboot 24.20% <ø> (-0.01%) ⬇️
e2e typescript 26.05% <ø> (-0.01%) ⬇️
e2e-config-ci 26.78% <ø> (-0.01%) ⬇️
integration 15.75% <ø> (?)
unit macos-14 42.24% <ø> (+<0.01%) ⬆️
unit macos-latest 42.24% <ø> (+<0.01%) ⬆️
unit ubuntu-24.04-arm 42.53% <ø> (-0.02%) ⬇️
unit ubuntu-latest 43.11% <ø> (+<0.01%) ⬆️
unit windows-latest 42.31% <ø> (+<0.01%) ⬆️

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.

@lkingland lkingland added the status/new label Jun 2, 2026
@lkingland lkingland self-assigned this Jun 2, 2026
@lkingland lkingland added this to Functions Traige Jun 2, 2026
@lkingland lkingland moved this to New in Functions Traige Jun 2, 2026
@lkingland lkingland removed the status/new label Jul 29, 2026
@Ankitsinghsisodya

Ankitsinghsisodya commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

cc: @lkingland

All reactions

Sorry, something went wrong.

Uh oh!

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

@lkingland

lkingland commented Aug 20, 2026

Copy link
Copy Markdown
Member

/lgtm
/approve

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 lgtm 🤖 PR is ready to be merged. label Aug 20, 2026
@knative-prow

knative-prow Bot commented Aug 20, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

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

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 [lkingland]

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 Aug 20, 2026
@knative-prow
knative-prow Bot merged commit 0463b9f into knative:main Aug 20, 2026
43 checks passed

Uh oh!

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

@github-project-automation github-project-automation Bot moved this from New to Done in Functions Traige Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

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

@lkingland lkingland

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/L 🤖 PR changes 100-499 lines, ignoring generated files.

Projects

Functions Traige
Status: Done

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 @lkingland
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 01402792 — 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.