Skip to content

feat(availability): extend tier matrix with per-parameter gating#150

Merged
polaz merged 21 commits intomainfrom
feat/#136-featavailability-extend-tier-matrix-with-per-param
Jan 23, 2026
Merged

feat(availability): extend tier matrix with per-parameter gating#150
polaz merged 21 commits intomainfrom
feat/#136-featavailability-extend-tier-matrix-with-per-param

Conversation

@polaz
Copy link
Copy Markdown
Member

@polaz polaz commented Jan 23, 2026

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 ManageWorkItemSchema defines 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/version
  • stripTierRestrictedParameters(schema, restrictedParams) in schema-utils.ts — removes properties and required entries from both flat and discriminated union schemas
  • Integration in registry-manager.ts buildToolLookupCache() — applied after transformToolSchema, before tool enters cache

Once the schema defines these parameters, agents on Free tier will no longer see weight/iterationId/healthStatus in the manage_work_item schema, avoiding confusing API errors for tier-restricted features.

Test plan

  • ToolAvailability.getRestrictedParameters — 6 tests covering free/premium/ultimate tiers, version gating, unknown tools, uninitialized connection
  • stripTierRestrictedParameters — 10 tests covering flat schemas, discriminated unions, required array cleanup, immutability, edge cases
  • RegistryManager — integration test for parameter stripping with cleanup
  • Existing mocks updated in RegistryManager.test.ts and ToolDescriptionOverrides.test.ts
  • Full suite passing, lint clean, build clean

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
Copilot AI review requested due to automatic review settings January 23, 2026 19:49
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 23, 2026

Test Coverage Report

Overall Coverage: 93.28%

Metric Percentage
Statements 92.8%
Branches 84.37%
Functions 82.72%
Lines 93.28%

View detailed coverage report

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 23, 2026

Codecov Report

❌ Patch coverage is 96.15385% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/services/ToolAvailability.ts 91.66% 0 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 and oneOf schemas (including required cleanup).
  • 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.

polaz added 3 commits January 23, 2026 21:55
…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
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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

polaz added 3 commits January 23, 2026 22:14
- 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
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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

polaz added 4 commits January 23, 2026 23:13
* 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
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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

polaz added 2 commits January 23, 2026 23:41
- 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
@polaz polaz requested a review from Copilot January 23, 2026 21:47
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

polaz added 3 commits January 23, 2026 23:53
… 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
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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

polaz added 2 commits January 24, 2026 00:16
- 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
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

@polaz polaz enabled auto-merge (squash) January 23, 2026 22:31
@polaz polaz merged commit 1ae98c8 into main Jan 23, 2026
15 checks passed
@polaz polaz deleted the feat/#136-featavailability-extend-tier-matrix-with-per-param branch January 23, 2026 22:33
sw-release-bot bot pushed a commit that referenced this pull request Jan 23, 2026
## [6.36.0](v6.35.0...v6.36.0) (2026-01-23)

### Features

* **availability:** extend tier matrix with per-parameter gating ([#150](#150)) ([1ae98c8](1ae98c8)), closes [#136](#136) [#143](#143) [#125](#125)
@sw-release-bot
Copy link
Copy Markdown

🎉 This PR is included in version 6.36.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(availability): extend tier matrix with per-parameter gating

2 participants