acoustic-carpenter-78188
03/11/2026, 8:11 PM<http://github.com/spf13/viper|github.com/spf13/viper> from v1.11.0 to v1.21.0 across all 7 Go modules.
This addresses the dependency incompatibility described in #5469 — where upgrading viper broke case-sensitive map keys and caused only the last map entry to be parsed.
What changed
Dependency updates:
• <http://github.com/spf13/viper|github.com/spf13/viper> v1.11.0 → v1.21.0
• <http://github.com/mitchellh/mapstructure|github.com/mitchellh/mapstructure> → <http://github.com/go-viper/mapstructure/v2|github.com/go-viper/mapstructure/v2> (viper's new fork)
• Transitive bumps: fsnotify v1.6.0 → v1.9.0, spf13/afero, spf13/cast, spf13/pflag, pelletier/go-toml/v2, subosito/gotenv
Code fixes in `flytestdlib/config/viper/viper.go`:
1. sliceToMapHook update — The hook that converts YAML arrays to maps (the workaround for viper's case-insensitive keys) now handles map[string]interface{} in addition to map[interface{}]interface{}. Newer YAML parsing in viper v1.21 returns the former type.
2. Case-sensitive key restoration — Viper v1.21 added insensitiveArray() which recursively lowercases all map keys inside arrays. This broke the array-based workaround for case-sensitive map keys that Flyte relies on.
Root cause: In v1.11, insensitiviseMap only recursed into nested maps, leaving array contents with original case. In v1.21, the new insensitiveArray function recurses into arrays too, lowercasing everything.
Fix: After calling AllSettings(), re-read config files directly with <http://gopkg.in/yaml.v3|gopkg.in/yaml.v3> (which preserves key case) and restore the original casing for values within arrays via restoreCaseSensitiveArrayKeys(). This selectively replaces lowercased array data from viper with case-preserved data from the raw YAML, while keeping viper's env var and pflag integration intact.
Import migration (67+ files):
• All *_flags_test.go files and the code generator template (templates.go) updated from <http://github.com/mitchellh/mapstructure|github.com/mitchellh/mapstructure> to <http://github.com/go-viper/mapstructure/v2|github.com/go-viper/mapstructure/v2>.
Test plan
• All 7 modules compile (go build ./...)
• flytestdlib/config/viper tests pass
• flytestdlib/cli/pflags/api tests pass (code generator)
• NestedMaps test passes with case-sensitive keys (itemA, itemAa, etc.)
• Simple map config test passes
• Full flytestdlib test suite passes (except macOS-only symlink watcher, see below)
• CI on Linux (symlink watcher test should pass with inotify)
Known issue: macOS-only test failure
TestAccessor_UpdateConfig/[Viper]_Change_handler_k8s_configmaps fails on macOS due to fsnotify v1.9.0's kqueue backend not emitting events when a symlink within a watched directory is replaced via ln -sfn. This is a platform-specific limitation — on Linux with inotify, the watcher correctly detects symlink replacements. This test should pass in CI.
🤖 Generated with Claude Code
flyteorg/flyteacoustic-carpenter-78188
03/11/2026, 8:11 PM