Skip to content

MCP server refresh + bug fixes since PR #87#88

Merged
JE-Chen merged 1 commit intomainfrom
dev
Apr 26, 2026
Merged

MCP server refresh + bug fixes since PR #87#88
JE-Chen merged 1 commit intomainfrom
dev

Conversation

@JE-Chen
Copy link
Copy Markdown
Member

@JE-Chen JE-Chen commented Apr 26, 2026

Summary

52 commits since PR #87 merged. The big-ticket item is bringing the MCP server up to date and the bugs that audit caught.

MCP server: 9 → 19 tools

The MCP server was last updated when only nine helpers existed. Around 30 new pure-function modules have landed since (action_formatter, md_authoring, sel_to_pw, pom_codegen, pii_scanner, failure_cluster, accessibility.a11y_diff, locator_strength's batch scorer, …). This PR wires the most useful 10 of them into build_default_tools():

Category New tools
Action authoring webrunner_format_actions, webrunner_parse_markdown, webrunner_translate_actions_to_playwright, webrunner_translate_python_to_playwright, webrunner_score_action_locators
Code generation webrunner_pom_from_html
Quality / triage webrunner_a11y_diff, webrunner_cluster_failures
Security / privacy webrunner_scan_pii, webrunner_redact_pii

Bug found by the MCP audit

_tool_lint_action used dataclass-style attribute access (f.level, f.message, f.rule) but lint_action actually returns List[Dict[str, Any]]. Every MCP tools/call against webrunner_lint_action was crashing with 'dict' object has no attribute 'level'. Now passes the list through verbatim, matching the Python API's shape.

Surface-freeze test

TestDefaultTools.test_full_default_tool_surface asserts the 19-tool set explicitly so accidental removals fail loudly in review.

Earlier rounds rolled into this PR

  • WR_sleep executor command + the examples/ cookbook (counting_stars, google_search, form_submit, smart_wait_demo, fanout_demo, pii_redact_demo, quick_smoke).
  • Comprehensive integration test suite under test/integration_test/ — 30 tests across 10 files wiring 2+ modules with real I/O. Surfaced a Windows-only LSP CRLF framing bug in python -m je_web_runner.action_lsp (fixed by sys.stdout.reconfigure(newline="")).
  • Real-browser E2E scaffold under test/e2e_test/ plus .github/workflows/e2e_browser.yml running daily against selenium/hub:4.20.0.
  • Thematic façade je_web_runner.api.{authoring, debugging, frontend, infra, mobile, networking, observability, quality, reliability, security, test_data} re-exporting the 80+ helpers.
  • Sphinx autodoc + autosummary; new api_reference.rst with mock imports for soft deps.
  • Static-analysis cleanup (4 rounds against PR Extended capabilities round 2 + cookbook + integration tests #86's review): ~30 Codacy + 30+ SonarCloud items resolved across cog-complexity refactors, suppression-syntax fixes (S7632), reflected-input hardening (S5131 + _safe_echo), nested-ternary collapse (S3358), and security annotations (S5042 / S4828 / S5332 / S5852 / S1313).
  • Optimisation pass: 7 pytest collection warnings cleared; workspace_lock distribution walk cached; socket_server quit tests went from 2.42s → 0.49s; suite −25%.

Bug catalogue across this PR

  1. webdriver_wrapper.execute_script swallowed return values — caught by JSON cookbook smoke. Fixed.
  2. LSP Content-Length framing corrupted on Windows by stdout newline translation — caught by integration subprocess test. Fixed via sys.stdout.reconfigure(newline="").
  3. Subprocess tests' _fileobj2output AttributeError + I/O operation on closed file — caught in CI rerun. Fixed by switching to proc.communicate(input=...) instead of manual stdin.close().
  4. _tool_lint_action dict-vs-dataclass shape mismatch — caught while auditing for this PR. Fixed.

Numbers

  • Tests: 1184 → 1241 (1200 unit + 41 integration / MCP).
  • 0 collection warnings.
  • Combined unit + integration suite ~17s.

Test plan

  • Unit + integration green on Python 3.10 / 3.11 / 3.12 / 3.13.
  • Daily E2E workflow runs against Selenium Grid.
  • Sphinx autosummary builds on the new sections.
  • PyPI publish workflow fires on merge.

The MCP server was last touched when only nine helpers existed; ~30
new pure-function modules have landed since (action_formatter,
md_authoring, sel_to_pw, pom_codegen, pii_scanner, failure_cluster,
a11y_diff, locator_strength's batch scorer). This wires the most
useful 10 of them into ``build_default_tools()`` so MCP-aware clients
can call them directly.

New tools:
- webrunner_format_actions
- webrunner_parse_markdown
- webrunner_translate_actions_to_playwright
- webrunner_translate_python_to_playwright
- webrunner_pom_from_html
- webrunner_scan_pii
- webrunner_redact_pii
- webrunner_cluster_failures
- webrunner_a11y_diff
- webrunner_score_action_locators

Bug: _tool_lint_action used dataclass-style attribute access (f.level,
f.message) but ``lint_action`` actually returns ``List[Dict[str, Any]]``
keyed on rule / severity / message / location. Pass the list through
verbatim so MCP clients see the same shape the Python API exposes.

Test: TestNewTools covers each new tool end-to-end through the MCP
server. TestDefaultTools.test_full_default_tool_surface freezes the
19-tool list so accidental removals fail loudly in review.

README + EN/ZH Sphinx docs grouped the now-larger tool list by purpose
(authoring / codegen / quality / security / reporting / infra) so
operators can scan the surface at a glance.

Tests: 1230 -> 1241.
@sonarqubecloud
Copy link
Copy Markdown

@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 37 complexity · 0 duplication

Metric Results
Complexity 37
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@JE-Chen JE-Chen merged commit 7f5a0f0 into main Apr 26, 2026
18 checks 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.

1 participant