You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(types): clear all 31 pre-existing pyright errors
CLAUDE.md requires zero pyright errors before commit. The 31 errors
that had accumulated on main are now resolved. Full src/apcore/ scan
goes from 31 errors → 0.
Real type bugs fixed:
- executor.py:_translate_abort approval branch was constructing
ApprovalDeniedError(message=...) without the required `result`
parameter — would TypeError at runtime if the pipeline ever aborted
at the approval_gate step. Now constructs synthetic ApprovalResult
per status. (Pipeline v2 raises typed errors directly so this branch
is rarely reached in practice, but it was still a runtime bug.)
- executor.py:_validate_async error_dict assignment was unsafe
(`e.to_dict() if hasattr(e, "to_dict")`); now uses callable check
+ isinstance(produced, dict) narrowing.
- sys_modules/registration.py was passing MetricsCollector | None
into HealthSummaryModule and HealthModuleModule, both of which
declare MetricsCollector (non-Optional). Would crash at startup
if metrics_collector was None. Now defaults to a fresh empty
MetricsCollector so health modules degrade gracefully.
API improvements:
- ContextKey.get gains @overload signatures so key.get(ctx, default=v)
narrows the return type to T (was T | None). Cleans up six
append-on-None warnings in observability/{context_logger,metrics,
usage}.py with no call-site changes.
- decorator._has_context_param renamed to _context_param_name and
collapsed to return str | None (was tuple[bool, str | None]). The
has_context boolean was redundant; checking `is not None` is enough.
Pure pyright satisfaction:
- Optional dependency imports (aiohttp, opentelemetry.*, watchdog.*)
marked with `# type: ignore[import-not-found]` since they live
inside try/except ImportError blocks.
- pydantic.fields.PydanticUndefined → pydantic_core.PydanticUndefined
(canonical export path; pydantic.fields is the private re-export).
- builtin_steps.py:redact_sensitive call sites now cast()
schema_dict_fn() result to dict[str, Any] (Pydantic contract).
- executor.Executor.__init__ strategy_kwargs gets explicit
dict[str, Any] annotation to break the dict() inference union.
- pipeline._validate_dependencies adds tuple[str, ...] annotations
for the getattr-derived requires/provides locals.
- pipeline_config._import_step BaseStep factory call now has a
targeted call-arg ignore.
- context.deserialize services=None has the same arg-type ignore as
the field declaration.
- pipeline_config factory call has a localized call-arg ignore.
Tests: tests/test_decorator.py updated to track the
_has_context_param → _context_param_name rename.
Verification: black ✓ ruff ✓ pyright ✓ pytest 2252/2252 ✓.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 commit comments