Skip to content

lib/yaml-subset.awk keeps the first duplicate key where the CI parser rejects the file #7331

Closed

Description

@kyle-sexton

Problem

When a mapping repeats a key, the shared awk YAML reader lib/yaml-subset.awk keeps the first value. The CI config parser rejects the same file. So a local reader and CI can disagree about one config.

Concrete case: babysit_merge_policy.py reads docs/conventions/pr-pipeline.yaml through this reader (via parse-concern-value.sh --strict) to decide the unattended merge rung. If the merge: block contained a key twice, CI would reject the file but the local reader would act on the first value. The CI rejection keeps the bad config off main, so this is latent today.

Expected

--strict mode treats a duplicate key in the same mapping as a parse error, the same as the CI parser.

Scope

  • Canonical source: lib/yaml-subset.awk.
  • Copies registered in scripts/shared-copies.txt (16 files on main); propagate with bash scripts/sync-shared-copies.sh.
  • Check each consumer of the non-strict mode keeps its current behavior, or opt it in.

Related

🤖 Generated with Claude Code

Activity

  1. added
    needs-triageNot yet classified. Floor until a type and one priority tier are set.
    on Oct 12, 2026
  2. github-actions commented on Oct 12, 2026

    @github-actions
    Contributor

    Thanks for the report. I understand the problem: lib/yaml-subset.awk's non-strict reader silently keeps the first value when a mapping key repeats, while the CI YAML parser rejects the same file as invalid — so a config that CI would reject could still be accepted and acted on by a local --strict reader, as in babysit_merge_policy.py reading docs/conventions/pr-pipeline.yaml. The fix should make --strict mode treat a duplicate key in the same mapping as a parse error, propagate the canonical lib/yaml-subset.awk fix to the 16 registered copies via scripts/sync-shared-copies.sh, and confirm each non-strict consumer either keeps its current behavior or explicitly opts into strict checking.

    Scope and related issues (#6699, #6202) are clearly identified. I found no duplicate open issues for this specific --strict duplicate-key gap.

    Automated triage. A maintainer reviews it.

  3. removed
    needs-triageNot yet classified. Floor until a type and one priority tier are set.
    on Oct 12, 2026
  4. added theissue type on Oct 12, 2026
  5. kyle-sexton commented on Oct 18, 2026

    @kyle-sexton
    MemberAuthor

    Decision recorded.

    Question: Admit this issue to the issue lane with the brief below, which implements the decision already discussed in this thread? (Premise holds: lib/yaml-subset.awk has no duplicate-key check while lib/yaml-subset.mjs:209 rejects duplicates, and strictness lives in lib/parse-concern-value.sh (--strict, exit 3); the issue states the expected behavior, so an opt-in flag keeps every direct awk consumer unchanged; 4 hand-edited files, 29 generated copies, 14 fragments; no open PR on these files.)

    Owner's answer: Yes. The owner was asked "Admit the 7 shared-copy issues and #6888 to the paced queue, recording each one's decision as a 'Decision recorded.' comment, and close #6227? #7373 and #6109 wait for their overlapping PRs." and answered "Yes (Recommended)" in an attended backlog-shaping session on 2026-10-18.

    Posted by AI from the owner's answer in that session.

  6. kyle-sexton commented on Oct 18, 2026

    @kyle-sexton
    MemberAuthor

    Agent Brief

    Type: Bug
    Summary: Make strict parsing report a key repeated in one mapping as a parse error, in the canonical awk YAML reader lib/yaml-subset.awk and the canonical lib/parse-concern-value.sh, then regenerate their copies.

    Current behavior:
    When a mapping repeats a key, the awk reader emits both records without error and consumers act on the first value. The JS reader lib/yaml-subset.mjs rejects the same file with a duplicate-key error, as CI's config parser does. So parse-concern-value.sh --strict, which the babysit merge policy uses to read the merge rung, accepts a file CI rejects.

    Desired behavior:

    • The awk reader takes a new opt-in variable for strict parsing. With it set, a key repeated in the same mapping (the same full dotted path) is a parse error in the reader's existing error<TAB><line><TAB><message> form, naming the line of the second occurrence.
    • The same key under two different parents, and keys inside different sequence items, are not duplicates.
    • Without the variable, output is byte-identical to today, so every direct awk consumer and every non-strict parse-concern-value.sh call behaves as before.
    • parse-concern-value.sh --strict sets the variable, so it exits 3 on such a file.

    Key interfaces:

    • Awk reader: a new strict variable beside BLOCK; error record format unchanged.
    • parse-concern-value.sh --strict: exit 3 on a duplicate key; non-strict mode unchanged.
    • Both files are canonicals in the shared-copy registry.

    Acceptance criteria:

    • A test in lib/yaml-subset-awk.test.sh shows a repeated key fails under the strict variable with the second occurrence's line, and parses as today without it.
    • A test shows the same key under two parents, and in two sequence items, is not an error under the strict variable.
    • A test in lib/parse-concern-value.test.sh shows --strict exits 3 on the duplicate-key file and the non-strict call returns what it returns today.
    • scripts/run-test-file.sh passes on lib/yaml-subset-awk.test.sh and lib/parse-concern-value.test.sh.
    • After editing the canonicals, the lane ran scripts/sync-shared-copies.sh to regenerate the copies, and scripts/sync-shared-copies.sh --check exits 0.
    • Each carrying plugin has one new changelog fragment under .changes/<plugin>/ whose bump is not none: discipline, discovery, docs-hygiene, education, harness-memory, harness-ops, multi-agent, planning, review, session-flow, source-control, testing, verification, work-items.

    Out of scope:


    This was generated by AI during backlog shaping. The owner approved its admission in an attended backlog-shaping session on 2026-10-18.

  7. added
    agent-readyFully specified and briefed; eligible for autonomous pickup from the frontier.
    work-class: scopedA briefed fix or small feature; blast radius bounded by the brief, tests exist.
    on Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyFully specified and briefed; eligible for autonomous pickup from the frontier.priority: mediumReal value, no hard deadline; normal backlog flow.work-class: scopedA briefed fix or small feature; blast radius bounded by the brief, tests exist.

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions