Conversation
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 54 out of 54 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 54 out of 54 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 54 out of 54 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 54 out of 54 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 54 out of 54 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
MIST-163263 Acceptance test validation
Field Coverage Tracking System
Problem: Terraform provider tests need comprehensive field coverage validation, but tracking was manual. This automates discovery of untested schema fields.
Solution: Three-component system using reflection to extract schema fields, normalize test paths, and generate coverage reports.
Core Data Structures
Path Normalization Algorithm
Converts concrete test paths to canonical schema paths:
privileges.0.role→privileges.role,dns_servers.#→dns_serversnetworks.guest.vlan_id→networks.{key}.vlan_idport_usages.100.description→port_usages.{key}.descriptionUnknownFieldsisNumericOrPunctuation()distinguishes context:"0","123"→ skip as array indices"100","10.0.0.0/8"→ replace with{key}Handles: IPv4/IPv6 CIDR, numeric map keys, nested maps, unlimited depth, unicode, empty paths.
Integration Flow
Setup:
FieldCoverageTrackerWithSchema(resourceName, schemaAttributes)extracts schema via reflection. ReturnsnilwhenDISABLE_MIST_FIELD_COVERAGE_TRACKERset.Interception:
newTestChecks(path, tracker)→testChecks.append()interceptsTestCheckResourceAttr*calls →tracker.MarkFieldAsTested(fieldPath)Reporting:
tracker.FieldCoverageReport(t)generates JSON to stdoutReport filters (
isTestableField()):Computed=true AND Optional=false→ excludedSingleNestedAttribute,MapNestedAttribute,MapAttribute→ excludedMapAttribute.{key}→ testableSchema Extraction
Reflection-based extraction (no public API in terraform-plugin-framework):
extractFields(): Recursive tree walkextractFieldMetadata(): ReflectsRequired,Optional,Computedfieldsget*NestedAttributes(): NavigateNestedObject.Attributesvia reflectionSupported types: String/Bool/Int64/Float64/Number/List/Set/Map/SingleNested/ListNested/SetNested/MapNested
Synthetic fields: Creates
{key}entry forMapAttributepaths.Failures tracked: When reflection can't access nested structures.
Test Suite
Isolation: Direct
NewFieldCoverageTracker()+extractFields()calls bypass env var.Key Design Decisions
MapNormalizationPathsfor bothMapAttributeandMapNestedAttributeMapAttribute.{key})nilwhen disabled; call sites checkif tracker != nilDISABLE_MIST_FIELD_COVERAGE_TRACKERdisables trackingUsage
Enabled by default unless
DISABLE_MIST_FIELD_COVERAGE_TRACKERset.100% coverage requirement:
untested_fields_countandunknown_fields_countmust be 0.