Skip to content

Refactor Accessibility Scan Tools with Enhanced Progress Updates and Local Report Download #41

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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

ruturaj-browserstack
Copy link
Contributor

This PR introduces a major refactor of the Accessibility Scan tool. Key changes include:

  • Replaced accessibility.ts logic with a modular structure:

    • AccessibilityScanner for scan orchestration and polling.
    • AccessibilityReportFetcher for report link retrieval and download.
  • Improved progress notification handling with better fallbacks for missing tokens.

  • Reports are now downloaded locally to ~/.browserstack/reports/.

  • Clear error messages and scan status updates sent via context.sendNotification.

Testing:

Tested on the following environments:

  • Claude Desktop
  • VS Code
  • Cursor Editor

✅ No timeouts observed
✅ CSV report successfully downloaded and visible in final tool output

@ruturaj-browserstack
Copy link
Contributor Author

TBD on pageURL to get multiple urls or single

try {
const statusResp = await this.pollStatus(scanId, scanRunId);
const status = statusResp.data!.status;
const progress = status === "completed" ? 100 : 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

since total timeout is of 5 minutes, and this setInterval runs every 5 seconds, we can increase progress by 5 seconds/5 minutes amount everytime

/** How many JSON-chars max per “page” (default 10000) */
maxCharacterLength?: number;
/** Character offset to start from (default 0) */
nextPage?: number;
Copy link
Collaborator

Choose a reason for hiding this comment

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

why do we need this ? this is never set, always 0, how will this be used ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added it, so it can be reused to fetch the next set of issues later.
Since we have a 10K character limit, this setup allows the user to request the next chunk if needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The thinking was to write this function , so it can be extended for new tool getNextAccessibilityIssues args -> project_name and next_page_token. We will get the url from local inmemory cache from key : project_name and return next(10K chars) results

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