chore(deps): upgrade ruff and ty with strict checking - #1167
Merged
Conversation
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Ruff and ty had fallen behind their current releases, and the repository still carried a
Pyright-specific configuration even though ty is the primary type-checking gate. Moving to ty's
complete current rule set exposed 489 diagnostics that were previously disabled or advisory.
This change upgrades the tools and fixes the codebase so those diagnostics are enforced as errors
across both production code and tests.
What Changed
pyproject.tomlanduv.lock.[tool.pyright]; no Black configuration existed to remove.all = "error"and no warning downgrades.@overridedecorators acrosssrc/,tests/, andtest-int/.dict[str, Any]mappings where the existingcode intentionally accepts dynamic values.
coverage.
compatibility seam in the database bootstrap.
Implementation Details
Ruff 0.16 expands its default lint selection and begins formatting Markdown code fences. This PR
preserves the repository's existing
E4,E7,E9, andFlint baseline and excludes Markdownfrom formatting so the executable upgrade does not silently introduce a second, unrelated lint
migration.
Ty's all-rules configuration initially produced 489 errors: primarily missing generic arguments
and missing
@overridedecorators. The migration fixes those at their source rather thansuppressing the rules globally. A probe using
dict[str, object]caused more than 200 invaliddownstream operations, so existing dynamic mappings are represented honestly as
dict[str, Any].The remaining type fixes preserve concrete types across importer helpers, SQLAlchemy selects and
sessions, task/result containers, subprocess results, WebDAV writes, and template callbacks.
Strict analysis also exposed an uninitialized relation-resolution path and a related-only MCP
prompt rendering bug.
Python's process-wide event-loop policy API is deprecated for removal in 3.16, but Basic Memory
supports 3.12-3.15 and currently has independently owned CLI and FastMCP/AnyIO loop entrypoints.
The existing policy seam remains behind narrow, documented
deprecatedignores. Migrating thoseentrypoints to explicit loop factories is intentionally deferred until the supported runtime
contract can change.
Reviewer Guide
The two commits separate the behavioral MCP prompt fix from the broad strict-typing migration.
Most of the 163-file diff is mechanical typing metadata:
pyproject.tomlanduv.lockTesting
Automated
just fast-check: passed; Ruff check/fix, Ruff format, and strict ty all passed..venv/bin/ty check src tests test-int --python-platform all --output-format concise: passed..venv/bin/pytest -q tests/mcp/test_prompts.py: 12 passed.asyncio-policy tests: 158 passed.
uv lock --check: passed; resolved 200 packages.git diff --check: passed.just fast-test: 4,972 passed and 33 skipped. The only failure was the opt-inpostgres-openaisemantic-quality benchmark, which received429 insufficient_quotawhileseeding external OpenAI embeddings. The SQLite, Postgres FTS, and FastEmbed variants passed.
Manual
commit.
Risks / Follow-ups
all = "error"intentionally means future ty upgrades may require new code changeswhen ty adds or strengthens rules.
support.
fully green live-provider run; no product assertion failed in that test.