gen-fields: use explicit legacy field source#127
Conversation
Signed-off-by: Nick Curry <ncurry@nvidia.com>
e2bd544 to
ad55ab1
Compare
| legacyFields = make(map[string]int) | ||
| } else { | ||
| fmt.Fprintf(os.Stderr, "Error extracting legacy fields: %v\n", err) | ||
| legacyFields := make(map[string]int) |
There was a problem hiding this comment.
Could we avoid successful generation with an empty curated legacy map when --legacy-fields is omitted? Verified that the old two-argument direct invocation still succeeds, but the generated legacyDCGMFields loses all lowercase dcgm_ entries. Since GetFieldID relies on those for compatibility, making the flag required or defaulting/falling back to pkg/dcgm/legacy_fields.csv would make this safer.
There was a problem hiding this comment.
Thanks for catching this. I fixed it by making the no-flag path load legacy_fields.csv from the output file directory instead of proceeding with an empty curated map, so the old two-argument invocation preserves the lowercase dcgm_ compatibility names. The generator now fails loudly if that fallback CSV is missing, and I added regression coverage for the default fallback, explicit --legacy-fields, missing CSV, and help behavior. Leaving this open for you to verify and resolve.
Signed-off-by: Nick Curry <ncurry@nvidia.com>
Signed-off-by: Nick Curry <ncurry@nvidia.com>
Signed-off-by: Nick Curry <ncurry@nvidia.com>
Summary
Motivation
This separates curated compatibility names from generated header-derived aliases. The generator no longer has to infer the curated lowercase names from generated output or header/comment patterns; they now live in an explicit source file that can be reviewed directly.
Testing