fix(workspace): preserve YAML boundaries when adding members - #30
Conversation
|
Independent review of Six new public-CLI cases now reproduce that compatibility failure across single/multi modes. The revision removes the inappropriate whole-document grammar restriction. Instead, the existing portable metadata reader verifies that the intended member belongs to the source list and that existing source records are unchanged; a fault-injection regression verifies that a misplaced block cannot be published. Opaque owner fields remain untouched, and tests independently parse the complete result with PyYAML. This is not a claim to introduce a new general-purpose YAML validator. Final test results and exact-commit re-review will follow. This PR remains unmerged. |
|
Independent re-review of Four new single/multi, dependency-present/absent cases reproduced this before repair. The revision shares source-section boundary detection between the v4 source reader and member insertion, so owner fields cannot leak into either side of the comparison. Final validation and exact-commit review will follow. |
|
Final evidence for exact head
The review cycle found and repaired additional compatibility issues before acceptance: restricted dependency-free parsing of owner fields, quoted nested owner-field leakage into source records, and anchored source-header handling. Each was reproduced before correction. The final implementation shares the source-section boundary between reader and writer and preserves prior header syntax and opaque owner fields. PR remains open and unmerged for user review. |
Member registration introduced two YAML preservation defects in #29: a commented
source_repositoriesheader raisesStopIteration, and a quoted top-level key can receive the new repository block beneath its scalar value, publishing invalid metadata.This follow-up shares section-boundary detection between the v4 source reader and member insertion. It recognizes commented or anchored list headers and all root-level boundaries, preserving surrounding document bytes. Before proposal or publication, the portable metadata reader verifies that the intended member is inside the source list and that existing source records remain unchanged. A misplaced or inconsistent insertion returns
WB_CONTROL_PLANE_METADATA_INVALIDwithout mutating the workspace.Regression coverage exercises dry-run, apply, and replay in single- and multi-repository workspaces, both with and without the optional YAML dependency. Fixtures preserve quoted scalar and nested mapping keys, comments on source and control-plane headers, anchors, flow mappings, and commented owner mappings. A fault-injection test verifies that a misplaced generated block leaves metadata, registry, and member checkout unchanged. Success tests parse the complete output with PyYAML as an independent oracle.
Review caught and removed an intermediate attempt to validate all preserved owner fields using the script-index loader's restricted YAML grammar. This change does not introduce a general-purpose YAML validator or a new optional-dependency requirement.
Validation:
ca5dd1774b78c421dc49fff06be1a08b5e8ef9f7.This PR remains open and unmerged for user review. It does not implement the next-generation toolkit.