Skip to content

Commit ab74031

Browse files
authored
Merge branch 'main' into fix/interrupted-child-redelegation
2 parents 593ff6e + 16425bc commit ab74031

370 files changed

Lines changed: 13084 additions & 8333 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.coderabbit.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ reviews:
7979
Require regression coverage at the lowest valid harness with behavior-focused
8080
assertions, including relevant negative, error, false/unset, and boundary cases.
8181
Check cleanup and deterministic async behavior and prefer shared typed test helpers.
82+
For guards and validators, require tests for both the accept path and the reject path
83+
through every public entry point; a reject-only matrix cannot catch a guard that rejects
84+
good input.
8285
Visible webview changes require a durable Playwright component snapshot; behavior-only
8386
changes do not.
8487
Reject weak assertions on values that could take multiple forms: .toBeDefined() or

‎.github/workflows/cli-release.yml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,11 @@ jobs:
9696
type: 'module',
9797
dependencies: {
9898
'@inkjs/ui': pkg.dependencies['@inkjs/ui'],
99-
'@trpc/client': pkg.dependencies['@trpc/client'],
10099
'commander': pkg.dependencies.commander,
101100
'fuzzysort': pkg.dependencies.fuzzysort,
102101
'ink': pkg.dependencies.ink,
103102
'p-wait-for': pkg.dependencies['p-wait-for'],
104103
'react': pkg.dependencies.react,
105-
'superjson': pkg.dependencies.superjson,
106104
'zustand': pkg.dependencies.zustand
107105
}
108106
};

‎.github/workflows/code-qa.yml‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,12 @@ jobs:
7676
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
7777
- name: Setup Node.js and pnpm
7878
uses: ./.github/actions/setup-node-pnpm
79+
- name: Verify Knip guardrails
80+
run: pnpm test:knip-policy
7981
- name: Run knip checks
8082
run: pnpm knip
83+
- name: Run production Knip checks
84+
run: pnpm knip:production
8185

8286
compile:
8387
runs-on: ubuntu-latest
@@ -173,10 +177,11 @@ jobs:
173177
- name: Run extension test lanes
174178
if: ${{ !matrix.collect-coverage }}
175179
run: pnpm turbo run test:api test:core test:services test:misc test:tree-sitter --filter="zoo-code" --concurrency=2 --log-order grouped --output-logs new-only
176-
# Runs outside Turbo so changes to .coderabbit.yaml and
177-
# .github/workflows/label-pr-review-state.yml always bust the
178-
# result — those files are outside the src/ package boundary and
179-
# cannot be declared as Turbo inputs.
180+
# Runs outside Turbo so changes to .coderabbit.yaml,
181+
# .github/workflows/label-pr-review-state.yml, and
182+
# .github/workflows/stale.yml always bust the result. Those files
183+
# sit outside the src/ package boundary and cannot be declared as
184+
# Turbo inputs.
180185
- name: Run workflow config tests
181186
run: pnpm --dir src run test:workflow
182187
- name: Verify extension coverage contract
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Label PR review state fork review follow-up
2+
3+
on:
4+
# Fork pull_request_review runs of "Label PR review state" get a read-only
5+
# token and skip their label writes (issue #2046). When such a run
6+
# completes, this privileged follow-up resolves the fork PRs and dispatches
7+
# a workflow_dispatch run of "Label PR review state", which reconciles them
8+
# and writes the computed labels. The follow-up lives in its own workflow
9+
# because GitHub rejects a workflow that lists itself in
10+
# workflow_run.workflows (issue #2086). It takes no artifact input and
11+
# never checks out code, so no untrusted PR code or artifacts are touched.
12+
workflow_run:
13+
workflows: ["Label PR review state"]
14+
types: [completed]
15+
16+
permissions:
17+
# This privileged workflow only reads PR metadata and dispatches the
18+
# reconciliation workflow. All unspecified permissions, including contents,
19+
# are none; no fork code or configuration is checked out or executed.
20+
actions: write
21+
pull-requests: read
22+
23+
# Each completed run gets its own group: one run can resolve several PRs, and
24+
# a shared key would let an unrelated completion supersede queued dispatches.
25+
concurrency:
26+
group: label-pr-review-state-fork-review-followup-${{ github.event.workflow_run.id }}
27+
cancel-in-progress: false
28+
29+
jobs:
30+
dispatch:
31+
name: Zoo Code / dispatch fork review reconciliation
32+
# Loop guard (issue #2046): follow up only on runs triggered by
33+
# pull_request_review. The runs this workflow dispatches have event
34+
# 'workflow_dispatch', so their completion is filtered out here and
35+
# the chain stops after one hop.
36+
if: github.event.workflow_run.event == 'pull_request_review'
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Resolve fork PRs and dispatch reconciliation
40+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
41+
with:
42+
retries: 3
43+
script: |
44+
const { owner, repo } = context.repo;
45+
const run = context.payload.workflow_run;
46+
47+
// Mirrors the job-level `if`: only runs triggered by
48+
// pull_request_review need a follow-up, so the chain
49+
// stops after one hop.
50+
if (run?.event !== 'pull_request_review') {
51+
core.info(`Ignoring workflow_run with event '${run?.event}'`);
52+
return;
53+
}
54+
55+
// Same-repository review runs already ran with a privileged
56+
// token and wrote their labels; only fork runs need the
57+
// follow-up.
58+
if (run.head_repository && run.head_repository.fork === false) {
59+
core.info('Ignoring same-repository pull_request_review run');
60+
return;
61+
}
62+
63+
// Resolve which PRs the completed run targeted. Fork runs
64+
// backfill pull_requests empty, so fall back to the exact head
65+
// owner, branch, and SHA lookup used by the resolve job of
66+
// label-pr-review-state.yml. Keep both copies in sync.
67+
let prNumbers = [];
68+
if (run.pull_requests?.length > 0) {
69+
prNumbers = run.pull_requests.map(pr => pr.number);
70+
} else {
71+
const headOwner = run.head_repository?.owner?.login;
72+
if (headOwner && run.head_branch && run.head_sha) {
73+
const candidates = await github.paginate(github.rest.pulls.list, {
74+
owner,
75+
repo,
76+
state: 'open',
77+
head: `${headOwner}:${run.head_branch}`,
78+
per_page: 100,
79+
});
80+
const baseRepository = `${owner}/${repo}`.toLowerCase();
81+
prNumbers = candidates
82+
.filter(pr =>
83+
pr.head?.sha === run.head_sha &&
84+
pr.base?.repo?.full_name?.toLowerCase() === baseRepository
85+
)
86+
.map(pr => pr.number);
87+
core.info(
88+
`Resolved workflow_run ${run.id ?? '(unknown)'} to ` +
89+
`${prNumbers.length} PR(s) by exact head owner, branch, and SHA`
90+
);
91+
}
92+
}
93+
94+
// Each dispatch starts a privileged workflow_dispatch run of the
95+
// reconciliation workflow for one PR. Its completion re-triggers
96+
// this workflow, but the loop guard above filters it out.
97+
// A failed dispatch must not skip the PRs after it: collect the
98+
// failures and fail the step once, naming each PR.
99+
const failures = [];
100+
for (const prNumber of prNumbers) {
101+
try {
102+
await github.rest.actions.createWorkflowDispatch({
103+
owner,
104+
repo,
105+
workflow_id: 'label-pr-review-state.yml',
106+
ref: 'main',
107+
inputs: { pull_request_number: String(prNumber) },
108+
});
109+
core.info(`Dispatched label-pr-review-state.yml for PR #${prNumber}`);
110+
} catch (error) {
111+
failures.push(`#${prNumber}: ${error.message}`);
112+
}
113+
}
114+
if (failures.length > 0) {
115+
core.setFailed(`Failed to dispatch ${failures.length} PR(s): ${failures.join('; ')}`);
116+
}

0 commit comments

Comments
 (0)