An open source design system that's fully customizable and agent ready
TypeScript
ci(spec-owner): designers approve with a review or /approve-spec, not a ready transition (#8900)
Cindy Zhang4eea4b605e3f
diff --git a/.github/DESIGNOWNERS b/.github/DESIGNOWNERSindex b32fea8b6d..c14efed5df 100644--- a/.github/DESIGNOWNERS+++ b/.github/DESIGNOWNERS@@ -4,16 +4,16 @@# - Current design and theme specs, component/module Design decisions, and# normative design assets may receive exact-head approval from any# DESIGNOWNER. ENGOWNERS may approve every spec.-# - A DESIGNOWNER author may attest an exact PR head by marking the PR ready for-# review. That evidence satisfies the design-approval group even in a mixed PR;-# every other applicable code or spec-owner group remains required. A-# classifier-proven appearance-only Core runtime change may also bypass the-# engineering review gate only when no other code reason applies. The+# - A DESIGNOWNER approves with an exact-head review or `/approve-spec <head>`,+# like every other owner; in a mixed PR every other applicable code or+# spec-owner group remains required. A classifier-proven appearance-only Core+# runtime change may bypass the engineering review gate only when no other+# code reason applies. The# existing gate may enable squash auto-merge only when every changed path is a# recognized spec record and every required group and branch check passes.# - Review tooling may use the list to frame design-authored changes.#-# This is not general merge permission. A design attestation alone never+# This is not general merge permission. Design approval alone never# authorizes non-design records or mixed code/spec changes, and any code path# prevents the spec-only auto-merge path.#diff --git a/.github/REVIEW_GATE.md b/.github/REVIEW_GATE.mdindex 763b9b4402..001684193a 100644--- a/.github/REVIEW_GATE.md+++ b/.github/REVIEW_GATE.md@@ -60,16 +60,7 @@ live pull request last, and if a status still lands on a head that settledduring that window, the run logs the status as unverified and stops beforeauto-merge.-When a DESIGNOWNER authors a PR, marking it ready for review attests that exact-head **for the design-approval group only**. The attestation is published only-for a `.github/DESIGNOWNERS` handle, and it is read back only for a handle that-is still in that file — a marker left by someone since removed, or published-before this rule existed, authorizes nothing. It satisfies no other group: the-non-design and theme groups always need a real exact-head review or command from-someone in their own list. An engineering owner cannot attest their own head.--The attestation does not grant auto-merge by itself. The existing gate may enable-squash auto-merge only when every changed path is a recognized spec record,+The gate may enable squash auto-merge only when every changed path is a recognized spec record,every required owner group has approved the exact head, and all branch checkspass. Normative assets and indexes are outside that scope; adding any code pathalso prevents the spec-only auto-merge path.diff --git a/.github/scripts/spec-owner-decision.cjs b/.github/scripts/spec-owner-decision.cjsindex 5a1e1787af..26788d628f 100644--- a/.github/scripts/spec-owner-decision.cjs+++ b/.github/scripts/spec-owner-decision.cjs@@ -15,7 +15,6 @@ const {/* eslint-enable @typescript-eslint/no-require-imports */const GATE_STATUS_CONTEXT = 'spec-owner-approval';-const READY_STATUS_PREFIX = 'spec-owner-ready/';const TRUSTED_STATUS_CREATOR = 'github-actions[bot]';// The workflow trigger filters comments with GitHub's `startsWith` against the@@ -83,7 +82,7 @@ function candidateTime(candidate) {function candidatePriority(candidate) {if (candidate.approved === false || candidate.approved === null) return 2;- return candidate.source === 'ready' ? 0 : 1;+ return 1;}function latestDismissalAt(review, dismissalEvents) {@@ -104,7 +103,6 @@ function latestDismissalAt(review, dismissalEvents) {function resolveOwnerDecision({reviews,comments,- readyAttestations = [],dismissalEvents = [],owners,headSha,@@ -127,15 +125,6 @@ function resolveOwnerDecision({}}- for (const attestation of readyAttestations) {- if (attestation.headSha !== headSha) continue;- consider(attestation.owner, {- approved: true,- at: attestation.at,- source: 'ready',- });- }-for (const review of reviews) {const login = review.user?.login?.toLowerCase();if (!login || review.commit_id !== headSha) continue;@@ -215,40 +204,6 @@ function isTrustedWorkflowStatus(status, repository) {);}-function parseReadyAttestations(statuses, {repository, headSha, owners}) {- // A ready marker is only design-group evidence, and only from a handle that- // is a design owner *now*. Markers published before that rule existed, or- // by someone since removed from .github/DESIGNOWNERS, are historical noise- // and must not authorize anything.- const allowed = new Set((owners ?? []).map(owner => owner.toLowerCase()));- const attestations = [];- for (const status of statuses) {- if (- status.state !== 'success' ||- !status.context?.startsWith(READY_STATUS_PREFIX) ||- !isTrustedWorkflowStatus(status, repository)- ) {- continue;- }- const owner = status.context- .slice(READY_STATUS_PREFIX.length)- .toLowerCase();- if (!/^[a-z0-9-]+$/.test(owner) || !allowed.has(owner)) continue;- const match = status.description?.match(- /^Owner ready at (\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z)\.$/,- );- if (!match || Number.isNaN(Date.parse(match[1]))) continue;- attestations.push({- approved: true,- at: match[1],- headSha,- owner,- source: 'ready',- });- }- return attestations;-}-function newestGateRun(statuses, repository) {let newest = null;for (const status of statuses) {@@ -326,7 +281,6 @@ function requiresOwnerApproval(records, options = {}) {module.exports = {GATE_STATUS_CONTEXT,OWNER_COMMAND_PREFIXES,- READY_STATUS_PREFIX,canonicalRunUrl,describeOwnerCommandProblem,isDispatchableOwnerCommand,@@ -337,7 +291,6 @@ module.exports = {parseOwnerCommand,parseOwnerCommandIntent,parseOwnerFile,- parseReadyAttestations,requiredApprovalGroups,requiresOwnerApproval,resolveOwnerDecision,diff --git a/.github/scripts/spec-owner-decision.test.mjs b/.github/scripts/spec-owner-decision.test.mjsindex 0ec6817fc4..7571c51e21 100644--- a/.github/scripts/spec-owner-decision.test.mjs+++ b/.github/scripts/spec-owner-decision.test.mjs@@ -14,7 +14,6 @@ const {parseOwnerCommand,parseOwnerCommandIntent,parseOwnerFile,- parseReadyAttestations,requiredApprovalGroups,resolveOwnerDecision,} = require('./spec-owner-decision.cjs');@@ -393,103 +392,17 @@ describe('spec owner decision', () => {expect(decision.approved).toBe(false);});- it('accepts only trusted workflow ready attestations', () => {- const repository = 'meta/astryx';- const trusted = {- context: 'spec-owner-ready/cixzhang',- state: 'success',- description: 'Owner ready at 2026-08-30T10:00:00.000Z.',- target_url: canonicalRunUrl(repository, '9007199254740993', '2'),- creator: {login: 'github-actions[bot]'},- };- const attestations = parseReadyAttestations(- [- trusted,- {...trusted, creator: {login: 'cixzhang'}},- {...trusted, target_url: 'https://example.com/forged'},- {...trusted, description: 'owner says ready'},- ],- {repository, headSha: head, owners: ['cixzhang']},- );-- expect(attestations).toEqual([- {- approved: true,- at: '2026-08-30T10:00:00.000Z',- headSha: head,- owner: 'cixzhang',- source: 'ready',- },- ]);- expect(- resolveOwnerDecision({- owners: ['cixzhang'],- headSha: head,- reviews: [],- comments: [],- readyAttestations: attestations,- }),- ).toMatchObject({approved: true, owner: 'cixzhang', source: 'ready'});- });-- it('invalidates a ready attestation on a new head', () => {- const decision = resolveOwnerDecision({- owners: ['cixzhang'],- headSha: '1111111111111111111111111111111111111111',- reviews: [],- comments: [],- readyAttestations: [- {- owner: 'cixzhang',- headSha: head,- at: '2026-08-30T10:00:00Z',- },- ],- });-- expect(decision.approved).toBe(false);- });-- it('lets a newer exact-head revoke override owner-ready', () => {+ it('orders dismissal by updated_at instead of the original submission', () => {const decision = resolveOwnerDecision({owners: ['cixzhang'],headSha: head,- reviews: [],- readyAttestations: [- {- owner: 'cixzhang',- headSha: head,- at: '2026-08-30T10:00:00Z',- },- ],comments: [{user: owner,- body: `/revoke-spec ${head}`,+ body: `/approve-spec ${head}`,created_at: '2026-08-30T10:01:00Z',},],- });-- expect(decision).toMatchObject({- approved: false,- owner: 'cixzhang',- source: 'command',- });- });-- it('orders dismissal by updated_at instead of the original submission', () => {- const decision = resolveOwnerDecision({- owners: ['cixzhang'],- headSha: head,- comments: [],- readyAttestations: [- {- owner: 'cixzhang',- headSha: head,- at: '2026-08-30T10:01:00Z',- },- ],reviews: [{id: 17,@@ -502,6 +415,7 @@ describe('spec owner decision', () => {],});+ // The dismissal is dated by its update, so it follows the command.expect(decision.approved).toBe(false);expect(decision.source).toBe(null);});@@ -510,12 +424,11 @@ describe('spec owner decision', () => {const decision = resolveOwnerDecision({owners: ['cixzhang'],headSha: head,- comments: [],- readyAttestations: [+ comments: [{- owner: 'cixzhang',- headSha: head,- at: '2026-08-30T10:01:00Z',+ user: owner,+ body: `/approve-spec ${head}`,+ created_at: '2026-08-30T10:01:00Z',},],reviews: [@@ -540,6 +453,31 @@ describe('spec owner decision', () => {expect(decision.approved).toBe(false);});+ it('lets a command after the dismissal approve again', () => {+ const decision = resolveOwnerDecision({+ owners: ['cixzhang'],+ headSha: head,+ comments: [+ {+ user: owner,+ body: `/approve-spec ${head}`,+ created_at: '2026-08-30T10:03:00Z',+ },+ ],+ reviews: [+ {+ id: 17,+ user: owner,+ state: 'DISMISSED',+ commit_id: head,+ submitted_at: '2026-08-30T09:00:00Z',+ updated_at: '2026-08-30T10:02:00Z',+ },+ ],+ });++ expect(decision.approved).toBe(true);+ });it('compares workflow run ids without losing integer precision', () => {const repository = 'meta/astryx';const statuses = ['9007199254740992', '9007199254740993'].map(runId => ({@@ -556,69 +494,6 @@ describe('spec owner decision', () => {expect(newestGateRun(statuses, repository)?.runId).toBe(9007199254740993n);});- it('accepts a ready marker only from a current design owner', () => {- const repository = 'meta/astryx';- const marker = login => ({- context: `spec-owner-ready/${login}`,- state: 'success',- description: 'Owner ready at 2026-08-30T10:00:00.000Z.',- target_url: canonicalRunUrl(repository, '42', '1'),- creator: {login: 'github-actions[bot]'},- });- const statuses = [marker('ernestt'), marker('imdreamrunner')];-- // imdreamrunner is an engineering owner and a design *approver*, but not a- // design owner. A marker they published — including one predating the rule that- // only design owners self-attest — is not evidence for any group.- expect(- parseReadyAttestations(statuses, {- repository,- headSha: head,- owners: ['ernestt', 'rubyycheung'],- }).map(attestation => attestation.owner),- ).toEqual(['ernestt']);-- // A handle removed from DESIGNOWNERS stops counting immediately.- expect(- parseReadyAttestations(statuses, {- repository,- headSha: head,- owners: ['rubyycheung'],- }),- ).toEqual([]);- expect(- parseReadyAttestations(statuses, {repository, headSha: head}),- ).toEqual([]);- });-- it('does not let a stale ready marker approve the design group', () => {- const repository = 'meta/astryx';- const designApprovers = ['cixzhang', 'imdreamrunner', 'ernestt'];- const stale = [- {- context: 'spec-owner-ready/imdreamrunner',- state: 'success',- description: 'Owner ready at 2026-09-04T05:54:18.000Z.',- target_url: canonicalRunUrl(repository, '42', '1'),- creator: {login: 'github-actions[bot]'},- },- ];-- expect(- resolveOwnerDecision({- owners: designApprovers,- headSha: head,- reviews: [],- comments: [],- readyAttestations: parseReadyAttestations(stale, {- repository,- headSha: head,- owners: ['ernestt', 'rubyycheung'],- }),- }).approved,- ).toBe(false);- });-describe('recognizing a command that does not decide the gate', () => {it('recognizes the owner-command shape whatever it names', () => {expect(parseOwnerCommandIntent('/approve-spec')).toEqual({diff --git a/.github/scripts/spec-owner-reconcile.cjs b/.github/scripts/spec-owner-reconcile.cjsindex 8639fb3b77..99669d507d 100644--- a/.github/scripts/spec-owner-reconcile.cjs+++ b/.github/scripts/spec-owner-reconcile.cjs@@ -9,14 +9,12 @@ const path = require('node:path');const {classifyChanges} = require('./change-scope.cjs');const {GATE_STATUS_CONTEXT,- READY_STATUS_PREFIX,canonicalRunUrl,describeOwnerCommandProblem,newestGateRun,parseOwnerCommand,parseOwnerCommandIntent,parseOwnerFile,- parseReadyAttestations,requiredApprovalGroups,resolveOwnerDecision,} = require('./spec-owner-decision.cjs');@@ -429,30 +427,6 @@ async function reconcileSpecOwnerGate({});if (await restoreNewerStatus(initialHead)) return;- const actor = context.actor?.toLowerCase();- const eventHead = context.payload.pull_request?.head?.sha;- const eventTime = context.payload.pull_request?.updated_at;- // Only a DESIGNOWNER author may self-attest a head, and only for the design- // approval group (.github/DESIGNOWNERS). An engineering owner marking their- // own pull request ready is not an approval by anyone else.- if (- context.eventName === 'pull_request_target' &&- context.payload.action === 'ready_for_review' &&- actor &&- actor === initialPr.user.login.toLowerCase() &&- designOwners.includes(actor) &&- eventHead === initialHead &&- eventTime &&- !Number.isNaN(Date.parse(eventTime))- ) {- await createStatus({- sha: initialHead,- context: `${READY_STATUS_PREFIX}${actor}`,- state: 'success',- description: `Owner ready at ${new Date(eventTime).toISOString()}.`,- });- }-const commentAuthor = context.payload.comment?.user?.login?.toLowerCase();const reviewAuthor = context.payload.review?.user?.login?.toLowerCase();const explicitRevoke =@@ -538,29 +512,17 @@ async function reconcileSpecOwnerGate({}const designApprovers = [...new Set([...engineeringOwners, ...designOwners])];const themeApprovers = [...new Set([...engineeringOwners, ...designOwners])];- const readyAttestations = parseReadyAttestations(statuses, {- repository,- headSha: initialHead,- owners: designOwners,- });const decisionInput = {reviews,comments,dismissalEvents: timeline,headSha: initialHead,};- // A ready-for-review attestation is the design group's own self-attestation- // path. It is not evidence for the non-design or theme groups, which stay on- // real exact-head reviews and commands.const specDecision = requiredGroups.spec? resolveOwnerDecision({...decisionInput, owners: engineeringOwners}): {approved: true, owner: null};const designDecision = requiredGroups.design- ? resolveOwnerDecision({- ...decisionInput,- readyAttestations,- owners: designApprovers,- })+ ? resolveOwnerDecision({...decisionInput, owners: designApprovers}): {approved: true, owner: null};const themeDecision = requiredGroups.theme? resolveOwnerDecision({...decisionInput, owners: themeApprovers})diff --git a/.github/scripts/spec-owner-reconcile.test.mjs b/.github/scripts/spec-owner-reconcile.test.mjsindex 7bf0ff6b42..d399eeadca 100644--- a/.github/scripts/spec-owner-reconcile.test.mjs+++ b/.github/scripts/spec-owner-reconcile.test.mjs@@ -273,7 +273,7 @@ function currentComponentSpec(decision, body = 'Body.') {}// Exact-head approval by a real spec owner. The auto-merge mechanics below-// need an approved head; they must not borrow the design self-attestation.+// need an approved head.const specOwnerReview = {user: {login: 'imdreamrunner'},state: 'APPROVED',@@ -294,52 +294,7 @@ function createDesignHarness(options = {}) {});}-function hasReadyAttestation(state, owner = 'ernestt') {- return state.statuses.some(- status => status.context === `spec-owner-ready/${owner}`,- );-}-describe('spec owner workflow reconciliation', () => {- it('never lets an ENGOWNER author self-attest their own head', async () => {- const harness = createHarness();-- await run(harness, context({runId: 100n}));-- expect(- harness.state.statuses.some(status =>- status.context.startsWith('spec-owner-ready/'),- ),- ).toBe(false);- expect(latestGateStatus(harness.state)).toMatchObject({- state: 'pending',- description: expect.stringContaining('engineering owner'),- });- expect(harness.state.calls).not.toContain('enable-auto-merge');- expect(harness.state.pr.auto_merge).toBe(null);- });-- it('keeps a DESIGNOWNER ready attestation out of the spec approval group', async () => {- const harness = createHarness({- author: 'ernestt',- headContent: 'kind: architecture\nauthority: current\n',- });-- await run(- harness,- context({runId: 100n, actor: 'ernestt', author: 'ernestt'}),- );-- // The attestation is published for the design group, and the non-design- // group still waits for a real exact-head engineering-owner decision.- expect(hasReadyAttestation(harness.state)).toBe(true);- expect(latestGateStatus(harness.state)).toMatchObject({- state: 'pending',- description: expect.stringContaining('engineering owner'),- });- expect(harness.state.calls).not.toContain('enable-auto-merge');- });-it('clears the gate on an exact-head ENGOWNER review', async () => {const harness = createApprovedHarness();@@ -436,121 +391,6 @@ describe('spec owner workflow reconciliation', () => {expect(harness.state.calls).toContain('enable-auto-merge');});- it('lets a DESIGNOWNER author self-attest an exact design-record-only head', async () => {- const harness = createDesignHarness();-- await run(- harness,- context({runId: 100n, actor: 'ernestt', author: 'ernestt'}),- );-- expect(hasReadyAttestation(harness.state)).toBe(true);- expect(latestGateStatus(harness.state)).toMatchObject({- state: 'success',- description: expect.stringContaining('Approved by @ernestt'),- });- expect(harness.state.calls).toContain('enable-auto-merge');- });-- it('lets a DESIGNOWNER author self-attest an exact DD-only component spec head', async () => {- const harness = createHarness({- author: 'ernestt',- changedFile: componentRecord,- baseContent: currentComponentSpec('Use a quiet label.'),- headContent: currentComponentSpec('Keep the label quiet.'),- });-- await run(- harness,- context({runId: 100n, actor: 'ernestt', author: 'ernestt'}),- );-- expect(hasReadyAttestation(harness.state)).toBe(true);- expect(latestGateStatus(harness.state)).toMatchObject({- state: 'success',- description: expect.stringContaining('Approved by @ernestt'),- });- });-- it('keeps mixed DD and component-contract edits waiting for engineering', async () => {- const harness = createHarness({- author: 'ernestt',- changedFile: componentRecord,- baseContent: currentComponentSpec('Use a quiet label.'),- headContent: currentComponentSpec(- 'Keep the label quiet.',- 'Changed behavioral contract.',- ),- });-- await run(- harness,- context({runId: 100n, actor: 'ernestt', author: 'ernestt'}),- );-- expect(hasReadyAttestation(harness.state)).toBe(true);- expect(latestGateStatus(harness.state)).toMatchObject({- state: 'pending',- description: expect.stringContaining('engineering owner'),- });- expect(harness.state.calls).not.toContain('enable-auto-merge');- });-- it('requires the ready actor to be the PR author', async () => {- const harness = createDesignHarness();-- await run(- harness,- context({runId: 100n, actor: 'rubyycheung', author: 'ernestt'}),- );-- expect(hasReadyAttestation(harness.state, 'rubyycheung')).toBe(false);- expect(latestGateStatus(harness.state).state).toBe('pending');- expect(harness.state.calls).not.toContain('enable-auto-merge');- });-- it('requires the ready event to identify the exact live head', async () => {- const harness = createDesignHarness();-- await run(- harness,- context({- runId: 100n,- actor: 'ernestt',- author: 'ernestt',- headSha: nextHead,- }),- );-- expect(hasReadyAttestation(harness.state)).toBe(false);- expect(latestGateStatus(harness.state).state).toBe('pending');- expect(harness.state.calls).not.toContain('enable-auto-merge');- });-- it('keeps a DESIGNOWNER ready marker outside the spec-only auto-merge path', async () => {- const harness = createDesignHarness({- changedFiles: [- designRecord,- {- filename: 'packages/core/src/Button/Button.tsx',- status: 'modified',- },- ],- });-- await run(- harness,- context({runId: 100n, actor: 'ernestt', author: 'ernestt'}),- );-- // The exact-head marker is evidence for applicable owner groups, not merge- // authority. Mixed code/spec scope must stop before auto-merge enablement.- expect(hasReadyAttestation(harness.state)).toBe(true);- expect(latestGateStatus(harness.state).state).toBe('success');- expect(harness.state.calls).not.toContain('enable-auto-merge');- expect(harness.state.pr.auto_merge).toBe(null);- });-it.each(['packages/core/src/__tests__/TopLevel.spec.md','packages/core/src/Button/.hidden/Hidden.spec.md',@@ -571,34 +411,6 @@ describe('spec owner workflow reconciliation', () => {expect(harness.state.calls).not.toContain('enable-auto-merge');});- it('requires a real ready transition and never auto-merges a draft PR', async () => {- const readyDraft = createDesignHarness({draft: true});-- await run(- readyDraft,- context({runId: 100n, actor: 'ernestt', author: 'ernestt'}),- );-- expect(hasReadyAttestation(readyDraft.state)).toBe(true);- expect(readyDraft.state.calls).not.toContain('enable-auto-merge');- expect(readyDraft.state.pr.auto_merge).toBe(null);-- const synchronizedDraft = createDesignHarness({draft: true});- await run(- synchronizedDraft,- context({- runId: 101n,- action: 'synchronize',- actor: 'ernestt',- author: 'ernestt',- }),- );-- expect(hasReadyAttestation(synchronizedDraft.state)).toBe(false);- expect(synchronizedDraft.state.calls).not.toContain('enable-auto-merge');- expect(synchronizedDraft.state.pr.auto_merge).toBe(null);- });-it('publishes owner approval and keeps conservative ownership when enablement is rejected', async () => {const harness = createApprovedHarness({onEnableAutoMerge: () => {@@ -726,23 +538,6 @@ describe('spec owner workflow reconciliation', () => {expect(catchBlock).not.toContain('cleanupFailedAutoMergeEnable');});- it('does not attest ready_for_review by a non-owner author', async () => {- const harness = createHarness({author: 'contributor'});-- await run(- harness,- context({runId: 100n, actor: 'contributor', author: 'contributor'}),- );-- expect(- harness.state.statuses.some(status =>- status.context.startsWith('spec-owner-ready/'),- ),- ).toBe(false);- expect(latestGateStatus(harness.state).state).toBe('pending');- expect(harness.state.calls).not.toContain('enable-auto-merge');- });-it('keeps a current theme change pending without exact-head approval', async () => {const harness = createHarness({changedFile: {@@ -981,49 +776,6 @@ describe('spec owner workflow reconciliation', () => {expect(harness.state.pr.auto_merge).toBe(null);});- it('uses dismissal ordering and immediately disables owned auto-merge', async () => {- const ready = trustedStatus({- runId: 90n,- statusContext: 'spec-owner-ready/cixzhang',- state: 'success',- description: 'Owner ready at 2026-08-30T10:01:00.000Z.',- });- const review = {- id: 17,- user: {login: 'cixzhang'},- state: 'DISMISSED',- commit_id: head,- submitted_at: '2026-08-30T09:00:00Z',- updated_at: '2026-08-30T10:02:00Z',- };- const harness = createHarness({- statuses: [ready],- reviews: [review],- timeline: [- {- event: 'review_dismissed',- created_at: '2026-08-30T10:02:00Z',- dismissed_review: {review_id: 17},- },- ],- labels: ['spec-auto-merge'],- autoMerge: {merge_method: 'squash'},- });-- await run(- harness,- context({- runId: 100n,- eventName: 'pull_request_review',- action: 'dismissed',- review,- }),- );-- expect(harness.state.pr.auto_merge).toBe(null);- expect(latestGateStatus(harness.state).state).toBe('pending');- });-it('yields to a newer run id instead of applying stale approval', async () => {const harness = createHarness({statuses: [trustedStatus({runId: 101n, state: 'success'})],@@ -1077,6 +829,90 @@ describe('spec owner workflow reconciliation', () => {]);});+ it('uses dismissal ordering and immediately disables owned auto-merge', async () => {+ const review = {+ id: 17,+ user: {login: 'cixzhang'},+ state: 'DISMISSED',+ commit_id: head,+ submitted_at: '2026-08-30T09:00:00Z',+ updated_at: '2026-08-30T10:02:00Z',+ };+ // A same-owner command at 10:01; the dismissal is dated by its 10:02+ // timeline event, so it is the latest act and the gate waits.+ const command = {+ user: {login: 'cixzhang'},+ body: `/approve-spec ${head}`,+ created_at: '2026-08-30T10:01:00Z',+ };+ const harness = createHarness({+ comments: [command],+ reviews: [review],+ timeline: [+ {+ event: 'review_dismissed',+ created_at: '2026-08-30T10:02:00Z',+ dismissed_review: {review_id: 17},+ },+ ],+ labels: ['spec-auto-merge'],+ autoMerge: {merge_method: 'squash'},+ });++ await run(+ harness,+ context({+ runId: 100n,+ eventName: 'pull_request_review',+ action: 'dismissed',+ review,+ }),+ );++ expect(harness.state.pr.auto_merge).toBe(null);+ expect(latestGateStatus(harness.state).state).toBe('pending');+ });++ it('keeps mixed DD and component-contract edits waiting for engineering', async () => {+ const harness = createHarness({+ author: 'ernestt',+ changedFile: componentRecord,+ baseContent: currentComponentSpec('Use a quiet label.'),+ headContent: currentComponentSpec(+ 'Keep the label quiet.',+ 'Changed behavioral contract.',+ ),+ reviews: [+ {+ user: {login: 'rubyycheung'},+ state: 'APPROVED',+ commit_id: head,+ submitted_at: '2026-08-30T09:59:00Z',+ },+ ],+ });++ await run(+ harness,+ context({runId: 100n, actor: 'ernestt', author: 'ernestt'}),+ );++ expect(latestGateStatus(harness.state)).toMatchObject({+ state: 'pending',+ description: expect.stringContaining('engineering owner'),+ });+ expect(harness.state.calls).not.toContain('enable-auto-merge');+ });++ it('never auto-merges a draft PR', async () => {+ const harness = createApprovedHarness({draft: true});++ await run(harness, context({runId: 100n}));++ expect(harness.state.calls).not.toContain('enable-auto-merge');+ expect(harness.state.pr.auto_merge).toBe(null);+ });+it('reconciles same-repository owner reviews automatically', async () => {const review = {user: {login: 'cixzhang'},@@ -1321,67 +1157,6 @@ describe('spec owner workflow reconciliation', () => {});});- it('ignores a ready marker from a handle that is not a design owner', async () => {- // Live shape from PR #5543: an engineering owner marked their own PR ready- // before the design-only rule, leaving a trusted spec-owner-ready status on the- // head. It must not satisfy the design group it is not a member of.- const harness = createDesignHarness({- author: 'imdreamrunner',- statuses: [- trustedStatus({- runId: 90n,- statusContext: 'spec-owner-ready/imdreamrunner',- state: 'success',- description: 'Owner ready at 2026-09-04T05:54:18.000Z.',- }),- ],- });-- await run(- harness,- context({- runId: 100n,- action: 'synchronize',- actor: 'imdreamrunner',- author: 'imdreamrunner',- }),- );-- expect(latestGateStatus(harness.state)).toMatchObject({- state: 'pending',- description: expect.stringContaining('design approver'),- });- expect(harness.state.calls).not.toContain('enable-auto-merge');- });-- it('still honours a ready marker from a current design owner', async () => {- const harness = createDesignHarness({- statuses: [- trustedStatus({- runId: 90n,- statusContext: 'spec-owner-ready/ernestt',- state: 'success',- description: 'Owner ready at 2026-08-30T09:59:00.000Z.',- }),- ],- });-- await run(- harness,- context({- runId: 100n,- action: 'synchronize',- actor: 'ernestt',- author: 'ernestt',- }),- );-- expect(latestGateStatus(harness.state)).toMatchObject({- state: 'success',- description: expect.stringContaining('@ernestt'),- });- });-it('does not restore a newer run\u2019s status onto a settled head', async () => {// Yielding writes too. If the pull request merged while this run worked,// the newer run's status is no more publishable than this run's own.diff --git a/.github/scripts/spec-owner-workflow.test.mjs b/.github/scripts/spec-owner-workflow.test.mjsindex efddd970ad..1dea8e4aed 100644--- a/.github/scripts/spec-owner-workflow.test.mjs+++ b/.github/scripts/spec-owner-workflow.test.mjs@@ -307,13 +307,8 @@ describe('spec-only workflow contract', () => {expect(reconciler).not.toContain('...new Set([...specOwners, ...engineeringOwners, ...designOwners])',);- // Only a DESIGNOWNER author self-attests, and only the design group- // reads that attestation.- expect(reconciler).toContain('designOwners.includes(actor)');- expect(reconciler).not.toContain('allOwners.has(actor)');- expect(reconciler).toContain(- 'readyAttestations,\n owners: designApprovers',- );+ // Every group approves through commands and reviews; no self-attestation.+ expect(reconciler).not.toContain('spec-owner-ready');expect(reconciler).toContain('isSettled(initialPr)');expect(reconciler).toContain('isPublishable(headSha)');expect(reconciler).toContain('specDecision.approved');@@ -395,14 +390,6 @@ describe('spec-only workflow contract', () => {);});- it('reads a ready attestation back only for a current design owner', () => {- const reconciler = read('.github/scripts/spec-owner-reconcile.cjs');- const decision = read('.github/scripts/spec-owner-decision.cjs');-- expect(reconciler).toContain('owners: designOwners');- expect(decision).toContain('!allowed.has(owner)');- });-it('does not run the privileged visual-report path for spec-only PRs', () => {const workflow = read('.github/workflows/pr-comment.yml');expect(workflow).toContain("needs.resolve.outputs.spec_only != 'true'");diff --git a/docs/architecture/knowledge-contracts.md b/docs/architecture/knowledge-contracts.mdindex a2a2d24b32..454b692380 100644--- a/docs/architecture/knowledge-contracts.md+++ b/docs/architecture/knowledge-contracts.md@@ -908,8 +908,8 @@ remains in `docs/design/`.A team DESIGNOWNER may include the local decision, implementation, and evidencein one atomic appearance-only pull request. DD-only current-record changes routeto design approval; mixing a DD edit with another component/module contract edit-requires both design and engineering. A DESIGNOWNER's exact-head ready transition-may satisfy the design group. The Core code gate is bypassed only when trusted-base+requires both design and engineering. A DESIGNOWNER approves with an exact-head+review or `/approve-spec <head>` like every other owner. The Core code gate is bypassed only when trusted-baseclassification proves an existing-file declaration-only appearance diff and noother code reason applies. Any uncertainty, contributor-authored change, behavior,JSX, API, package, barrel, new component, or unknown runtime path fails closed todiff --git a/docs/design/README.md b/docs/design/README.mdindex 02f52be03b..d86a1e7744 100644--- a/docs/design/README.md+++ b/docs/design/README.md@@ -52,9 +52,9 @@ of `.github/ENGOWNERS` or `.github/DESIGNOWNERS`. A mixed PR still needs anENGOWNER for non-design current records. The design record names its contentowners separately from this repository gate.-A DESIGNOWNER author may attest the exact PR head for the design-approval group-by marking it ready for review. That evidence also counts in a mixed PR, while-every other applicable code or spec-owner group remains required. The existing+A DESIGNOWNER approves with an exact-head review or `/approve-spec <head>`,+like every other owner; in a mixed PR every other applicable code or spec-owner+group remains required. The existinggate may enable squash auto-merge only when every changed path is a recognizedspec record, every required group has approved, and all branch checks pass.Normative assets and indexes are outside that scope; any code path prevents the