Skip to content

Add include_unversioned option to VersionFilter#3349

Merged
jlowin merged 2 commits intoPrefectHQ:mainfrom
yangbaechu:add-versionfilter-include-unversioned
Mar 3, 2026
Merged

Add include_unversioned option to VersionFilter#3349
jlowin merged 2 commits intoPrefectHQ:mainfrom
yangbaechu:add-versionfilter-include-unversioned

Conversation

@yangbaechu
Copy link
Copy Markdown
Contributor

Description

This PR adds an include_unversioned option to VersionFilter, defaulting to True to preserve the current behavior. When set to False, unversioned components are excluded from VersionFilter list results by passing match_none=self.include_unversioned through the existing VersionSpec.matches() calls.

I kept the change narrowly scoped to the list filtering behavior discussed on the issue. The PR also adds regression coverage for tools, resources, and mounted tools, updates VersionFilter's docstring, and refreshes the versioning guide to document the new option and its default behavior.

I used gpt-5.3-codex to help draft and refine this change

Contributors Checklist

Review Checklist

  • I have self-reviewed my changes
  • My Pull Request is ready for review

@marvin-context-protocol marvin-context-protocol Bot added enhancement Improvement to existing functionality. For issues and smaller PR improvements. server Related to FastMCP server implementation or server-side functionality. labels Mar 2, 2026
Copy link
Copy Markdown
Member

@jlowin jlowin left a comment

Choose a reason for hiding this comment

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

Thanks for picking this up! Two things before this is ready:

The tests cover tools, resources, and mounted tools, but prompts and resource templates have no coverage for include_unversioned=False despite being implemented. Same pattern as the others — should be straightforward to add.

Also, imports belong at the top of the test file, not inside individual test methods. The existing tests in that file do this too, but please don't extend the pattern in the new ones.

@yangbaechu
Copy link
Copy Markdown
Contributor Author

Thanks for the review. I updated this PR by adding include_unversioned=False coverage for prompts and resource templates and moving imports to the top for the tests touched here. I also aligned the test scenarios so each test now defines three inputs (unversioned, in-range versioned, and out-of-range versioned) and verifies that only the in-range versioned entry remains after filtering.

Copy link
Copy Markdown
Member

@jlowin jlowin left a comment

Choose a reason for hiding this comment

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

Thanks!

@jlowin jlowin merged commit 8a356ad into PrefectHQ:main Mar 3, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improvement to existing functionality. For issues and smaller PR improvements. server Related to FastMCP server implementation or server-side functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VersionFilter includes unversioned components with a version range

2 participants