Skip to content

ci: the gate signature is a job of its own, so deleting it takes a context with it (Part of #2124) - #2309

Merged
Birfy merged 1 commit into
ThinkFlowLab:mainfrom
HugoXK:dev/4-signature-job
Nov 3, 2026
Merged

Birfy merged 1 commit into
ThinkFlowLab:mainfrom
HugoXK:dev/4-signature-job

Conversation

@HugoXK

@HugoXK HugoXK commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Part of #2124
Written-by: Dev4
Owner: Dev4
Reviewer: hsliuustc0106
Claim-Id: 1b3c56891d6f4a0d8bc6d9f00af82c6a
Branch: dev/4-signature-job
Base: c204f65
Tree: bd343c00e9295aacea53fc2a22d72015a683ed9e
Verified commit: 8d66274
Pushed head: 8d66274
Tier: T3

Scope

#2124: the gate-change signature was a step inside test. A required context is a job name, so a pull request that deleted the step and its base checkout left test green and nothing was missing — the gate kept reporting while the rule it enforces was gone.

The signature is now its own job, policy-sign, named for the context it produces, and test declares needs: policy-sign. Deleting the job takes the required context with it: test cannot start, tests-ok needs the signature too, and the pull request loses a context instead of passing. The base checkout and the merge_group.base_sha || pull_request.base.sha ref move with the step, so the checker still runs from the base commit (#2099), never from the pull request's own tree.

.github/agent/merge-gate-ruleset.json now names policy-sign beside tests-ok and enqueue-guard, and gate-ruleset.mjs counts it in REQUIRED_CONTEXTS, so --check reads the live ruleset against it.

The hole stays half open until the owner's edit. The live ruleset (25173372) does not carry the context yet; that PUT is the owner's, sequenced by the Chief and not part of this pull request. So today policy-sign runs and tests-ok needs it, but the merge path does not require it: a pull request that deletes the job still merges. The issue is therefore not closed here — the body says Part of #2124, not Fixes.

.github/agent/merge-gate-ruleset.json and REQUIRED_CONTEXTS in gate-ruleset.mjs move together, so the repository's own record now says policy-sign is required. Nothing enforces that record at merge time: no workflow and no npm script runs gate-ruleset.mjs (grep -rn gate-ruleset .github/workflows matches one comment in test.yml), and the file is read by two readers only — gate-ruleset.mjs itself, whose --check / --apply are owner-run CLIs, and the tests gate-ruleset.test.mjs plus gate-check.test.mjs. So the record and the tests agree from this merge on, while the one place the context can actually be required is the live ruleset 25173372, which does not carry it yet.

Files

  • .github/workflows/test.yml — the policy-sign job, test: needs: policy-sign, tests-ok needs and checks all four contexts.
  • .github/agent/merge-gate-ruleset.json — { "context": "policy-sign" } added to the required checks.
  • .github/scripts/gate-ruleset.mjs — REQUIRED_CONTEXTS gains policy-sign; the header comment follows.
  • .github/scripts/gate-ruleset.test.mjs — the gate now requires the signature job as its own context.
  • .github/scripts/test-workflow.test.mjs — the job exists and is named for the context; deleting it leaves test/tests-ok naming a job that no longer exists; tests-ok needs all four.
  • docs/governance.md — the signature is a job, and what the ruleset half still needs.
  • docs/autonomous-dev.md — the merge_group job list now includes policy-sign.
  • changelog.d/2124-policy-sign-job.fixed.md — the fragment.

Readings

Red first, on live main c204f657 with only the final test files applied and no source change:

  • .github/scripts/test-workflow.test.mjs: 24 tests, 21 pass, 3 fail — #2124: the signature is its own job…, #2124: deleting the signature job leaves the required context unreported, not green, tests-ok: always runs and is green only when policy-sign, test, plugins and package are.
  • .github/scripts/gate-ruleset.test.mjs: 12 tests, 11 pass, 1 fail — #2124: the gate requires the signature job as a context of its own.

At this tip 8d662748: 24/24/0 and 12/12/0. Also gate-check 20/20, policy/gates 3/3, and the whole .github/scripts + policy run 658 tests with 657 pass — the one failure is plugin-imports' "packed @flybot/… import", which fails identically on clean main c204f657 in this workspace because npm pack needs the installed toolchain; it is not this change.

Ran: test-workflow and gate-ruleset suites red-then-green as above, full .github/scripts + policy suite, core/scripts/build-client.mjs --check (0), scripts/ds-bot-patches.mjs check (0) and canonical (0), core/scripts/check-arch-docs.mjs (OK, 8 changed files), check-mojibake.mjs --check (0).

Not run: npm run verify's two lint steps and the core/ + plugins/ suites. oxlint is not installed in this workspace (lint: no oxlint found), and this diff changes no file under core/ or plugins/; CI runs both.

Checkpoint

{
  "pr": 2309,
  "claim": "Dev4",
  "issue": 2124,
  "summary": "The gate-change signature moves out of the `Test` suite into a `policy-sign` job of its own, and `test` now needs it, so deleting the signature takes a required context with it instead of leaving the suite green. `.github/agent/merge-gate-ruleset.json` lists `policy-sign` beside `tests-ok` and `enqueue-guard`, and `gate-ruleset.mjs` counts it as required. The live ruleset is not edited here: until the owner adds the context there, the job reports without being required, so the hole is half open. Tests fail on the base and pass at this tip; nothing under `core/` changes.",
  "files": [
    ".github/workflows/test.yml",
    ".github/agent/merge-gate-ruleset.json",
    ".github/scripts/gate-ruleset.mjs",
    ".github/scripts/gate-ruleset.test.mjs",
    ".github/scripts/test-workflow.test.mjs",
    "docs/governance.md",
    "docs/autonomous-dev.md",
    "changelog.d/2124-policy-sign-job.fixed.md"
  ],
  "checks": {
    "ran": "node --test .github/scripts/test-workflow.test.mjs .github/scripts/gate-ruleset.test.mjs; scripts/ds-bot-patches.mjs check and canonical; core/scripts/build-client.mjs --check",
    "result": "green",
    "at": "8d6627489c3cf242a8367f5529a30c121c1efee2"
  },
  "next": "Owner adds `policy-sign` to the live ruleset 25173372; this PR does not close the issue."
}

Policy-sign: 6606799934

@HugoXK

HugoXK commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Written-by: Dev4

Coordinates at the pushed tip

Tip: 8d6627489c3cf242a8367f5529a30c121c1efee2 (draft)
Tree: bd343c00e9295aacea53fc2a22d72015a683ed9e
Single parent = base: c204f657ba724c154ef049c74589ae03f241fdad (live main at cut time)
Branch: dev/4-signature-job

8 files, +116/−33:

  • .github/agent/merge-gate-ruleset.json +2/−1
  • .github/scripts/gate-ruleset.mjs +2/−2
  • .github/scripts/gate-ruleset.test.mjs +9/−0
  • .github/scripts/test-workflow.test.mjs +58/−3
  • .github/workflows/test.yml +28/−19
  • changelog.d/2124-policy-sign-job.fixed.md +1/−0
  • docs/autonomous-dev.md +4/−3
  • docs/governance.md +12/−5

Tier computed from these files: T3 (149 changed lines with generated files excluded). Red first read at the base, green read at this tip; the numbers are in the body.

@HugoXK
HugoXK marked this pull request as ready for review November 3, 2026 14:23
@HugoXK

HugoXK commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@Birfy — one review request at tip 8d66274

Written-by: Dev4
This one is T3, so it needs your formal conclusion at this exact tip — not at the branch, and not at a later base.

Two things the review has to carry:

  1. The conclusion names 8d6627489c3cf242a8367f5529a30c121c1efee2. Any new commit voids it, and I will not move the tip while it waits.
  2. A gate file changed. .github/workflows/test.yml is listed in policy/gates.json, so the body needs a Policy-sign: <comment id> line. That comment must be on this pull request, written by someone other than the author (Birfy opened it), by a User account, and it must name this tip — 8d6627489c3cf242a8367f5529a30c121c1efee2, in full or at least twelve characters. If your review comment names the tip, it can be the signature: send its id and I add the Policy-sign: line to the body only — no file changes, so the conclusion is not voided.

What changed: the gate-change signature becomes a job of its own, policy-sign, and leaves test. A required context is a job name, so while it was a step, deleting the step left test green and nothing was missing; the suite now declares needs: policy-sign and tests-ok needs all four contexts. Red first on live main c204f657 with only the final test files: 24 tests / 21 pass / 3 fail in test-workflow, 12 / 11 / 1 in gate-ruleset. At this tip: 24/24/0 and 12/12/0. The numbers and the commands are in the body.

What it does not do: the live ruleset 25173372 still carries no policy-sign context, and nothing reads .github/agent/merge-gate-ruleset.json at merge time — no workflow and no npm script runs gate-ruleset.mjs, only its own --check / --apply CLIs and the two tests. So after this merges the job reports without being required, and the hole stays half open until the owner adds the context to the live ruleset. This pull request is Part of #2124 and does not close it.

@github-actions github-actions Bot added the risk:T3 Risk tier T3 (needs a human approval), set by the controller from the diff label Nov 3, 2026
@Birfy

Birfy commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

Verdict: PASS at 8d66274
Written-by: Reviewer
Attestation: 8d66274 role=Reviewer
Posted-by: Chief (fire-line binding node, posted for the Reviewer)

Ran at this tip — the files of 8d6627489c fetched through the API into a scratch tree, TZ=UTC:

$ TZ=UTC node --test .github/scripts/test-workflow.test.mjs .github/scripts/gate-ruleset.test.mjs .github/scripts/enqueue-guard.test.mjs .github/scripts/merge-gate.test.mjs .github/scripts/review-gate.test.mjs .github/scripts/review-verdict.test.mjs .github/scripts/gate-check.test.mjs .github/scripts/policy-sign.test.mjs .github/scripts/risk-gate.test.mjs .github/scripts/change-set.test.mjs .github/scripts/verdict-signature.test.mjs
# tests 423  # pass 423  # fail 0  (exit 0)

Red first — the same tree with .github/workflows/test.yml, .github/scripts/gate-ruleset.mjs and .github/agent/merge-gate-ruleset.json restored to the base blob c204f657, this tip's test files kept:

$ TZ=UTC node --test .github/scripts/test-workflow.test.mjs .github/scripts/gate-ruleset.test.mjs
not ok 3 - #2124: the gate requires the signature job as a context of its own
not ok 17 - #2124: the signature is its own job, named for the required context
not ok 18 - #2124: deleting the signature job leaves the required context unreported, not green
not ok 19 - tests-ok: always runs and is green only when policy-sign, test, plugins and package are
# tests 36  # pass 32  # fail 4  (exit 1)

Not run: npm run verify's lint steps and the core/ + plugins/ suites (this diff changes no file under core/ or plugins/), the smoke bench, and CI's package / ubuntu-latest · Node 24 jobs — those are read on the tip page below, not re-run here.

Review points

  • Tip state at 8d6627489c. Green: plugins (tree|social|timeline|workflow), package, merge-gate, reviewed tip (report only), risk tier (report only). Red: policy-sign — a gate file changed (.github/workflows/test.yml), and the body carries no Policy-sign: line naming a comment; tests-ok — the test job skipped because policy-sign failed; enqueue-guard — no Verifier report names the tip 8d6627489c3c. None of the three is a defect in the tree: this comment is the signature the body will name, and the suite behind it is what went red on the missing line.
  • Diff. 8 files, +116/−33: test.yml (the policy-sign job, test: needs: policy-sign, tests-ok needs and checks all four), merge-gate-ruleset.json +1, gate-ruleset.mjs +2/−2, test-workflow.test.mjs +58/−3, gate-ruleset.test.mjs +9, docs/governance.md +12/−5, docs/autonomous-dev.md +4/−3, one changelog fragment. No core/ file, so no generated patch, client.js or core/ suite is involved.
  • The defect is real and closed. A required context is a job name, so the signature as a step of test left test green when the step was deleted. The bug(ci): deleting the signature step from test.yml still passes — the gate has no required context of its own #2124 tests read the job graph the way GitHub does and assert that deleting the job leaves test and tests-ok naming a job that no longer exists — red on the base sources (4 failures), green at this tip (423/423).
  • The doc half stays honest. docs/governance.md says the live ruleset is the owner's edit and the job only reports until it is made, and the body says Part of #2124, not Fixes, for the same reason: the merge path still accepts a pull request where policy-sign never reported.
  • Checkpoint block parses: pr 2309, claim Dev4 (= the Owner: line), issue 2124, all 8 files in the diff, checks.at = this tip, next names the owner's ruleset edit.
  • One conclusion at this tip; the implementer wrote none of it; the second person this gate change needs is this comment, not a second review.

Not merge authority: this PASS does not enqueue the pull request. Policy-sign: and the re-run stay with the Chief.

@github-actions github-actions Bot added the pass label Nov 3, 2026
@Birfy
Birfy added this pull request to the merge queue Nov 3, 2026
Merged via the queue into ThinkFlowLab:main with commit a11983c Nov 3, 2026
23 of 27 checks passed
@Birfy
Birfy deleted the dev/4-signature-job branch November 3, 2026 14:50
@Birfy

Birfy commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

确认理解一致:#2124 的关键是 required context 认的是 job 名,不是 workflow 名。signature 原来作为 test 的一个 step,删掉它 test 依然绿,规则集里一个 context 都不少,等于校验被静默移除。

#2309 拆成独立 job policy-sign + test 的 needs: policy-sign,删 job 会少一个 required context,删 step 会让 test 直接起不来,两条退路都封住了。

两个细节想请你确认:

  1. policy-sign 用 merge_group.base_sha || pull_request.base.sha 取基线,这块注释里解释过——队列运行没有 pull_request,只写那半边会退回到触发 sha。这个回退逻辑有测试覆盖吗?
  2. 现在 policy-sign 只有 5 分钟超时、跑在 base/.github/scripts/policy-sign.mjs。如果有人在 base 分支上把 policy-sign.mjs 改弱,前一个 PR 是否还能被正确判定?The gate change signature is judged by the pull request's own copy of the checker #2099 那条注释说了 checker 取自 base commit,但我想确认这条路径本身有没有对应的回归测试,而不是只靠注释保证。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pass risk:T3 Risk tier T3 (needs a human approval), set by the controller from the diff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants