Skip to content

test: add Claude coverage for the model-pin drift guard in test_health.py#483

Merged
cgfixit merged 1 commit into
mainfrom
claude/cyclaw-optimize-health-claude-coverage
Jul 9, 2026
Merged

test: add Claude coverage for the model-pin drift guard in test_health.py#483
cgfixit merged 1 commit into
mainfrom
claude/cyclaw-optimize-health-claude-coverage

Conversation

@cgfixit

@cgfixit cgfixit commented Jul 9, 2026

Copy link
Copy Markdown
Owner

What

Adds 3 new tests to tests/test_health.py::TestCheckAll, mirroring the 3 existing Grok model-pin drift guard tests for the Claude provider:

  • test_hybrid_claude_configured_model_present_is_healthy
  • test_hybrid_retired_claude_model_pin_reports_unhealthy
  • test_hybrid_unparseable_models_body_stays_healthy_claude

Why / benefit

utils/health.py::_ping's expect_model drift check runs identically for grok_api and claude_api (same _ping(..., expect_model=...) call shape, symmetric hybrid+<provider>.enabled gate in check_all()). But TestCheckAll's three drift-guard tests only ever passed grok_enabled=True/grok_model=... and asserted on grok_api. The retired/renamed-model detection that protects against a stale pin — the exact class of bug the grok-4grok-4.3 retirement already hit — had zero coverage for the same code path when it's Claude's model id (config.yaml's models.claude.model) that drifts instead.

Risk to monitor

None — test-only change, no production code touched. _write_cfg already supported claude_enabled/claude_model params (used by two pre-existing tests), so no fixture changes were needed.

Verify

GROK_API_KEY=dummy pytest tests/test_health.py -q --tb=short → 17 passed (14 existing + 3 new). Ran on the sandbox's available Python (3.11); CI validates against the pinned 3.12 per ci.yml's matrix.

Scan context

CyClaw-Optimize (ponytail + Karpathy + fable-protocol loaded). Finding #8 of an 8-finding scan; deduped against open PRs #473, #477, #415.


Generated by Claude Code

…alth.py

TestCheckAll's three model-pin drift guard tests (configured-model-present,
retired-model-pin-unhealthy, unparseable-body-stays-healthy) exercised
utils/health.py's expect_model check only for Grok, even though check_all()
runs the identical _ping(..., expect_model=...) call for Claude via the
symmetric hybrid+claude.enabled block. The retired/renamed-model detection
that protects against a stale Grok pin (the exact class of bug the
grok-4->grok-4.3 retirement already hit) had zero coverage for the same
code path when it's Claude's model id that drifts. Mirrors all three cases.

GROK_API_KEY=dummy pytest tests/test_health.py -q --tb=short -> 17 passed
(14 existing + 3 new).
@cgfixit cgfixit marked this pull request as ready for review July 9, 2026 19:45
@cgfixit cgfixit merged commit 5367f42 into main Jul 9, 2026
29 checks passed
@cgfixit cgfixit deleted the claude/cyclaw-optimize-health-claude-coverage branch July 9, 2026 19:45
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.

2 participants