Skip to content

Update dependencies#307

Draft
temotskipa wants to merge 2 commits into
CursorTouch:mainfrom
temotskipa:update-dependencies
Draft

Update dependencies#307
temotskipa wants to merge 2 commits into
CursorTouch:mainfrom
temotskipa:update-dependencies

Conversation

@temotskipa

Copy link
Copy Markdown
Contributor

Summary

  • Refresh dependencies in uv.lock from uv lock --upgrade.
  • Update startup task tests for the current interpreter-based launcher and PowerShell scheduled-task registration path.
  • Update tree view tests to assert the current grouped tree rendering format instead of the removed row/to_row() format.

Why

The dependency refresh exposed stale test expectations that no longer matched the current implementation on main. The production behavior was already using the newer contracts, so the tests were updated to cover that behavior.

Validation

  • uv run --extra dev pytest -> 318 passed
  • uv run --extra dev ruff check tests/test_startup_task.py tests/test_tree_views.py -> all checks passed

@temotskipa temotskipa changed the title [codex] update dependencies Update dependencies Jul 4, 2026
@temotskipa temotskipa marked this pull request as ready for review July 4, 2026 21:48
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Refresh uv.lock and align tests with current startup task + tree rendering

⚙️ Configuration changes 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Refresh locked Python dependencies via uv lock --upgrade.
• Update startup task tests to match interpreter-based launcher and PowerShell task registration.
• Update tree view tests to assert the grouped window/tree string format.
Diagram

graph TD
  A["Scheduled task install"] --> B["_resolve_program()"] --> C["sys.executable -m windows_mcp"] --> D["_register_task_powershell()"] --> E["Windows Task Scheduler"]
  F["TreeState formatting"] --> G["_render_tree()"] --> H["Grouped window output"]

  subgraph Legend
    direction LR
    _fn([Function/module]) ~~~ _os[[OS facility]]
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Keep PATH-based resolution (shutil.which) with fallbacks
  • ➕ Can prefer an installed console script when multiple interpreters exist
  • ➕ Might match user expectations when invoking via windows-mcp
  • ➖ More brittle (PATH ordering, uv ephemeral caches)
  • ➖ Harder to make scheduled task reliably target the current environment
2. Register task via schtasks /Create only
  • ➕ Fewer moving parts (no PowerShell command string)
  • ➕ Common/understood Windows tooling
  • ➖ Creating ONLOGON tasks can require elevation depending on settings
  • ➖ Harder to control RunLevel Limited behavior without PowerShell cmdlets

Recommendation: The current approach—always using the running interpreter (sys.executable -m windows_mcp) and registering the task via PowerShell—is the most reliable way to bind the scheduled task to the exact installed environment and avoid PATH/uv-cache ambiguity. The test updates in this PR correctly lock expectations to that more deterministic contract.

Files changed (3) +26 / -57

Tests (2) +26 / -57
test_startup_task.pyAlign startup task tests with interpreter launcher + PowerShell registration +11/-26

Align startup task tests with interpreter launcher + PowerShell registration

• Updates '_resolve_program()' expectations to use 'sys.executable -m windows_mcp' rather than a PATH-discovered console script. Adjusts install tests to assert PowerShell-based scheduled-task registration ('_register_task_powershell') instead of 'schtasks /Create' argument matching.

tests/test_startup_task.py

test_tree_views.pyUpdate tree view tests for grouped window/tree string rendering +15/-31

Update tree view tests for grouped window/tree string rendering

• Changes assertions from the removed row/'to_row()' table format to the current grouped output (window header plus tree lines). Updates expectations around ordering and scrollable rendering, and removes now-obsolete 'to_row'-related tests.

tests/test_tree_views.py

Other (1)
uv.lockRefresh locked dependencies via uv upgrade +0/-0

Refresh locked dependencies via uv upgrade

• Updates the lockfile to the latest resolved dependency set from 'uv lock --upgrade', keeping the environment reproducible while pulling in newer package versions.

