Skip to content

chore: make the two local PR-section declarations checkable against the fixed upstream contract #58

Closed

Description

@kyle-sexton

Context

The four required PR-body sections (Summary / Fix / Verification / Related) are declared in three places that drift independently:

  1. .claude/source-control.md — pr_body_required_sections, which steers the source-control plugin's PR-body scaffold.
  2. .github/PULL_REQUEST_TEMPLATE.md — the ## headings a human author sees.
  3. The pr-issue-linkage reusable in ci-workflows — the gate that actually fails the PR.

Only the third is authoritative, and it is not configurable: the four sections are hardcoded in the reusable's requiredSections array, and its only workflow_call inputs are runner, prerequisite-result, and exempt-authors. That is deliberate — melodic-software/ci-workflows#153 posed exactly this decision ("either extend pr-issue-linkage-style validation to all four contract headers, or slim the PR template to only what is enforced") and was closed completed by extending validation to all four. The fixed org-wide contract is the settled answer; this issue does not reopen it.

What follows from that: the two local declarations are mirrors of an upstream constant, and nothing checks that they still match it.

They have already drifted once. .claude/source-control.md declared Summary / Test plan / Related when it was added in #38 (bebe84d, 2026-07-26). It was corrected to the four-section contract only in #52 (3a306d7, 2026-08-19) — fourteen commits later, in a commit whose stated reason was that the shipped template failed the gate and passed ## Summary vacuously via a bare-dash placeholder. For that window, the repo's own scaffold produced PR bodies its own gate rejected.

Proposed work

Make the mirrors checkable rather than trusting them to stay aligned by hand. Options, to be settled in planning:

  • A CI check asserting the template's ## headings and .claude/source-control.md's pr_body_required_sections both match the four-section contract.
  • Or: drop the local declaration entirely if the source-control plugin can be pointed at the upstream contract, removing one mirror instead of checking it.

The first is cheap and self-contained. The second is better if the plugin supports it — one fewer copy beats a check on a copy.

Required stages before implementation

  • /planning:plan — decide between "check the mirrors" and "remove a mirror", and where the contract's canonical text lives for the check to compare against. No discovery stage: the three declarations, the upstream requiredSections array, and the drift history are all identified above.

Explicitly not in scope: adding a required-sections input to the pr-issue-linkage reusable. That would re-litigate ci-workflows#153, which decided the four-header contract is fixed org-wide.

Acceptance criteria

  • A drift between the PR template's ## headings and the four-section contract fails a check, or the template is no longer a second declaration.
  • The same holds for .claude/source-control.md's pr_body_required_sections, or that declaration is removed.
  • The check names the upstream contract as its source, so a future change to the contract has one obvious place to land.

References

Surfaced by an architecture deepening scan of this repo.

Activity

  1. added
    needs-triage
    on Aug 23, 2026
  2. self-assigned this
    on Aug 23, 2026
  3. kyle-sexton commented on Aug 23, 2026

    @kyle-sexton
    MemberAuthor
    No description provided.
  4. added
    status: ready
    agent-ready
    and removed
    needs-triage
    on Aug 23, 2026
  5. added theissue type on Aug 23, 2026
  6. kyle-sexton commented on Aug 23, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during triage.

    Triage

    Category: enhancement / chore (tooling drift-prevention gap, not a defect in running code).

    Redundancy check: searched this repo for any existing mechanism that compares .claude/source-control.md's pr_body_required_sections or .github/PULL_REQUEST_TEMPLATE.md's headings against the upstream contract — none found (grep -rn "requiredSections\|pr_body_required_sections\|pr-issue-linkage" across workflows/docs surfaces only the two mirrors and the gate's own reusable-workflow reference, no comparison logic). No docs/out-of-scope/ ledger exists in this repo, so no rejected-concept check applies.

    Verification (fact-check of the claim, done before drafting the brief):

    • Confirmed .claude/source-control.md currently declares Summary / Fix / Verification / Related under pr_body_required_sections.
    • Confirmed .github/PULL_REQUEST_TEMPLATE.md currently carries the same four ## headings.
    • Fetched melodic-software/ci-workflows's .github/workflows/pr-issue-linkage.yml directly (gh api repos/melodic-software/ci-workflows/contents/...) and confirmed: the requiredSections array is hardcoded to exactly those four sections inside the validation script, and the workflow's only workflow_call inputs are runner, prerequisite-result, and exempt-authors — no section-list override exists. This matches the issue's claim precisely: both local declarations are unchecked mirrors of a fixed, non-configurable upstream contract.
    • Did not verify the historical drift commits (bebe84d, 3a306d7) — they're outside this shallow clone's fetched history — but the current-state claim (the load-bearing part for scoping this work) is independently confirmed above, so this doesn't block briefing.

    No cluster relationship found with the other open raw-intake siblings in this batch (#65–76): none touch PR-body-section declarations or the pr-issue-linkage contract.

    Agent Brief

    Type: Task
    Summary: Add a CI check that fails when either local mirror of the four-section PR-body contract (.github/PULL_REQUEST_TEMPLATE.md's ## headings, and/or .claude/source-control.md's pr_body_required_sections) no longer matches the contract enforced by ci-workflows's pr-issue-linkage reusable workflow.

    Current behavior:
    Two local declarations mirror the four-section contract (Summary/Fix/Verification/Related) that the pr-issue-linkage reusable workflow actually enforces. That workflow's requiredSections list is hardcoded and not configurable via any workflow_call input. Nothing compares either local mirror against it or against each other, and they have drifted before.

    Desired behavior:
    A CI check runs (at minimum on changes to the PR template, .claude/source-control.md, or the check itself) and fails when either mirror's section set doesn't match the upstream contract. The check must not become a third silently-driftable copy of the list: prefer deriving its comparison target from a live read of the pr-issue-linkage reusable workflow's source (e.g. via the GitHub API) over hardcoding the four names a third time; if hardcoding proves the only reliable option, comment it clearly as an intentional, singular mirror of the upstream reusable workflow. On failure, the check's message must name the upstream contract (ci-workflows's pr-issue-linkage reusable workflow) as the source of truth it compared against.

    Decision on .claude/source-control.md specifically: RECOMMENDED — keep the declaration and add it to the check (cheap, self-contained to this repo, no dependency on unverified capability elsewhere). ALTERNATIVE (maintainer-vetoable) — remove that one declaration entirely by pointing the source-control plugin at the upstream contract directly, if investigation confirms the plugin supports sourcing the required-sections list from ci-workflows rather than a local static config. This alternative does not apply to the PR template mirror, which GitHub renders from a static file and so always needs the checking approach regardless.

    Explicitly out of scope (already decided against in ci-workflows#153): adding a required-sections (or equivalently named) workflow_call input to the pr-issue-linkage reusable workflow, or otherwise changing that workflow's validation logic or the four-section contract itself.

    Key interfaces:

    • The check's failure output names the upstream pr-issue-linkage reusable workflow as its comparison source.
    • Whatever reads the upstream requiredSections array tolerates the reusable workflow's script evolving in minor ways — parse defensively, fail loudly with a clear message if the array can no longer be located, rather than silently passing.

    Acceptance criteria:

    • A drift between .github/PULL_REQUEST_TEMPLATE.md's ## headings and the four-section contract fails a check.
    • A drift between .claude/source-control.md's pr_body_required_sections and the four-section contract fails a check, OR that declaration is removed in favor of pointing the source-control plugin at the upstream contract directly (only if confirmed feasible — do not remove speculatively).
    • The check's failure message names the upstream pr-issue-linkage reusable workflow as its source.
    • The check itself does not introduce an unchecked third copy of the four-section list.

    Out of scope:

    • Adding a required-sections input (or equivalent) to the pr-issue-linkage reusable workflow in ci-workflows — already decided against.
    • Changing the four-section contract itself.
    • Any change to pr-issue-linkage's own validation logic.

    Decision defaulted: keep + check the .claude/source-control.md mirror rather than attempt to remove it via a source-control-plugin capability that hasn't been confirmed to exist — veto before merge if that capability turns out to already be available and removal is preferred.

  7. kyle-sexton commented on Aug 23, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI in the autonomous worker lane.

    Lease takeover. The prior lease on this item was held by MELO-LAP-001-triage-202608230449 and has expired — it was acquired and last renewed at the timestamp in that lease comment, with a 1-hour TTL, and was never renewed or released.

    Taking it over as melo-lap-001-worker-202608230449 to carry the item to a review-ready pull request.

    For the record, this is a lane-protocol observation rather than a collision: the triage lane takes a lease while triaging and does not release it when it flips an item to agent-ready, so every handed-off item is unavailable to the worker lane until its lease lapses about an hour later. Releasing the lease as part of the agent-ready flip would remove the delay entirely.

  8. kyle-sexton commented on Aug 23, 2026

    @kyle-sexton
    MemberAuthor
    No description provided.
  9. kyle-sexton commented on Aug 23, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI in the autonomous worker lane (melo-lap-001-worker-202608230449).

    Escalated — blocked on a decision I am not permitted to make: a reusable-workflow pin bump.

    What I found before writing any code

    This issue's premise is true upstream but false at this repository's pin, which inverts the work.

    • .github/workflows/pr-issue-linkage.yml pins the reusable at
      melodic-software/ci-workflows/.github/workflows/pr-issue-linkage.yml@e94438746c300b02385a7f8a2a2dcd19a7f4ad4a # v0.10.2.

    • At that SHA there is no requiredSections array. The validation script enforces exactly two things: a native closing keyword (or a no-issue marker) and a non-empty ## Related section. Verbatim, from e9443874:

      const related = extractSection(body, /^##\s+related$/i);
      if (related === null) {
        errors.push(
          'Missing a "## Related" section. List related PRs, ADRs, or decision-log ' +
            "entries this PR does not close."
        );
      } else if (related.length === 0) {
        errors.push('The "## Related" section is empty.');
      }
    • The four-section requiredSections array (Summary / Fix / Verification / Related) exists only in later refs. Presence by tag, checked directly at each SHA:

      Ref SHA requiredSections
      v0.10.2 (pinned here) e9443874 absent
      v0.11.0 ee96bd2 absent
      v0.12.0 734158c absent
      v0.14.0 62bef7b present
      v0.17.2 (latest) 0f8176e present
    • melodic-software/ci-workflows#153 closed COMPLETED on 2026-08-12, which is the change that introduced the array — landing between v0.12.0 and v0.14.0, after this repo's pin.

    Consequence: three of the four "contract" sections (Summary, Fix, Verification) are not enforced on this repository's pull requests today. The two local declarations are not mirrors of an enforced contract; they are ahead of it.

    The triage note verified the array via gh api repos/melodic-software/ci-workflows/contents/..., which reads the default branch, not the pinned ref — which is why the gap was not visible at triage time. README.md already records that Dependabot deliberately does not move the three reusable-workflow pins ("the standards runner-policy allowlist admits only independently reviewed refs, so those move through explicit reviewed pull requests"), so the stale pin is a known process artifact rather than a bug.

    Why I stopped instead of shipping a check

    Every correct form of the requested check runs through the pin, and each one is either wrong or blocked:

    1. Exact set equality against the pinned ref — red on arrival. The pinned gate's set is {Related}; both mirrors declare four. The check could never go green, so ci-status would block its own PR.
    2. Exact equality against the pinned ref, plus trimming the mirrors to match — would delete Summary / Fix / Verification from the org-wide PR template to match a stale pin. That re-litigates ci-workflows#153, which this issue explicitly puts out of scope.
    3. Compare against ci-workflows's main — passes today, but makes a gating check in this repo depend on another repository's floating HEAD: a green PR could go red with zero local changes. It also breaks this repo's SHA-pinning discipline and asserts a contract the real gate does not enforce.
    4. Subset invariant (pinned enforced set ⊆ both mirrors) plus mirror-vs-mirror equality — green today and self-upgrading after a pin bump, but it does not satisfy the first acceptance criterion at the current pin: a rename applied to both mirrors at once (exactly the Summary / Test plan / Related drift class from chore(source-control): declare the PR-body required sections #38) still passes against {Related}. It would ship a check whose stated acceptance depends on work it does not do.
    5. Bump the pin to a reviewed ref ≥ v0.14.0, then exact equality — the clean design, and the one I am not permitted to take: a dependency pin change is an explicit escalation trigger for this lane, and README.md requires reusable-workflow pins to move through explicit reviewed pull requests.

    Recommended resolution

    1. Prerequisite (separate reviewed PR): bump .github/workflows/pr-issue-linkage.yml's uses: pin from e9443874 (v0.10.2) to a reviewed ref carrying the four-section contract — v0.17.2 (0f8176e) is current; v0.14.0 (62bef7b) is the minimum. Worth a look at the four intervening minors for any other behavior change before choosing. Note that once the pin moves, the four-section contract starts actually gating this repo's PRs, which is a real (and presumably intended) behavior change.
    2. Then chore: make the two local PR-section declarations checkable against the fixed upstream contract #58 executes mechanically: a lane that parses the uses: line in .github/workflows/pr-issue-linkage.yml for owner/repo/path@<sha>, fetches that file from raw.githubusercontent.com at that exact SHA (ci-workflows is public, so no token is needed), extracts the requiredSections names, and asserts exact set equality against the PR template's ## headings (with HTML comments stripped first) and against .claude/source-control.md's ## pr_body_required_sections list. No third copy of the list, no floating HEAD, and the failure message names the pinned upstream reusable as its source. Both parse points must fail loudly (zero or multiple matches → non-zero exit), never pass silently.

    Side-check settled while here

    The brief's alternative — remove the .claude/source-control.md mirror by pointing the source-control plugin at the upstream contract — is not feasible. plugins/source-control/reference/config-resolution.md resolves pr_body_required_sections only from the three layered source-control.md files plus the bundled plugin default; there is no mechanism to source the list from a remote repository. Keep-and-check is settled for that mirror, as the triage note's RECOMMENDED default assumed.

    What is left to decide

    No code was written and nothing was pushed. The worktree and feature branch created for this attempt have been removed; the lease is released.

    Addendum — fleet position of this pin (independent verification)

    A second, fresh-context pass over all nine pr-issue-linkage callers in the org confirms this repo's pin is an outlier, not the norm:

    Repo Pin Tag Four-section contract?
    .github (this repo) e9443874 v0.10.2 no
    codex-plugins c136b27f v0.9.1 no
    ci-runner d26c7506 v0.17.0 yes
    claude-code-plugins 7107b348 v0.14.2 yes
    dotfiles 7107b348 v0.14.2 yes
    github-iac 7107b348 v0.14.2 yes
    medley 7107b348 v0.14.2 yes
    provisioning 7107b348 v0.14.2 yes
    standards 7107b348 v0.14.2 yes

    Seven of nine callers already enforce the four-section contract; this repo and codex-plugins do not. The workflow file at v0.14.2 is byte-identical to main (blob 40b8116f2dbfbb3339513dd13df25515f3f2ff5b at both main and v0.17.2), so v0.14.0 through main is one contract, not several — v0.14.2 is the ref six sibling repos already run.

    Two further facts that constrain the eventual check's design:

    • requiredSections has no canonical machine-readable form. It appears in exactly two places in ci-workflows, both inside .github/workflows/pr-issue-linkage.yml (declaration at line 425, iteration at line 447), embedded in an inline actions/github-script script: | block. There is no JSON/YAML data file, no schema, no composite action, and no release asset carrying the list — all 23 releases have zero assets. Every other mention in that repo (its README, the workflow header comment, pr-issue-linkage-self.yml, and .github/scripts/pr-issue-linkage.test.cjs) is prose or a fixture; the test file reads the workflow YAML and vm-runs the extracted script rather than restating the contract. So parsing the workflow file at the pinned SHA is the only non-duplicating source, and it must parse defensively.
    • There is no floating tag to pin to. All 23 tags are immutable vX.Y.Z; no v0 or v0.17 alias exists. The bump must name a specific ref.

    Also confirmed: ci-workflows exposes no consumer-facing reusable workflow or composite action for validating a caller's own local PR-body/template contract — its three drift checks (tool-version-drift-check, release-tag-drift-check, selector-conformance) are self-only with no workflow_call trigger. So this check has to be built locally here; there is nothing upstream to call.

  10. added
    needs-human
    and removed
    agent-ready
    on Aug 23, 2026
  11. removed their assignment
    on Aug 23, 2026
  12. added
    needs-owner-decision
    and removed
    status: ready
    on Aug 23, 2026
  13. kyle-sexton commented on Aug 23, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during work.

    Decision-ready summary

    An advisor panel reviewed this issue's needs-human gate and split on the framing:

    • Reading A — the open question ("which mirror check to build, and is keep-and-check settled for .claude/source-control.md?") has a well-evidenced default, supported by this issue's own addendum: 7/9 org callers of pr-issue-linkage already pin v0.14.2/7107b348 (byte-identical through main), and this repo's v0.10.2/e9443874 pin is a two-repo outlier that only enforces a subset of the four-section contract. On this reading the issue could move to agent-ready with a local CI check scoped against the current (or bumped) pin.
    • Reading B — the actual fix here requires bumping a dependency SHA pin (pr-issue-linkage reusable workflow), which is an unconditional dependency-pin gate trigger for this lane regardless of how clear the resolution looks.

    Per this lane's standing rule, a split panel stays gated (needs-human).

    RECOMMENDED — approve bumping the pr-issue-linkage reusable-workflow pin used by this repo from v0.10.2/e9443874 to v0.14.2/7107b348. This is the ref 6 of 9 org repos already run, the workflow file is byte-identical from v0.14.2 through main, and it resolves the stale-premise question directly (this repo would then enforce the same four-section contract as its siblings). Once bumped, .claude/source-control.md's mirror stays as previously settled (keep + check).

    ALTERNATIVE — reject the pin bump and instead scope a local revalidation check that re-derives the four-section contract from the currently-pinned e9443874 ref (parsed defensively from the workflow's inline script, since no schema/data-file form exists). More code, avoids a pin change, but still substitutes local logic for the reusable workflow's own guarantee — still needs a human okay since it's a deliberate divergence from 6/9 sibling repos' contract.

    Both options are compatible with the .claude/source-control.md keep-and-check decision already recorded above; neither requires re-opening that part.

  14. kyle-sexton commented on Aug 23, 2026

    @kyle-sexton
    MemberAuthor

    Claiming for gate-audit re-check (role-label legitimacy panel).

  15. kyle-sexton commented on Aug 23, 2026

    @kyle-sexton
    MemberAuthor

    Gate-audit complete; releasing claim. Gate left in place (see decision-ready summary above).

  16. kyle-sexton commented on Aug 27, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI in a documentation-lane worker (dotgithub lane).

    Not resolved here. This item was routed to a lane scoped to small documentation and prose changes, alongside #68, #74, and #99. It is not one: the only unblocked implementation path is still a reusable-workflow pin bump. Leaving it gated, with two findings that narrow the decision.

    Finding 1 — the addendum's "no canonical machine-readable form" claim is wrong

    The escalation addendum above concluded that requiredSections "has no canonical machine-readable form," having searched melodic-software/ci-workflows only. There is one, in melodic-software/standards:

    components/pr-convention-policy/policy.json

    {
      "schemaVersion": 1,
      "title": { "allowedTypes": ["build", "chore", "ci", "docs", "feat", "fix", "perf", "refactor", "revert", "security", "style", "test"], "requireScope": false },
      "body": {
        "requiredSections": ["Summary", "Fix", "Verification", "Related"],
        "closingKeywords": ["Closes", "Fixes", "Resolves"],
        "noIssueMarkers": ["No linked issue", "No related issue"]
      }
    }

    It has a schema (policy.schema.json), an analyzer (pr-convention-policy.mjs), and tests that run in standards' own CI. It is exactly the non-duplicating comparison target this issue's acceptance criteria ask for, and it is versioned data rather than an array parsed out of an inline actions/github-script block.

    Finding 2 — but an accepted ADR forecloses building on it here

    melodic-software/standards docs/adr/0005-retire-pr-convention-policy-distribution.md (accepted 2026-08-19, supersedes ADR-0003) retired distribution of that component to consumers, on the evidence that the five consuming repositories vendored it and never invoked it. It keeps policy.json as "the machine-readable convention source" while stating:

    Enforcement remains where it already lives: the ci-workflows reusable that consumers pin.

    A future consumer-side analyzer need is a new adoption decision (and a new ADR), not a revival of this entry.

    A drift check in this repository that reads standards' policy.json is a consumer-side analyzer. So the design that Finding 1 makes technically clean is closed by governance, not by taste, and opening it requires a new ADR in standards rather than a PR here.

    What that leaves

    Option (ii) from the escalation (build a local check) is now foreclosed as scoped, and options (i)/(iii)/(iv) were already ruled out above. The option space collapses to the pin bump, matching this issue's existing RECOMMENDED.

    One point in its favor that had not been checked: 7107b348 (v0.14.2) is already present in standards' components/runner-policy/policy.json under approvedSelectorReferencesByRepositoryOwner."melodic-software". Those entries are select-runner.yml@<sha>, not pr-issue-linkage.yml@<sha>, so this does not show the allowlist gating pr-issue-linkage directly; what it shows is that the ref itself has been independently reviewed, which is the precondition README.md names for moving a reusable-workflow pin ("the standards runner-policy allowlist admits only independently reviewed refs, so those move through explicit reviewed pull requests"). The bump would not be introducing an unreviewed ref.

    Two operational notes for whoever executes it:

    1. pr-issue-linkage.yml runs on pull_request_target against the base-branch definition, so the bump takes effect on every open PR at its next synchronize or edited event, not just on PRs opened afterwards. Any open PR whose body lacks a non-empty ## Summary, ## Fix, or ## Verification goes red at that moment. Worth landing when the queue is short or checking the open PRs' bodies first.
    2. Once the pin moves, this repository's gate enforces the same four sections both local mirrors already declare, which is the state 7 of 9 org callers are in. Whether a separate drift check is still wanted afterwards is a smaller question than it looks: the gate validates PR bodies, not the template file, so a drifted template would be caught only indirectly, by the next author who fills it in and fails, which is exactly how the chore(source-control): declare the PR-body required sections #38 -> chore: align the PR template with the four-section linkage contract #52 drift surfaced.

    Recommendation unchanged: bump .github/workflows/pr-issue-linkage.yml from e94438746c300b02385a7f8a2a2dcd19a7f4ad4a (v0.10.2) to 7107b34832a7b6db5d08d3b132621c599fbe5e50 (v0.14.2). Still needs-human; no code was written and nothing was pushed for this item.

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

    needs-humanneeds-owner-decision

    Type

    Fields

    No fields configured for Task.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions