Skip to content

Pre-commit coverage gate fails on clean main — four functions from #25 below 100% #30

Closed

Description

@bdougie

Problem

scripts/check-coverage.sh (run by the pre-commit hook) fails on clean main (bf3a719), so every commit currently requires --no-verify regardless of what it touches. PR #25 merged four functions below the 100% coverage bar:

pkg/advisor/strategy.go:9    ResolveStrategy   85.7%
pkg/agent/agent.go:95        New               91.5%
pkg/loop/escalation.go:12    NewEscalation     66.7%
pkg/observer/observer.go:253 AnalyzeModels     93.8%

Reproduce: ./scripts/check-coverage.sh on main.

Why it matters

A gate that always fails trains contributors to bypass it, which silently waives coverage for genuinely new code too (e.g. #29 had to commit with --no-verify).

Fix

For each function, either add tests covering the missed branches or, where a branch is genuinely untriggerable in tests, add it to EXCLUDED_FUNCTIONS in scripts/check-coverage.sh with a comment explaining why. The uncovered branches in agent.New are likely the ladder/advisor warning paths, and NewEscalation at 66.7% suggests most of its error handling is untested.

Activity

  1. bdougie commented on Jul 5, 2026

    @bdougie
    ContributorAuthor

    Fixed by PR #33 (d2cbf84), which merged after this was filed. All four functions now report 100% coverage — tests were added in strategy_test.go, agent_test.go, escalation_test.go, and observer_test.go rather than expanding the exclusion list. The same PR also fixed the mktemp template in check-coverage.sh (BSD mktemp treats a template with a suffix after the X's as a literal path, so runs shared one coverage file). Verified on clean main: ./scripts/check-coverage.sh passes with 93.3% total coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions