Skip to content

Stabilize pkg/ai coverage runs and eliminate lingering httptest shutdown/coverage export flakiness #96

@CodeMonkeyCybersecurity

Description

Summary

pkg/ai functionally passes its targeted tests after the #291 fix, but package-level coverage runs still show shutdown/coverage-export instability.

Evidence

  • go test -cover ./pkg/ai reported httptest.Server blocked in Close after 5 seconds.
  • The same run then failed with error generating coverage report ... gocoverdir ... no such file or directory.
  • The behavior is separate from the original invalid-URL timeout issue, which is now fixed by fail-fast URL validation.

Why this matters

  • It makes the package look unhealthy even when the functional regression is fixed.
  • It undermines confidence in coverage-based gates and developer feedback loops.

Proposed work

  1. Audit pkg/ai tests for response bodies or idle connections that are not drained/closed under all paths.
  2. Reproduce the coverage-export failure under the current Go toolchain and isolate whether it is test behavior or toolchain interaction.
  3. Add a targeted regression test for the timeout path that is compatible with coverage runs.
  4. Document any required harness changes if the issue is Go-version-specific.

Acceptance criteria

  • go test -cover ./pkg/ai passes reliably.
  • No httptest.Server blocked in Close warning appears in the package test run.
  • Coverage artifacts are produced consistently for pkg/ai.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions