Skip to content

Add representation-preserving YAML entry removal #44

Open

Description

Why

Configuration authors need to remove selected YAML data without converting the stream into lossy PowerShell objects. Existing object projection cannot preserve tags, complex keys, anchors, aliases, shared or recursive graphs, mapping order, or multiple-document boundaries.

What

Add Remove-YamlEntry as a pure text transformation that removes one or more entries selected by RFC 6901 JSON Pointer while preserving the unaffected YAML representation graph.

Acceptance criteria

  • Accept YAML through mandatory pipeline-capable -InputObject [string[]], aggregate records with LF as one stream, and return exactly one normalized LF-only string without a final newline
  • Accept one or more mandatory JSON Pointers through -Path [string[]]; an empty pointer selects a document root, and non-empty pointers require strict /, ~0, and ~1 syntax
  • Select document zero by default through -DocumentIndex, or apply every path independently to every original document with mandatory -AllDocuments
  • Address mapping entries only through ordinal-matching scalar string keys; preserve but never coerce complex, non-string, or unknown-tagged keys
  • Address sequences only with canonical non-negative decimal indexes and reject signs, -, leading zeros, overflow, and malformed values
  • Resolve and validate every target against an immutable deep-cloned representation graph before applying changes; -IgnoreMissing skips only unresolved targets
  • Coalesce duplicate logical targets reached through aliases, let ancestors subsume descendants, and remove sequence children and document roots in descending original index order
  • Preserve unaffected tags, anchors, aliases, shared and cyclic identity, complex keys, mapping order, and document order; removing inside a shared collection is visible through every alias, and removing an alias edge removes only that edge
  • Remove selected root documents and return an empty string when no documents remain
  • Mirror parser and emitter safety controls for indentation, depth, nodes, aliases, scalar length, tag lengths, and numeric length; bound cloning, pointer parsing and resolution, coalescing, mutation, and output validation with classified errors
  • Include complete command help, README and example usage, generated documentation and package export coverage, source and built-artifact tests, deterministic self-parse coverage, and cross-platform Process-PSModule validation

Activity

  1. changed the title [-]Add representation-preserving YAML merge[/-] [+]Add representation-preserving YAML entry removal[/+] on Jul 25, 2026
  2. MariusStorhaug commented on Jul 25, 2026

    @MariusStorhaug
    MemberAuthor

    Aligned the stale duplicate merge description with the assigned removal work. - Replaced the duplicate #43 merge scope with the supplied Remove-YamlEntry contract - Added representation, pointer, transaction, safety, test, documentation, and stacked-delivery decisions - Recorded current core/test progress and the remaining package, documentation, artifact, and CI gates

  3. MariusStorhaug commented on Jul 25, 2026

    @MariusStorhaug
    MemberAuthor

    Completed the implementation plan and validation record. - Added the public representation-preserving removal command and transactional graph helpers - Covered strict pointers, documents, ordering, aliases, cycles, tags, limits, determinism, package export, and fresh-process behavior - Updated README, examples, generated command help, and site output - Passed full source and generated-module Pester, parser and analyzer gates, plus Process-PSModule on Windows, Linux, and macOS in run 30149822606 - Kept draft PR #46 stacked on #45

  4. MariusStorhaug commented on Jul 26, 2026

    @MariusStorhaug
    MemberAuthor

    What changed: Reformatted the issue body to the MSXOrg Issue Format — a local Why plus an outcome-level What/acceptance criteria. Removed the Technical Decisions and Implementation Plan sections (and other implementation-tradeoff notes).
    Why: Issue bodies should state local purpose and observable outcome without leaking implementation detail into the outcome-level description; durable technical decisions belong in the PR/design, not the tracking issue.
    Follow-up: None.

  5. MariusStorhaug commented on Aug 2, 2026

    @MariusStorhaug
    MemberAuthor

    Deferring this out of the v1.0.0 module go-live (#47).

    The initial release scopes the module to a focused YAML surface: parse/serialize (ConvertFrom-Yaml, ConvertTo-Yaml), validate against the YAML 1.2.2 specification (Test-Yaml), import/export files (Import-Yaml, Export-Yaml), format (Format-Yaml), and merge streams (Merge-Yaml). Representation-preserving entry removal via a JSON Pointer path is a mutation surface that sits outside that core intent, so Remove-YamlEntry and its helpers have been removed from the release branch to keep v1.0.0 tight and well-defined.

    This issue stays open as a deferred candidate for a future release. PR #47 references it as a non-closing, deferred link rather than a closing keyword, so cutting v1.0.0 will not auto-close it.

  6. MariusStorhaug commented on Aug 7, 2026

    @MariusStorhaug
    MemberAuthor

    Alignment note from the YAML 1.2.2 gap pass:

    This issue should align with the representation-level backlog now split into focused issues:

    For idiomatic PowerShell, Remove-YamlEntry should keep a clear parameter-set boundary between document selection (-DocumentIndex versus all documents), path selection, and transformation policy. It should continue to operate as a representation-preserving pipeline command rather than projecting to rich PowerShell objects and back.

    Official references:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions