fix(settings): quote numeric-shaped YAML keys so hash-keyed settings survive reload
The emitter wrote block-map keys raw while only values went through quoting. A workspace-hash key segment that happens to be all digits with a leading zero (or digits-e-digits) reloaded as an int/float — leading zero dropped, or collapsed to Infinity — orphaning the stored value. Hit ~1 in 1200 repos, deterministically and permanently: the PATH preset (D-106) and the pre-existing Claude account binding for such a repo vanished on every restart with no diagnostics. Same defect class as the T-376 value-corruption fixes in this file; found by the T-511 review pass, confirmed against the live store. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -282,7 +282,14 @@ void _emit(StringBuffer buf, Object? v, int indent) {
|
||||
return;
|
||||
}
|
||||
v.forEach((k, vv) {
|
||||
buf.write('$pad$k:');
|
||||
// Keys go through the same quoting as values: a numeric-shaped key —
|
||||
// e.g. an all-digit FNV workspace-hash suffix (`app.env.pathPrepend.
|
||||
// 0123…`, `app.claude.account.<hash>`) — would otherwise reload as an
|
||||
// int/float and silently corrupt the key (leading zero dropped, or
|
||||
// `1e…` collapsing to Infinity), orphaning the stored value.
|
||||
buf.write(pad);
|
||||
_emitScalar(buf, '$k');
|
||||
buf.write(':');
|
||||
if (vv is Map && vv.isNotEmpty) {
|
||||
buf.writeln();
|
||||
_emit(buf, vv, indent + 1);
|
||||
|
||||
Reference in New Issue
Block a user