Skip to content
Back to skills

2503 2026 02 22 Mypy Type Contract Fixes C3a176d9

ASecurity

Fixed the reported mypy errors by tightening type contracts at their source:

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
businessshellbash

Security analysis

A100/100

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 2503-2026-02-22-mypy-type-contract-fixes_c3a176d9 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 2503 2026 02 22 Mypy Type Contract Fixes C3a176d9?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 2503 2026 02 22 Mypy Type Contract Fixes C3a176d9
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-2503-2026-02-22-mypy-type-contract-fixes-c3a176d9/badge)](https://www.skillsdirectory.com/skills/tools-only-2503-2026-02-22-mypy-type-contract-fixes-c3a176d9)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
---
title: Resolve four mypy contract violations with source-level typing fixes
type: delta
link: mypy-type-contract-fixes
path: src/tunacode
depth: 1
seams: [S, M]
ontological_relations:
  - affects: [[ui]]
  - affects: [[core]]
  - affects: [[tools]]
  - affects: [[typing-contracts]]
tags:
  - mypy
  - typing
  - literals
  - rich
  - error-handling
created_at: 2026-02-22T15:12:48-06:00
updated_at: 2026-02-22T15:12:48-06:00
uuid: febc9ce8-4061-4ee8-b2a1-770f0997a7ca
---

# Resolve four mypy contract violations with source-level typing fixes

## Summary

Fixed the reported mypy errors by tightening type contracts at their source:

1. `editor.py`: added explicit Rich style narrowing so `Text.stylize()` always receives `StyleType`.
2. `web_fetch.py`: marked `_handle_http_error()` as `NoReturn` because it always raises.
3. `compaction/types.py`: made compaction status constants literal-typed (`Final[Literal[...]]`) and defined `CompactionStatus` as a type alias.
4. `shell_runner.py`: unpacked `render_bash()` tool render tuple and returned only the renderable content as required by `RenderableType`.

No shims, no fallback branches, and no cast-based suppression were introduced.

## Files changed

- `src/tunacode/ui/widgets/editor.py`
- `src/tunacode/tools/web_fetch.py`
- `src/tunacode/core/compaction/types.py`
- `src/tunacode/ui/shell_runner.py`

## Verification

- `uv run mypy src/tunacode/ui/widgets/editor.py src/tunacode/tools/web_fetch.py src/tunacode/core/compaction/controller.py src/tunacode/ui/shell_runner.py src/tunacode/core/compaction/types.py` ✅
- `uv run ruff check src/tunacode/ui/widgets/editor.py src/tunacode/tools/web_fetch.py src/tunacode/core/compaction/types.py src/tunacode/ui/shell_runner.py` ✅

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.