uv.lock

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (3) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 15 rules

Grey Divider


Action required

1. Long test function signature 📘 Rule violation ✧ Quality
Description
The modified test function definition exceeds the 100-character maximum line length. This reduces
readability and violates the style requirement for changed code.
Code

tests/test_tree_views.py[108]

+    def test_scrollable_elements_are_independent_from_interactive_count(self, sample_scroll_element_node):
Relevance

⭐⭐ Medium

No historical evidence found that reviewers enforce 100-char limit on test function definitions.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 222796 requires keeping non-comment code lines at or below 100 characters. The
function definition at the cited line is a single long signature that exceeds this limit.

Rule 222796: Enforce maximum line length of 100 characters
tests/test_tree_views.py[108-108]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A modified line exceeds the 100-character maximum line length.

## Issue Context
`tests/test_tree_views.py` contains a changed function definition whose full signature is on one line and is longer than 100 characters.

## Fix Focus Areas
- tests/test_tree_views.py[108-108]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Single-quoted assertions added 📘 Rule violation ✧ Quality
Description
New/modified assertions introduce single-quoted string literals instead of double quotes. This
violates the requirement for consistent double-quoted string literals in changed code.
Code

tests/test_tree_views.py[R70-71]

+        assert lines[0] == 'window "Notepad"'
+        assert '(200,100) button "OK"' in lines[1]
Relevance

⭐⭐ Medium

No prior accepted/rejected reviews found enforcing double-quote literals in tests in this repo.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 222799 requires double quotes for all string literals. The cited lines add/modify
assertions that use single-quoted strings (e.g., 'window "Notepad"', '(200,100) button "OK"').

Rule 222799: Enforce double quotes for all string literals
tests/test_tree_views.py[70-74]
tests/test_tree_views.py[87-88]
tests/test_tree_views.py[103-106]
tests/test_tree_views.py[118-119]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Changed lines contain single-quoted string literals; the rule requires double quotes for all string literals.

## Issue Context
Several newly added/modified assertions in `tests/test_tree_views.py` use single quotes (e.g., `assert lines[0] == 'window "Notepad"'`).

## Fix Focus Areas
- tests/test_tree_views.py[70-74]
- tests/test_tree_views.py[87-88]
- tests/test_tree_views.py[103-106]
- tests/test_tree_views.py[118-119]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. Install test mocks launcher 🐞 Bug ⚙ Maintainability
Description
test_install_writes_start_script_and_creates_task replaces _resolve_program with a fixed exe argv,
so it no longer exercises the real interpreter-based launcher used by install(). This reduces
coverage for the actual start-script command line (including quoting/-m windows_mcp composition).
Code

tests/test_startup_task.py[R15-47]

def test_install_writes_start_script_and_creates_task(monkeypatch, tmp_path):
Relevance

⭐⭐ Medium

No historical evidence on test stubbing _resolve_program/start-script coverage; file not found in
repo history tools.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Production install() builds its start-script argv from _resolve_program(), which always returns
sys.executable -m windows_mcp, but the updated test stubs _resolve_program() to a
windows-mcp.exe argv and asserts against that exe-based string, so the test no longer covers the
real production launcher path.

src/windows_mcp/main.py[738-745]
src/windows_mcp/main.py[789-807]
tests/test_startup_task.py[15-47]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The install test currently monkeypatches `_resolve_program()` to return a hard-coded `windows-mcp.exe` argv and then asserts that string appears in the generated script. Production `_resolve_program()` always returns `[sys.executable, "-m", "windows_mcp"]`, so the test no longer validates the real install/start-script launcher contract.

## Issue Context
Because `install()` uses `_resolve_program()` to build the command written into the scheduled-task wrapper script, the test should verify that the generated script matches the interpreter-based invocation shape (and handles quoting for paths with spaces).

## Fix Focus Areas
- tests/test_startup_task.py[15-47]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

