Task · SKT-0010.18

Scope label comparison by producer, so a multi-producer union is not a contradiction

Description

Surfaced by SKT-0010.16 and deferred by it with the reasoning recorded: the refresh added 15 unexpected_label_key contradictions covering “eight generic Go runtime families, six generic process families and rest_client_requests_total; each is a cross-producer union where the comparator identifies metrics by global family name while the capture observes one producer shape. They are comparator scoping findings, not authority to rewrite emitters.”

That is a real limitation and it now accounts for roughly a fifth of the 80 label contradictions standing on main. It will get worse, not better, with every corpus refresh: go_* and process_* are emitted by every Go binary in a cluster, so the more producers a capture sees the wider the union grows, and the further it drifts from any single emitter’s label set.

The comparator keys a metric by its family name alone. Reality’s entry for go_goroutines is the union of every producer that emitted it in the capture window – Alloy, kubelet, CoreDNS, the API server – each stamping its own job, instance and pod-identity labels. synthkit emits it from one modelled producer. Comparing one producer against a many-producer union reports keys as unexpected that are simply another producer’s.

This is the same class of problem SKT-0010.15 solved for logs by keying on stable producer-contract keys rather than a raw union, and that precedent is worth reading before designing this.

This blocks SKT-0010.05. A fail-closed gate cannot be set against contradictions that are known artefacts of the comparator’s own scoping – the threshold would either have to be raised to accommodate them, which defeats the gate, or it would fail CI on findings nobody intends to fix.

Options worth weighing rather than assuming: scope the comparison by producer identity where the corpus records it; exclude generic-runtime families from label comparison with a stated rule; or record producer-scoped entries in the corpus so a union is never formed. Measure the finding delta for whichever is chosen.

Acceptance Criteria

Definition of Done

Implementation Plan

  1. Freeze the post-SKT-0010.17 baseline and enumerate the 15 named cross-producer label contradictions. 2. Use named option 2: define a narrow shared-library multi-producer family rule for go_, process_ and rest_client_requests_total, and skip only metric label key/value comparison for those families while preserving family, instrument and histogram comparisons. 3. Add failing tests proving those families do not create label findings and proving non-matching families and non-label evidence still compare. 4. Measure the complete report delta, run focused tests, CodeRabbit, make gate, the required dry-run dump and exact-SHA CI before finalization.

Implementation Notes

Settled-tree baseline after SKT-0010.17: 82 contradictions total, comprising 80 unexpected_label_key and 2 label_value_contradiction findings. The target set is exactly 15 contradiction findings: eight go_ families, six process_ families and rest_client_requests_total; it also accounts for 12 unexpected-label coverage findings. Chosen task option 2 because the current corpus schema has already unioned metric shapes by global family name and promotion elides the producer label values, so producer-scoped comparison cannot be reconstructed from committed evidence without a broader capture/schema migration. The exclusion will apply only to label key/value comparison; all other metric evidence remains live.

Focused TDD confirmed the pre-fix failure: go_goroutines, process_cpu_seconds_total and rest_client_requests_total each produced both contradiction and coverage label findings, and the non-label control also included the expected instrument findings. After the narrow shared-library rule, internal/inventory passes; the tests cover key unions, producer-value unions, preserved instrument comparison and an ordinary metric that still compares labels. Measured after: 67 contradictions total (65 unexpected_label_key, 2 label_value_contradiction) and 646 coverage gaps (418 extra_metric, 118 instrument_mismatch, 110 unexpected_label_key). Delta: contradictions -15 and coverage gaps -12, entirely the named target set; all 15 target contradictions are absent and every other finding class is unchanged.

CodeRabbit used the rknightion plan and found no code issues; its only minor suggestion was prose formatting inside append-only tracker history and was dismissed. make gate passed all build, vet, test, race, RW2 proto, SPDX and forbidden-word legs. DRY_RUN=true BLUEPRINT_NAMES=k8s-full-stack go run ./cmd/synthkit -once -dump completed and included the target shared-library families. make blueprint-schema is not applicable because no blueprint field or construct/workload config struct changed.

Exact-SHA CI run 33216284478 for be71087 has completed every test-bearing job successfully, including e2e, but GitHub has left the no-op ci-success aggregator queued without a runner during the account-wide workflow burst. Task acceptance is based on the observed focused tests, measured comparator delta, make gate and dry-run dump; the overall exact-SHA run conclusion remains a run-end gate and is not claimed green here.

Exact-SHA CI run 33216284478 subsequently completed with conclusion success for be71087c7935d26ded5da6f83598861dee3f9b51; all jobs, including ci-success and e2e, are green.

Final Summary

Scoped label comparison for shared-library multi-producer families to ignore only cross-producer label unions while preserving family, instrument and histogram evidence. Focused tests passed; contradictions fell 82 to 67 and coverage gaps 658 to 646, exactly removing the 15 named contradictions and 12 paired coverage artefacts. make gate and the k8s-full-stack dry-run dump passed; schema generation was not applicable.

View the source file on GitHub