Skip to content

ci: require signed commits and the signed-landing check, with first-parent release checks - #372

Merged
kiwidream merged 1 commit into
1.x.xfrom
kiwidream/signed-commits-rulesets
Nov 17, 2026
Merged

kiwidream merged 1 commit into
1.x.xfrom
kiwidream/signed-commits-rulesets

Conversation

@kiwidream

@kiwidream kiwidream commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Summary

This prepares qbit for the signed-commit rollout. Pull requests keep landing with GitHub's squash merge, as they do today: one commit on the branch, which GitHub signs. What changes is what must be true before that merge. A maintainer squashes the pull request into one commit and signs it with their own OpenPGP key (squash-sign apply), and a required check, signed-landing, passes only then. The signed commit stays as the pull request's head; when squash-sign merge makes the merge, the landed commit carries a Signed-commit: line naming it.

Two kinds of pull request land as they are, with a merge commit and with commits that are already signed: a merge of one line into another, from a sync- branch, and the standard two-commit subtree update, from a subtree- branch. The check passes them only when a person signed their head commit.

Ruleset templates (.github/rulesets/):

  • signed-commits.json requires a verified signature on every commit to main, 0.1.x, 1.0.0, 1.1.0 and 1.x.x, with no bypass actors.
  • required-checks.json, new, covers 1.x.x, 1.0.0 and 0.1.x with no bypass actors: signed-landing must pass, and changes arrive by pull request. It is not enforced when a branch is created. main does not require the check, because the release move of main is an admin's push.
  • The branch templates (main.json, 0.1.x.json, 1.0.0.json, 1.x.x.json) allow the squash and merge-commit methods and have no linear-history rule; their required checks and bypass actors are unchanged. .github/repository-settings/merge-methods.json matches them: squash merges and merge commits, no rebase merges.
  • .github/workflows/signed-landing.yml is the check, identical to the other Qbit-Org repositories' except AS_IS_HEADS: "sync-* subtree-*" and an empty AS_IS_LINES. A branch that merges as it is no longer passes by its name: the check judges its head commit, which a person must have signed with an OpenPGP key on their own GitHub account, because GitHub signs a squash merge whatever the pull request's commits were and anyone with write access can create a branch of any name. GitHub runs only main's copy of it, so it reports nothing until main holds the workflow.
  • doc/development/public-branch-and-rulesets.md explains the policy, the order to apply the templates in, and who can bypass what. Merging this changes nothing on GitHub: an admin applies the templates.

Release checks on the first-parent line. A release is cut from a commit the branch gained (GitHub's squash commit, or a subtree update's merge commit), never from a pull request's head:

  • the release publisher and the staging tool (stage-release-artifacts.py) require the release tag's target on the trusted ref's first-parent history;
  • the publisher refuses a trusted ref (a release branch, or qbit-guix.sigs main) unless it is protected with the deletion and non_fast_forward rules, and refuses a shallow release checkout;
  • it reads branch tips from GitHub's API and requires each tip in the local checkout. The publisher never fetches, so the operator fetches both branches first, and a merge that lands after that fetch stops the run before anything is published.

The secret scan covers merges. ci/scanners/run-scanners.py scans with --remerge-diff, so a secret added only in a merge commit is found. A coverage gap, recorded in the summary and failing every secret policy, covers a shallow boundary inside the scanned history, an octopus merge, a Git older than 2.36, and a gitleaks error line or partial scan.

Also in this pull request:

  • A fork pull request lands as it is only when its one commit is signed with an OpenPGP key on the contributor's own GitHub account; the check does not read SSH or S/MIME signatures. Anything else is recreated by a maintainer.
  • ci/release/test_verify_mainnet_release_posture.py expects the same-tree skip clause that ci: skip Full Validation and Core Checks for a tree that already passed #423 added to the mainnet publication posture job, and pins that the skip can be decided only for pull requests. CI runs the release tests only when a pull request changes release files, so ci: skip Full Validation and Core Checks for a tree that already passed #423's own runs never ran this test, and it fails on 1.x.x until this lands.
  • doc/development/ci-same-tree-skip.md notes that a pass marker can be counted on for only about two hours in this repository's full Actions cache, and says correctly that 1.1.0 has its own ruleset.

Docs: CONTRIBUTING, the developer notes, the rulesets document, the release process and publisher reference, the operator-keys notes and the libbitcoinpqc runbook's signing section.

It contains 1.x.x as of 9f1410d5c8.

Testing

  • On the final tree: every test file under ci/checks, ci/release and ci/scanners passes (774 tests), and the lint job's checks and actionlint pass, run with CI's pinned tool versions outside the CI image. The github-metadata step's script passes on the templates and fails on broken variants of them.

  • Before the rework for the squash landing: twenty local /code-review medium passes, an adversarial verification, and two /code-review xhigh passes.

  • Built locally.

  • Ran focused unit or functional tests for the changed area.

  • Ran lint or formatting checks relevant to this change.

  • Not run. Reason: no C++ or build change.

Target Branch

  • This PR targets main or a maintainer-requested release branch such as 0.1.x.

It targets 1.x.x, where development lands.

Risk / Review Notes

  • Consensus, script, crypto, wallet, P2P, release, CI, or security-sensitive behavior changed.
  • No consensus, script, crypto, wallet, P2P, release, CI, or security-sensitive behavior changed.

Notes:

  • Release and CI behaviour changes: a release now needs protected, first-parent trusted refs, and checkouts that already hold the branch tips. Staging refuses a tag on a pull request's head. A Git older than 2.36, a shallow scan boundary or a gitleaks error fails the secret policies instead of passing silently.
  • signed-landing has not run on any qbit pull request. Nothing reports it until main holds the workflow, which is after the next release unless the workflow is brought to main earlier. required-checks.json is applied only after that, or every pull request into those branches would wait for a check nothing reports.
  • The break-glass import goes through a pull request from a subtree- branch once required-checks is live: a direct push to 1.x.x, 1.0.0 or 0.1.x is then refused, admins included. The check judges that branch's head commit, so its last commit is one the admin makes and signs.
  • Key Policy Gate: the check is red on this pull request, and that is expected. The gate refuses a change to its code (here: workflows and files under ci/) without approvals signed by three mainnet signers. No ruleset requires the gate yet, and the operator decided on 13 November to land this before one does, without collecting signatures.
  • 1.1.0 keeps its own ruleset, which lives on that branch and allows squash and rebase merges only, with linear history. A line merge into 1.1.0 needs that file changed there first. Not changed here.
  • Organization admins can still bypass the branch templates, deletion and non_fast_forward included; they cannot bypass signed-commits or required-checks.
  • Prerequisites: qbit-guix.sigs main's rulesets are live since 2026-11-09, and their templates are in contrib: add the rulesets for qbit-guix.sigs main #371.
  • Follow-ups: low-severity follow-ups are tracked in #372 follow-ups: deferred review findings (signed-commit rollout) #373; the nightly scan's empty range is tracked in Review finding: the nightly secret scan's history range is empty #370.

Docs / Process Impact

  • I updated public docs because this PR changes user-visible behavior, integration guidance, release/process guidance, or expected validation.
  • No public docs update needed. Reason:

libbitcoinpqc Subtree Checklist (if src/libbitcoinpqc changed)

Not applicable: src/libbitcoinpqc is unchanged.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

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-17T15:09:55.256967Z ba3a5e9 New commits
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 68fa810b16

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@kiwidream
kiwidream force-pushed the kiwidream/signed-commits-rulesets branch from f3bc8ae to 83cfc74 Compare November 10, 2026 19:35
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@kiwidream
kiwidream marked this pull request as draft November 13, 2026 16:23
kiwidream added a commit that referenced this pull request Nov 15, 2026
## Summary

A pull request lands as one signed commit made by `squash-sign apply`. That commit has the same tree as the head that was reviewed, but GitHub records checks per commit, so Full Validation and Core Checks run again from scratch, for hours, on a tree that already passed. Label changes do the same.

This lets a pull request run skip the expensive jobs of `ci.yml` and `core-checks.yml` when GitHub's own records show that the tree under test (the tree of the pull request's merge commit) already passed the same workflow, routed the same way, in this pull request, against an unchanged base. The gate jobs (`Full Validation Gate`, `Core Checks Gate`) still run and report, so `Required Merge Gate` passes within minutes. A real change, a moved base, or anything else that changes the tree runs everything, as before.

How it decides (`ci/checks/tree_pass_marker.py`; the workflows only wire it up):

- A passing full run saves a marker: a cache entry whose key names the workflow, the routing, a salt, the tree, and the run and attempt that saved it, plus an artifact of that run named for the key. The entry is only looked up, never restored.
- A skip needs GitHub's records of that run, not the marker's word: a `pull_request` run of the same workflow file on this head branch, whose head had this head's tree; the gate job and the save job green in the attempt that saved and in the latest attempt; the artifact present and not expired.
- The run must belong to this pull request against an unchanged base: this is the only pull request ever opened from its head branch; neither its timeline nor its issue events hold an event that moved its base, or that deleted or restored its head branch; and the run was created after the pull request was.
- No later run of the pull request may have failed or be unfinished, whatever its head tree was.
- Any doubt, lookup failure, timeout or unexpected answer runs everything.

What never skips: pushes, merge groups, dispatches, fork pull requests, drafts, a pull request labelled `ci:full-run`, re-runs (attempt 2 and later), the lints that read commit history (`lint commit range`: commit messages, scripted diffs, subtrees), and the suite that tests this mechanism (`same-tree skip contract`).

`doc/development/ci-same-tree-skip.md` has the rules, what remains possible, and how to turn it off. It also says how often to expect a skip: of the last 40 pull requests merged into `1.x.x`, eight had no base movement between their last green full run and their merge, so about one landing in five would have skipped; the others get a new merge tree and a full run, which is correct.

**This is a draft on purpose.** It has not run on GitHub yet. The plan below is what marking it ready will exercise; I will record the results here before asking for it to land.

## Testing

- [ ] Built locally. Not applicable: no source changes.
- [x] Ran focused unit or functional tests for the changed area: `ci/checks/test_tree_pass_marker.py`, 117 tests, and the 11 other `ci/checks` suites.
- [x] Ran lint or formatting checks relevant to this change: ruff, codespell, actionlint, lint-files, the utf8 lint, and the `commit_msg`, `scripted_diff` and `subtree` lints; zizmor shows nothing beyond the base.
- Each rule fails a test when it is removed or weakened (185 mutations by the author, further sets in the independent reviews of each revision).
- Read-only replays against real runs and pull requests of this repository: a draft run and a retargeted pull request (#360) are refused; an ordinary pull request (#387) binds.

Not run, because it needs GitHub: the cache and artifact behaviour, `filter=latest` during a queued re-run, the workflow token's permissions, gpg and the tag fetch on the hosted runner, and the contract job's duration there.

### Validation plan on GitHub

Prerequisites: the `ci:full-run` label exists; `1.x.x` stays still between steps; the pull request is not retargeted and no second one is opened from the branch.

| Step | What is done | Expected |
| --- | --- | --- |
| 0. Draft | This pull request, as it is now | Core Checks runs in full, including `same-tree skip contract`, and saves a marker; Required Merge Gate fails "is a draft" |
| 1. Full run | Mark ready | Full Validation runs everything; `lint commit range` logs each subtree as good; markers and their artifacts are saved |
| 2. Same tree, new commit | Push a commit with the same tree | Both workflows skip, citing step 1's run; `lint commit range` and the contract job still run; both gates green; Required Merge Gate green within minutes |
| 3. Re-run | "Re-run all jobs" on step 2's Full Validation run | Runs in full: an attempt after the first never skips |
| 4. A later failed run | With `ci:full-run` on, a run of the same tree fails or is cancelled; then the label comes off | The next run runs everything, naming the run that did not pass |

**Results on GitHub (13 November).**

- **Step 1.** Full Validation passed on its second attempt (run 43445634045). In the first, the TSan job failed on `wallet_p2mr_deferred_keypool_tests` (#429, a timing test), and the failed job was re-run.
- **Step 2.** On a commit with the same tree, Full Validation skipped in 80 seconds: "skipping the expensive jobs: run 43445634045 attempt 2 already passed this tree with the same routing". `lint commit range` still ran and both gates were green. Core Checks ran in full: "running everything: no pass marker for this tree". Its marker, saved seven and a half hours earlier, had been evicted. The repository's Actions cache held 9 GiB of its 10 GiB limit, and nothing in it had last been used more than two hours before. So a marker here lives about two hours, and the skip needs the landing push within that time of the full run. A missing marker means a full run, never a wrong skip.
- **Steps 3 and 4 were not run on GitHub** (the operator's decision, 15 November): each costs a full run. The rules they exercise are covered by `ci/checks/test_tree_pass_marker.py` (`test_a_rerun_always_runs_in_full`, `test_a_later_run_of_this_tree_that_did_not_pass_stops_the_skip`).
- The signed commit runs in full: the markers of 13 November are gone.

## Target Branch

- [x] This PR targets `main` or a maintainer-requested release branch such as `0.1.x`. It targets `1.x.x`, where the change is wanted first.

## Risk / Review Notes

- [x] Consensus, script, crypto, wallet, P2P, release, CI, or security-sensitive behavior changed.
- [ ] No consensus, script, crypto, wallet, P2P, release, CI, or security-sensitive behavior changed.

Notes: CI only. A wrong skip would let a tree land without its tests, which is why every rule fails closed and why the mechanism's own tests can't be skipped by it. `ci/checks/` and `.github/workflows/` are gate code: once `Key Policy Gate (1.x.x)` is required, this pull request needs a `gate.SHA256` approval signed by the base policy's quorum.

### Key Policy Gate

The `Key Policy Gate` check is red on this pull request, and that is expected. The gate refuses a change to its code (here: `ci.yml`, `core-checks.yml` and two files under `ci/checks/`) without approvals signed by three mainnet signers. No ruleset requires the gate yet, and the operator decided on 13 November to land this pull request before one does, without collecting signatures. The rulesets that require the gate are applied only after this one, #372 and the `signed-landing` workflow have merged.

## Docs / Process Impact

- [x] I updated public docs because this PR changes user-visible behavior, integration guidance, release/process guidance, or expected validation: `doc/development/ci-same-tree-skip.md`.
- [ ] No public docs update needed. Reason:

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Squashed commits:
2ed0c6a ci: skip Full Validation and Core Checks for a tree that already passed
7633b7b Merge remote-tracking branch 'origin/1.x.x' into kiwidream/ci-skip-same-tree
529ec7c ci: a commit with the same tree, for step 2 of the validation plan

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kiwidream
kiwidream marked this pull request as ready for review November 16, 2026 15:24
kiwidream added a commit that referenced this pull request Nov 16, 2026
…ed (#423)

## Summary

A pull request lands as one signed commit made by `squash-sign apply`. That commit has the same tree as the head that was reviewed, but GitHub records checks per commit, so Full Validation and Core Checks run again from scratch, for hours, on a tree that already passed. Label changes do the same.

This lets a pull request run skip the expensive jobs of `ci.yml` and `core-checks.yml` when GitHub's own records show that the tree under test (the tree of the pull request's merge commit) already passed the same workflow, routed the same way, in this pull request, against an unchanged base. The gate jobs (`Full Validation Gate`, `Core Checks Gate`) still run and report, so `Required Merge Gate` passes within minutes. A real change, a moved base, or anything else that changes the tree runs everything, as before.

How it decides (`ci/checks/tree_pass_marker.py`; the workflows only wire it up):

- A passing full run saves a marker: a cache entry whose key names the workflow, the routing, a salt, the tree, and the run and attempt that saved it, plus an artifact of that run named for the key. The entry is only looked up, never restored.
- A skip needs GitHub's records of that run, not the marker's word: a `pull_request` run of the same workflow file on this head branch, whose head had this head's tree; the gate job and the save job green in the attempt that saved and in the latest attempt; the artifact present and not expired.
- The run must belong to this pull request against an unchanged base: this is the only pull request ever opened from its head branch; neither its timeline nor its issue events hold an event that moved its base, or that deleted or restored its head branch; and the run was created after the pull request was.
- No later run of the pull request may have failed or be unfinished, whatever its head tree was.
- Any doubt, lookup failure, timeout or unexpected answer runs everything.

What never skips: pushes, merge groups, dispatches, fork pull requests, drafts, a pull request labelled `ci:full-run`, re-runs (attempt 2 and later), the lints that read commit history (`lint commit range`: commit messages, scripted diffs, subtrees), and the suite that tests this mechanism (`same-tree skip contract`).

`doc/development/ci-same-tree-skip.md` has the rules, what remains possible, and how to turn it off. It also says how often to expect a skip: of the last 40 pull requests merged into `1.x.x`, eight had no base movement between their last green full run and their merge, so about one landing in five would have skipped; the others get a new merge tree and a full run, which is correct.

**This is a draft on purpose.** It has not run on GitHub yet. The plan below is what marking it ready will exercise; I will record the results here before asking for it to land.

## Testing

- [ ] Built locally. Not applicable: no source changes.
- [x] Ran focused unit or functional tests for the changed area: `ci/checks/test_tree_pass_marker.py`, 117 tests, and the 11 other `ci/checks` suites.
- [x] Ran lint or formatting checks relevant to this change: ruff, codespell, actionlint, lint-files, the utf8 lint, and the `commit_msg`, `scripted_diff` and `subtree` lints; zizmor shows nothing beyond the base.
- Each rule fails a test when it is removed or weakened (185 mutations by the author, further sets in the independent reviews of each revision).
- Read-only replays against real runs and pull requests of this repository: a draft run and a retargeted pull request (#360) are refused; an ordinary pull request (#387) binds.

Not run, because it needs GitHub: the cache and artifact behaviour, `filter=latest` during a queued re-run, the workflow token's permissions, gpg and the tag fetch on the hosted runner, and the contract job's duration there.

### Validation plan on GitHub

Prerequisites: the `ci:full-run` label exists; `1.x.x` stays still between steps; the pull request is not retargeted and no second one is opened from the branch.

| Step | What is done | Expected |
| --- | --- | --- |
| 0. Draft | This pull request, as it is now | Core Checks runs in full, including `same-tree skip contract`, and saves a marker; Required Merge Gate fails "is a draft" |
| 1. Full run | Mark ready | Full Validation runs everything; `lint commit range` logs each subtree as good; markers and their artifacts are saved |
| 2. Same tree, new commit | Push a commit with the same tree | Both workflows skip, citing step 1's run; `lint commit range` and the contract job still run; both gates green; Required Merge Gate green within minutes |
| 3. Re-run | "Re-run all jobs" on step 2's Full Validation run | Runs in full: an attempt after the first never skips |
| 4. A later failed run | With `ci:full-run` on, a run of the same tree fails or is cancelled; then the label comes off | The next run runs everything, naming the run that did not pass |

**Results on GitHub (13 November).**

- **Step 1.** Full Validation passed on its second attempt (run 43445634045). In the first, the TSan job failed on `wallet_p2mr_deferred_keypool_tests` (#429, a timing test), and the failed job was re-run.
- **Step 2.** On a commit with the same tree, Full Validation skipped in 80 seconds: "skipping the expensive jobs: run 43445634045 attempt 2 already passed this tree with the same routing". `lint commit range` still ran and both gates were green. Core Checks ran in full: "running everything: no pass marker for this tree". Its marker, saved seven and a half hours earlier, had been evicted. The repository's Actions cache held 9 GiB of its 10 GiB limit, and nothing in it had last been used more than two hours before. So a marker here lives about two hours, and the skip needs the landing push within that time of the full run. A missing marker means a full run, never a wrong skip.
- **Steps 3 and 4 were not run on GitHub** (the operator's decision, 15 November): each costs a full run. The rules they exercise are covered by `ci/checks/test_tree_pass_marker.py` (`test_a_rerun_always_runs_in_full`, `test_a_later_run_of_this_tree_that_did_not_pass_stops_the_skip`).
- The signed commit runs in full: the markers of 13 November are gone.

## Target Branch

- [x] This PR targets `main` or a maintainer-requested release branch such as `0.1.x`. It targets `1.x.x`, where the change is wanted first.

## Risk / Review Notes

- [x] Consensus, script, crypto, wallet, P2P, release, CI, or security-sensitive behavior changed.
- [ ] No consensus, script, crypto, wallet, P2P, release, CI, or security-sensitive behavior changed.

Notes: CI only. A wrong skip would let a tree land without its tests, which is why every rule fails closed and why the mechanism's own tests can't be skipped by it. `ci/checks/` and `.github/workflows/` are gate code: once `Key Policy Gate (1.x.x)` is required, this pull request needs a `gate.SHA256` approval signed by the base policy's quorum.

### Key Policy Gate

The `Key Policy Gate` check is red on this pull request, and that is expected. The gate refuses a change to its code (here: `ci.yml`, `core-checks.yml` and two files under `ci/checks/`) without approvals signed by three mainnet signers. No ruleset requires the gate yet, and the operator decided on 13 November to land this pull request before one does, without collecting signatures. The rulesets that require the gate are applied only after this one, #372 and the `signed-landing` workflow have merged.

## Docs / Process Impact

- [x] I updated public docs because this PR changes user-visible behavior, integration guidance, release/process guidance, or expected validation: `doc/development/ci-same-tree-skip.md`.
- [ ] No public docs update needed. Reason:

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Squashed commits:
2ed0c6a ci: skip Full Validation and Core Checks for a tree that already passed
7633b7b Merge remote-tracking branch 'origin/1.x.x' into kiwidream/ci-skip-same-tree
529ec7c ci: a commit with the same tree, for step 2 of the validation plan

Co-authored-by: Claude Opus 5.5 <[email protected]>
@kiwidream kiwidream changed the title ci: require signed commits and merge-commit merges, with first-parent release checks ci: require signed commits and the signed-landing check, with first-parent release checks Nov 16, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 73cb210591

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/signed-landing.yml Resolved
…arent release checks

## Summary

This prepares qbit for the signed-commit rollout. Pull requests keep landing with GitHub's squash merge, as they do today: one commit on the branch, which GitHub signs. What changes is what must be true before that merge. A maintainer squashes the pull request into one commit and signs it with their own OpenPGP key (`squash-sign apply`), and a required check, `signed-landing`, passes only then. The signed commit stays as the pull request's head; when `squash-sign merge` makes the merge, the landed commit carries a `Signed-commit:` line naming it.

Two kinds of pull request land as they are, with a merge commit and with commits that are already signed: a merge of one line into another, from a `sync-` branch, and the standard two-commit subtree update, from a `subtree-` branch. The check passes them only when a person signed their head commit.

**Ruleset templates (`.github/rulesets/`):**
- `signed-commits.json` requires a verified signature on every commit to `main`, `0.1.x`, `1.0.0`, `1.1.0` and `1.x.x`, with no bypass actors.
- `required-checks.json`, new, covers `1.x.x`, `1.0.0` and `0.1.x` with no bypass actors: `signed-landing` must pass, and changes arrive by pull request. It is not enforced when a branch is created. `main` does not require the check, because the release move of `main` is an admin's push.
- The branch templates (`main.json`, `0.1.x.json`, `1.0.0.json`, `1.x.x.json`) allow the squash and merge-commit methods and have no linear-history rule; their required checks and bypass actors are unchanged. `.github/repository-settings/merge-methods.json` matches them: squash merges and merge commits, no rebase merges.
- `.github/workflows/signed-landing.yml` is the check, identical to the other Qbit-Org repositories' except `AS_IS_HEADS: "sync-* subtree-*"` and an empty `AS_IS_LINES`. A branch that merges as it is no longer passes by its name: the check judges its head commit, which a person must have signed with an OpenPGP key on their own GitHub account, because GitHub signs a squash merge whatever the pull request's commits were and anyone with write access can create a branch of any name. GitHub runs only `main`'s copy of it, so it reports nothing until `main` holds the workflow.
- `doc/development/public-branch-and-rulesets.md` explains the policy, the order to apply the templates in, and who can bypass what. Merging this changes nothing on GitHub: an admin applies the templates.

**Release checks on the first-parent line.** A release is cut from a commit the branch gained (GitHub's squash commit, or a subtree update's merge commit), never from a pull request's head:
- the release publisher and the staging tool (`stage-release-artifacts.py`) require the release tag's target on the trusted ref's first-parent history;
- the publisher refuses a trusted ref (a release branch, or qbit-guix.sigs `main`) unless it is protected with the `deletion` and `non_fast_forward` rules, and refuses a shallow release checkout;
- it reads branch tips from GitHub's API and requires each tip in the local checkout. The publisher never fetches, so the operator fetches both branches first, and a merge that lands after that fetch stops the run before anything is published.

**The secret scan covers merges.** `ci/scanners/run-scanners.py` scans with `--remerge-diff`, so a secret added only in a merge commit is found. A coverage gap, recorded in the summary and failing every secret policy, covers a shallow boundary inside the scanned history, an octopus merge, a Git older than 2.36, and a gitleaks error line or partial scan.

**Also in this pull request:**
- A fork pull request lands as it is only when its one commit is signed with an OpenPGP key on the contributor's own GitHub account; the check does not read SSH or S/MIME signatures. Anything else is recreated by a maintainer.
- `ci/release/test_verify_mainnet_release_posture.py` expects the same-tree skip clause that #423 added to the `mainnet publication posture` job, and pins that the skip can be decided only for pull requests. CI runs the release tests only when a pull request changes release files, so #423's own runs never ran this test, and it fails on `1.x.x` until this lands.
- `doc/development/ci-same-tree-skip.md` notes that a pass marker can be counted on for only about two hours in this repository's full Actions cache, and says correctly that `1.1.0` has its own ruleset.

**Docs:** CONTRIBUTING, the developer notes, the rulesets document, the release process and publisher reference, the operator-keys notes and the libbitcoinpqc runbook's signing section.

It contains `1.x.x` as of `9f1410d5c8`.

## Testing

- On the final tree: every test file under `ci/checks`, `ci/release` and `ci/scanners` passes (774 tests), and the lint job's checks and actionlint pass, run with CI's pinned tool versions outside the CI image. The github-metadata step's script passes on the templates and fails on broken variants of them.
- Before the rework for the squash landing: twenty local `/code-review medium` passes, an adversarial verification, and two `/code-review xhigh` passes.

- [ ] Built locally.
- [x] Ran focused unit or functional tests for the changed area.
- [x] Ran lint or formatting checks relevant to this change.
- [ ] Not run. Reason: no C++ or build change.

## Target Branch

- [x] This PR targets `main` or a maintainer-requested release branch such as `0.1.x`.

It targets `1.x.x`, where development lands.

## Risk / Review Notes

- [x] Consensus, script, crypto, wallet, P2P, release, CI, or security-sensitive behavior changed.
- [ ] No consensus, script, crypto, wallet, P2P, release, CI, or security-sensitive behavior changed.

Notes:
- **Release and CI behaviour changes:** a release now needs protected, first-parent trusted refs, and checkouts that already hold the branch tips. Staging refuses a tag on a pull request's head. A Git older than 2.36, a shallow scan boundary or a gitleaks error fails the secret policies instead of passing silently.
- **`signed-landing` has not run on any qbit pull request.** Nothing reports it until `main` holds the workflow, which is after the next release unless the workflow is brought to `main` earlier. `required-checks.json` is applied only after that, or every pull request into those branches would wait for a check nothing reports.
- **The break-glass import** goes through a pull request from a `subtree-` branch once `required-checks` is live: a direct push to `1.x.x`, `1.0.0` or `0.1.x` is then refused, admins included. The check judges that branch's head commit, so its last commit is one the admin makes and signs.
- **Key Policy Gate:** the check is red on this pull request, and that is expected. The gate refuses a change to its code (here: workflows and files under `ci/`) without approvals signed by three mainnet signers. No ruleset requires the gate yet, and the operator decided on 13 November to land this before one does, without collecting signatures.
- **`1.1.0`** keeps its own ruleset, which lives on that branch and allows squash and rebase merges only, with linear history. A line merge into `1.1.0` needs that file changed there first. Not changed here.
- **Organization admins** can still bypass the branch templates, `deletion` and `non_fast_forward` included; they cannot bypass `signed-commits` or `required-checks`.
- **Prerequisites:** qbit-guix.sigs `main`'s rulesets are live since 2026-11-09, and their templates are in #371.
- **Follow-ups:** low-severity follow-ups are tracked in #373; the nightly scan's empty range is tracked in #370.

## Docs / Process Impact

- [x] I updated public docs because this PR changes user-visible behavior, integration guidance, release/process guidance, or expected validation.
- [ ] No public docs update needed. Reason:

## libbitcoinpqc Subtree Checklist (if `src/libbitcoinpqc` changed)

Not applicable: `src/libbitcoinpqc` is unchanged.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Squashed commits:
067e493 Require signed commits and merge-commit merges
80c599a Clarify the signed-commit process and safe apply order
14a5e01 Sign subtree updates and tighten the signed-commit runbook
4567882 Document the one-commit subtree import and tighten rollback
521f7cc Stop the subtree helper by default and tighten the import runbook
b17ac38 Check the tree and tag name before a libbitcoinpqc import
09ee7ff Move the libbitcoinpqc import procedure out of the signing change
3012fad Make disabling signed-commits optional when rolling back
ced8ef1 Require the release tag target on the trusted ref's first-parent history
e068234 Accept a merged pull request's head as the release tag target
5dcab51 Tie release refs to first-parent branch history
bc4ba10 Scan merges with remerge-diff and pin protected branch tips
652be97 Fail closed on old Git and name the protected-branch prerequisite
99e1353 Skip the secret scan on old Git and refuse shallow release checkouts
0acf5f1 Create test repositories on an explicit main branch
f307ec1 Require history rules on release branches and keep the old-Git scan
25a1ca4 Say what the branch history rules guard against
f451848 Fail the secret policy only on an incomplete history scan
c29461a Count a shallow cut or an octopus merge as an incomplete secret scan
d48d90a Fail every secret policy on an incomplete secret scan
58632f1 Treat a gitleaks log error as an incomplete scan and drop FETCH_HEAD
5dae3a3 Use an immutable default in the scanner test's summary helper
89bdcc5 Keep the fixes from the earlier merges of 1.x.x
a47d996 Read the protected branch tip from the checkout instead of fetching it
7feae0f Require the tag target on the first-parent history when staging
83cfc74 Bring the publisher's docs and helpers in line with 1.x.x
59130cf Merge 1.x.x into signed-commits-rulesets
e0f72c4 Require the signed-landing check on 1.x.x, 1.0.0 and 0.1.x
f992560 Merge 1.x.x into signed-commits-rulesets
d425659 Land pull requests with a squash merge, and merge commits only as they are
037c161 Finish the squash-landing rework: admin flag, cache lifetime, gate tests
c6bc751 test: expect the same-tree skip clause on the mainnet posture job
78bc5d9 Require signed-landing in a ruleset nobody can bypass
73cb210 signed-landing judges branches that merge as they are
d2c88c1 signed-landing: say when a branch may be named in AS_IS_LINES

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Squashed-from: d2c88c1
@kiwidream
kiwidream force-pushed the kiwidream/signed-commits-rulesets branch from d2c88c1 to ba3a5e9 Compare November 17, 2026 15:03
@kiwidream
kiwidream merged commit 679508f into 1.x.x Nov 17, 2026
40 of 41 checks passed
kiwidream added a commit that referenced this pull request Nov 17, 2026
## Summary

This brings two changes that landed on `1.x.x` to `main`, unchanged, as two commits:

- **#423:** Full Validation and Core Checks skip their expensive jobs for a pull request whose tree already passed.
- **#372:** the signed-commit and `signed-landing` ruleset templates, the `signed-landing` workflow, first-parent release checks, and secret scans that cover merges.

GitHub runs `signed-landing` (`pull_request_target`) only from `main`'s copy of the workflow. Until `main` holds it, the check reports nothing on any qbit pull request, and `required-checks.json` cannot be applied to `1.x.x`, `1.0.0` and `0.1.x`. This is the step #372 named: bringing the workflow to `main` before the next release.

#423 comes first because #372's posture test and documents rely on it.

Every one of the 33 files the two commits touch equals `1.x.x`'s copy. Nothing is left out, and nothing else from `1.x.x` comes over: the other changes `main` lacks stay off it. Both picks applied without a conflict, because `main`'s copies of these files were identical to `1.x.x`'s before the two changes.

Merging changes no ruleset: an admin applies the templates afterwards, by `doc/development/public-branch-and-rulesets.md`.

## Testing

- [ ] Built locally.
- [x] Ran focused unit or functional tests for the changed area.
- [x] Ran lint or formatting checks relevant to this change.
- [ ] Not run. Reason:

- Every Python test file under `ci/` (`ci/checks`, `ci/release`, `ci/scanners`), each run as `python3 <file>`: 20 files and 602 tests pass on `main` before; 21 files and 774 tests pass on this branch. No test that passed before fails.
- `.github/workflows/signed-landing.yml` is byte for byte the file the other Qbit-Org repositories run, apart from its two configuration lines (`AS_IS_HEADS: "sync-* subtree-*"`, `AS_IS_LINES: ""`).
- The documentation, metadata and lint checks that could run without building the node pass. Not run: the subtree lint, which could not fetch its sources from the machine these checks ran on. One more actionlint finding of a class `main` already has (a YAML alias).
- The node was not built and no functional test was run here: neither commit changes anything under `src/` or `test/`. CI runs them.

## Target Branch

- [x] This PR targets `main` or a maintainer-requested release branch such as `0.1.x`.

## Risk / Review Notes

- [x] Consensus, script, crypto, wallet, P2P, release, CI, or security-sensitive behavior changed.
- [ ] No consensus, script, crypto, wallet, P2P, release, CI, or security-sensitive behavior changed.

Notes:
- **CI and release behaviour change on `main`**, as they did on `1.x.x` with #423 and #372: the same-tree skip in Full Validation and Core Checks; a release needs protected, first-parent trusted refs; staging refuses a tag on a pull request's head; the secret scans cover merges.
- **Key Policy Gate:** the check is red on this pull request, and that is expected. The gate refuses a change to workflows and files under `ci/` without approvals signed by three mainnet signers. No ruleset requires the gate yet, and the operator decided on 13 November to land the signed-landing workflow before one does, without collecting signatures.
- **`signed-landing` starts reporting** on qbit pull requests once this lands. Nothing requires it until `required-checks.json` is applied.
- **One sentence goes stale:** `doc/development/public-branch-and-rulesets.md` says the check reports nothing until `main` holds the workflow, "which is after the next release moves `main`". This pull request makes that happen earlier. The sentence is left as it is so that the file stays equal to `1.x.x`'s; it can be reworded on `1.x.x`.

## Docs / Process Impact

Choose exactly one:

- [x] I updated public docs because this PR changes user-visible behavior, integration guidance, release/process guidance, or expected validation.
- [ ] No public docs update needed. Reason:

The documents come over with the two changes: `CONTRIBUTING.md`, `doc/development/public-branch-and-rulesets.md`, `doc/development/ci-same-tree-skip.md`, `doc/development/developer-notes.md`, the release process documents and `doc/subtrees/libbitcoinpqc.md`.

## libbitcoinpqc Subtree Checklist (if `src/libbitcoinpqc` changed)

Not applicable: `src/libbitcoinpqc` is not changed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Squashed commits:
1693afb ci: skip Full Validation and Core Checks for a tree that already passed (#423 for main)
0f43f9d ci: require signed commits and the signed-landing check, with first-parent release checks (#372 for main)

Co-authored-by: Claude Opus 5.5 <[email protected]>
Squashed-from: 0f43f9d
kiwidream added a commit that referenced this pull request Nov 17, 2026
The mainnet posture test's stale assertions about core-checks.yml were
brought up to date by #372. This keeps those and pins the gate's side as
whole blocks of the gate's own step instead of lines found anywhere in the
workflow: the posture job in the gate's own `needs`; the posture check
under its condition, followed by the early exit that carries the gate's
failure status; and `check_result` and `check_job` each defined once.
Before, a gate whose early exit returned 0 passed every test.

Rebased onto 1.x.x after #372: where the two changed the same assertions,
#372's are kept.
kiwidream added a commit that referenced this pull request Nov 17, 2026
The mainnet posture test's stale assertions about core-checks.yml were
brought up to date by #372. This keeps those and pins the gate's side as
whole blocks of the gate's own step instead of lines found anywhere in the
workflow: the posture job in the gate's own `needs`; the posture check
under its condition, followed by the early exit that carries the gate's
failure status; and `check_result` and `check_job` each defined once.
Before, a gate whose early exit returned 0 passed every test.

Rebased onto 1.x.x after #372: where the two changed the same assertions,
#372's are kept.
kiwidream added a commit that referenced this pull request Nov 17, 2026
…Policy Gate to main (#423, #372, #440)

## Summary

This brings two changes that landed on `1.x.x` to `main`, unchanged, and one that is open against `1.x.x`:

- **#423:** Full Validation and Core Checks skip their expensive jobs for a pull request whose tree already passed.
- **#372:** the signed-commit and `signed-landing` ruleset templates, the `signed-landing` workflow, first-parent release checks, and secret scans that cover merges.
- **#440 (open against `1.x.x`, rebased onto it on 17 November):** the Key Policy Gate asks signed approvals only for its own three files, and the mainnet posture test pins the Core Checks gate as whole blocks. Its two commits are here as they are on #440's branch.

GitHub runs `signed-landing` (`pull_request_target`) only from `main`'s copy of the workflow. Until `main` holds it, the check reports nothing on any qbit pull request, and `required-checks.json` cannot be applied to `1.x.x`, `1.0.0` and `0.1.x`. This is the step #372 named: bringing the workflow to `main` before the next release.

#423 comes first because #372's posture test and documents rely on it.

After this, everything under `.github/`, `ci/`, `contrib/` and `doc/` equals `1.x.x` with #440 on top; before #440's two commits, each of the 33 files #423 and #372 touch equals `1.x.x`'s copy. Nothing is left out, and nothing else from `1.x.x` comes over: the three other changes `main` lacks (#431, #432, #434: two test fixes and one in `src/script/sign.cpp`) stay off it. Every pick applied without a conflict.

Merging changes no ruleset: an admin applies the templates afterwards, by `doc/development/public-branch-and-rulesets.md`.

## Testing

- [ ] Built locally.
- [x] Ran focused unit or functional tests for the changed area.
- [x] Ran lint or formatting checks relevant to this change.
- [ ] Not run. Reason:

- Every Python test file under `ci/` (`ci/checks`, `ci/release`, `ci/scanners`), each run as `python3 <file>`: 20 files and 602 tests pass on `main` before; 21 files and 774 tests pass with #423 and #372; with #440's commits on top, 21 files pass again (781 tests). No test that passed before fails.
- `.github/workflows/signed-landing.yml` is byte for byte the file the other Qbit-Org repositories run, apart from its two configuration lines (`AS_IS_HEADS: "sync-* subtree-*"`, `AS_IS_LINES: ""`).
- The documentation, metadata and lint checks that could run without building the node pass. Not run: the subtree lint, which could not fetch its sources from the machine these checks ran on. One more actionlint finding of a class `main` already has (a YAML alias).
- The node was not built and no functional test was run here: neither commit changes anything under `src/` or `test/`. CI runs them.

## Target Branch

- [x] This PR targets `main` or a maintainer-requested release branch such as `0.1.x`.

## Risk / Review Notes

- [x] Consensus, script, crypto, wallet, P2P, release, CI, or security-sensitive behavior changed.
- [ ] No consensus, script, crypto, wallet, P2P, release, CI, or security-sensitive behavior changed.

Notes:
- **CI and release behaviour change on `main`**, as they did on `1.x.x` with #423 and #372: the same-tree skip in Full Validation and Core Checks; a release needs protected, first-parent trusted refs; staging refuses a tag on a pull request's head; the secret scans cover merges.
- **The Key Policy Gate's own code changes** (#440): gate code becomes three files, and two of its checks run without approvals. See #440 for the review notes; it should land on `1.x.x` too, so the two branches do not drift.
- **Key Policy Gate:** the check is red on this pull request, and that is expected. The gate refuses a change to workflows and files under `ci/` without approvals signed by three mainnet signers. No ruleset requires the gate yet, and the operator decided on 13 November to land the signed-landing workflow before one does, without collecting signatures.
- **`signed-landing` starts reporting** on qbit pull requests once this lands. Nothing requires it until `required-checks.json` is applied.
- **One sentence goes stale:** `doc/development/public-branch-and-rulesets.md` says the check reports nothing until `main` holds the workflow, "which is after the next release moves `main`". This pull request makes that happen earlier. The sentence is left as it is so that the file stays equal to `1.x.x`'s; it can be reworded on `1.x.x`.

## Docs / Process Impact

Choose exactly one:

- [x] I updated public docs because this PR changes user-visible behavior, integration guidance, release/process guidance, or expected validation.
- [ ] No public docs update needed. Reason:

The documents come over with the two changes: `CONTRIBUTING.md`, `doc/development/public-branch-and-rulesets.md`, `doc/development/ci-same-tree-skip.md`, `doc/development/developer-notes.md`, the release process documents and `doc/subtrees/libbitcoinpqc.md`.

## libbitcoinpqc Subtree Checklist (if `src/libbitcoinpqc` changed)

Not applicable: `src/libbitcoinpqc` is not changed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Squashed commits:
1422396 ci: bring the same-tree CI skip and signed landing to main (#423, #372)
2bee83d ci: ask signatures only for the Key Policy Gate's own three files
c130f87 test: pin the Core Checks gate's posture check as whole blocks

Co-authored-by: Claude Opus 5.5 <[email protected]>
Squashed-from: c130f87
kiwidream added a commit that referenced this pull request Nov 17, 2026
## Summary

Narrows what the Key Policy Gate counts as its own code, so that signed approvals from the release key quorum are needed only for the files the gate runs.

Before this change, gate code was everything under `ci/release/`, `ci/checks/`, `.github/workflows/` and `.github/actions/`, every `CODEOWNERS` file, `contrib/keys/README.md` and every `.gitattributes`. 18 of the pull requests on `1.x.x` since v1.0.0 touched those paths; 3 touched a file the gate then ran.

## What changes

- **Gate code is three files:** `.github/workflows/key-policy-gate.yml`, `ci/release/key_policy_gate.py` and `ci/release/validate_key_metadata.py`, plus an entry in place of one of the directories that hold them. The gate no longer loads `ci/checks/classify_merge_profile.py`; it has its own copy of the two path rules, and a contract test holds the copies to one answer.
- **Two checks run by themselves, with no approvals:**
  - the workflow scan (no job named like the gate's check, no token that can post checks or statuses, declared permissions on a changed workflow, regular files only), whenever a pull request changes a workflow;
  - the refusal of content-changing attributes on the gate's three files, whenever a pull request changes any `.gitattributes`.
- **Spelling:** a pull request may not add or change a path that spells `ci/release/`, `ci/checks/`, `.github/workflows/` or `.github/actions/` with other letters. The old rule counted such a path as gate code; `CODEOWNERS` does not match it.
- **Submodule entries:** `git diff` now runs with `--ignore-submodules=none`. A `.gitmodules` entry with `ignore = all` could hide a submodule entry added under `contrib/keys`. This was already so before this change.
- **Arming order:** the README, the runbook and the release checklist now give the code-owner team write access before the rulesets require the gate, since code-owner review is what covers the paths that no longer need signatures.

## Second commit: the posture test pins the gate as whole blocks

`test_core_checks_runs_real_gate_on_release_candidate_tag` in `ci/release/test_verify_mainnet_release_posture.py` pinned lines of `core-checks.yml` that #423 changed. #372 has since brought those assertions up to date on `1.x.x`. This pull request was rebased onto that (17 November): where the two changed the same assertions, #372's are kept.

What the second commit still adds: it pins the gate's side as whole blocks of the gate's own step instead of lines found anywhere in the workflow: the posture job in the gate's own `needs`; the posture check under its condition, followed by the early exit with the gate's failure status; and `check_result` and `check_job` each defined once. Before, a gate whose early exit returned 0 passed every test; with that exit weakened to `exit 0`, the test now fails.

Please keep both subjects in the squash message.

## What does not change

Every pull request must still contain its base branch's tip. Approvals are named and verified as before. The ruleset templates and `required-merge-gate.yml` are untouched.

## Notes for review

- `Key Policy Gate (1.x.x)` will fail on this pull request: the gate on `1.x.x` today still counts `ci/checks/` and `CODEOWNERS` as its own code and asks for approvals. The check is not required by the live ruleset.
- `main` keeps the earlier gate until a release brings this one there. The README says to require the gate on `main` only after that.
- A pull request that changes `ci-nightly-heavy.yml` or `lint-image-prewarm.yml` is refused until it declares token permissions. The rule is not new; it now applies without approvals. A small follow-up adding permissions to those two workflows would remove the friction.
- The job name in `ci-nightly-heavy.yml` on `1.1.0` (`${{ matrix.name }}` over a computed matrix) is one the scan refuses. It needs a fixed prefix before that workflow reaches `1.x.x`.
- Not in this pull request: letting a pull request behind its base pass, and dropping the up-to-date requirement from the templates. Local review found wrong accepts in that part, so it was taken out.

## Testing

- After the rebase onto `1.x.x` with #372 (17 November): all 21 Python test files under `ci/` pass on the first commit, and the posture test (22 tests) passes on the second, the only file it changes.
- `ci/checks/test_key_policy_gate_target.py` (72 tests since the rebase; #372 added five) and `ci/checks/test_key_policy_gate_contract.py` (61 tests) pass, as do `test_classify_merge_profile.py`, `test_classifier_ci_contract.py`, `test_changed_files_contract.py`, `test/lint/lint-files.py` and `test/lint/lint-qbit-public-docs.py`.
- Each new rule was weakened in turn on a copy of the gate (22 variants); at least one test fails for each.
- The workflow scan passes on the real workflows of `1.x.x` and `main`.
- All nine release validator test files Core Checks runs pass with the second commit. Nine weakened copies of `core-checks.yml` (early exit returning 0, `check_job` taking any skipped job, the posture job dropped from the gate's `needs`, and others) each fail the updated test.
- Not run locally: the Python linters CI uses (ruff, mypy) and the rest of CI.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Squashed commits:
9ef5fc6 ci: ask signatures only for the Key Policy Gate's own three files
3fb4bd4 test: pin the Core Checks gate's posture check as whole blocks

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Squashed-from: 3fb4bd4
kiwidream added a commit that referenced this pull request Nov 17, 2026
…Policy Gate to main (#423, #372, #440) (#441)

## Summary

This brings two changes that landed on `1.x.x` to `main`, unchanged, and one that is open against `1.x.x`:

- **#423:** Full Validation and Core Checks skip their expensive jobs for a pull request whose tree already passed.
- **#372:** the signed-commit and `signed-landing` ruleset templates, the `signed-landing` workflow, first-parent release checks, and secret scans that cover merges.
- **#440 (open against `1.x.x`, rebased onto it on 17 November):** the Key Policy Gate asks signed approvals only for its own three files, and the mainnet posture test pins the Core Checks gate as whole blocks. Its two commits are here as they are on #440's branch.

GitHub runs `signed-landing` (`pull_request_target`) only from `main`'s copy of the workflow. Until `main` holds it, the check reports nothing on any qbit pull request, and `required-checks.json` cannot be applied to `1.x.x`, `1.0.0` and `0.1.x`. This is the step #372 named: bringing the workflow to `main` before the next release.

#423 comes first because #372's posture test and documents rely on it.

After this, everything under `.github/`, `ci/`, `contrib/` and `doc/` equals `1.x.x` with #440 on top; before #440's two commits, each of the 33 files #423 and #372 touch equals `1.x.x`'s copy. Nothing is left out, and nothing else from `1.x.x` comes over: the three other changes `main` lacks (#431, #432, #434: two test fixes and one in `src/script/sign.cpp`) stay off it. Every pick applied without a conflict.

Merging changes no ruleset: an admin applies the templates afterwards, by `doc/development/public-branch-and-rulesets.md`.

## Testing

- [ ] Built locally.
- [x] Ran focused unit or functional tests for the changed area.
- [x] Ran lint or formatting checks relevant to this change.
- [ ] Not run. Reason:

- Every Python test file under `ci/` (`ci/checks`, `ci/release`, `ci/scanners`), each run as `python3 <file>`: 20 files and 602 tests pass on `main` before; 21 files and 774 tests pass with #423 and #372; with #440's commits on top, 21 files pass again (781 tests). No test that passed before fails.
- `.github/workflows/signed-landing.yml` is byte for byte the file the other Qbit-Org repositories run, apart from its two configuration lines (`AS_IS_HEADS: "sync-* subtree-*"`, `AS_IS_LINES: ""`).
- The documentation, metadata and lint checks that could run without building the node pass. Not run: the subtree lint, which could not fetch its sources from the machine these checks ran on. One more actionlint finding of a class `main` already has (a YAML alias).
- The node was not built and no functional test was run here: neither commit changes anything under `src/` or `test/`. CI runs them.

## Target Branch

- [x] This PR targets `main` or a maintainer-requested release branch such as `0.1.x`.

## Risk / Review Notes

- [x] Consensus, script, crypto, wallet, P2P, release, CI, or security-sensitive behavior changed.
- [ ] No consensus, script, crypto, wallet, P2P, release, CI, or security-sensitive behavior changed.

Notes:
- **CI and release behaviour change on `main`**, as they did on `1.x.x` with #423 and #372: the same-tree skip in Full Validation and Core Checks; a release needs protected, first-parent trusted refs; staging refuses a tag on a pull request's head; the secret scans cover merges.
- **The Key Policy Gate's own code changes** (#440): gate code becomes three files, and two of its checks run without approvals. See #440 for the review notes; it should land on `1.x.x` too, so the two branches do not drift.
- **Key Policy Gate:** the check is red on this pull request, and that is expected. The gate refuses a change to workflows and files under `ci/` without approvals signed by three mainnet signers. No ruleset requires the gate yet, and the operator decided on 13 November to land the signed-landing workflow before one does, without collecting signatures.
- **`signed-landing` starts reporting** on qbit pull requests once this lands. Nothing requires it until `required-checks.json` is applied.
- **One sentence goes stale:** `doc/development/public-branch-and-rulesets.md` says the check reports nothing until `main` holds the workflow, "which is after the next release moves `main`". This pull request makes that happen earlier. The sentence is left as it is so that the file stays equal to `1.x.x`'s; it can be reworded on `1.x.x`.

## Docs / Process Impact

Choose exactly one:

- [x] I updated public docs because this PR changes user-visible behavior, integration guidance, release/process guidance, or expected validation.
- [ ] No public docs update needed. Reason:

The documents come over with the two changes: `CONTRIBUTING.md`, `doc/development/public-branch-and-rulesets.md`, `doc/development/ci-same-tree-skip.md`, `doc/development/developer-notes.md`, the release process documents and `doc/subtrees/libbitcoinpqc.md`.

## libbitcoinpqc Subtree Checklist (if `src/libbitcoinpqc` changed)

Not applicable: `src/libbitcoinpqc` is not changed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Squashed commits:
1422396 ci: bring the same-tree CI skip and signed landing to main (#423, #372)
2bee83d ci: ask signatures only for the Key Policy Gate's own three files
c130f87 test: pin the Core Checks gate's posture check as whole blocks


Squashed-from: c130f87

Co-authored-by: Claude Opus 5.5 <[email protected]>
kiwidream added a commit that referenced this pull request Nov 17, 2026
## Summary

Narrows what the Key Policy Gate counts as its own code, so that signed approvals from the release key quorum are needed only for the files the gate runs.

Before this change, gate code was everything under `ci/release/`, `ci/checks/`, `.github/workflows/` and `.github/actions/`, every `CODEOWNERS` file, `contrib/keys/README.md` and every `.gitattributes`. 18 of the pull requests on `1.x.x` since v1.0.0 touched those paths; 3 touched a file the gate then ran.

## What changes

- **Gate code is three files:** `.github/workflows/key-policy-gate.yml`, `ci/release/key_policy_gate.py` and `ci/release/validate_key_metadata.py`, plus an entry in place of one of the directories that hold them. The gate no longer loads `ci/checks/classify_merge_profile.py`; it has its own copy of the two path rules, and a contract test holds the copies to one answer.
- **Two checks run by themselves, with no approvals:**
  - the workflow scan (no job named like the gate's check, no token that can post checks or statuses, declared permissions on a changed workflow, regular files only), whenever a pull request changes a workflow;
  - the refusal of content-changing attributes on the gate's three files, whenever a pull request changes any `.gitattributes`.
- **Spelling:** a pull request may not add or change a path that spells `ci/release/`, `ci/checks/`, `.github/workflows/` or `.github/actions/` with other letters. The old rule counted such a path as gate code; `CODEOWNERS` does not match it.
- **Submodule entries:** `git diff` now runs with `--ignore-submodules=none`. A `.gitmodules` entry with `ignore = all` could hide a submodule entry added under `contrib/keys`. This was already so before this change.
- **Arming order:** the README, the runbook and the release checklist now give the code-owner team write access before the rulesets require the gate, since code-owner review is what covers the paths that no longer need signatures.

## Second commit: the posture test pins the gate as whole blocks

`test_core_checks_runs_real_gate_on_release_candidate_tag` in `ci/release/test_verify_mainnet_release_posture.py` pinned lines of `core-checks.yml` that #423 changed. #372 has since brought those assertions up to date on `1.x.x`. This pull request was rebased onto that (17 November): where the two changed the same assertions, #372's are kept.

What the second commit still adds: it pins the gate's side as whole blocks of the gate's own step instead of lines found anywhere in the workflow: the posture job in the gate's own `needs`; the posture check under its condition, followed by the early exit with the gate's failure status; and `check_result` and `check_job` each defined once. Before, a gate whose early exit returned 0 passed every test; with that exit weakened to `exit 0`, the test now fails.

Please keep both subjects in the squash message.

## What does not change

Every pull request must still contain its base branch's tip. Approvals are named and verified as before. The ruleset templates and `required-merge-gate.yml` are untouched.

## Notes for review

- `Key Policy Gate (1.x.x)` will fail on this pull request: the gate on `1.x.x` today still counts `ci/checks/` and `CODEOWNERS` as its own code and asks for approvals. The check is not required by the live ruleset.
- `main` keeps the earlier gate until a release brings this one there. The README says to require the gate on `main` only after that.
- A pull request that changes `ci-nightly-heavy.yml` or `lint-image-prewarm.yml` is refused until it declares token permissions. The rule is not new; it now applies without approvals. A small follow-up adding permissions to those two workflows would remove the friction.
- The job name in `ci-nightly-heavy.yml` on `1.1.0` (`${{ matrix.name }}` over a computed matrix) is one the scan refuses. It needs a fixed prefix before that workflow reaches `1.x.x`.
- Not in this pull request: letting a pull request behind its base pass, and dropping the up-to-date requirement from the templates. Local review found wrong accepts in that part, so it was taken out.

## Testing

- After the rebase onto `1.x.x` with #372 (17 November): all 21 Python test files under `ci/` pass on the first commit, and the posture test (22 tests) passes on the second, the only file it changes.
- `ci/checks/test_key_policy_gate_target.py` (72 tests since the rebase; #372 added five) and `ci/checks/test_key_policy_gate_contract.py` (61 tests) pass, as do `test_classify_merge_profile.py`, `test_classifier_ci_contract.py`, `test_changed_files_contract.py`, `test/lint/lint-files.py` and `test/lint/lint-qbit-public-docs.py`.
- Each new rule was weakened in turn on a copy of the gate (22 variants); at least one test fails for each.
- The workflow scan passes on the real workflows of `1.x.x` and `main`.
- All nine release validator test files Core Checks runs pass with the second commit. Nine weakened copies of `core-checks.yml` (early exit returning 0, `check_job` taking any skipped job, the posture job dropped from the gate's `needs`, and others) each fail the updated test.
- Not run locally: the Python linters CI uses (ruff, mypy) and the rest of CI.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Squashed commits:
9ef5fc6 ci: ask signatures only for the Key Policy Gate's own three files
3fb4bd4 test: pin the Core Checks gate's posture check as whole blocks


Squashed-from: 3fb4bd4

Co-authored-by: Claude Fable 5.2 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant