Repository navigation
ci: require Nik approval for account-scoped UI changes - #24200
Conversation
There was a problem hiding this comment.
4 issues found and verified against the latest diff
Confidence score: 2/5
ui-author-approval.cjsmisses real UI paths, so an actor PR can bypass the approval gate. ExpandisUIto cover the affected web and macOS paths.ui-author-approval.cjschecks account ID 9387252, but it’s unclear whether that belongs to Nik. Confirm the ID and update the actor check if needed.ui-author-approval.test.cjsis not wired into CI, so approval and fail-closed behavior can regress without a check failing. Register it in a Node test lane or add an explicit CI check.ui-author-approval.cjsmakes one serial GraphQL request per commit, which could make checks slow on large PRs. Batch the lookups or use bounded concurrency.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".github/scripts/ui-author-approval.cjs">
<violation number="1" location=".github/scripts/ui-author-approval.cjs:2">
P2: The gate checks the 'Git-on-my-level' account ID (9387252), but the description says it should match PRs and commits from Nik. Confirm that this ID is Nik's own GitHub account. If it is not, the actor check needs Nik's ID, and the `NIK_ID` approver check stays separate.</violation>
<violation number="2" location=".github/scripts/ui-author-approval.cjs:7">
P1: `isUI` misses real UI paths, allowing an actor PR to bypass this approval gate. For example, `web/admin/components/...tsx` and `desktop/macos/Desktop/Sources/MainWindow/.../ChatFirstShell.swift` are user-facing UI but match neither allowlist branch, making `required` false and the status pass; cover these UI trees and add regression cases for representative paths.</violation>
<violation number="3" location=".github/scripts/ui-author-approval.cjs:45">
P3: This runs one GraphQL request per commit, serially, so a 250-commit PR makes 250 round trips on every run. Batch the author lookups into one aliased GraphQL query, or run them with bounded concurrency.</violation>
</file>
<file name=".github/scripts/tests/ui-author-approval.test.cjs">
<violation number="1" location=".github/scripts/tests/ui-author-approval.test.cjs:1">
P2: This security-gate test is not wired into any CI check, so the covered approval and fail-closed behaviors can regress without failing the repository’s checks. Register this file in a Node test lane or add an explicit workflow/check-manifest command.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| const STATUS = 'UI author approval'; | ||
| const MARKER = '<!-- ui-author-approval:git-on-my-level -->'; | ||
| const isActor = user => user?.id === ACTOR_ID; | ||
| const isUI = path => /^(app\/lib\/(pages|widgets|ui|l10n)\/|desktop\/macos\/Desktop\/(Sources\/(Views|Components|Theme|UI)\/|Resources\/)|desktop\/windows\/src\/(components|pages|views|styles)\/|web\/[^/]+\/(app|src)\/.*\.(tsx|jsx|vue|css|scss|html|svg|png|jpg|webp)$|frontend\/.*\.(tsx|jsx|vue|css|scss|html|svg|png|jpg|webp)$)/.test(path) |
There was a problem hiding this comment.
P1: isUI misses real UI paths, allowing an actor PR to bypass this approval gate. For example, web/admin/components/...tsx and desktop/macos/Desktop/Sources/MainWindow/.../ChatFirstShell.swift are user-facing UI but match neither allowlist branch, making required false and the status pass; cover these UI trees and add regression cases for representative paths.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/scripts/ui-author-approval.cjs, line 7:
<comment>`isUI` misses real UI paths, allowing an actor PR to bypass this approval gate. For example, `web/admin/components/...tsx` and `desktop/macos/Desktop/Sources/MainWindow/.../ChatFirstShell.swift` are user-facing UI but match neither allowlist branch, making `required` false and the status pass; cover these UI trees and add regression cases for representative paths.</comment>
<file context>
@@ -0,0 +1,111 @@
+const STATUS = 'UI author approval';
+const MARKER = '<!-- ui-author-approval:git-on-my-level -->';
+const isActor = user => user?.id === ACTOR_ID;
+const isUI = path => /^(app\/lib\/(pages|widgets|ui|l10n)\/|desktop\/macos\/Desktop\/(Sources\/(Views|Components|Theme|UI)\/|Resources\/)|desktop\/windows\/src\/(components|pages|views|styles)\/|web\/[^/]+\/(app|src)\/.*\.(tsx|jsx|vue|css|scss|html|svg|png|jpg|webp)$|frontend\/.*\.(tsx|jsx|vue|css|scss|html|svg|png|jpg|webp)$)/.test(path)
+ || /^desktop\/macos\/Desktop\/Sources\/.*(View|ViewController|Window|Panel)\.swift$/.test(path)
+ || /^desktop\/windows\/src\/renderer\/.*\.(tsx|jsx|css|scss|html|svg|png|jpg|webp)$/.test(path)
</file context>
| @@ -0,0 +1,134 @@ | |||
| // Account-scoped UI approval. All inputs are API data, never executable PR code. | |||
| const ACTOR_ID = 9387252; // Git-on-my-level, stable across login renames. | |||
There was a problem hiding this comment.
P2: The gate checks the 'Git-on-my-level' account ID (9387252), but the description says it should match PRs and commits from Nik. Confirm that this ID is Nik's own GitHub account. If it is not, the actor check needs Nik's ID, and the NIK_ID approver check stays separate.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/scripts/ui-author-approval.cjs, line 2:
<comment>The gate checks the 'Git-on-my-level' account ID (9387252), but the description says it should match PRs and commits from Nik. Confirm that this ID is Nik's own GitHub account. If it is not, the actor check needs Nik's ID, and the `NIK_ID` approver check stays separate.</comment>
<file context>
@@ -0,0 +1,111 @@
+// Account-scoped UI approval. All inputs are API data, never executable PR code.
+const ACTOR_ID = 9387252; // Git-on-my-level, stable across login renames.
+const NIK_ID = 43514161;
+const STATUS = 'UI author approval';
</file context>
| @@ -0,0 +1,131 @@ | |||
| const {test} = require('node:test'); | |||
There was a problem hiding this comment.
P2: This security-gate test is not wired into any CI check, so the covered approval and fail-closed behaviors can regress without failing the repository’s checks. Register this file in a Node test lane or add an explicit workflow/check-manifest command.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/scripts/tests/ui-author-approval.test.cjs, line 1:
<comment>This security-gate test is not wired into any CI check, so the covered approval and fail-closed behaviors can regress without failing the repository’s checks. Register this file in a Node test lane or add an explicit workflow/check-manifest command.</comment>
<file context>
@@ -0,0 +1,98 @@
+const {test} = require('node:test');
+const assert = require('node:assert/strict');
+const {decision} = require('../ui-author-approval.cjs');
</file context>
| commits.push(...next.commits); | ||
| } | ||
| if (commits.length !== first.total_commits) throw new Error('Incomplete commit evidence'); | ||
| for (const commit of commits) { |
There was a problem hiding this comment.
P3: This runs one GraphQL request per commit, serially, so a 250-commit PR makes 250 round trips on every run. Batch the author lookups into one aliased GraphQL query, or run them with bounded concurrency.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/scripts/ui-author-approval.cjs, line 45:
<comment>This runs one GraphQL request per commit, serially, so a 250-commit PR makes 250 round trips on every run. Batch the author lookups into one aliased GraphQL query, or run them with bounded concurrency.</comment>
<file context>
@@ -0,0 +1,111 @@
+ commits.push(...next.commits);
+ }
+ if (commits.length !== first.total_commits) throw new Error('Incomplete commit evidence');
+ for (const commit of commits) {
+ const data = await github.graphql(`query($owner:String!,$name:String!,$oid:GitObjectID!) {
+ repository(owner:$owner,name:$name) { object(oid:$oid) { ... on Commit {
</file context>
What changed and why
Require Nik's explicit current-head approval for UI PRs involving Git-on-my-level as opener or linked commit author/coauthor. Other accounts and provider/backend-only work pass. The account introduced the transparent Home live row in commit 30b960c (#23366); #23417 only preserved it.
A read-only job resolves the immutable head before SHA-scoped concurrency. Replaced pending events therefore re-evaluate that same head, including current approval revocations, without scanning evidence for unrelated PRs. File/author evidence is bound to immutable base/head SHAs; SwiftUI source is inspected as data for arbitrarily named components. Trusted base workflow code reads API data, publishes
UI author approvalon the exact head and mentions @kodjima33 once per head. Nik approves with/approve-ui <full head SHA>and withdraws with/reject-ui <full head SHA>. No PR code executes with write credentials. API errors and incomplete author evidence fail closed.Verification
Node tests cover opener/author/committer/coauthor, unrelated work, rename detection, stale/wrong-user approval, revocation, API truncation, repeated notification deduplication, fresh-head notification and API failure. actionlint passes. Independent security review found and fixed shared-SHA status leakage, mutable PR evidence races, dropped pending revocations, and desktop UI location gaps. Twelve focused tests pass. Fresh independent security review approved 150e7d0. A live read-only API run on #24200 took 18.89 seconds and 11 API invocations, expanding to about 29 HTTP requests across 950 open PRs in ten summary pages (writes intercepted).
Activation
Parent owns merging. After the workflow is on main, add required status
UI author approval, bound to GitHub Actions app 15368, preserving Mobile Release Eligibility and strict=false. Do not require the status before the workflow exists. Existing administrator bypass remains unchanged (enforce_admins=false). No account access is revoked. Live Actions behavior is unverified until merged.Product invariants affected
none
Failure class (fixes)
Failure-Class: none