Files
deepseek-harness/packages/settings
Yichen Jiang 85a3a158dd fix(settings-local): one operation chain, read-modify-write under a writer lock, and diff-shaped YAML edits
Review round three found the provider's write path could destroy state it
never observed:

- Watcher reloads and document writes ran on two independent promise
  chains, and a write rendered the whole next document from the cached
  text. An external edit still inside the debounce window (or missed
  outright) was overwritten, and the follow-up reload no-oped because the
  post-rename content matched the cache — the edit vanished without a
  trace. Reloads and writes now share one operation chain, and every write
  starts by reconciling the on-disk text into the seam before rendering,
  so unobserved sibling sections survive and publish first. An unparsable
  on-disk document fails the write loud instead of being overwritten.
- The initial load raced the watcher's own setup: a change written between
  that read and the watcher becoming active never fired an event. The
  watcher's ready signal now queues one reconcile, closing the gap.
- Two processes sharing a harness home rendered from independent caches,
  last writer winning. Writes now hold a wx-created <file>.lock sibling
  around the read-render-rename cycle with bounded backoff, a crashed-
  holder stale takeover, and a deadline failure; readers stay lock-free
  because the rename commit is atomic.
- renderYaml replaced the whole namespace node, dropping every comment
  inside the section. The next section now lands as a leaf-level diff
  (set changed values, delete removed keys), so comments, anchors, and
  formatting survive on every untouched node and on the key of every
  changed pair; arrays still replace wholesale when unequal.
2026-07-30 13:39:22 +08:00
..

settings/ — user-settings capability family

English | 中文

The user-settings seam and its providers. The interface package owns the abstract Settings service — namespace registration, layered resolution, and change commits; providers implement raw-document storage and push external edits through the seam. All product packages.

Package Role ctx key
settings/ Settings seam: namespace registry, layered resolution, commit events ctx.settings
settings-local/ File-backed provider (settings.yaml/.json) with hot reload and comment-preserving write-back (registers ctx.settings)

The interface lives at settings/settings/; providers are flat siblings. A network configuration-center provider (for example a nacos-style backend) joins here and registers on ctx.settings. Composition config stays in cordis.yml: a settings namespace carries only the user-editable subset, resolved as schema defaults, then the registrant's composition base, then the user document.