Skip to content

Feat: Implement fuzzy search and caching for App Live devices #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

ruturaj-browserstack
Copy link
Contributor

@ruturaj-browserstack ruturaj-browserstack commented Apr 30, 2025

This pull request introduces a new fuzzy search utility, enhances the startSession logic for App Live sessions, and removes redundant code related to app uploads. The most important changes include the implementation of a custom fuzzy search algorithm, caching for App Live devices, and significant refactoring of session initialization logic.

New Features

  • Custom Fuzzy Search Utility: Added a customFuzzySearch function in src/lib/fuzzy.ts to perform Levenshtein-based fuzzy matching on lists of items. This function is used to rank items based on their similarity to a query.
  • Device Cache Implementation: Introduced a caching mechanism in src/tools/applive-utils/device-cache.ts to store App Live device data with a 1-day TTL, reducing redundant API calls.

Refactoring and Enhancements

  • Improved App Live Session Logic: Refactored the startSession function in src/tools/applive-utils/start-session.ts to include:
    • Device filtering and fuzzy matching using the new utilities.
    • Platform version normalization (e.g., resolving "latest" or "oldest" versions).
    • Improved error handling for device selection and app URL validation.
  • Simplified Session Initialization: Removed the uploadApp dependency from startAppLiveSession in src/tools/applive.ts, delegating app upload logic entirely to startSession. [1] [2]

Testing Updates

  • Removed Redundant Tests: Eliminated tests for the removed uploadApp logic and updated existing tests to reflect the refactored startSession behavior. [1] [2]

@ruturaj-browserstack ruturaj-browserstack marked this pull request as ready for review May 2, 2025 08:57
const command =
process.platform === "darwin"
? ["open", launchUrl]
: process.platform === "win32"
? ["cmd", "/c", "start", launchUrl]
: ["xdg-open", launchUrl];

// nosemgrep:javascript.lang.security.detect-child-process.detect-child-process
Copy link
Collaborator

Choose a reason for hiding this comment

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

dont remove this

@pulkitsharma07 pulkitsharma07 merged commit bc1aada into browserstack:main May 2, 2025
1 check passed
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.

2 participants