Skip to content

fix(workspace): preserve YAML boundaries when adding members - #30

Merged
Ldsystem merged 4 commits into
mainfrom
fix/member-metadata-boundaries
Aug 31, 2026
Merged

fix(workspace): preserve YAML boundaries when adding members#30
Ldsystem merged 4 commits into
mainfrom
fix/member-metadata-boundaries

Conversation

@Ldsystem

@Ldsystem Ldsystem commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Member registration introduced two YAML preservation defects in #29: a commented source_repositories header raises StopIteration, 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_INVALID without 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:

  • Original four boundary cases failed before the fix for the independently reported reasons.
  • Six dependency-free compatibility cases failed against the first PR revision before correction.
  • Four quoted nested mapping cases and four anchored-header cases reproduced subsequent review findings before correction.
  • Focused v4/member suite passed 121 tests before the final header predicate adjustment; all four added anchor cases pass on the final candidate.
  • Final full pinned suite: 719 passed in 237.92s.
  • Required GitHub checks: Ubuntu and macOS passed on exact head ca5dd1774b78c421dc49fff06be1a08b5e8ef9f7.
  • Fresh independent exact-commit review: accept, no findings.

This PR remains open and unmerged for user review. It does not implement the next-generation toolkit.

@Ldsystem

Copy link
Copy Markdown
Owner Author

Independent review of cfc1b4c299f412adfc684ba915f3b8af8a35106d returned repair. The original two defects were fixed, but the new whole-document check reused a restricted script-index YAML loader. In the dependency-free runtime, it rejects valid preserved fields such as owner_settings: {} and commented mappings. The reviewer reproduced this independently; the 700-test full suite did not cover it.

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.

@Ldsystem

Copy link
Copy Markdown
Owner Author

Independent re-review of 926c74ffdbbe8a578e4ff136292546979faddeb2 returned repair for a reader/writer boundary mismatch. A quoted owner mapping with nested fields renders correctly, but the old source reader includes those fields in the last source record. The new preservation check therefore rejects otherwise valid input.

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.

@Ldsystem

Copy link
Copy Markdown
Owner Author

Final evidence for exact head ca5dd1774b78c421dc49fff06be1a08b5e8ef9f7:

  • Full pinned local suite: 719 passed in 237.92s.
  • Required CI: deterministic-ubuntu-latest and deterministic-macos-latest both passed.
  • Fresh independent agent review: accept, no findings.
  • Reviewer identity was independent of implementation. This comment is posted by the PR author as the agent review record, not as a separate GitHub account approval.

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.

@Ldsystem
Ldsystem merged commit e8384b3 into main Aug 31, 2026
2 checks passed
@Ldsystem
Ldsystem deleted the fix/member-metadata-boundaries branch August 31, 2026 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant