Skip to content

fix(trs): reset tool class filter on switch - #587

Merged
uniqueg merged 3 commits into
devfrom
fix/586-trs-tool-class-switch
Nov 18, 2026
Merged

uniqueg merged 3 commits into
devfrom
fix/586-trs-tool-class-switch

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Closes #586

Summary

On a provider or baseUrl switch, ecc-client-ga4gh-trs-tools now resets the tool class filter and clears the previous provider's tool classes before it loads from the new provider (option 1 from the issue: reset to all classes):

  • filterParams.toolClass is reset to "", so the first request to the new provider has no tool class filter.
  • toolClasses and toolClassMap are cleared, so the select offers no classes of the previous provider while the new ones load (a late result from the old provider was already dropped as stale).
  • The tool class select's value is bound to the filter (with live()), so after the reset the select shows its placeholder and not the old class.
  • Docs: a "Provider switches" section on the TRS tools page, and a sentence on the providers overview page linking to it.
  • Changeset: @elixir-cloud/trs patch.

Verification

  • Regression tests first: the two new tests in packages/ecc-client-ga4gh-trs/src/components/tools/tests/tools.test.ts (filter dropped on a provider switch; no old classes while a slow getToolClasses() of the new provider loads) failed before the fix (expected 'Notebook' to equal '', expected [ Array(1) ] to deeply equal []) and pass with it. Further tests cover a baseUrl switch and a class picked while a load is still running.
  • npx web-test-runner "src/**/*.test.ts" --config ../../web-test.runner-config.mjs --port 8005 in packages/ecc-client-ga4gh-trs: 92 passed in Chromium and Firefox. WebKit isn't installed locally, so CI covers it.
  • npm run lint (turbo; includes the build of all packages and the docs site): passes. The only warnings in the touched files are two old no-console warnings.
  • npx turbo run build --filter=@elixir-cloud/trs: passes.
  • CI: all checks passed (Lint, Test on Node 22 and 24 incl. WebKit, CodeQL, Codecov, Read the Docs, CI passed).

Declined review findings

  • Quality reviewer (low): assert the select's option count in place of its text content. Declined: the test already checks the cleared state and that no old class name is rendered, which is the visible behaviour.
  • Adversarial and quality reviewers (medium): a class picked during a pending load could survive the reset because of Lit's dirty check. A test for that case (drops a tool class filter picked during a load on a provider switch) passes even without live(): the switch's own render commits the picked value before updated() resets it, so the reset is always written. live() is kept anyway as a cheap safeguard, together with the test.

Open questions

None.

🤖 Generated with Claude Code

Summary by Sourcery

Reset tool-class filtering when the TRS tools data source changes so requests and selections do not carry over classes from the previous provider.

Bug Fixes:

  • Reset the TRS tools tool-class filter and remove stale tool classes when switching providers or base URLs.

Enhancements:

  • Keep the tool-class selector synchronized with the reset filter while new provider classes load.

Documentation:

  • Document tool-class filter behavior during provider and base URL switches.

Tests:

  • Add regression coverage for provider switches, base URL changes, pending class loads, and stale tool-class removal.

Chores:

  • Add a patch changeset for the TRS package.

uniqueg and others added 2 commits November 17, 2026 01:42
Clear the tool class filter, the tool classes and their map of
ecc-client-ga4gh-trs-tools when its provider or base URL changes, so
the first request to the new provider is not filtered by a class of
the previous one and the select offers no old classes. Bind the select
value to the filter so it shows all classes after the reset.

Closes #586

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Bind the tool class select with live() so a reset always reaches it,
test the reset for base URL switches and for a class picked while a
load is still running, link the providers page to the tools page and
describe what the select shows after a reset in the changeset.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Implementation

Reset the tool-class filter and clear the previous provider’s tool-class data when the provider or base URL changes, so the new provider’s request starts unfiltered.

  • packages/ecc-client-ga4gh-trs/src/components/tools/tools.ts L3, L121-127, L134 (removed lines)

UI

Bind the tool-class select to the filter value so it displays the reset state after a provider switch.

  • packages/ecc-client-ga4gh-trs/src/components/tools/tools.ts L334

Configuration

Record the TRS package patch release and summarize the provider-switch behavior in its changeset.

  • .changeset/trs-tool-class-switch.md L1-5

Documentation

Document how the TRS tools list resets its filter and available classes on provider or base URL switches.

  • apps/documentation/pages/docs/trs/components/tools.mdx L74-81

Link the providers overview to the TRS tools documentation for provider-switch behavior.

  • apps/documentation/pages/docs/providers.mdx L61-63

Tests

Add regression coverage for provider and base URL switches, including stale class options, selections made during a pending load, and the select’s reset value.

  • packages/ecc-client-ga4gh-trs/src/components/tools/tests/tools.test.ts L50-60, L272-395

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 77.02%. Comparing base (fd4653a) to head (7f2ebcd).

Files with missing lines Patch % Lines
...ecc-client-ga4gh-trs/src/components/tools/tools.ts 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #587      +/-   ##
==========================================
+ Coverage   76.96%   77.02%   +0.05%     
==========================================
  Files          73       73              
  Lines       18783    18787       +4     
  Branches     1175     1178       +3     
==========================================
+ Hits        14457    14471      +14     
+ Misses       4305     4295      -10     
  Partials       21       21              

☔ 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.

@uniqueg
uniqueg marked this pull request as ready for review November 17, 2026 01:33
@uniqueg
uniqueg requested a review from anuragxxd as a code owner November 17, 2026 01:33
@sourcery-ai

sourcery-ai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Linked issues

Checked at commit 7f2ebcd

#586 fix(trs): drop old tool class filter on provider switch · 7 of 7 met

# Requirement Status Notes
1 Clear the previous provider's tool classes and class map before loading the new provider's classes. ✅ Met Both are cleared in the provider-switch branch before either new-provider load starts.
2 On a switch, either reset the tool class filter to all classes or keep it only if the new provider offers it. ✅ Met The filter is reset to an empty string before loading tools, and the select is bound to that filter.
3 Fire ecc-tools-changed with the tools from the unfiltered (or still-valid) query. ✅ Met The reset happens before loadData(); its successful response is assigned to tools and emitted through ecc-tools-changed.
4 Test switching providers with a tool class filter set, including the first request and the select state. ✅ Met The regression test checks that the new provider's first request has an empty toolClass filter and that the select value is empty after the switch.
5 Test that a slow new-provider tool-class load does not leave the previous provider's classes available. ✅ Met The test holds the new provider's class response pending and verifies the old class is absent until the new response arrives.
6 Document the filter reset on the TRS tools page. ✅ Met The Provider switches section describes the reset and class options during loading.
7 Document the filter reset in the providers overview's provider-switch discussion. ✅ Met The overview now links to the TRS tools page and states that its filter resets on a switch.

@sourcery-ai sourcery-ai Bot 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.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@anuragxxd anuragxxd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks Alex, looks good: small change, and the tests cover the switch while a load is still running. LGTM.

@uniqueg
uniqueg merged commit 86bd628 into dev Nov 18, 2026
17 of 19 checks passed
@uniqueg
uniqueg deleted the fix/586-trs-tool-class-switch branch November 18, 2026 12:17
uniqueg added a commit that referenced this pull request Nov 19, 2026
Resolve the conflict in the TRS tools list tests by keeping both
sides: the timeout test of this branch and the tool class filter
tests of #587.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(trs): drop old tool class filter on provider switch

2 participants