test: build round-trip fuzz funcs from the API version #8190
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #8190"
general
weight: 0.35
cadenmarchese
<!-- No Jira issue: see "Tracking issue" below. -->
What
Replaces the per-API-version lists of randfill overrides in
internal/azureapi/v/conversion_fuzz_test.gowith a singlecoreapitesting.RoundTripFuzzFuncs(apiVersion metadataapi.APIVersion)that derives the overrides from the API version, gating each field on the version that introduced it withmetadataapi.APIVersion.LT:Each version's
TestRoundTripInternalExternalInternalis now a three-line fuzzer setup that names its own version constant.CommonRoundTripFuzzFuncsis folded intoRoundTripFuzzFuncsand unexported, so there is one entry point and versions cannot drift back to hand-rolled lists.Why
TestRoundTripInternalExternalInternalverifies that an internalcoreapiobject survives conversion to a versioned external type and back. Fields that postdate a given API version cannot survive that round trip, so the fuzzer has to zero them before the comparison.Those overrides were duplicated across all five version tests. Adding a field to the latest API version meant revisiting every older version's test and appending another override — easy to forget, and the resulting failure (a 200-iteration fuzz diff on a randomly generated object) is expensive to read. Centralizing them means adding a field to the newest version now requires exactly one new
apiVersion.LT(...)guard in one function.The duplication had already drifted. The
CustomerPlatformProfileoverride in v20251223preview, v20260630preview, and v20260901preview shadowed theCommonDeepCopyFuzzFuncsfill func for that type — randfill keeps only the last-registered func per type — and so silently dropped the type-correct ARM resource ID generation.SubnetIDandNetworkSecurityGroupIDin those three tests fell through to the genericazcorearm.ResourceIDfunc, which always emits aMicrosoft.RedHatOpenShift/hcpOpenShiftClustersID, meaning a subnet field was fuzzed with a cluster-typed ID. v20240610preview avoided this by copy-pasting the base fill inline. That copy-pasted body is now extracted asfillCustomerPlatformProfile/fillOSDiskProfileand shared, so every version gets properly-typed subnet, NSG, and disk-encryption-set IDs. The conversion code passes these through as strings, so this widens fuzz coverage rather than changing any assertion.Behavior
No production code changes — the diff is confined to test code and the test-only
coreapitestinghelper package. The round-trip coverage per version is unchanged except for the more realistic resource IDs noted above.Going forward, the contract is: a field added to the newest API version gets one guard in
RoundTripFuzzFuncs. Because randfill dispatches on type and keeps the last-registered func, there must be at most one func per type in that list — when a type gains a field in a new version, extend that type's existing func rather than registering a second one. This is stated in the function's doc comment.Testing
go test -count=30on all fiveinternal/azureapi/vpackages andinternal/api/coreapi, each run seeding from a freshrand.Int63(). Fullinternalmodule suite passes;test-integrationstill builds.golangci-lintclean oninternal/apitesting/...andinternal/azureapi/....APIVersionV20261001makes v20240610preview, v20260630preview, and v20260901preview fail as expected.Special notes for your reviewer
.claude/change:.claude/skills/bootstrap-api-version/SKILL.mdgains two documentation bullets so the next version bootstrap updates the version constant passed toRoundTripFuzzFuncsinstead of copying override lists. Markdown only — nosettings.json, no scripts, no executable commands..github/workflows/,Makefile,pipeline.yaml, or anyDockerfileis touched.ConvertToInternal(original), and the conversion deliberately carries unknown-to-this-version fields through fromfrom(v20251223preview/hcpopenshiftclusters_methods.go:532-543). ItsContainerRegistry/KeyVaultTypeoverrides were already no-ops before this change; the behavior is preserved rather than quietly altered.Tracking issue
No Jira issue. This is a self-contained cleanup of test infrastructure with no functional, API, or deployed-artifact impact, raised directly from maintenance of the API-version fuzz tests.