4. Tree output checks too partial 🐞 Bug ⚙ Maintainability
Description
Several updated tree-view tests assert only substrings (e.g., element names) instead of the full
rendered lines, making them less likely to catch regressions in the grouped tree formatting used in
snapshot outputs. This can allow unintended changes to connectors/action/metadata formatting to pass
while still matching the loose substrings.
Code

tests/test_tree_views.py[R76-79]

+    def test_interactive_elements_preserve_order(self, sample_tree_element_node):
        node2 = TreeElementNode(
            bounding_box=sample_tree_element_node.bounding_box,
            center=sample_tree_element_node.center,
Relevance

⭐⭐ Medium

No historical suggestions found about preferring full-line assertions over substring checks in
tree-view tests.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Snapshot building uses
TreeState.interactive_elements_to_string()/scrollable_elements_to_string() directly, which
render via _render_tree() into a specific multi-line tree format. The updated tests for
ordering/independence now primarily check for partial substrings, reducing coverage of the full
rendered format.

src/windows_mcp/tools/_snapshot_helpers.py[88-90]
src/windows_mcp/tree/views.py[61-78]
tests/test_tree_views.py[66-120]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The tree-view tests were updated to the grouped tree renderer, but some assertions now only check for substrings like `button "OK"` / `pane "Document"`. This weakens the guarantee that the actual tree formatting (connectors, `[action: ...]`, and metadata tokens) remains stable.

## Issue Context
These strings are surfaced in snapshot responses (`capture_desktop_state`) and are produced by `_render_tree()`.

## Fix Focus Areas
- tests/test_tree_views.py[66-120]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Tree view tests untyped 📘 Rule violation ✧ Quality
Description
Modified test function signatures in the changed code omit required parameter and return type
annotations, including fixture parameters. This violates the requirement that all changed function
definitions have fully type-annotated signatures.
Code

tests/test_tree_views.py[76]

+    def test_interactive_elements_preserve_order(self, sample_tree_element_node):
Relevance

⭐ Low

Team previously rejected adding type hints to pytest test/fixture signatures (PR #202, #232).

PR-#202
PR-#232

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 222805 requires explicit type hints for every parameter and an explicit return type
on all changed function definitions. The cited modified test functions in the referenced files are
defined without parameter annotations and without any return type annotation, demonstrating
non-compliance with the rule.

Rule 222805: Require type hints for all function signatures
tests/test_tree_views.py[76-76]
tests/test_tree_views.py[108-108]
tests/test_startup_task.py[9-9]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Modified function definitions in tests are missing required type hints for parameters (including fixture parameters) and return types.

## Issue Context
PR Compliance ID 222805 requires explicit annotations for all function parameters and an explicit return type on any changed function definition; for tests that do not return a value, the return type should typically be `-> None`.

## Fix Focus Areas
- tests/test_tree_views.py[76-83]
- tests/test_tree_views.py[108-108]
- tests/test_startup_task.py[9-12]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment thread tests/test_tree_views.py
assert "[v:42.5%]" in lines[1]

def test_scrollable_elements_base_index_offset(self, sample_scroll_element_node):
def test_scrollable_elements_are_independent_from_interactive_count(self, sample_scroll_element_node):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. Long test function signature 📘 Rule violation ✧ Quality

The modified test function definition exceeds the 100-character maximum line length. This reduces
readability and violates the style requirement for changed code.
Agent Prompt
## Issue description
A modified line exceeds the 100-character maximum line length.

## Issue Context
`tests/test_tree_views.py` contains a changed function definition whose full signature is on one line and is longer than 100 characters.

## Fix Focus Areas
- tests/test_tree_views.py[108-108]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread tests/test_tree_views.py
Comment on lines +70 to +71
assert lines[0] == 'window "Notepad"'
assert '(200,100) button "OK"' in lines[1]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

2. Single-quoted assertions added 📘 Rule violation ✧ Quality

New/modified assertions introduce single-quoted string literals instead of double quotes. This
violates the requirement for consistent double-quoted string literals in changed code.
Agent Prompt
## Issue description
Changed lines contain single-quoted string literals; the rule requires double quotes for all string literals.

## Issue Context
Several newly added/modified assertions in `tests/test_tree_views.py` use single quotes (e.g., `assert lines[0] == 'window "Notepad"'`).

## Fix Focus Areas
- tests/test_tree_views.py[70-74]
- tests/test_tree_views.py[87-88]
- tests/test_tree_views.py[103-106]
- tests/test_tree_views.py[118-119]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines 15 to 47
@@ -33,6 +20,7 @@ def test_install_writes_start_script_and_creates_task(monkeypatch, tmp_path):
monkeypatch.setattr(cli, "_resolve_program", lambda: ["C:\\Tools\\windows-mcp.exe"])

calls = []
registrations = []

def fake_schtasks(*args: str):
calls.append(args)
@@ -41,6 +29,12 @@ def fake_schtasks(*args: str):
return Mock(returncode=0, stdout="", stderr="")

monkeypatch.setattr(cli, "_schtasks", fake_schtasks)
monkeypatch.setattr(
cli,
"_register_task_powershell",
lambda task_name, script_path: registrations.append((task_name, script_path))
or Mock(returncode=0, stdout="", stderr=""),
)

result = runner.invoke(main, ["install", "--transport", "sse", "--host", "127.0.0.1", "--port", "9000"])

@@ -49,16 +43,7 @@ def fake_schtasks(*args: str):
assert "windows-mcp.exe serve --transport sse --host 127.0.0.1 --port 9000" in script
assert '1>>"' in script
assert '2>>"' in script
assert (
"/Create",
"/SC",
"ONLOGON",
"/TN",
cli._TASK_NAME,
"/TR",
f'"{start_script}"',
"/F",
) in calls
assert registrations == [(cli._TASK_NAME, str(start_script))]
assert ("/Run", "/TN", cli._TASK_NAME) in calls

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

4. Install test mocks launcher 🐞 Bug ⚙ Maintainability

test_install_writes_start_script_and_creates_task replaces _resolve_program with a fixed exe argv,
so it no longer exercises the real interpreter-based launcher used by install(). This reduces
coverage for the actual start-script command line (including quoting/-m windows_mcp composition).
Agent Prompt
## Issue description
The install test currently monkeypatches `_resolve_program()` to return a hard-coded `windows-mcp.exe` argv and then asserts that string appears in the generated script. Production `_resolve_program()` always returns `[sys.executable, "-m", "windows_mcp"]`, so the test no longer validates the real install/start-script launcher contract.

## Issue Context
Because `install()` uses `_resolve_program()` to build the command written into the scheduled-task wrapper script, the test should verify that the generated script matches the interpreter-based invocation shape (and handles quoting for paths with spaces).

## Fix Focus Areas
- tests/test_startup_task.py[15-47]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread tests/test_tree_views.py
Comment on lines +76 to 79
def test_interactive_elements_preserve_order(self, sample_tree_element_node):
node2 = TreeElementNode(
bounding_box=sample_tree_element_node.bounding_box,
center=sample_tree_element_node.center,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Informational

5. Tree output checks too partial 🐞 Bug ⚙ Maintainability

Several updated tree-view tests assert only substrings (e.g., element names) instead of the full
rendered lines, making them less likely to catch regressions in the grouped tree formatting used in
snapshot outputs. This can allow unintended changes to connectors/action/metadata formatting to pass
while still matching the loose substrings.
Agent Prompt
## Issue description
The tree-view tests were updated to the grouped tree renderer, but some assertions now only check for substrings like `button "OK"` / `pane "Document"`. This weakens the guarantee that the actual tree formatting (connectors, `[action: ...]`, and metadata tokens) remains stable.

## Issue Context
These strings are surfaced in snapshot responses (`capture_desktop_state`) and are produced by `_render_tree()`.

## Fix Focus Areas
- tests/test_tree_views.py[66-120]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@temotskipa temotskipa marked this pull request as draft July 4, 2026 22:02
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