Skip to content

feat(ci): link ADRs and collapse long lists in the PR comment - #257

Merged
mbeacom merged 2 commits into
mainfrom
feat/ci-comment-presentation
Oct 3, 2026
Merged

mbeacom merged 2 commits into
mainfrom
feat/ci-comment-presentation

Conversation

@mbeacom

@mbeacom mbeacom commented Oct 3, 2026 •

Copy link
Copy Markdown
Owner

What and why

The governing-decisions comment named records as bare bold ids and rendered every list in full. On a change touching a busy part of the tree, that was a wall of bullets with nothing to click. This makes the comment navigable and keeps it readable when many records apply.

  • Links. Every record id links to the record at the evaluated commit (GITHUB_SHA), including the successor in "superseded by". Each @adr declaration links to its line. A backslash in a path is kept as a filename character (%5C), never treated as a separator. URLs are absolute and built from context.serverUrl, because comment bodies never resolve relative links and GHES has to link to itself.
  • Untrusted paths. Record filenames and declaration paths come from the PR. Each segment is percent-encoded, including the ()'!*~ that encodeURIComponent leaves alone. A path that is absolute, contains ./../empty segments, or holds a control character gets no link.
  • Tally. A line under the heading gives the accepted count, e.g. **10** accepted decisions govern this change · 1 historical record. It's omitted at zero, where it would only repeat the "no accepted decisions" sentence.
  • Collapsing. Up to 10 governing decisions stay expanded; 11 or more collapse behind a summary carrying the count. Active proposals and historical records are always collapsed, since neither binds the change.
  • Truncation. A body over GitHub's limit now has every open <details> closed at the cut, with the closers budgeted up front. Without that, GitHub folds the "output truncated" notice into the collapsed block.

Unchanged: the marker still leads the body (ADR-0026), every display cap still applies, markers still have no exit-code authority (ADR-0022), and @adrkit/core is untouched. No new action.yml inputs.

Checklist

  • Commits are DCO signed off (git commit -s).
  • If this changes a recorded decision in docs/adr/, an ADR is added or supersedes the affected record. (No recorded decision changes; this is presentation inside ADR-0022/0026.)
  • If the schema changed, I edited the Zod source and re-emitted. (Schema unchanged.)
  • I regenerated packages/ci/dist under linux/amd64 bun 1.4.2 and committed it. Only index.js changed; queue-action.js is byte-identical.
  • New or changed behavior is covered by tests, and each was observed failing before it passed. I disabled the <details> closers and the path guard in turn and watched their tests fail.
  • bun run typecheck && bun run build && bun test && bun run lint pass (3214 tests).

Notes for reviewers

Three defaults worth pushing back on:

  1. Links point at GITHUB_SHA, the merge commit the default checkout lints, because that's the tree record paths and marker lines are read from. A head-SHA link would 404 for a record the base added after branching, and a base change above a marker would shift its #L anchor (caught in review). The merge commit is regenerated when the base moves, but the comment is rewritten on every run.
  2. Expand up to 10 governing decisions.
  3. Proposals and history always collapsed.

I haven't seen the result rendered on a live PR yet. This PR's own action-dogfood run is the first look at how GitHub displays the <details> blocks and links. Both dogfood workflows assert only on the marker, so moving the old #### headings into <summary> doesn't affect them.

The governing-decisions comment named records as bare bold ids, and
every list rendered in full. A change that touched a busy part of the
tree produced a wall of bullets with nothing to click.

Every record id now links to the record at the pull request's head
commit, including a superseded record's successor, and each @adr
declaration links to its line. Links are absolute and built from the
workflow's server URL, since comment bodies never resolve relative
links and GHES must link to itself. Record and declaration paths are
untrusted, so each segment is percent-encoded (including the
parentheses encodeURIComponent leaves alone), and an absolute,
tree-escaping, or control-character path renders unlinked.

A one-line tally under the heading gives the accepted count. Up to ten
governing decisions stay expanded; more collapse behind a summary that
carries the count. Proposals and history are always collapsed, since
neither binds the change.

Truncation now closes every <details> block still open at the cut and
budgets for the closers. Without that, GitHub folds the truncation
notice into the collapsed block where no reviewer sees it.

The marker still leads the body (ADR-0026), every display cap still
applies, and @adrkit/core is untouched. packages/ci/dist/index.js is
rebuilt under linux/amd64 Bun 1.4.2; queue-action.js is unchanged.

Signed-off-by: Mark Beacom <m@beacom.dev>
Copilot AI balanced review requested due to automatic review settings October 3, 2026 03:33
@mbeacom mbeacom added the gate-change-acknowledged A maintainer has seen and accepted this PR's change to the CI gate surface (ADR-0035) label Oct 3, 2026
@mbeacom mbeacom self-assigned this Oct 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Links can target incorrect files or revisions, and rename tallies overcount changed files.

Review effort: Balanced
Findings: 3 Medium severity

Open (3)
What changed in this PR

Adds navigable, collapsible governing-decision comments with tallies and safe truncation.

Changes:

  • Links ADRs and marker declarations.
  • Collapses long or non-governing sections.
  • Regenerates the Action bundle and expands tests.

The adrkit MCP server was unavailable, so marker-only governance was not independently verified.

File Description
packages/​ci/​src/​comment.ts Adds links, tallies, collapsing, and truncation handling.
packages/​ci/​src/​action.ts Supplies record paths to the renderer.
packages/​ci/​src/​index.ts Configures repository and commit links.
packages/​ci/​test/​comment-render.test.ts Tests rendering behavior.
packages/​ci/​test/​action.test.ts Tests Action link integration.
packages/​ci/​dist/​index.js Regenerates the shipped Action bundle.
CHANGELOG.md Documents the feature.

Comment thread packages/ci/src/comment.ts Outdated
Comment thread packages/ci/src/comment.ts Outdated
Comment thread packages/ci/src/index.ts Outdated
@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Decisions governing this change

7 accepted decisions govern this change

  • 0016 — Require every check to be observed failing before it counts as coverage
    • via path: packages/*/test/**
  • 0022 — Scan inbound markers in check and CI without giving them exit-code authority
    • via path: packages/ci/src/**
  • 0026 — Identify the CI comment by the strongest author evidence the token allows
    • via path: packages/ci/src/comment.ts
    • via path: packages/ci/src/index.ts
  • 0030 — Keep extension surfaces that carry a dependency tree outside this repository
    • via path: packages/ci/**
  • 0035 — Execute the gates that certify a pull request from the default branch
    • via path: packages/ci/**
  • 0036 — Expose the governing-decisions Action through one root Marketplace entry point
    • via path: packages/ci/dist/index.js
  • 0041 — Regenerate committed artifacts on Dependabot pull requests with default-branch scripts behind a maintainer label
    • via path: packages/ci/dist/**

Links point at f4ccdd7, this run's GITHUB_SHA. Run adr explain <path> locally to see why a file is governed.

Three corrections from review of #257:

- Links pointed at the PR head, but record paths and marker lines are
  read from the merge checkout. A record the base added after the PR
  branched linked to a 404, and a base change above a marker shifted
  its #L anchor. Links now use GITHUB_SHA, the commit the default
  checkout lints; the footer names it as such rather than asserting
  more.
- A backslash was rewritten into a path separator, so a declaration in
  `src/we\ird.ts` linked to the different file `src/we/ird.ts`. It is
  a filename character in a Git path; it is now kept and encoded as
  %5C.
- The tally counted `changedFiles`, which carries both sides of a
  rename, so renaming one file read as "2 changed files". The tally
  now says "govern this change" and makes no file count.

Signed-off-by: Mark Beacom <m@beacom.dev>
@github-actions github-actions Bot removed the gate-change-acknowledged A maintainer has seen and accepted this PR's change to the CI gate surface (ADR-0035) label Oct 3, 2026
@mbeacom mbeacom added the gate-change-acknowledged A maintainer has seen and accepted this PR's change to the CI gate surface (ADR-0035) label Oct 3, 2026
@mbeacom
mbeacom merged commit ec59da0 into main Oct 3, 2026
22 of 25 checks passed
@mbeacom
mbeacom deleted the feat/ci-comment-presentation branch October 3, 2026 03:54
@mbeacom mbeacom mentioned this pull request Oct 3, 2026
6 tasks done
mbeacom added a commit that referenced this pull request Oct 3, 2026
* chore(release): prepare v0.17.0

Moves the lockstep surface to 0.17.0: the four public packages,
CLI_VERSION, SERVER_INFO and server.json, bun.lock's workspace entries,
and every documented pin (README, ci.mdx, badges.mdx, quickstart, the
site hero, RELEASING.md, AGENTS.md, the bug-report template). The
historical Spec Kit range `<0.16.0` in RELEASING.md and the Spec Kit
reference verification is a different version line and stays.

The CHANGELOG's Unreleased section becomes 0.17.0. The only change is
the governing-decisions comment from #257, so the section says the npm
packages carry no behavior change, and calls out that the proposals and
history headings moved into collapsed <summary> lines for anyone who
scrapes posted comments.

The Action bundles are unchanged from main, and release:pack prepares
all five packages for v0.17.0 with no lockfile drift.

Signed-off-by: Mark Beacom <m@beacom.dev>

* docs(changelog): date 0.17.0 for the day it is cut

Signed-off-by: Mark Beacom <m@beacom.dev>

---------

Signed-off-by: Mark Beacom <m@beacom.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gate-change-acknowledged A maintainer has seen and accepted this PR's change to the CI gate surface (ADR-0035)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants