Skip to content

Add Pyright coverage for cppa_user_tracker and cppa_pinecone_sync#284

Open
snowfox1003 wants to merge 2 commits into
cppalliance:developfrom
snowfox1003:refactor/pyright-cppa-user-pinecone
Open

Add Pyright coverage for cppa_user_tracker and cppa_pinecone_sync#284
snowfox1003 wants to merge 2 commits into
cppalliance:developfrom
snowfox1003:refactor/pyright-cppa-user-pinecone

Conversation

@snowfox1003

@snowfox1003 snowfox1003 commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

Extend static type checking to cppa_user_tracker (identity hub) and cppa_pinecone_sync (Pinecone ingestion pipeline). Both apps are added to pyrightconfig.json and now pass Pyright at the configured basic strictness with zero errors.
cppa_user_tracker

  • Add # pyright: ignore[reportCallIssue] on TextChoices members (same pattern as github_activity_tracker)
  • Annotate reverse FK emails on BaseProfile via TYPE_CHECKING + Manager["Email"]
  • Tighten get_or_create_slack_user input to SlackUserPayload | dict[str, Any]; normalize Optional[X]X | None
    cppa_pinecone_sync
  • Fix TextSplitter._keep_separator annotation in text_chunking.py
  • Type Document.metadata, sync document helpers (list[Document]), and PreprocessFn boundaries
  • Type management command helpers (_resolve_preprocessor, add_arguments, preprocessor field guard)
    Docs updated to list all six Pyright-scoped apps.

Apps touched

  • cppa_user_tracker
  • cppa_pinecone_sync
  • pyrightconfig.json (repo root)
  • docs/ (Pyright scope notes)
  • README.md

Test plan

  • python -m pytest cppa_user_tracker/ cppa_pinecone_sync/ (168 passed)
  • uv run pyright (0 errors)
  • lint-imports (if imports or cross-app coupling changed) — TYPE_CHECKING-only import from cppa_slack_tracker.api_schemas; no runtime cross-app coupling change
  • App command smoke-tested (if collector/command changed):
pyright

Docs / coupling

  • cross-app-dependencies.md updated (if FKs or cross-app imports changed)
  • python scripts/generate_service_docs.py run (if services.py or core/protocols.py changed)
  • App README or docs/ updated (if behavior or ops changed)

Closes #266

Summary by CodeRabbit

  • Bug Fixes

    • Improved Pinecone sync command to validate configuration and surface a clear error if setup is incomplete.
  • Documentation

    • Updated README, development guidelines, and core/service API docs to reflect expanded local static type-checking scope.
  • Chores

    • Modernized type annotations across trackers and sync tooling to Python 3.10+ union/generic syntax for clearer typing.

@snowfox1003 snowfox1003 self-assigned this Jun 11, 2026
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f23310e2-fe7b-4eea-85a3-63dc51520afb

📥 Commits

Reviewing files that changed from the base of the PR and between a520a85 and 8fdfad0.

📒 Files selected for processing (2)
  • docs/service_api/cppa_pinecone_sync.md
  • docs/service_api/cppa_user_tracker.md

📝 Walkthrough

Walkthrough

Modernize type annotations to Python 3.10+ union/built-in generics across tracker and Pinecone modules and expand Pyright's include list and documentation to cover additional packages.

Changes

Type Annotation Modernization and Pyright Scope Expansion

Layer / File(s) Summary
Pyright configuration and documentation
pyrightconfig.json, README.md, docs/Core_public_API.md, docs/Development_guideline.md
Pyright include list extended to cppa_slack_tracker, cppa_user_tracker, and cppa_pinecone_sync; README and docs updated to reflect the expanded typed-path list.
Pinecone management command safety
cppa_pinecone_sync/management/commands/run_cppa_pinecone_sync.py
Adds argparse typing, imports cast, casts resolved preprocessors to PreprocessFn, stores _preprocess_fn as `PreprocessFn
Pinecone services and sync types
cppa_pinecone_sync/services.py, cppa_pinecone_sync/sync.py
Switch Optional[datetime] to `datetime
Text chunking modernization
cppa_pinecone_sync/text_chunking.py
Replace legacy typing with built-in generics and union syntax across Document.metadata, _split_text_with_regex, TextSplitter, and RecursiveCharacterTextSplitter method signatures without changing runtime behavior.
User tracker models and services
cppa_user_tracker/models.py, cppa_user_tracker/services.py
Add TYPE_CHECKING annotations and a emails: Manager[\"Email\"] declaration in models; update service function signatures from Optional[T] to `T

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • jonathanMLDev
  • wpak-ai

Poem

🐰 I hopped through types both new and old,
From Optional nests to unions bold.
I nudged the docs and Pyright's view,
Typed preprocessors safe and true.
A tiny rabbit, tidy and proud.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: extending Pyright coverage to two new apps (cppa_user_tracker and cppa_pinecone_sync), which aligns with the primary objective of the changeset.
Description check ✅ Passed The description comprehensively covers all required template sections: Summary explains the changes and objectives, Apps touched lists all affected apps, Test plan provides verification steps with checkmarks, and Docs/coupling section documents updates made.
Docstring Coverage ✅ Passed Docstring coverage is 85.19% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

Expand Pyright coverage beyond 4 of 16 apps

2 participants