fix(fixtures): pin pattern.id to detector consts (audit #421)#425
Merged
Conversation
Five rows in the canonical SDK fixture (docs/schemas/fixtures/shipped-patterns-v1.0.0-rc1.json) carried wrong pattern.id values: hbm_ecc "17"->"3", thermal_throttle "18"->"4", pcie_aer "19"->"5", cuda_oom "20"->"10", ib_link_flap "21"->"2". The envelope schema only constrains pattern.id to be a non-empty string, so per-pattern envelope tests round-tripped the drift silently. The ib_link_flap row also used the unscoped key "node" while the Go struct serializes Node as "k8s.node.name" (the customer-stable attribute namespace per docs/ATTRIBUTES.md). Renamed to match. Drift-prevention test TestCanonicalShippedFixtures_PatternIDsMatchDetectorConsts pins each fixture row's pattern.id to the PatternID* const exported by the detector package, and asserts every detector const has a fixture row (symmetry guard against orphans on either side). Refs #421 Refs #398
Contributor
Author
Review: SHIPDual-surface verification: PASSED
Pattern.id corrections: All 5 match detector consts:
Test coverage: LOAD-BEARING
Scoped-key audit: No findings. Ready to merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Audit issue #421 finding-2 root-fix. PR #398 landed the canonical v1.0-rc1 SDK fixture at
docs/schemas/fixtures/shipped-patterns-v1.0.0-rc1.jsonwith five rows carrying wrongpattern.idvalues — the fixture was hand-typed by sequential counter (..14, 15, 16, 17, 18, 19, 20, 21) instead of being copied from thePatternID*constants inmodule/pkg/patterns/*.go. The envelope schema only constrainspattern.idtotype:string, minLength:1, so per-pattern envelope tests round-tripped the drift silently.Before / after pattern.id
module/pkg/patterns/*.go)hbm_ecc"17"PatternIDHBMECC = "3"thermal_throttle"18"PatternIDThermalThrottle = "4"pcie_aer"19"PatternIDPCIeAER = "5"cuda_oom"20"PatternIDCUDAOOM = "10"ib_link_flap"21"PatternIDIBLinkFlap = "2"pod_evicted("14"),nccl_hang("15"),xid_correlation("16"),silent_data_corruption("13") were already correct.Scoped-keys delta
The
ib_link_flaprow also used unscoped"node"whileIBLinkFlapVerdict.Nodeserializes as"k8s.node.name"(customer-stable namespace perdocs/ATTRIBUTES.mdline 152-154 +docs/patterns/pattern-2-ib-link-flap.md). Renamed in the fixture to mirror what the Go struct actually emits. The other unscoped keys on this row (hca_device,port,transition_count) match the Go struct'sjson:"..."tags as-is — those are the envelope key names; the operator-facing dashboard scoped names (tracecore.alert.ib_link_flap.transition_count,hw.network.ib.device,hw.network.ib.port.num) are the OTel log-record attributes the processor promotes alongside the JSON payload, a separate surface.Drift-prevention test
TestCanonicalShippedFixtures_PatternIDsMatchDetectorConstsinmodule/pkg/patterns/verdict_envelope_schema_test.gopins each fixture row'spattern.idto thePatternID*const in the detector package and asserts symmetry (every const has a fixture, every fixture matches a const). Confirmed RED with the buggy fixture (5 failures matching the audit prediction exactly), GREEN after the fix.Refs #421
Refs #398
Test plan
go test ./pkg/patterns/...PASS (new test + existing envelope suite)go test ./sdk/verdict/...PASS (Go SDK round-trip)python3 -m pytest python/tracecore_verdict/test_decode.py22/22 PASSmake vetcleanmake lint0 issuesTestCanonicalShippedFixtures_PatternIDsMatchDetectorConsts