Skip to content

coverage: sdks/c's coverage depends on CGO_ENABLED, and the coverage job's cgo posture is incidental #361

Closed

Description

@scttfrdmn

Surfaced while fixing #199 (PR #359). sdks/c is the one package the coverage gate reports as unfloored with a non-zero number — 11.0% — and it is the only one of the six whose reason for having no floor isn't "the number is a collection artifact".

Its reason is that the number isn't stable across build configurations. sdks/c/main.go carries import "C", so it's a CgoFile rather than a GoFile. With cgo off, the package does not fall back to a build-tag-excluded variant — it fails to compile:

$ CGO_ENABLED=0 go test ./sdks/c/
undefined: codeFromErr
undefined: fillCStr

main_test.go references both, and neither declaration is built. That is a hard failure, not a skip.

CI sets CGO_ENABLED=0 in the cross-build matrix (ci.yml:310, :319) and for the release build. The coverage job does not set it either way, so it inherits the runner default of cgo on — which is why the 11.0% appears in coverage.out at all. A floor written against that number would be a floor on a posture no workflow states, held in place by a default.

What to do, in order:

  1. Make the coverage job's cgo posture explicit — set CGO_ENABLED in the coverage job rather than inheriting it, so the number a floor would gate is a stated configuration.
  2. Then set a floor for sdks/c and delete its # no-floor: entry from .coverage-floors. test: hold the coverage gate's unfloored set to a recorded reason (#199) #359's TestUnfloorablePackagesAreExplained fails if the entry is left behind once the gate stops reporting the package, so the two halves can't drift apart.

11.0% is also low enough to be worth a look on its own — the C SDK's error and string-marshalling paths are exactly where a caller in another language has no type system to catch a mistake. But the ordering matters: a floor set before step 1 pins a number that a future CGO_ENABLED=0 on the coverage job would turn into a compile failure rather than a coverage drop, which is a much worse failure to debug.

Activity

  1. added
    type: testing
    priority: low
    area: tests
    effort: small
    area: ci-cd
    on Aug 5, 2026
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

    area: ci-cdarea: testseffort: smallpriority: lowtype: testing

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions