Skip to content

refactor(ci): choose a linked issue's spec source in one pure function - #18434

Merged
kyle-sexton merged 5 commits into
mainfrom
refactor/spec-resolution
Nov 23, 2026
Merged

kyle-sexton merged 5 commits into
mainfrom
refactor/spec-resolution

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

No related issue: candidate 21 of an /architecture:improve deepening pass over the CI lanes, run in a local session.

Summary

pr-verify/resolve-pr.mjs chose a linked issue's spec through a chain of null-guard ternaries over seven sources plus the trusted-human body (resolve-pr.mjs:1124-1138 before this change): written, split child, own agent, briefed, recurring, upstream drift and main-red incident. Each new source had landed as a fix to that chain.

Fix

  • New .github/scripts/pr-verify/spec-source.mjs exports a pure specSource(facts) that returns {source?, body} with the same keys in the same order. linkedIssues gathers the facts as before and calls it. The module imports nothing.
  • The precedence is a pure function of facts already read: every read (split parent, drift files, comments) finishes before the choice, and ownAgentText, briefedIssue, recurringSpec and mainRedIncident are pure and total, so computing each once per issue changes no output.
  • spec-source.mjs joins the hold floor as enforcement; sync-hold-floor.py regenerated its copies and the floor pins moved. .base is a full checkout in the verify and merge-risk jobs, so no workflow line changes.
  • Left in place: the merge-risk-only modes (ratedBy, laneOf, RATED_*, RESOLVE_LANE). pr-rate-merge-risk.yml runs .base/.github/scripts/pr-verify/resolve-pr.mjs at three steps, so moving them changes what those steps run.

Reasons kept from deleted comments

  • The upstream-drift and main-red incident sources yield only to a written, split-child or recurring spec, so beside an own-agent or briefed body they still mark the source; the table test pins this.

Verification

  • New spec-source.test.mjs: 14 rows, each pinned from the old code's output; two deliberate breaks each turn one row red.
  • resolve-pr.test.mjs unchanged: 197 pass. Importer suites: 1717 pass, 0 fail. affected-tests.sh selects both suites; plan-test-lanes.sh ends unmapped=0; the can't-fail scan passes on the 3 changed test files.

Follow-ups

  • Pre-existing (advisory): the drift and incident sources do not yield to an own-agent or briefed body, so they can set source while the body is the filing's own text. Today their authors keep them apart (ownAgentIds excludes the Actions bot); briefedIssue would overlap only if laneAppId were the Actions bot id. Pinned by two table rows.

Related

Part of the .github deepening series; follows #18349 (size-split module).

🤖 Generated with Claude Code

kyle-sexton and others added 2 commits November 23, 2026 07:23
Which spec source wins for a linked issue (written, split child,
own-agent, briefed, recurring, upstream drift, main-red incident) moves
from a ternary chain in resolve-pr.mjs linkedIssues into
spec-source.mjs specSource, a pure function of the facts each source
already produced, pinned by a table test with no GitHub stub. Every
decider it is fed was already pure and total, so evaluating each once
per issue leaves every resolved spec identical. The module joins the
hold floor as enforcement beside resolve-pr.mjs.

Reasons kept from deleted comments:
- The upstream-drift and main-red incident sources yield only to a
  written, split-child or recurring spec, so beside an own-agent or
  briefed body they still mark the source; the table test pins this.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
kyle-sexton and others added 3 commits November 23, 2026 09:26
Generated hold-floor files take main's side and are regenerated by
scripts/sync-hold-floor.py; floor pins are main's counts plus this
branch's one enforcement row (.github/scripts/pr-verify/spec-source.mjs).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Generated hold-floor files take main's side and are regenerated by
scripts/sync-hold-floor.py; floor pins are main's values plus this
branch's one enforcement row (.github/scripts/pr-verify/spec-source.mjs).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 23, 2026 16:26
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T16:27:47.008037Z ccf19bd Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed ccf19bd8c0020e74057617246aa5b24d6ee25f1f: read 12 of 12 changed file(s); 0 finding(s), 0 as inline comments.

Code review: no findings.

The PR moves the choice of a linked issue's spec source out of an inline ternary chain in resolve-pr.mjs and into a pure function, specSource, in .github/scripts/pr-verify/spec-source.mjs. It also adds that file to the hold floor as enforcement, with the generated copies and pins updated to match.

Equivalence check. I compared the old chain with specSource source by source:

  • Own-agent and briefed bodies: the same gates as before. Neither applies to a written issue, an issue with a split-child body, or a split-marked body, and briefed loses to own-agent. Both are truthiness checks, so ownFiling being a non-boolean value changes nothing.
  • Recurring, drift and incident: the old code gave these the same precedence and kept them mutually exclusive, so it never had to pick between the three source spreads.
  • Body: the fallback chain is the same, written && typeof body === "string", then split child, filed, schedule, upstream, red main. Key order is the same: source comes before body, then scope and the rest in linkedIssues.
  • Calls that used to be skipped: ownAgentText, briefedIssue, recurringSpec and mainRedIncident now run for every issue, where before short-circuiting skipped some of them. All four are pure and total on any issue shape (admit.mjs:293, admit.mjs:2012, which wraps its parse in try/catch, resolve-pr.mjs:756 and resolve-pr.mjs:920). issue.comments.nodes was already read on every issue (resolve-pr.mjs, the comments line in linkedIssues), so the extra calls change no output and cannot throw anywhere new.

Hold-floor sync. The new glob appears in all five places, each next to resolve-pr.mjs: docs/conventions/pr-pipeline.yaml, HOLD_PATH_CLASSES in merge-holds.mjs, the bash hold_patterns in pr-require-checks.yml, and the path lists in pr-review-hosted.yml and pr-review-security-hosted.yml. The count pins all move the same way: enforcement 65→66, classes 163→164, review 65→66, config rows 164−32.

Loosened checks. Nothing here loosens a check. The pin and count updates in test_diff_risk.py and test_floor_paths.py follow from a floor that now holds one more path, which makes it stricter. Those tests document that pins move in the PR that changes the floor. Loosened checks would be marked: fail (default; no loosened_check_verdict: line in the prompt); patterns: 0 (no loosened_check_patterns: line). With no loosened_check_decision_record: line, the citation requirement was not checked.

Closing issue. The PR closes no issue ("No related issue"), so there are no acceptance criteria to check.

Tests. The new spec-source.test.mjs covers each precedence edge. That includes the overlap the PR body flags as pre-existing: next to an own-agent or briefed body, drift or incident still sets source. Both rows reproduce the old code's behaviour, and the PR body already lists that overlap as a follow-up, so I don't count it again here. I ran nothing myself, so the suite results in the PR body (197 pass, 1717 pass) are the author's and unverified.

Spend. None beyond normal CI. The PR changes no workflow behaviour except listing one more path.

Verifier dropped 0 of 0 candidates.

@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed ccf19bd8c0020e74057617246aa5b24d6ee25f1f: read 12 of 12 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #18434

This PR has no security issues.

What it changes. The chain of ternaries in linkedIssues that picks a linked issue's spec source (resolve-pr.mjs) moves into a new pure function, specSource, in .github/scripts/pr-verify/spec-source.mjs. The new module is added to the hold floor everywhere the floor is listed: merge-holds.mjs HOLD_PATH_CLASSES, pr-pipeline.yaml merge globs, the generated hold_patterns in pr-require-checks.yml, the hold-paths lists in both hosted review workflows, and the babysit floor test pins.

Trust controls read

  • Spec selection (what untrusted text reaches the verify lane as spec). I compared the old and new logic for every source.
    • own matches the old ownBody !== null. brief gets its !own from the old ownBody === null guard. The schedule, upstream and redMain guards match the old recurring, upstreamDrift and incident guards term for term.
    • The source key can only be one value, because the guards rule each other out, so the order of the spread keys doesn't matter.
    • The body fallback chain (splitChild ?? filed ?? schedule ?? upstream ?? redMain) matches the old childBody ?? ownBody ?? briefed ?? recurring ?? upstreamDrift ?? incident. A written issue still returns its own body only when that body is a string.
    • The facts going in are the same predicates (ownAgentText, briefedIssue, recurringSpec, mainRedIncident) applied to the same issue, so no new text source and no new trusted author can become the spec. The one difference is that those predicates now run on every issue instead of being skipped once an earlier source wins. That could only add a thrown error, not admit text. Nothing widens.
  • Merge holds. merge-holds.mjs line 371, pr-pipeline.yaml, pr-require-checks.yml hold_patterns and the review workflows' hold-paths only add the new path. That narrows what merges unheld. I found no hold removed or weakened. The Dependabot-only line ([ "$AUTHOR_ID" = 49699333 ] || hold_patterns=()) is unchanged.
  • Babysit floor tests. Only the counts and digests change, to match the one added enforcement row. diff_risk.py and the rest of the floor logic are untouched.

No permissions: block, trigger, token request, trusted-actor list, kill switch or plugin manifest is in the diff. The PR description contains no embedded instructions to the lane.

critical-findings: 0

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit 3236247 Nov 23, 2026
89 of 103 checks passed
@kyle-sexton
kyle-sexton deleted the refactor/spec-resolution branch November 23, 2026 18:09
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 23, 2026
kyle-sexton added a commit that referenced this pull request Nov 23, 2026
Keep main's floor rows from #18434 and this branch's two test-scope
gate rows in the merge-holds floor, regenerate the floor copies with
scripts/sync-hold-floor.py, and repin the babysit floor tests to the
combined counts and digests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UJUn7MnPkm1aG9ivrZ2Enp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant