Read an empty array from JSON and property list files #228
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 278 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 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.337
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #228"
general
weight: 0.35
czechboy0
Motivation
An empty array in a JSON or property list file reads as no value at all:
All four array accessors return nil, and the throwing API reports
failed to convert to type stringArray.Because a key that resolves to no value means "continue to the next provider", an explicitly empty array doesn't shadow a lower-priority source or a default — someone emptying a list to turn something off gets the old value back.
The YAML provider returns
[]for the same configuration, so the two file providers disagree with it:| Provider |
["a"]|[]||---|---|---|
| YAML |
["a"]|[]|| JSON |
["a"]|nil|| PropertyList |
["a"]|nil|Modifications
An empty array is parsed into its own
emptyArraycase, since with no elements there's no element type to infer. That part is right — but none of the array branches in the conversion mention it, so it falls through tothrowMismatch().Handle it in each array branch of both providers:
Requests for a non-array type still fail, since an array isn't a string. YAML needs no change.
Testing
Added
emptyArraytoJSONFileProviderTestsandPropertyListFileProviderTests, covering all four array accessors,byteChunkArray, a supplied default, and a non-array request. Both fail onmainand pass with this change.No existing test constructs an empty array in any format.
Full suite with
--traits JSON,YAML,PropertyList: 118 tests, 0 failures. Default traits: 110, 0 failures.swift format lint --strictclean.Related
This is the second place where an explicitly empty value is treated as absent — #227 covers
KEY=in environment files. Different code, same consequence. Might be worth a look at the other providers.