Skip to content

ci(pyright): add type-check ratchet gate, fix 15 None-deref bugs#65

Merged
cdeust merged 2 commits into
mainfrom
fix/pyright-batch-0
Jun 18, 2026
Merged

ci(pyright): add type-check ratchet gate, fix 15 None-deref bugs#65
cdeust merged 2 commits into
mainfrom
fix/pyright-batch-0

Conversation

@cdeust

@cdeust cdeust commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Summary

Batch 0 of the pyright remediation. Introduces deterministic pyright type checking in CI with a per-rule baseline ratchet, and fixes the real None-dereference bugs that the two blocking rules surfaced.

What changed

Type-check infrastructure

  • pyrightconfig.jsonvenvPath=. / venv=.venv, basic mode, py3.10, reportMissingModuleSource=none for deterministic venv resolution.
  • scripts/check_pyright_ratchet.py — per-rule gate (--write-baseline, --blocking); fails CI when a rule's error count rises above its recorded baseline.
  • typecheck-baseline.json — current floor: 568 errors across 8 rules.
  • .github/workflows/ci.ymltypecheck job builds .venv, installs deps + pyright==1.1.410; the gate blocks reportOptionalMemberAccess and reportOptionalSubscript (both now at 0), with no continue-on-error.
  • .gitignore — ignore .venv/ and pyright-*.json.

Bug fixes — 15 None-deref guards

  • handlers/ingest_codebase_cypher.py_run_query now returns {} (not None) on error paths; tests_py/handlers/test_ingest_codebase.py updated to the new {} contract.
  • infrastructure/pg_store.py — guard None row.
  • infrastructure/pg_store_wiki.py — new _returning_id helper applied across 5 sites.
  • infrastructure/ap_bridge.py — guard None client.
  • infrastructure/workflow_graph_source_ast.py — capture loop-local binding.
  • core/titans_memory.py — guard None grad.

Verification

  • reportOptionalMemberAccess 9 → 0, reportOptionalSubscript 6 → 0.
  • Zero regression on the remaining rules (baseline = 568).
  • 46 targeted tests pass; ruff clean; py_compile OK.
  • The CI ratchet gate re-verifies all of the above on this PR.

Notes

The --blocking set is intentionally narrow (the two rules fully cleared) so the gate is green today while the 568-error baseline ratchets down in later batches. Working-doc files under tasks/ are deliberately not part of this commit.

🤖 Generated with Claude Code

cdeust and others added 2 commits June 18, 2026 00:44
Batch 0 of pyright remediation. Introduces deterministic pyright type
checking in CI with a per-rule baseline ratchet, and fixes the real
None-dereference bugs that the two blocking rules surfaced.

Infrastructure:
- pyrightconfig.json: venvPath=. / venv=.venv, basic mode, py3.10,
  reportMissingModuleSource=none for deterministic venv resolution
- scripts/check_pyright_ratchet.py: per-rule gate (--write-baseline,
  --blocking) — fails CI when a rule rises above its baseline
- typecheck-baseline.json: 568 errors across 8 rules (current floor)
- .github/workflows/ci.yml: typecheck job builds .venv, installs deps
  + pyright==1.1.410; gate blocks reportOptionalMemberAccess and
  reportOptionalSubscript (both now 0), no continue-on-error
- .gitignore: ignore .venv/ and pyright-*.json

Bug fixes (15 None-deref guards):
- handlers/ingest_codebase_cypher.py: _run_query returns {} (not None)
  on error paths; tests_py/handlers/test_ingest_codebase.py updated to
  the new {} contract
- infrastructure/pg_store.py: guard None row (~513)
- infrastructure/pg_store_wiki.py: new _returning_id helper across 5 sites
- infrastructure/ap_bridge.py: guard None client (~294)
- infrastructure/workflow_graph_source_ast.py: capture loop local (~96)
- core/titans_memory.py: guard None grad (~196)

reportOptionalMemberAccess 9->0, reportOptionalSubscript 6->0; zero
regression; 46 targeted tests pass; ruff clean; py_compile OK.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… 624->626)

The pyright None-deref fixes (f80008b) inserted lines above the canonical
heat_base writers in pg_store.py, shifting bump_heat_raw's UPDATE to line 566
and update_memories_heat_batch's SET to line 626. Update _ALLOWED_WRITERS pins
in test_I2_canonical_writer.py to match. Fixes the 4 failing Test jobs on PR #65.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cdeust cdeust merged commit 9241ffd into main Jun 18, 2026
12 checks passed
cdeust added a commit that referenced this pull request Jun 19, 2026
…pliance bundle

Consolidates the cortex-official-mcp working tree onto main (base 9241ffd / #65),
applied as a 33-file --binary patch via --3way (clean, no conflicts):

- rename neuro-cortex-memory -> hypermnesia-mcp across pyproject.toml, manifest.json,
  server.json, plugin.json, package.json; install-plugin.sh keeps the intentional
  dual-cleanup of the legacy name; marketplace.json version_note left as history
- MCP Directory submission bundle: server.json, manifest.json (12 tools annotated),
  icon.png, PRIVACY.md, .mcpbignore, mcp-name marker in README
- docs/papers: science.md -> trimmed bibliography.md
- infra/handlers carried from the #65 base (upstream_availability, pg_schema,
  pooled_sink, sqlite_store_search, staging_resolve_sink, tool_registry_ingest,
  ingest_codebase_schema, ingest_prd, wiki_adr)

uv.lock regenerated (hypermnesia-mcp v3.23.0). Pyright per-rule ratchet: 568 errors
== baseline 568, no blocking-rule regression (reportOptionalMemberAccess/Subscript 0).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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