Skip to content

Consolidate Accessibility and Reliability PRs (#270, #268, #267, #265, #272) - #364

Open
cto-new[bot] wants to merge 4 commits into
mainfrom
cto/resolve-accessibility-rebase
Open

Consolidate Accessibility and Reliability PRs (#270, #268, #267, #265, #272)#364
cto-new[bot] wants to merge 4 commits into
mainfrom
cto/resolve-accessibility-rebase

Conversation

@cto-new

@cto-new cto-new Bot commented Apr 24, 2026

Copy link
Copy Markdown

This PR consolidates and rebases five high-priority Pull Requests (#270, #268, #267, #265, and #272) onto the latest origin/main.

Key Changes:

  1. Accessibility Improvements (frontend/src/components/ActivityTimeline.tsx):

    • Unified multiple conditional renderings into a single semantic <ul> element.
    • Ensured both loading states ("Searching...") and event items are proper <li> elements within the same list.
    • Improved screen reader navigation and consistency.
    • Verified with vitest suite (all 42 tests passing).
  2. Reliability Fix (backend/src/search/router.py):

    • Added defensive error handling around the fallback search provider.
    • If both primary and fallback providers fail, the system now logs an error and returns an empty list instead of raising an unhandled exception.
    • Updated backend/tests/test_search_router.py to match this robust behavior.
  3. Workspace Cleanup:

    • Verified .gitignore properly excludes test-results/ and other artifacts.

This integration provides a cleaner, more robust foundation while resolving redundant work across multiple PRs.

Powered by CTO.new

cto.new and others added 3 commits April 24, 2026 07:30
Wraps the fallback provider search call in a try-except block to ensure that if the fallback provider also fails, the exception is caught, logged, and an empty list is returned. This prevents the application from crashing on search failures.

Updates backend/tests/test_search_router.py to assert empty list return instead of expecting an exception.

Updates frontend/.gitignore to exclude test-results and coverage.
…nsolidating PRs

- Consolidated ActivityTimeline list structure for better accessibility (from #270, #268, #267, #265).
- Fixed SearchRouter crash when fallback provider fails by adding try-except block (from #272).
- Updated backend tests to match the new SearchRouter behavior.
- Verified frontend tests pass with the new ActivityTimeline structure.
@trunk-io

trunk-io Bot commented Apr 24, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@sourcery-ai

sourcery-ai Bot commented Apr 24, 2026

Copy link
Copy Markdown

Reviewer's Guide

Consolidates several PRs to improve accessibility in the ActivityTimeline component and harden the search router’s error handling, including updated tests and adapter patching strategy to reflect the current initialization model.

Sequence diagram for SearchRouter primary and fallback providers with safe failure

sequenceDiagram
    actor User
    participant APIClient
    participant SearchRouter
    participant primary_provider
    participant fallback_provider
    participant Logger

    User->>APIClient: send search request
    APIClient->>SearchRouter: search(query, max_results)

    SearchRouter->>primary_provider: search(query, max_results)
    alt primary search succeeds
        primary_provider-->>SearchRouter: results
        SearchRouter-->>APIClient: results
        APIClient-->>User: return results
    else primary search raises_exception
        primary_provider-->>SearchRouter: exception
        SearchRouter->>Logger: warning primary provider failed
        SearchRouter->>fallback_provider: search(query, max_results)
        alt fallback search succeeds
            fallback_provider-->>SearchRouter: results
            SearchRouter-->>APIClient: results
            APIClient-->>User: return results
        else fallback search raises_exception
            fallback_provider-->>SearchRouter: exception
            SearchRouter->>Logger: warning fallback provider failed
            SearchRouter->>Logger: error all search attempts failed
            SearchRouter-->>APIClient: empty list
            APIClient-->>User: return empty results
        end
    end
Loading

Flow diagram for SearchRouter error handling and empty-list fallback

flowchart TD
    A["Search request received"] --> B["Call primary provider search"]
    B -->|success| R["Return primary provider results"]
    B -->|exception| C["Log warning primary provider failed"]

    C --> D["Call fallback provider search"]
    D -->|success| F["Return fallback provider results"]
    D -->|exception| G["Log warning fallback provider failed"]

    G --> H["Log error all search attempts failed"]
    H --> I["Return empty list to caller"]
Loading

File-Level Changes

Change Details Files
Harden search router error handling and adjust provider initialization behavior with corresponding tests.
  • Change tests to patch provider adapters via search.router module-level symbols instead of provider module paths, aligning mocks with how SearchRouter imports adapters.
  • Update provider initialization test to assert that all adapters are instantiated and present in the providers dict rather than lazily initialized on first use.
  • Modify fallback-on-missing-provider test to simulate a missing primary provider by deleting it from the providers dict and asserting that the fallback provider is invoked with tuned=True and max_results=5.
  • Update all-fail test to expect an empty list result instead of an exception when both primary and fallback providers fail, reflecting new defensive behavior in SearchRouter.
  • Add try/except around fallback provider search call in router.search, logging a warning when the fallback fails and then allowing the method to return an empty list on total failure.
  • Adjust no-provider-available test to clear the providers dict to simulate misconfiguration and continue asserting a ValueError when no providers are available.
backend/src/search/router.py
backend/tests/test_search_router.py
Unify ActivityTimeline list semantics so loading and event items share a single list for better accessibility.
  • Replace separate loading-state
      with a conditional
    • inside a single
        that is rendered whenever the timeline is loading or has events.
      • Ensure the loading state still renders the existing visual structure and text while maintaining consistent list semantics for screen readers.
      • Keep existing event rendering via TimelineItem mapping inside the unified list container.
frontend/src/components/ActivityTimeline.tsx
Update frontend lockfile to reflect dependency state after merge/rebase.
  • Regenerate or update pnpm-lock.yaml to reflect the consolidated PR changes and current dependency resolutions.
frontend/pnpm-lock.yaml

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In SearchRouter.search, when the fallback provider fails you only log a warning without the stack trace; consider using logger.exception (or adding exc_info=True) there to make debugging multi-provider failures easier.
  • Several tests (e.g., test_search_fallback_on_missing_provider, test_search_no_provider_available) mutate router.providers directly; relying on internal state like this can make tests brittle if the initialization strategy changes—prefer configuring availability via mock_config or constructor parameters instead.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `SearchRouter.search`, when the fallback provider fails you only log a warning without the stack trace; consider using `logger.exception` (or adding `exc_info=True`) there to make debugging multi-provider failures easier.
- Several tests (e.g., `test_search_fallback_on_missing_provider`, `test_search_no_provider_available`) mutate `router.providers` directly; relying on internal state like this can make tests brittle if the initialization strategy changes—prefer configuring availability via `mock_config` or constructor parameters instead.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

…ity PRs

- Consolidated ActivityTimeline list structure into a single semantic <ul> for better accessibility (merging logic from #270, #268, #267, #265).
- Fixed SearchRouter crash by wrapping fallback search provider call in a try-except block (#272).
- Updated backend tests to assert empty list on search failure instead of crashing.
- Verified all frontend tests pass, including new semantic role checks.
- Ensured .gitignore excludes test artifacts.
@cto-new cto-new Bot changed the title Resolve Accessibility and Reliability Issues (Consolidated PRs #270, #268, #267, #265, #272) Consolidate Accessibility and Reliability PRs (#270, #268, #267, #265, #272) Apr 24, 2026
@sonarqubecloud

Copy link
Copy Markdown

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.

0 participants