Conversation
…ield Config normalization discarded the parse issue that explained why a value was rejected, so an invalid `capabilities` object reported only the enclosing provider path. Decode through `SchemaParser.decodeUnknownResult` instead of the `Option` adapters and carry the issue into the diagnostic, appending the failing field path so the log names the offending field. Value redaction is unchanged: the diagnostic message stays generic and only schema positions are added. Closes anomalyco#50340
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
Note on the This PR targets The reference above is deliberate. This change localizes the diagnostic that #50340 and #50756 both report, but it does not change which configs load, so it should not close #50340 — the schema-side PRs #50702 and #49940 do that. I am leaving the issue unlinked rather than forcing a closing link that the change does not earn. |
Issue for this PR
Related to #50340, and to the diagnostic issue #50756 that its reporter closed after folding it into this thread.
This is the diagnostic half of that report. It does not change which configs load, so it does not close #50340 on its own — the schema-side PRs #50702 and #49940 handle that. Whichever of those lands, any remaining silent skip stays debuggable with this change.
Type of change
What does this PR do?
When a config value fails to decode,
normalize.tsreports a diagnostic at the enclosing path with the message "skipped malformed recognized value". The failing field is lost:decodeValue/decodeEncodeddecode withSchema.decodeUnknownOption, which returnsNoneon failure, so the parse error that carries the offending path is discarded before anything can log it.The effect is visible in #50340, #49912 and #50756: three different malformed values (a
capabilitiesobject missingtools, an invalid legacypackageid) all collapse to the same provider-root warning, which tells a user that something is wrong but not what.This switches those decoders to
SchemaParser.decodeUnknownResultand walks the resulting issue to recover the failing sub-path, so the warning names the field:Two limits are deliberate, and both are covered by tests:
AnyOf/OneOfEffect records an issue per branch with no preferred member, so guessing one would report an arbitrary field. The path therefore localizesformatterentries but notlspentries; the new test documents this rather than hiding it.Behaviour is otherwise unchanged: the value is still skipped exactly as before. That is why the existing assertions stay green, apart from three that now report a more precise path.
Note:
packages/core/src/config/normalize.tsexists only onv2, which is why this targetsv2.How did you verify your code works?
bun test test/configinpackages/core: 209 pass, 0 fail (28 tests in the normalization file, one of them new).["commands","fallback","template"],["provider","azure","env"]and["formatter","prettier","command","0"].bun run typecheck(tsgo) clean,oxlintclean,prettier --checkclean.Screenshots / recordings
Not applicable — log output only.
Checklist