MergeSettings: an append annotation inside an overlay-only object is emitted raw into settings.json

Chiusa Adatta ai principianti
#2,307 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 9 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
86/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
bun, json, typescript
Ambito
backend

Direzione di ricerca

Leggi LifeOS/install/LIFEOS/TOOLS/MergeSettings.ts intorno alle righe 170–177, poi esegui la riproduzione con l’albero di lavoro pulito dell’issue ed esamina out.json. Controlla come vengono gestiti gli oggetti presenti solo nell’overlay e confronta il risultato con l’output atteso indicato. Il lavoro è completato quando le annotazioni di merge annidate sono state consumate e l’output contiene l’array atteso.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Version
LifeOS 7.40.4; repro on main @ 5e2f2e8

What is broken
mergeSettings consumes { "__merge": "append", "values": [...] } only when it meets the annotation at a key the system layer also has, or at the top level of an overlay-only key. When the overlay adds an object the system layer does not have at all, the function falls through to cloneJsonValue(user), which copies the object verbatim, so any annotation nested inside it reaches settings.json unconsumed. Claude Code then rejects the field, e.g. autoMode.allow: Expected array, but received object, and the rules in it are not applied. The file header promises "Merge annotations are consumed and never emitted in the output." The --check mode compares against the same merge, so it reports no differences.

Where (file:line)
LifeOS/install/LIFEOS/TOOLS/MergeSettings.ts:177 (return cloneJsonValue(user);), reached from the overlay-only branch at :170 with system === undefined.

Repro on a clean tree

mkdir -p /tmp/ms-repro && cd /tmp/ms-repro
echo '{"permissions":{"allow":["Read"]}}' > system.json
echo '{"autoMode":{"allow":{"__merge":"append","values":["rule one"]}}}' > user.json
HOME=/tmp/ms-repro bun <lifeos-checkout>/LifeOS/install/LIFEOS/TOOLS/MergeSettings.ts \
  --system system.json --user user.json --output out.json
jq -c .autoMode out.json

Negative control
On unpatched main @ 5e2f2e8 the merge exits 0 ("Merged 1 system keys + 1 user overlays") and out.json contains {"allow":{"__merge":"append","values":["rule one"]}}, an object where Claude Code requires an array. Expected: {"allow":["rule one"]}.

A stock install does not hit this through autoMode, because the shipped settings.system.json defines autoMode. It is hit by any overlay-only section that carries an annotation, e.g. a settings.system.json that omits autoMode while SettingsBackport writes an append annotation for autoMode.allow into the overlay.

Suggested fix
Recurse into overlay-only objects so nested annotations are consumed. Tested against the repro above: output becomes {"allow":["rule one"]}.

@@ -172,6 +172,10 @@
     return merged;
   }
 
+  if (system === undefined && isObjectRecord(user)) {
+    return mergeSettings({}, user);
+  }
+
   return cloneJsonValue(user);
 }

Before submitting

  • I searched open and closed issues for this defect.
  • The repro runs against a clean tree of the version above, not against my modified install.
  • I removed personal data from the pasted output.
Lingua principale
TypeScript
Stelle
19.6k
Fork
2.5k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di danielmiessler/LifeOS

Tutte le issue di danielmiessler/LifeOS

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.