Skip to content

config_patch produces spurious formatting diffs (YAML round-trip fidelity)

When config_patch(apply=False) is called on a config with flow-style YAML mappings (e.g. json: { suffix: "ecephys", extension: ".json" }), the diff shows: 1. Flow-style spacing stripped: { suffix: "ecephys", extension: ".json" }{suffix: "ecephys", extension: ".json"} 2. List indentation changed: 4-space indented - subject → 2-space - subject 3. Alignment whitespace removed: inputs: { ... }inputs: { ... }

These are cosmetic-only changes but they make the diff noisy and hard to review — the actual patch (new registry group addition) is buried in formatting noise.

Root cause

The YAML round-trip serializer (likely ruamel.yaml) normalizes formatting on dump. The config_patch tool loads the full YAML, patches it, then dumps to compute the diff.

Impact

  • Agents using config_patch(apply=True) would reformat the entire config file
  • This makes git diffs noisy and breaks the "diff shows ONLY the new registry group" guarantee

Suggested fix

Use ruamel.yaml's preserve_quotes=True and round-trip mode, or compute the diff by only inserting the new block at the correct indentation level without re-serializing the whole file.


Source context: pixecog

PixEcog (pixecog): Neuropixels and ECoG dataset and analysis

Recent commits:

c309f45 Fix pipeline doc naming drift, populate registry doc_path, close 3 issues
84d605b Migrate 43 scripts from utils.smk.smk_log
5808910 [DATALAD] removed content

README:


type: readme


Quick Start for Collaborators

Follow this checklist to get started with Pixecog documentation and workflows.

🐀 Pixecog Project — Compact Overview

Core principles

  • One immutable BIDS raw dataset (raw/) as the canonical baseline
  • Each analysis pipeline ha
  • [[issue-arash-20260329-223209-991822.md]] — Same tool (pipeio_config_patch), same root cause: YAML round-trip serializer destroys formatting — anchors/comments vs. flow-style spacing, both stem from ruamel.yaml dump behavior
  • [[issue-arash-20260330-031350-558222.md]] — pipeio bugs discovered during mod creation workflow — overlapping context where config_patch behavior would surface