D180 — Every typed client-config field is written by Save¶
Decision. Save emits search_depth, Load strips it from Extra, and a
table-driven test asserts that every field of the YAML struct appears in the
written file.
Rationale.
- The defect was invisible because a second bug hid it.
SearchDepthwas read (yamlConfig.SearchDepth) but missing from the structSavemarshals, so it never reached the file from the typed field. It looked fine anyway, becauseLoaddid not stripsearch_depthfromExtra, andSave's merge wrote the stale raw value back. A file therefore round-tripped correctly while every programmatic change to the field was silently discarded — including the clamping D162 documents, which could never be persisted, so its warning repeated on every run. - Both halves had to be fixed together. Fixing only
SaveleavesExtrashadowing the field, and the merge would keep the stale copy; fixing onlyLoadstarts dropping the value from disk entirely. Extrais for genuinely unknown keys. A known, typed field living there is a latent conflict, not a redundancy.- The guard is a test over the struct, not a comment. This defect class is invisible on review — an omission from a literal — so the next one fails a test instead of shipping.
Consequences. None observable for a hand-written config: omitempty means a
zero SearchDepth still writes no key, so existing files are not churned.