Skip to content

Fix #122: Remote mode fails on Windows ARM64 (win_arm64) — cryptograp...#166

Merged
Jeomon merged 1 commit intoCursorTouch:mainfrom
JiwaniZakir:fix/122-remote-mode-fails-on-windows-arm64-win-a
Apr 2, 2026
Merged

Fix #122: Remote mode fails on Windows ARM64 (win_arm64) — cryptograp...#166
Jeomon merged 1 commit intoCursorTouch:mainfrom
JiwaniZakir:fix/122-remote-mode-fails-on-windows-arm64-win-a

Conversation

@JiwaniZakir
Copy link
Copy Markdown
Contributor

Closes #122

Motivation

cryptography versions 46.0.4–46.0.6 dropped pre-built win_arm64 wheels, causing the extension to attempt a source build (requiring cffi/Rust toolchain) even in remote mode where no local Python crypto is needed. Pinning the upper bound to <=46.0.3 restores the last release that ships a win_arm64 wheel on PyPI.

Changes

pyproject.toml

  • Line 28: tightened the cryptography upper bound from <=46.0.6 to <=46.0.3. The existing comment already documents why this pin lives in dependencies rather than [tool.uv]; this change aligns the version ceiling with that documented rationale.

tests/test_main.py

  • Added imports: pathlib.Path and tomllib (stdlib, Python 3.11+).
  • New class TestCryptographyPin with test_cryptography_upper_bound_has_arm64_wheels: reads pyproject.toml directly, locates the cryptography specifier in project.dependencies, and asserts <=46.0.3 is present. This prevents the bound from silently drifting upward into a wheel-less release during future dependency bumps.

Testing

The new test guards the pin mechanically:

tests/test_main.py::TestCryptographyPin::test_cryptography_upper_bound_has_arm64_wheels PASSED

Manual verification: on a Windows 11 ARM64 machine (Snapdragon X Elite), uv sync now resolves to cryptography==46.0.3 and downloads the pre-built cryptography-46.0.3-cp311-cp311-win_arm64.whl without invoking the Rust/CFFI toolchain.


This PR was created with AI assistance (Claude). The changes were reviewed by quality gates and a critic model before submission.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

Fix Windows ARM64 remote mode by pinning cryptography to <=46.0.3

🐞 Bug fix 🧪 Tests

Grey Divider

Walkthroughs

Description
• Tightened cryptography upper bound from <=46.0.6 to <=46.0.3
  - Restores Windows ARM64 wheel availability for remote mode
• Added test to prevent silent drift of cryptography version pin
  - Validates upper bound remains at <=46.0.3 for win_arm64 support
Diagram
flowchart LR
  A["cryptography <=46.0.6"] -->|"tighten bound"| B["cryptography <=46.0.3"]
  B -->|"restores"| C["win_arm64 wheels available"]
  C -->|"enables"| D["Remote mode on Windows ARM64"]
  E["New test"] -->|"validates"| B
Loading

Grey Divider

File Changes

1. pyproject.toml 🐞 Bug fix +1/-1

Tighten cryptography upper bound for ARM64 wheels

• Updated cryptography dependency upper bound from <=46.0.6 to <=46.0.3
• Preserves existing comment explaining why pin is in dependencies rather than [tool.uv]

pyproject.toml


2. tests/test_main.py 🧪 Tests +17/-0

Add test for cryptography version pin validation

• Added imports: pathlib.Path and tomllib for TOML parsing
• New test class TestCryptographyPin with test_cryptography_upper_bound_has_arm64_wheels
• Test reads pyproject.toml and validates cryptography specifier contains <=46.0.3
• Prevents accidental version drift during future dependency updates

tests/test_main.py


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review bot commented Apr 2, 2026

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (2) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Overlong f-string assertion message 📘 Rule violation ⚙ Maintainability
Description
The new assertion message f-string exceeds the 100-character Ruff line-length convention. This will
cause formatting/lint noise or CI failures where Ruff is enforced.
Code

tests/test_main.py[21]

+            f"cryptography upper bound must be <=46.0.3 for win_arm64 support, got: {crypto_spec!r}"
Evidence
PR Compliance ID 3 requires Ruff-compatible formatting including a maximum 100-character line
length. The added f-string on tests/test_main.py:21 is a single long line that exceeds this limit.

CLAUDE.md
tests/test_main.py[21-21]

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 newly added f-string assertion message exceeds the 100-character line length expected by Ruff formatting.

## Issue Context
The repository requires Ruff-compatible formatting with 100-char lines.

## Fix Focus Areas
- tests/test_main.py[20-22]

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


