Skip to content

refactor: harden packaging, MCP errors, and kernel validation - #20

Merged
deepnmr merged 42 commits into
masterfrom
refactor/debug-repo
Oct 22, 2026
Merged

deepnmr merged 42 commits into
masterfrom
refactor/debug-repo

Conversation

@deepnmr

@deepnmr deepnmr commented Oct 22, 2026

Copy link
Copy Markdown
Owner

The declared Python 3.10 floor was already broken (the test suite imports tomllib), the mcp extra was unpinned so a 1.x resolve lacked MCPServer, every MCP tool failure reached the client as an opaque "Error executing tool", the Seedless kernels accepted non-finite Bloch vectors and mis-shaped waveforms with backend-dependent exceptions, and the sdist shipped repository-internal files.

  • Raise requires-python to 3.11, pin mcp>=2.0,<3 and numpy>=2.0 / scipy>=1.13, add licence/classifier/URL metadata, and trim the sdist to what a builder needs.
  • Add the MIT LICENSE and an optimalcontrol/py.typed marker.
  • Surface MCP user errors through ToolError (the pinned ValueError text now reaches the model), reject n_seeds < 1 up front, and type the band argument as a BandSpec TypedDict so the tool schema documents its keys.
  • Validate Seedless kernel inputs (Bloch-vector shape/finiteness, (n_steps, 2) waveform) before dispatch so both backends raise the same ValueError.
  • Give ControlProblem.freeze a default of None and drop the boilerplate from the docs.
  • Share the offset-operator dimension validation between grape and ensemble.
  • Tests: tmp_path instead of /tmp, pinned match= on the Seedless rejections, parity tests assert the native extension is present, in-memory MCP client tests, failing-first kernel tests.

Validation: full native suite 288 passed (274 before + 14 new); NumPy fallback suite (full, minus the by-design Rust-only file) 273 passed, 15 deselected; Ruff and strict mypy clean; in-memory MCP probe shows the pinned messages for all four error cases; the new kernel tests fail against the original kernel (5 failed) and pass against the fix (18 passed); renaming the native .so makes the Bloch parity test fail at the new availability assert and restoring it turns it green again; maturin sdist contains none of .kbsi/, .github/, CLAUDE.md, AGENTS.md, .gitignore, .claude-plugin/, benchmarks/; the wheel carries py.typed, LICENSE, Requires-Python: >=3.11. Later waves of the same plan (lint/format adoption, Rust manifest, module split, example dedupe, direct tests, CI, docs) land on this branch as further commits.

@deepnmr
deepnmr merged commit 170c988 into master Oct 22, 2026
4 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