Conversation
Add parameter-level tier restrictions to the schema filtering pipeline. Parameters above the user's GitLab tier are stripped from JSON Schema before exposure to agents, preventing confusing API errors. - Add parameterRequirements map to ToolAvailability (manage_work_item: weight, iterationId, healthStatus) - Add getRestrictedParameters() method checking tier and version - Add stripTierRestrictedParameters() utility in schema-utils for both flat and discriminated union schemas - Integrate parameter stripping in registry-manager buildToolLookupCache pipeline
Test Coverage ReportOverall Coverage: 93.28%
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
Adds per-parameter tier/version gating so tool schemas hide inputs that aren’t available on the detected GitLab tier/version.
Changes:
- Introduces
ToolAvailability.getRestrictedParameters()backed by a per-tool parameter requirements matrix. - Adds
stripTierRestrictedParameters()to remove gated parameters from both flat andoneOfschemas (includingrequiredcleanup). - Integrates parameter stripping into
RegistryManager.buildToolLookupCache()and updates unit tests/mocks accordingly.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/services/ToolAvailability.ts |
Adds parameter-level tier/version requirements and a lookup method to compute restricted parameter names. |
src/utils/schema-utils.ts |
Adds schema transformation to remove restricted params from properties and required (flat + oneOf). |
src/registry-manager.ts |
Applies parameter stripping after schema transformation when building the tool cache. |
tests/unit/services/ToolAvailability.test.ts |
Adds unit tests for per-parameter restriction behavior across tiers/versions and uninitialized connection handling. |
tests/unit/utils/schema-utils.test.ts |
Adds unit tests for schema stripping behavior, including discriminated unions and immutability. |
tests/unit/RegistryManager.test.ts |
Updates ToolAvailability mock to include getRestrictedParameters. |
tests/unit/services/ToolDescriptionOverrides.test.ts |
Updates ToolAvailability mock to include getRestrictedParameters. |
…bug log - Add ParameterRequirement type alias for semantic clarity (vs ActionRequirement) - Include version in restricted parameters debug log since parameters can be restricted by version, not just tier
- Add RegistryManager test for schema property removal integration - Add schema-utils tests: no properties, no required array, discriminated union with missing properties branch
- Use human-readable version string (e.g. "17.0.0") in debug log instead of parsed numeric value (1700) - Wrap parameter stripping test in try/finally to clean up shared registry after test completes
* docs: add Prompt Library, guides, llms.txt, and use-case tool pages (#125) - Prompt Library with 16 pages of ready-to-use prompts organized by workflow (quick-start, code-review, CI/CD, project-management) and by role (developer, devops, team-lead, PM) - 4 step-by-step guides: code review, CI notifications, multi-GitLab setup, team onboarding - llms.txt for machine-readable documentation summary - Tool pages reorganized by use-case: code-review, ci-cd, project-management, repository - VitePress nav/sidebar updated with Prompts and Guides sections - Homepage updated with Prompt Library action button * docs: add Automate Releases guide and tool comparison tables - Add 5th guide: automate-releases.md (end-to-end release workflow) - Add tool comparison table by role (Developer/DevOps/Lead/PM) - Add Query vs Command comparison table for CQRS tools - Update sidebar and guides index with new guide * fix(docs): correct tool schemas in prompt library and guides - Rename list_webhooks/list_integrations to browse_webhooks/browse_integrations - Remove per_page from non-paginated actions (get, job, logs, content, compare) - Remove ref from manage_pipeline retry/cancel (only needed for create) - Fix manage_ref params: delete_branch uses branch only, protect_branch uses name, create_tag uses tag_name+ref - Use limit instead of per_page for job logs - Update manage_webhook actions (remove 'read'), manage_integration (remove 'get') * fix(docs): correct tool action params and restore CLI nav - browse_webhooks: use action "list" instead of empty string - browse_integrations: add required action "list" field - create_branch: remove action field from standalone tool usage - manage_ref protect_branch: use name param, remove branch/ref - manage_ref create_tag: remove invalid branch param - browse_milestones: use "issues" action for milestone filtering - Restore CLI nav link in config.mts - Rename "Related Guides" section to "Related" where mixed * fix(docs): add CLI sidebar section for /cli/ pages * fix(docs): remove invalid params from tool examples - list_group_iterations: remove action field (flat schema, no action) - browse_work_items get: remove state/first/simple (list-only params) - manage_merge_request approve/merge/update/get_approval_state: remove source_branch (not accepted by these actions) - manage_work_item update: remove namespace/workItemType (only id accepted) * fix(docs): correct publish_all, webhook, and integration examples - manage_draft_notes publish_all: remove invalid note field - manage_webhook description: replace CRUD with actual actions - manage_integration description: remove get (moved to browse_integrations) - setup-ci-notifications: use browse_integrations for get action * fix(docs): clarify tool references and descriptions - project-management: add missing list_project_members tool to table - repository: reorder create_branch as convenience alias of manage_ref - debug-failure: add tool name comments to distinguish manage_pipeline from manage_pipeline_job - multi-gitlab-setup: fix reset description (restores full context, not just scope) * fix(docs): use jsonc lang tag, correct API URL and tool schemas - Switch fenced blocks with // annotations to jsonc language - GITLAB_API_URL: use base URL without /api/v4 suffix - manage_ref: add update_branch_protection and unprotect_tag actions - create_branch: standalone tool, not alias - project-management: label browse_members example explicitly * fix(docs): add missing access levels and use conventional commits - Access level tables: add 0=No access and 5=Minimal - Suggestion examples: use conventional commit format in commit_message * fix(docs): add missing draft action and use conventional commit format
…ter init - Accept optional pre-fetched instanceInfo in getRestrictedParameters() to avoid redundant ConnectionManager calls per tool in cache build loop - Pre-fetch instance info once at the start of buildToolLookupCache() - Refresh registry cache after successful ConnectionManager initialization so tier-restricted parameters are stripped even if RegistryManager was constructed before connection was available - Invalidate toolDefinitionsCache in refreshCache() for consistency
- Skip getRestrictedParameters call when instanceInfo is undefined to avoid repeated throw/catch in ConnectionManager.getInstanceInfo() - Use invalidateCaches() in refreshCache() to clear all derived caches (toolNamesCache, readOnlyToolsCache) consistently - Add ConnectionManager mock to RegistryManager and ToolDescriptionOverrides tests so buildToolLookupCache can pre-fetch instance info
… guard - Add tests for getRestrictedParameters with cachedInstanceInfo parameter (tier check, version check, bypassing ConnectionManager) - Add RegistryManager test verifying parameter stripping is skipped when ConnectionManager is not initialized
- Restructure stripFromProperties to handle required filtering independently from properties deletion - Add mockClear() in RegistryManager test to prevent stale call history - Add test case for schema with required but no properties object
|
🎉 This PR is included in version 6.36.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Closes #136
Extends the tier restriction system with per-parameter gating infrastructure, complementing existing per-tool and per-action levels. This is preparatory work — the stripping logic is in place and ready to take effect once
ManageWorkItemSchemadefines the gated parameters (weight,iterationId,healthStatus) in a follow-up PR (see #135).ToolAvailability.parameterRequirements— static map declaring which parameters require which tier/version (manage_work_item:weight→ premium,iterationId→ premium,healthStatus→ ultimate)ToolAvailability.getRestrictedParameters(toolName)— returns parameter names that should be hidden for the current instance tier/versionstripTierRestrictedParameters(schema, restrictedParams)inschema-utils.ts— removes properties and required entries from both flat and discriminated union schemasregistry-manager.tsbuildToolLookupCache()— applied aftertransformToolSchema, before tool enters cacheOnce the schema defines these parameters, agents on Free tier will no longer see
weight/iterationId/healthStatusin themanage_work_itemschema, avoiding confusing API errors for tier-restricted features.Test plan
ToolAvailability.getRestrictedParameters— 6 tests covering free/premium/ultimate tiers, version gating, unknown tools, uninitialized connectionstripTierRestrictedParameters— 10 tests covering flat schemas, discriminated unions, required array cleanup, immutability, edge casesRegistryManager— integration test for parameter stripping with cleanupRegistryManager.test.tsandToolDescriptionOverrides.test.ts