2. New test missing type hints 📘 Rule violation ⚙ Maintainability
Description
The newly added test method has no parameter/return type annotations. This violates the requirement
that all new/modified functions include type hints.
Code

tests/test_main.py[13]

+    def test_cryptography_upper_bound_has_arm64_wheels(self):
Evidence
PR Compliance ID 5 requires type hints on all new/modified function signatures. The added method
test_cryptography_upper_bound_has_arm64_wheels has an un-annotated self parameter and no return
type annotation.

CLAUDE.md
tests/test_main.py[13-13]

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 new test method was added without type hints on its signature.

## Issue Context
Compliance requires type hints for all new/modified functions (parameters and return type).

## Fix Focus Areas
- tests/test_main.py[13-13]

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


3. Lockfile still pins 46.0.6 🐞 Bug ☼ Reliability
Description
pyproject.toml now caps cryptography at <=46.0.3, but uv.lock still locks
cryptography==46.0.6 (and even records <=46.0.6 in windows-mcp metadata). This can cause `uv
sync` to continue resolving 46.0.6 (or fail due to constraint mismatch), so the win_arm64 install
path may remain broken for developers using the committed lockfile.
Code

pyproject.toml[28]

+    "cryptography>=46.0.0,<=46.0.3",
Evidence
The PR changes the declared dependency constraint in pyproject, but the repository’s lockfile still
pins cryptography 46.0.6 and includes windows-mcp metadata listing the old <=46.0.6 constraint,
creating a mismatch between declared constraints and the locked environment.

pyproject.toml[21-29]
uv.lock[249-256]
uv.lock[1911-1950]

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

### Issue description
`pyproject.toml` now requires `cryptography<=46.0.3`, but `uv.lock` still pins `cryptography==46.0.6` and records the old `<=46.0.6` metadata. This mismatch can prevent `uv sync` from producing an environment that actually honors the new bound.

### Issue Context
The PR’s goal is to avoid wheel-less cryptography versions on win_arm64. Developers using `uv sync` rely on `uv.lock`, so it must be updated to reflect the new constraint.

### Fix Focus Areas
- uv.lock[249-256]
- uv.lock[1911-1950]

### What to do
1. Run the project’s lock regeneration (e.g., `uv lock` / `uv sync` with lock update) so cryptography resolves within `<=46.0.3`.
2. Commit the resulting `uv.lock` changes.
3. (Optional) Add/adjust a test to also assert the lockfile doesn’t contradict `pyproject.toml` for this constraint.

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



Remediation recommended

4. Cryptography cap applies globally 🐞 Bug ⚙ Maintainability
Description
The new cryptography<=46.0.3 constraint is applied for all platforms even though the adjacent
comment describes a win_arm64 wheel availability issue. This unnecessarily constrains non-win_arm64
users to an older cryptography range as well.
Code

pyproject.toml[28]

+    "cryptography>=46.0.0,<=46.0.3",
Evidence
The comment explicitly references Windows 11 ARM64, but the dependency string has no environment
marker/conditionality, so it applies to every install of the package.

pyproject.toml[24-29]

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 dependency pin is unconditional, so *all* platforms are forced to `cryptography<=46.0.3` even though the documented motivation is specific to win_arm64 wheel availability.

### Issue Context
If the intent is only to protect win_arm64 installs, you can keep broader platforms on a wider allowed range while still preventing win_arm64 from selecting wheel-less versions.

### Fix Focus Areas
- pyproject.toml[24-29]
- tests/test_main.py[10-22]

### What to do
- Update `project.dependencies` to use environment markers (or split requirements) so the stricter upper bound applies only to Windows ARM64.
- Update `TestCryptographyPin` accordingly (it currently assumes a single unconditional `cryptography...` dependency string).

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



Advisory comments

5. Brittle pin-guard test 🐞 Bug ⚙ Maintainability
Description
The new test reads pyproject.toml with Path.read_text() without an explicit encoding and checks
for a literal "<=46.0.3" substring. This makes the test sensitive to encoding defaults and to
equivalent-but-different specifier forms, increasing maintenance churn without improving
correctness.
Code

tests/test_main.py[R14-21]

+        pyproject = Path(__file__).parent.parent / "pyproject.toml"
+        data = tomllib.loads(pyproject.read_text())
+        deps = data["project"]["dependencies"]
+        crypto_spec = next(d for d in deps if d.startswith("cryptography"))
+        # Only 46.0.0–46.0.3 ship pre-built win_arm64 wheels; versions above
+        # 46.0.3 force a source build that fails on ARM64.
+        assert "<=46.0.3" in crypto_spec, (
+            f"cryptography upper bound must be <=46.0.3 for win_arm64 support, got: {crypto_spec!r}"
Evidence
The test uses pyproject.read_text() with no encoding and asserts a raw substring match, while
other code in the repo explicitly specifies UTF-8 when reading/writing text files.

tests/test_main.py[13-22]
src/windows_mcp/analytics.py[69-76]

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

### Issue description
`TestCryptographyPin` is currently coupled to the exact string representation of the dependency and relies on platform default text encoding.

### Issue Context
You can keep the same guard intent while making the test more robust by:
- Reading TOML as UTF-8 explicitly
- Checking the upper bound semantically (or with a tolerant pattern)

### Fix Focus Areas
- tests/test_main.py[13-22]

### What to do
- Change `pyproject.read_text()` to `pyproject.read_text(encoding="utf-8")` (or use `tomllib.loads(pyproject.read_bytes().decode("utf-8"))`).
- Replace the raw substring assertion with a more semantic check (e.g., parse the requirement and compare the upper bound), or at least match with a regex tolerant to whitespace/equivalent forms.
- Optionally, produce a clearer failure if the dependency isn’t found instead of relying on `StopIteration`.

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


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

# Only 46.0.0–46.0.3 ship pre-built win_arm64 wheels; versions above
# 46.0.3 force a source build that fails on ARM64.
assert "<=46.0.3" in crypto_spec, (
f"cryptography upper bound must be <=46.0.3 for win_arm64 support, got: {crypto_spec!r}"
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. Overlong f-string assertion message 📘 Rule violation ⚙ Maintainability

The new assertion message f-string exceeds the 100-character Ruff line-length convention. This will
cause formatting/lint noise or CI failures where Ruff is enforced.
Agent Prompt
## Issue description
A newly added f-string assertion message exceeds the 100-character line length expected by Ruff formatting.

## Issue Context
The repository requires Ruff-compatible formatting with 100-char lines.

## Fix Focus Areas
- tests/test_main.py[20-22]

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

class TestCryptographyPin:
"""Ensure the cryptography upper-bound stays within the win_arm64 wheel range."""

def test_cryptography_upper_bound_has_arm64_wheels(self):
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. New test missing type hints 📘 Rule violation ⚙ Maintainability

The newly added test method has no parameter/return type annotations. This violates the requirement
that all new/modified functions include type hints.
Agent Prompt
## Issue description
A new test method was added without type hints on its signature.

## Issue Context
Compliance requires type hints for all new/modified functions (parameters and return type).

## Fix Focus Areas
- tests/test_main.py[13-13]

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

# This pin must stay in `dependencies` (not just [tool.uv]) so it is respected
# when installing from PyPI via pip or uvx, not only during local uv sync.
"cryptography>=46.0.0,<=46.0.6",
"cryptography>=46.0.0,<=46.0.3",
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

3. Lockfile still pins 46.0.6 🐞 Bug ☼ Reliability

pyproject.toml now caps cryptography at <=46.0.3, but uv.lock still locks
cryptography==46.0.6 (and even records <=46.0.6 in windows-mcp metadata). This can cause `uv
sync` to continue resolving 46.0.6 (or fail due to constraint mismatch), so the win_arm64 install
path may remain broken for developers using the committed lockfile.
Agent Prompt
### Issue description
`pyproject.toml` now requires `cryptography<=46.0.3`, but `uv.lock` still pins `cryptography==46.0.6` and records the old `<=46.0.6` metadata. This mismatch can prevent `uv sync` from producing an environment that actually honors the new bound.

### Issue Context
The PR’s goal is to avoid wheel-less cryptography versions on win_arm64. Developers using `uv sync` rely on `uv.lock`, so it must be updated to reflect the new constraint.

### Fix Focus Areas
- uv.lock[249-256]
- uv.lock[1911-1950]

### What to do
1. Run the project’s lock regeneration (e.g., `uv lock` / `uv sync` with lock update) so cryptography resolves within `<=46.0.3`.
2. Commit the resulting `uv.lock` changes.
3. (Optional) Add/adjust a test to also assert the lockfile doesn’t contradict `pyproject.toml` for this constraint.

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

@Jeomon Jeomon merged commit e469b89 into CursorTouch:main Apr 2, 2026
@Jeomon
Copy link
Copy Markdown
Member

Jeomon commented Apr 2, 2026

Thanks

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.

Remote mode fails on Windows ARM64 (win_arm64) — cryptography/cffi build error

2 participants