Name the setting and value when a size does not parse (closes #429)
check / check (push) Successful in 9m51s
check / check (push) Successful in 9m51s
A size setting such as chunk_size: banana failed with "invalid size
format: strconv.ParseFloat: parsing "": invalid syntax", naming neither
the setting nor the value. The size decoder now quotes the value, and
Parse checks every size setting after ${...} references are filled in,
so the error reads chunk_size: "banana" is not a size; use a number of
bytes or a unit such as 10MB. This covers chunk_size, blob_size_limit
and s3.part_size, and config set.
Model: opus-5-5
This commit is contained in:
1 bovenliggende
d8d13d1c8b
commit
c33639cb69
5 files changed
+169
-17
No files matched your search
@@ -129,10 +129,11 @@ func checkKeys(node *yaml.Node, typ reflect.Type, path string,
|
||||
return nil
|
||||
}
|
||||
|
||||
// checkFilledKeys is checkKeys for data, the config after smartconfig has
|
||||
// filled in its ${...} references. A key that a reference brings in is not
|
||||
// in the file, and the copy that Encode makes has no line numbers.
|
||||
func checkFilledKeys(data map[string]any) error {
|
||||
// checkFilledConfig checks data, the config after smartconfig has filled in
|
||||
// its ${...} references: its keys with checkKeys, then its size settings
|
||||
// with checkSizes. A key that a reference brings in is not in the file, and
|
||||
// the copy that Encode makes has no line numbers.
|
||||
func checkFilledConfig(data map[string]any) error {
|
||||
var filled yaml.Node
|
||||
|
||||
err := filled.Encode(data)
|
||||
@@ -140,8 +141,13 @@ func checkFilledKeys(data map[string]any) error {
|
||||
return fmt.Errorf("failed to marshal config data: %w", err)
|
||||
}
|
||||
|
||||
return checkKeys(&filled, reflect.TypeFor[Config](), "",
|
||||
err = checkKeys(&filled, reflect.TypeFor[Config](), "",
|
||||
map[*yaml.Node]bool{}, map[nodeAndType]bool{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return checkSizes(&filled, nil)
|
||||
}
|
||||
|
||||
// checkMappingKeys is checkKeys for a map.
|
||||
|
||||
Reference in new issue
Block a user