Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix(github): board writes need an approval that covers the column mapping
review9ca6409d280c
diff --git a/src/core/github/config.test.ts b/src/core/github/config.test.tsindex 572278eef..796ba3f12 100644--- a/src/core/github/config.test.ts+++ b/src/core/github/config.test.ts@@ -1,5 +1,5 @@import { describe, expect, it } from 'vitest'-import { normaliseProjectKanbanGitHub, parseGitHubRepository } from './config'+import { githubMappingDigest, normaliseProjectKanbanGitHub, parseGitHubRepository } from './config'const columns = [{ id: 'todo', title: 'To Do', color: '#0a84ff' },@@ -82,3 +82,42 @@ describe('normaliseProjectKanbanGitHub', () => {expect(normaliseProjectKanbanGitHub(input, columns)).toEqual({ ok: false, reason })})})++describe('githubMappingDigest', () => {+ const base = {+ columnMappings: [+ { columnId: 'todo', label: 'status:todo' },+ { columnId: 'done', label: 'status:done' }+ ],+ completionColumnId: 'done'+ }++ it('ignores what does not change a write: column order and mapping order', () => {+ const reordered = [...columns].reverse()+ const a = normaliseProjectKanbanGitHub(base, columns)+ const b = normaliseProjectKanbanGitHub({+ ...base, columnMappings: [...base.columnMappings].reverse()+ }, reordered)+ if (!a.ok || !b.ok) throw new Error('fixture')+ expect(githubMappingDigest('o/r', a.value)).toBe(githubMappingDigest('o/r', b.value))+ // The config revision DOES move with column order — which is why approval cannot reuse it:+ // dragging a column would silently revoke every write until the user re-approved.+ expect(a.value.revision).not.toBe(b.value.revision)+ })++ it.each([+ ['the repository', 'x/y', base],+ ['the completion column', 'o/r', { ...base, completionColumnId: 'todo' }],+ ['no completion column', 'o/r', { columnMappings: base.columnMappings }],+ ['a label spelling', 'o/r', { ...base, columnMappings: [+ { columnId: 'todo', label: 'status:Todo' }, { columnId: 'done', label: 'status:done' }+ ] }],+ ['a dropped mapping', 'o/r', { columnMappings: [{ columnId: 'done', label: 'status:done' }], completionColumnId: 'done' }]+ ])('changes with %s', (_name, repository, changed) => {+ const a = normaliseProjectKanbanGitHub(base, columns)+ const b = normaliseProjectKanbanGitHub(changed, columns)+ if (!a.ok || !b.ok) throw new Error('fixture')+ expect(githubMappingDigest(repository, b.value)).not.toBe(githubMappingDigest('o/r', a.value))+ expect(githubMappingDigest('o/r', a.value)).toMatch(/^[0-9a-f]{64}$/)+ })+})diff --git a/src/core/github/config.ts b/src/core/github/config.tsindex fa1de8bfa..8cb245574 100644--- a/src/core/github/config.ts+++ b/src/core/github/config.ts@@ -102,3 +102,22 @@ export function normaliseProjectKanbanGitHub(}return { ok: true, value: normalised }}++/**+ * What a local approval must cover beyond the repository: everything that decides what a board+ * WRITE does on GitHub — which label a column applies, and which column closes an issue.+ *+ * Those live in `.nodeterm/project.json`, which is git-shared: a pulled commit could otherwise+ * repoint "Done" at a label that triggers someone's automation, or make an innocent column close+ * issues, under an approval the user gave to something else. Column ORDER and titles are left out on+ * purpose — they change nothing GitHub sees, and `config.revision` (which does include order) would+ * make every column drag silently revoke writes.+ */+export function githubMappingDigest(repository: string, config: NormalisedProjectKanbanGitHub): string {+ const mappings = config.columnMappings+ .map((item) => [item.columnId, item.label] as const)+ .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))+ return createHash('sha256')+ .update(JSON.stringify([repository, config.completionColumnId ?? null, mappings]))+ .digest('hex')+}diff --git a/src/core/github/control-store.test.ts b/src/core/github/control-store.test.tsindex e2da63bb8..c02147bcd 100644--- a/src/core/github/control-store.test.ts+++ b/src/core/github/control-store.test.ts@@ -108,3 +108,29 @@ describe('GitHubControlStore', () => {})})})++describe('GitHubControlStore mapping approval', () => {+ const digest = 'a'.repeat(64)+ const input = { localApprovalId: 'local-a', projectId: 'project-a', repository: 'nodeterm/nodeterm' }++ it('records the column mapping it approved and answers for exactly that mapping', async () => {+ const store = new GitHubControlStore(userDataDir)+ const state = await store.approve({ expectedRevision: 0, ...input, mappingDigest: digest })+ expect(state.approvals[0].mappingDigest).toBe(digest)+ expect(store.isMappingApproved(state, { ...input, mappingDigest: digest })).toBe(true)+ expect(store.isMappingApproved(state, { ...input, mappingDigest: 'b'.repeat(64) })).toBe(false)+ expect(store.isMappingApproved(state, { ...input, repository: 'other/repo', mappingDigest: digest })).toBe(false)+ })++ it('keeps an approval written before mappings were bound: readable, but not approved for writes', async () => {+ await fs.writeFile(path.join(userDataDir, 'github-issues-control.json'), JSON.stringify({+ version: 1, revision: 3, authProvider: 'gh',+ approvals: [{ ...input, enabled: true, approvedAt: 1 }]+ }))+ const store = new GitHubControlStore(userDataDir)+ const state = await store.load()+ expect(state.revision).toBe(3)+ expect(store.isApproved(state, input)).toBe(true)+ expect(store.isMappingApproved(state, { ...input, mappingDigest: digest })).toBe(false)+ })+})diff --git a/src/core/github/control-store.ts b/src/core/github/control-store.tsindex 98dd69ea1..a5f7e700d 100644--- a/src/core/github/control-store.ts+++ b/src/core/github/control-store.ts@@ -27,6 +27,7 @@ type ApprovalInput = {localApprovalId: stringprojectId: stringrepository: string+ mappingDigest?: string}function validString(value: unknown, max = 512): value is string {@@ -40,7 +41,8 @@ function validApproval(value: unknown): value is GitHubProjectApproval {validString(approval.projectId, 256) &&parseGitHubRepository(approval.repository) === approval.repository &&approval.enabled === true &&- Number.isSafeInteger(approval.approvedAt) && approval.approvedAt > 0+ Number.isSafeInteger(approval.approvedAt) && approval.approvedAt > 0 &&+ (approval.mappingDigest === undefined || validString(approval.mappingDigest, 128))}function validState(value: unknown): value is GitHubControlState {@@ -74,7 +76,8 @@ export class GitHubControlStore {return this.mutate(input.expectedRevision, (state) => {if (!validString(input.localApprovalId, 128) ||!validString(input.projectId, 256) ||- parseGitHubRepository(input.repository) !== input.repository) {+ parseGitHubRepository(input.repository) !== input.repository ||+ (input.mappingDigest !== undefined && !validString(input.mappingDigest, 128))) {throw new GitHubControlError('invalid-control-input')}const approval: GitHubProjectApproval = {@@ -82,7 +85,8 @@ export class GitHubControlStore {projectId: input.projectId,repository: input.repository,enabled: true,- approvedAt: Date.now()+ approvedAt: Date.now(),+ ...(input.mappingDigest ? { mappingDigest: input.mappingDigest } : {})}return {...state,@@ -128,6 +132,20 @@ export class GitHubControlStore {approval.repository === input.repository)}+ /** Approved for WRITES: the repository approval, and the column mapping it was given for is the+ * one on disk now. An approval from before mappings were bound carries no digest and never+ * matches — it keeps reading (isApproved) until the user approves again. */+ isMappingApproved(+ state: GitHubControlState,+ input: { localApprovalId: string; projectId: string; repository: string; mappingDigest: string }+ ): boolean {+ return state.approvals.some((approval) => approval.enabled &&+ approval.localApprovalId === input.localApprovalId &&+ approval.projectId === input.projectId &&+ approval.repository === input.repository &&+ approval.mappingDigest === input.mappingDigest)+ }+private mutate(expectedRevision: number,change: (state: GitHubControlState) => GitHubControlStatediff --git a/src/core/github/host.test.ts b/src/core/github/host.test.tsindex 1a8200abc..ad99a908f 100644--- a/src/core/github/host.test.ts+++ b/src/core/github/host.test.ts@@ -28,6 +28,7 @@ const project: Project = {}function fixture() {+ let current: Project = projectlet state: GitHubControlState = {version: 1,revision: 0,@@ -49,11 +50,20 @@ function fixture() {repository: string}) => current.approvals.some((item) => item.localApprovalId === input.localApprovalId &&item.projectId === input.projectId && item.repository === input.repository)),+ isMappingApproved: vi.fn((current: GitHubControlState, input: {+ localApprovalId: string+ projectId: string+ repository: string+ mappingDigest: string+ }) => current.approvals.some((item) => item.localApprovalId === input.localApprovalId &&+ item.projectId === input.projectId && item.repository === input.repository &&+ item.mappingDigest === input.mappingDigest)),approve: vi.fn(async (input: {expectedRevision: numberlocalApprovalId: stringprojectId: stringrepository: string+ mappingDigest?: string}) => {state = {...state,@@ -98,8 +108,8 @@ function fixture() {createIssueComment: vi.fn()}const controller = new GitHubHostController({- project: vi.fn(async (id: string) => id === project.id- ? { project, localApprovalId: 'local-private-id' }+ project: vi.fn(async (id: string) => id === current.id+ ? { project: current, localApprovalId: 'local-private-id' }: null),detectRepository: vi.fn(async () => 'owner/repo'),controls,@@ -118,7 +128,11 @@ function fixture() {}: {}})- return { controller, controls, resolver, secret, client }+ return {+ controller, controls, resolver, secret, client,+ setProject: (next: Project) => { current = next },+ setState: (next: GitHubControlState) => { state = next }+ }}describe('GitHubHostController', () => {@@ -158,6 +172,39 @@ describe('GitHubHostController', () => {})})+ it('stops writes when a pulled commit changes the column mapping, until this machine approves it again', async () => {+ const { controller, setProject } = fixture()+ await controller.approve({ projectId: 'project-1', repository: 'owner/repo', expectedRevision: 0 })+ expect((await controller.contextForProject('project-1')).mappingApproved).toBe(true)++ // The completion column now closes issues from "Todo" — nobody on this machine agreed to that.+ setProject({ ...project, kanban: { ...project.kanban!, github: {+ ...project.kanban!.github!, completionColumnId: 'todo'+ } } })+ const changed = await controller.contextForProject('project-1')+ expect(changed.mappingApproved).toBe(false)+ const view = await controller.status('project-1')+ expect(view.project).toMatchObject({ approved: true, mappingApproved: false })++ await controller.approve({ projectId: 'project-1', repository: 'owner/repo', expectedRevision: 1 })+ expect((await controller.contextForProject('project-1')).mappingApproved).toBe(true)+ expect((await controller.status('project-1')).project?.mappingApproved).toBe(true)+ })++ it('keeps reading under an approval from before mappings were bound, but never writes under it', async () => {+ const { controller, setState } = fixture()+ setState({+ version: 1, revision: 4, authProvider: 'auto',+ approvals: [{+ localApprovalId: 'local-private-id', projectId: 'project-1', repository: 'owner/repo',+ enabled: true, approvedAt: 1+ }]+ })+ const context = await controller.projectContextForCache('project-1')+ expect(context.mappingApproved).toBe(false)+ expect((await controller.status('project-1')).project).toMatchObject({ approved: true, mappingApproved: false })+ })+it('rejects approval for a repository other than the configured or detected repository', async () => {const { controller } = fixture()await expect(controller.approve({diff --git a/src/core/github/host.ts b/src/core/github/host.tsindex 1957b9fbe..0d25e4134 100644--- a/src/core/github/host.ts+++ b/src/core/github/host.ts@@ -7,7 +7,7 @@ import type {GitHubRateStatus,GitHubThrottle} from '../../shared/github-issues'-import { normaliseProjectKanbanGitHub, parseGitHubRepository } from './config'+import { githubMappingDigest, normaliseProjectKanbanGitHub, parseGitHubRepository } from './config'import type { GitHubSecretStore, ResolvedGitHubCredential, TokenValidation } from './credentials'import { GitHubReachabilityError } from './failure'import type {@@ -39,6 +39,7 @@ type ControlStoreLike = {localApprovalId: stringprojectId: stringrepository: string+ mappingDigest?: string}): Promise<GitHubControlState>revoke(input: { expectedRevision: number; localApprovalId: string }): Promise<GitHubControlState>selectProvider(input: {@@ -50,6 +51,12 @@ type ControlStoreLike = {projectId: stringrepository: string}): boolean+ isMappingApproved(state: GitHubControlState, input: {+ localApprovalId: string+ projectId: string+ repository: string+ mappingDigest: string+ }): boolean}type CredentialResolverLike = {@@ -106,6 +113,16 @@ export class GitHubHostController {projectId,repository})+ // Only a VALID configuration has a mapping to approve; an invalid one keeps writes off anyway.+ const board = record.project.kanban+ const config = board?.github ? normaliseProjectKanbanGitHub(board.github, board.columns) : null+ const mappingApproved = approved && !!repository && !!config?.ok &&+ this.dependencies.controls.isMappingApproved(state, {+ localApprovalId: record.localApprovalId,+ projectId,+ repository,+ mappingDigest: githubMappingDigest(repository, config.value)+ })const authed = approved? this.authView(await this.dependencies.resolver.status(state.authProvider)): {@@ -124,7 +141,8 @@ export class GitHubHostController {projectId,...(repository ? { repository } : {}),...(detected ? { detectedRepository: detected } : {}),- approved+ approved,+ ...(approved ? { mappingApproved } : {})}}}@@ -138,10 +156,13 @@ export class GitHubHostController {if (parseGitHubRepository(input.repository) !== project.repository) {throw new GitHubHostError('repository-mismatch')}+ // The approval covers the column mapping as it is on disk NOW — what the user is looking at+ // when they click Approve. A later change to it (a pull, a teammate's commit) re-asks.await this.dependencies.controls.approve({...input,localApprovalId: project.localApprovalId,- repository: project.repository+ repository: project.repository,+ mappingDigest: githubMappingDigest(project.repository, project.config)})return this.status(input.projectId)}@@ -229,18 +250,25 @@ export class GitHubHostController {projectId,repository: project.repository})) throw new GitHubHostError('not-approved')- return this.cacheProjectContext(project, state.revision)+ return this.cacheProjectContext(project, state.revision, this.dependencies.controls.isMappingApproved(state, {+ localApprovalId: project.localApprovalId,+ projectId,+ repository: project.repository,+ mappingDigest: githubMappingDigest(project.repository, project.config)+ }))}async projectContextForCacheDeletion(projectId: string): Promise<GitHubIssueProjectContext> {const project = await this.resolveProject(projectId)const state = await this.dependencies.controls.load()- return this.cacheProjectContext(project, state.revision)+ // Deletion needs no approval at all, and certainly never writes to GitHub.+ return this.cacheProjectContext(project, state.revision, false)}private cacheProjectContext(project: ResolvedProject,- controlRevision: number+ controlRevision: number,+ mappingApproved: boolean): GitHubIssueProjectContext {return {localApprovalId: project.localApprovalId,@@ -248,6 +276,7 @@ export class GitHubHostController {repository: project.repository,config: project.config,controlRevision,+ mappingApproved,columnColors: Object.fromEntries((project.project.kanban?.columns ?? []).map((column) => [column.id, column.color]))diff --git a/src/core/github/service.test.ts b/src/core/github/service.test.tsindex 970f9fec7..b2570ebdf 100644--- a/src/core/github/service.test.ts+++ b/src/core/github/service.test.ts@@ -139,6 +139,7 @@ function context(client: FixtureClient, over: Partial<GitHubIssueServiceContext>userId: 'user-1',client,columnColors: { todo: '#0a84ff', doing: '#ffd60a', done: '#30d158' },+ mappingApproved: true,...over}}@@ -1271,3 +1272,49 @@ describe('GitHubIssueService close reason', () => {})).rejects.toThrow('mutation-not-confirmed')})})++describe('GitHubIssueService mapping approval', () => {+ async function ready(mappingApproved: boolean) {+ const shown = issue(1, { labels: [{ id: 1, name: 'status:todo', color: '0a84ff' }] })+ const client = new FixtureClient([shown])+ const cache = new GitHubIssueCache(userDataDir)+ await cache.bind('local-1', 'project-1', 'o/r', 'user-1')+ await cache.saveComplete('user-1', 'o/r', {+ issues: [shown], etags: {}, lastSuccessfulRefreshAt: 1, lastFullReconciliationAt: 1+ })+ const service = new GitHubIssueService({+ cache, coordinator: new GitHubRequestCoordinator(),+ contextForProject: async () => context(client, { mappingApproved }), now: () => 10_000+ })+ return { client, service, shown }+ }++ it('writes nothing to GitHub under a column mapping this machine has not approved', async () => {+ const { client, service, shown } = await ready(false)+ expect(await service.moveIssue({+ projectId: 'project-1', issueNumber: 1, toColumnId: 'done', expectedUpdatedAt: shown.updatedAt+ })).toEqual({ status: 'read-only' })+ expect((await service.createMissingLabels({ projectId: 'project-1' })).status).toBe('read-only')+ expect(client.updates).toEqual([])+ expect(client.createdLabels).toEqual([])+ })++ it('still shows the issues, read only, and says the mapping is what needs approving', async () => {+ const { service } = await ready(false)+ const page = await service.query({ projectId: 'project-1', columnId: 'todo', pageSize: 50 })+ expect(page.items.map((item) => item.number)).toEqual([1])+ expect(page.readOnly).toBe(true)+ expect(page.mappingNotApproved).toBe(true)+ })++ it('writes as before once the mapping is approved', async () => {+ const { client, service, shown } = await ready(true)+ const page = await service.query({ projectId: 'project-1', columnId: 'todo', pageSize: 50 })+ expect(page.readOnly).toBe(false)+ expect(page.mappingNotApproved).toBeUndefined()+ await service.moveIssue({+ projectId: 'project-1', issueNumber: 1, toColumnId: 'doing', expectedUpdatedAt: shown.updatedAt+ })+ expect(client.updates).toHaveLength(1)+ })+})diff --git a/src/core/github/service.ts b/src/core/github/service.tsindex 728398c1f..4f0729c1d 100644--- a/src/core/github/service.ts+++ b/src/core/github/service.ts@@ -70,6 +70,10 @@ export interface GitHubIssueProjectContext {config: NormalisedProjectKanbanGitHubcontrolRevision: numbercolumnColors: Record<string, string>+ /** This machine approved the column mapping now on disk (see `githubMappingDigest`). Without it+ * the board reads but never writes: the mapping decides what a write DOES, and it arrives+ * through the git-shared project file. */+ mappingApproved: boolean}export interface GitHubIssueServiceContext extends GitHubIssueProjectContext {@@ -371,8 +375,9 @@ export class GitHubIssueService {(wantPull && !!state.snapshot?.pullsTruncated),// The board never writes a pull request, so its page says so on the wire rather than// relying on every consumer to remember.- readOnly: wantPull ||+ readOnly: wantPull || !context.mappingApproved ||state.incomplete || !state.snapshot || !context.config.completionColumnId,+ ...(context.mappingApproved ? {} : { mappingNotApproved: true as const }),...(state.snapshot ? {lastSuccessfulRefreshAt: state.snapshot.lastSuccessfulRefreshAt,lastFullReconciliationAt: state.snapshot.lastFullReconciliationAt@@ -407,7 +412,8 @@ export class GitHubIssueService {throw error}const cacheGeneration = state.cacheGeneration- if (state.incomplete || !state.snapshot || !captured.config.completionColumnId) {+ if (!captured.mappingApproved || state.incomplete || !state.snapshot ||+ !captured.config.completionColumnId) {return { status: 'read-only' }}const target = state.snapshot.issues.find((item) => item.number === request.issueNumber)@@ -527,7 +533,8 @@ export class GitHubIssueService {}throw error}- if (state.incomplete || !captured.config.completionColumnId) {+ // Label names come from the column mapping, so creating them is a write the mapping drives.+ if (!captured.mappingApproved || state.incomplete || !captured.config.completionColumnId) {return {status: 'read-only',created: [],diff --git a/src/renderer/components/kanban/KanbanView.tsx b/src/renderer/components/kanban/KanbanView.tsxindex 764fa1b64..6cf2279a7 100644--- a/src/renderer/components/kanban/KanbanView.tsx+++ b/src/renderer/components/kanban/KanbanView.tsx@@ -176,6 +176,7 @@ export const KanbanView = memo(function KanbanView({const projectColor = useProjects((s) => s.projects.find((p) => p.id === s.activeProjectId)?.color)const github = useGitHubIssues((state) => state.projects[projectId])const githubReadOnly = Object.values(github?.pages ?? {}).some((page) => page.readOnly)+ const githubMappingNotApproved = Object.values(github?.pages ?? {}).some((page) => page.mappingNotApproved)// Every page of one project carries the same identity's throttle; any one of them answers.const githubThrottle = Object.values(github?.pages ?? {}).find((page) => page.throttle)?.throttle// Pull requests are evicted first when a repository outgrows the cache bounds, so the lane can@@ -582,7 +583,9 @@ export const KanbanView = memo(function KanbanView({)}{board.github && githubReadOnly && (<span className="kanban-github-status kanban-github-status--error">- GitHub issues are read only until configuration and refresh are complete.+ {githubMappingNotApproved+ ? 'The column labels changed. Approve them in Settings → GitHub Issues to move issues again.'+ : 'GitHub issues are read only until configuration and refresh are complete.'}</span>)}{board.github && githubThrottle && (diff --git a/src/renderer/components/settings/sections/GitHubIssuesSection.test.tsx b/src/renderer/components/settings/sections/GitHubIssuesSection.test.tsxindex d181639b3..0aab6e6ab 100644--- a/src/renderer/components/settings/sections/GitHubIssuesSection.test.tsx+++ b/src/renderer/components/settings/sections/GitHubIssuesSection.test.tsx@@ -165,6 +165,19 @@ describe('GitHubIssuesSection', () => {expect(host.textContent).toContain('GitHub could not be reached. Nothing was changed')})+ it('asks to approve a changed column mapping before the board may change issues again', async () => {+ const approve = vi.fn(async () => viewWith({}, true))+ ;(window as unknown as { nodeTerminal: any }).nodeTerminal.githubControl.approve = approve+ const view = viewWith({}, true)+ stub({ ...view, project: { ...view.project!, mappingApproved: false } })+ await mount()+ expect(host.textContent).toContain('The column labels changed since this machine approved them')+ expect(host.textContent).not.toContain('Ready as')+ const button = [...host.querySelectorAll('button')].find((b) => b.textContent === 'Approve column labels')!+ await act(async () => { button.click() })+ expect(approve).toHaveBeenCalledWith({ projectId: 'p1', repository: 'owner/repo', expectedRevision: 0 })+ })+it('clears the write-only token field after Save and never renders the stored token', async () => {await mount()const input = host.querySelector<HTMLInputElement>('#github-personal-access-token')!diff --git a/src/renderer/components/settings/sections/GitHubIssuesSection.tsx b/src/renderer/components/settings/sections/GitHubIssuesSection.tsxindex ff451541a..3d32c0d47 100644--- a/src/renderer/components/settings/sections/GitHubIssuesSection.tsx+++ b/src/renderer/components/settings/sections/GitHubIssuesSection.tsx@@ -214,10 +214,21 @@ export function GitHubIssuesSection({ isActive }: { isActive: boolean }): React.const enabled = !!githubConfigconst repository = githubConfig?.repository ?? view?.project?.detectedRepositoryconst approved = enabled && !!view?.project?.approved+ // The repository approval lets the board READ; writes also need this machine to have approved the+ // column mapping now in the (git-shared) project file. Only an explicit false withholds it.+ const mappingApproved = approved && view?.project?.mappingApproved !== falseconst authenticated = !!view?.auth.activeProviderconst completionReady = !!githubConfig?.completionColumnId &&mappings.has(githubConfig.completionColumnId)- const ready = approved && authenticated && completionReady+ const ready = approved && mappingApproved && authenticated && completionReady+ const approveRepository = (): Promise<void> => run('approve', async () => {+ const status = await window.nodeTerminal.githubControl.status(projectId)+ await window.nodeTerminal.githubControl.approve({+ projectId,+ repository: repository!,+ expectedRevision: status.control.revision+ })+ }, 'Repository approved on this machine.', 'repository')// What actually authenticates a request is `activeProvider` — the RESULT of the selected provider// meeting the credentials that exist. `ghAuthenticated` alone lies in both directions: pinned to@@ -369,6 +380,8 @@ export function GitHubIssuesSection({ isActive }: { isActive: boolean }): React.<span className="text-muted">{ready? `Ready as ${view?.auth.login ?? 'GitHub user'}`+ : approved && !mappingApproved+ ? 'The column labels changed since this machine approved them. Approve them to let the board change issues on GitHub.': view?.project?.approved? view.auth.unreachable && !authenticated? 'Repository approved. GitHub could not be reached to check the sign-in.'@@ -376,21 +389,15 @@ export function GitHubIssuesSection({ isActive }: { isActive: boolean }): React.: 'Approval is required before nodeterm reads the repository.'}</span>{!view?.project?.approved && repository && (- <Button- variant="primary"- disabled={busy !== ''}- onClick={() => void run('approve', async () => {- const status = await window.nodeTerminal.githubControl.status(projectId)- await window.nodeTerminal.githubControl.approve({- projectId,- repository,- expectedRevision: status.control.revision- })- }, 'Repository approved on this machine.', 'repository')}- >+ <Button variant="primary" disabled={busy !== ''} onClick={() => void approveRepository()}>Approve this machine</Button>)}+ {approved && !mappingApproved && repository && (+ <Button variant="primary" disabled={busy !== ''} onClick={() => void approveRepository()}>+ Approve column labels+ </Button>+ )}</div>{notice && noticeRow === 'repository' &&<p role="status" className="text-[13px] text-muted">{notice}</p>}diff --git a/src/shared/github-issues.ts b/src/shared/github-issues.tsindex 2767d2360..d7ca5af29 100644--- a/src/shared/github-issues.ts+++ b/src/shared/github-issues.ts@@ -40,6 +40,10 @@ export interface GitHubProjectApproval {repository: stringenabled: trueapprovedAt: number+ /** Digest of the column mapping this approval covers (repository + completion column + column+ * labels — see `githubMappingDigest`). Board WRITES require it to match the mapping on disk;+ * absent on an approval given before mappings were bound, which therefore allows reads only. */+ mappingDigest?: string}export interface GitHubControlState {@@ -215,6 +219,9 @@ export interface GitHubIssuePage {readOnly: booleanlastSuccessfulRefreshAt?: numberlastFullReconciliationAt?: number+ /** The board is read only because this machine has not approved the column mapping now in the+ * project file (it changed, or the approval predates mapping approval). */+ mappingNotApproved?: true/** Present while sync for this project's GitHub identity is held by the rate budget. */throttle?: GitHubThrottle}@@ -249,6 +256,9 @@ export interface GitHubControlView {repository?: stringdetectedRepository?: stringapproved: boolean+ /** The approval also covers the column mapping now in the project file, so the board may+ * write. False while approved means the mapping changed (or predates mapping approval). */+ mappingApproved?: boolean}}