Skip to content

Commit 039aaf1

Browse files
committed
CI: cleanup and fix broken job references
- Fix code-size -> code-analysis job name (5 jobs had wrong dependency) - Remove useless install-check job (was no-op) - Add explicit docs_only guard to release-check - Remove dead submodule checkout steps (no submodules in repo) - Rename detect-docs-only -> detect-docs-changes, add docs_changed output - Reorder check script: format first for faster fail - Fix billing error test (PR #12946 removed fallback detection but not test)
1 parent 64cf50d commit 039aaf1

6 files changed

Lines changed: 71 additions & 90 deletions

File tree

.github/actions/detect-docs-only/action.yml renamed to .github/actions/detect-docs-changes/action.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ outputs:
88
docs_only:
99
description: "'true' if all changes are docs/markdown, 'false' otherwise"
1010
value: ${{ steps.check.outputs.docs_only }}
11+
docs_changed:
12+
description: "'true' if any changed file is under docs/ or is markdown"
13+
value: ${{ steps.check.outputs.docs_changed }}
1114

1215
runs:
1316
using: composite
@@ -28,9 +31,18 @@ runs:
2831
CHANGED=$(git diff --name-only "$BASE" HEAD 2>/dev/null || echo "UNKNOWN")
2932
if [ "$CHANGED" = "UNKNOWN" ] || [ -z "$CHANGED" ]; then
3033
echo "docs_only=false" >> "$GITHUB_OUTPUT"
34+
echo "docs_changed=false" >> "$GITHUB_OUTPUT"
3135
exit 0
3236
fi
3337
38+
# Check if any changed file is a doc
39+
DOCS=$(echo "$CHANGED" | grep -E '^docs/|\.md$|\.mdx$' || true)
40+
if [ -n "$DOCS" ]; then
41+
echo "docs_changed=true" >> "$GITHUB_OUTPUT"
42+
else
43+
echo "docs_changed=false" >> "$GITHUB_OUTPUT"
44+
fi
45+
3446
# Check if all changed files are docs or markdown
3547
NON_DOCS=$(echo "$CHANGED" | grep -vE '^docs/|\.md$|\.mdx$' || true)
3648
if [ -z "$NON_DOCS" ]; then

‎.github/workflows/ci.yml‎

Lines changed: 32 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
outputs:
1818
docs_only: ${{ steps.check.outputs.docs_only }}
19+
docs_changed: ${{ steps.check.outputs.docs_changed }}
1920
steps:
2021
- name: Checkout
2122
uses: actions/checkout@v4
@@ -25,7 +26,7 @@ jobs:
2526

2627
- name: Detect docs-only changes
2728
id: check
28-
uses: ./.github/actions/detect-docs-only
29+
uses: ./.github/actions/detect-docs-changes
2930

3031
# Detect which heavy areas are touched so PRs can skip unrelated expensive jobs.
3132
# Push to main keeps broad coverage.
@@ -120,7 +121,7 @@ jobs:
120121
121122
# Build dist once for Node-relevant changes and share it with downstream jobs.
122123
build-artifacts:
123-
needs: [docs-scope, changed-scope, code-size, check-lint]
124+
needs: [docs-scope, changed-scope, code-analysis, check]
124125
if: needs.docs-scope.outputs.docs_only != 'true' && (github.event_name == 'push' || needs.changed-scope.outputs.run_node == 'true')
125126
runs-on: blacksmith-4vcpu-ubuntu-2404
126127
steps:
@@ -144,9 +145,10 @@ jobs:
144145
path: dist/
145146
retention-days: 1
146147

147-
install-check:
148-
needs: [docs-scope, changed-scope, code-size, check-lint]
149-
if: needs.docs-scope.outputs.docs_only != 'true' && (github.event_name == 'push' || needs.changed-scope.outputs.run_node == 'true')
148+
# Validate npm pack contents after build.
149+
release-check:
150+
needs: [docs-scope, build-artifacts]
151+
if: needs.docs-scope.outputs.docs_only != 'true'
150152
runs-on: blacksmith-4vcpu-ubuntu-2404
151153
steps:
152154
- name: Checkout
@@ -159,8 +161,17 @@ jobs:
159161
with:
160162
install-bun: "false"
161163

164+
- name: Download dist artifact
165+
uses: actions/download-artifact@v4
166+
with:
167+
name: dist-build
168+
path: dist/
169+
170+
- name: Check release contents
171+
run: pnpm release:check
172+
162173
checks:
163-
needs: [docs-scope, changed-scope, code-size, check-lint]
174+
needs: [docs-scope, changed-scope, code-analysis, check]
164175
if: needs.docs-scope.outputs.docs_only != 'true' && (github.event_name == 'push' || needs.changed-scope.outputs.run_node == 'true')
165176
runs-on: blacksmith-4vcpu-ubuntu-2404
166177
strategy:
@@ -188,9 +199,9 @@ jobs:
188199
- name: Run ${{ matrix.task }} (${{ matrix.runtime }})
189200
run: ${{ matrix.command }}
190201

191-
# Format check — cheapest gate (~43s). Always runs, even on docs-only changes.
192-
check-format:
193-
name: "check: format"
202+
# Types, lint, and format check.
203+
check:
204+
name: "check"
194205
runs-on: blacksmith-4vcpu-ubuntu-2404
195206
steps:
196207
- name: Checkout
@@ -201,13 +212,13 @@ jobs:
201212
- name: Setup Node environment
202213
uses: ./.github/actions/setup-node-env
203214

204-
- name: Check formatting
205-
run: pnpm format:check
215+
- name: Check types and lint and oxfmt
216+
run: pnpm check
206217

207-
# Lint check — runs after format passes for cleaner output.
208-
check-lint:
209-
name: "check: lint"
210-
needs: [check-format]
218+
# Validate docs (format, lint, broken links) only when docs files changed.
219+
check-docs:
220+
needs: [docs-scope]
221+
if: needs.docs-scope.outputs.docs_changed == 'true'
211222
runs-on: blacksmith-4vcpu-ubuntu-2404
212223
steps:
213224
- name: Checkout
@@ -218,14 +229,13 @@ jobs:
218229
- name: Setup Node environment
219230
uses: ./.github/actions/setup-node-env
220231

221-
- name: Check types and lint
222-
run: pnpm check
232+
- name: Check docs
233+
run: pnpm check:docs
223234

224235
# Check for files that grew past LOC threshold in this PR (delta-only).
225236
# On push events, all steps are skipped and the job passes (no-op).
226237
# Heavy downstream jobs depend on this to fail fast on violations.
227-
code-size:
228-
needs: [check-format]
238+
code-analysis:
229239
runs-on: blacksmith-4vcpu-ubuntu-2404
230240
steps:
231241
- name: Checkout
@@ -279,7 +289,7 @@ jobs:
279289
fi
280290
281291
checks-windows:
282-
needs: [docs-scope, changed-scope, build-artifacts, code-size, check-lint]
292+
needs: [docs-scope, changed-scope, build-artifacts, code-analysis, check]
283293
if: needs.docs-scope.outputs.docs_only != 'true' && (github.event_name == 'push' || needs.changed-scope.outputs.run_node == 'true')
284294
runs-on: blacksmith-4vcpu-windows-2025
285295
env:
@@ -328,19 +338,6 @@ jobs:
328338
Write-Warning "Failed to apply Defender exclusions, continuing. $($_.Exception.Message)"
329339
}
330340
331-
- name: Checkout submodules (retry)
332-
run: |
333-
set -euo pipefail
334-
git submodule sync --recursive
335-
for attempt in 1 2 3 4 5; do
336-
if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then
337-
exit 0
338-
fi
339-
echo "Submodule update failed (attempt $attempt/5). Retrying…"
340-
sleep $((attempt * 10))
341-
done
342-
exit 1
343-
344341
- name: Download dist artifact (lint lane)
345342
if: matrix.task == 'lint'
346343
uses: actions/download-artifact@v4
@@ -400,7 +397,7 @@ jobs:
400397
# running 4 separate jobs per PR (as before) starved the queue. One job
401398
# per PR allows 5 PRs to run macOS checks simultaneously.
402399
macos:
403-
needs: [docs-scope, changed-scope, code-size, check-lint]
400+
needs: [docs-scope, changed-scope, code-analysis, check]
404401
if: github.event_name == 'pull_request' && needs.docs-scope.outputs.docs_only != 'true' && needs.changed-scope.outputs.run_macos == 'true'
405402
runs-on: macos-latest
406403
steps:
@@ -481,19 +478,6 @@ jobs:
481478
with:
482479
submodules: false
483480

484-
- name: Checkout submodules (retry)
485-
run: |
486-
set -euo pipefail
487-
git submodule sync --recursive
488-
for attempt in 1 2 3 4 5; do
489-
if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then
490-
exit 0
491-
fi
492-
echo "Submodule update failed (attempt $attempt/5). Retrying…"
493-
sleep $((attempt * 10))
494-
done
495-
exit 1
496-
497481
- name: Select Xcode 26.1
498482
run: |
499483
sudo xcode-select -s /Applications/Xcode_26.1.app
@@ -646,7 +630,7 @@ jobs:
646630
PY
647631
648632
android:
649-
needs: [docs-scope, changed-scope, code-size, check-lint]
633+
needs: [docs-scope, changed-scope, code-analysis, check]
650634
if: needs.docs-scope.outputs.docs_only != 'true' && (github.event_name == 'push' || needs.changed-scope.outputs.run_android == 'true')
651635
runs-on: blacksmith-4vcpu-ubuntu-2404
652636
strategy:
@@ -663,19 +647,6 @@ jobs:
663647
with:
664648
submodules: false
665649

666-
- name: Checkout submodules (retry)
667-
run: |
668-
set -euo pipefail
669-
git submodule sync --recursive
670-
for attempt in 1 2 3 4 5; do
671-
if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then
672-
exit 0
673-
fi
674-
echo "Submodule update failed (attempt $attempt/5). Retrying…"
675-
sleep $((attempt * 10))
676-
done
677-
exit 1
678-
679650
- name: Setup Java
680651
uses: actions/setup-java@v4
681652
with:

‎.github/workflows/install-smoke.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
- name: Detect docs-only changes
2525
id: check
26-
uses: ./.github/actions/detect-docs-only
26+
uses: ./.github/actions/detect-docs-changes
2727

2828
install-smoke:
2929
needs: [docs-scope]

‎docs/ci.md‎

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ Tier 1 — Cheapest gates (parallel, ~43 s)
1919
check-format secrets
2020
2121
Tier 2 — After format (parallel, ~2 min)
22-
check-lint code-size
22+
check-lint code-analysis
2323
2424
Tier 3 — Build (~3 min)
25-
build-artifacts install-check
25+
build-artifacts release-check
2626
2727
Tier 4 — Tests (~5 min)
2828
checks (node tsgo / test / protocol, bun test)
@@ -39,8 +39,8 @@ Tier 5 — Platform (most expensive)
3939
```
4040
docs-scope ──► changed-scope ──┐
4141
│
42-
check-format ──► check-lint ──►├──► build-artifacts ──► checks-windows
43-
├─► code-size ──►├──► install-check
42+
check-format ──► check-lint ──►├──► build-artifacts ──► release-check
43+
├─► code-analysis ►│ └──► checks-windows
4444
├──► checks
4545
├──► macos
4646
└──► android
@@ -65,37 +65,37 @@ secrets (independent)
6565

6666
### Tier 2 — After Format
6767

68-
| Job | Runner | Depends on | Purpose |
69-
| ------------ | ----------------- | -------------- | ----------------------------------------------------------- |
70-
| `check-lint` | Blacksmith 4 vCPU | `check-format` | Runs `pnpm lint` — cleaner output after format passes |
71-
| `code-size` | Blacksmith 4 vCPU | `check-format` | Checks LOC thresholds — accurate counts need formatted code |
68+
| Job | Runner | Depends on | Purpose |
69+
| --------------- | ----------------- | -------------- | ----------------------------------------------------------- |
70+
| `check-lint` | Blacksmith 4 vCPU | `check-format` | Runs `pnpm lint` — cleaner output after format passes |
71+
| `code-analysis` | Blacksmith 4 vCPU | `check-format` | Checks LOC thresholds — accurate counts need formatted code |
7272

7373
### Tier 3 — Build
7474

75-
| Job | Runner | Depends on | Purpose |
76-
| ----------------- | ----------------- | ------------------------- | ------------------------------------- |
77-
| `build-artifacts` | Blacksmith 4 vCPU | `check-lint`, `code-size` | Builds dist and uploads artifact |
78-
| `install-check` | Blacksmith 4 vCPU | `check-lint`, `code-size` | Verifies `pnpm install` works cleanly |
75+
| Job | Runner | Depends on | Purpose |
76+
| ----------------- | ----------------- | ----------------------------- | -------------------------------- |
77+
| `build-artifacts` | Blacksmith 4 vCPU | `check-lint`, `code-analysis` | Builds dist and uploads artifact |
78+
| `release-check` | Blacksmith 4 vCPU | `build-artifacts` | Validates npm pack contents |
7979

8080
### Tier 4+ — Tests and Platform
8181

82-
| Job | Runner | Depends on | Purpose |
83-
| ---------------- | ------------------ | -------------------------------------------- | ------------------------------------------------------ |
84-
| `checks` | Blacksmith 4 vCPU | `check-lint`, `code-size` | TypeScript checks, tests (Node + Bun), protocol checks |
85-
| `checks-windows` | Blacksmith Windows | `build-artifacts`, `check-lint`, `code-size` | Windows-specific lint, tests, protocol checks |
86-
| `macos` | `macos-latest` | `check-lint`, `code-size` | TS tests + Swift lint/build/test (PR only) |
87-
| `android` | Blacksmith 4 vCPU | `check-lint`, `code-size` | Gradle test + build |
82+
| Job | Runner | Depends on | Purpose |
83+
| ---------------- | ------------------ | ------------------------------------------------ | ------------------------------------------------------ |
84+
| `checks` | Blacksmith 4 vCPU | `check-lint`, `code-analysis` | TypeScript checks, tests (Node + Bun), protocol checks |
85+
| `checks-windows` | Blacksmith Windows | `build-artifacts`, `check-lint`, `code-analysis` | Windows-specific lint, tests, protocol checks |
86+
| `macos` | `macos-latest` | `check-lint`, `code-analysis` | TS tests + Swift lint/build/test (PR only) |
87+
| `android` | Blacksmith 4 vCPU | `check-lint`, `code-analysis` | Gradle test + build |
8888

89-
## Code-Size Gate
89+
## Code-Analysis Gate
9090

91-
The `code-size` job runs `scripts/analyze_code_files.py` on PRs to catch:
91+
The `code-analysis` job runs `scripts/analyze_code_files.py` on PRs to catch:
9292

9393
1. **Threshold crossings** — files that grew past 1000 lines in the PR
9494
2. **Already-large files growing** — files already over 1000 lines that got bigger
9595
3. **Duplicate function regressions** — new duplicate functions introduced by the PR
9696

9797
When `--strict` is set, any violation fails the job and blocks all downstream
98-
work. On push to `main`, the code-size steps are skipped (the job passes as a
98+
work. On push to `main`, the code-analysis steps are skipped (the job passes as a
9999
no-op) so pushes still run the full test suite.
100100

101101
### Excluded Directories
@@ -109,26 +109,25 @@ The analysis skips: `node_modules`, `dist`, `vendor`, `.git`, `coverage`,
109109
**Bad PR (formatting violations):**
110110

111111
- `check-format` fails at ~43 s
112-
- `check-lint`, `code-size`, and all downstream jobs never start
112+
- `check-lint`, `code-analysis`, and all downstream jobs never start
113113
- Total cost: ~1 runner-minute
114114

115115
**Bad PR (lint or LOC violations, good format):**
116116

117-
- `check-format` passes → `check-lint` and `code-size` run in parallel
117+
- `check-format` passes → `check-lint` and `code-analysis` run in parallel
118118
- One or both fail → all downstream jobs skipped
119119
- Total cost: ~3 runner-minutes
120120

121121
**Good PR:**
122122

123123
- Critical path: `check-format` (43 s) → `check-lint` (1m 46 s) → `build-artifacts` → `checks`
124-
- `code-size` runs in parallel with `check-lint`, adding no latency
124+
- `code-analysis` runs in parallel with `check-lint`, adding no latency
125125

126126
## Composite Action
127127

128128
The `setup-node-env` composite action (`.github/actions/setup-node-env/`)
129129
handles the shared setup boilerplate:
130130

131-
- Submodule init/update with retry (5 attempts, exponential backoff)
132131
- Node.js 22 setup
133132
- pnpm via corepack + store cache
134133
- Optional Bun install
@@ -141,7 +140,7 @@ This eliminates ~40 lines of duplicated YAML per job.
141140

142141
## Push vs PR Behavior
143142

144-
| Trigger | `code-size` | Downstream jobs |
143+
| Trigger | `code-analysis` | Downstream jobs |
145144
| -------------- | ----------------------------- | --------------------- |
146145
| Push to `main` | Steps skipped (job passes) | Run normally |
147146
| Pull request | Full analysis with `--strict` | Blocked on violations |

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"build": "pnpm canvas:a2ui:bundle && tsdown && pnpm build:plugin-sdk:dts && node --import tsx scripts/write-plugin-sdk-entry-dts.ts && node --import tsx scripts/canvas-a2ui-copy.ts && node --import tsx scripts/copy-hook-metadata.ts && node --import tsx scripts/write-build-info.ts && node --import tsx scripts/write-cli-compat.ts",
3636
"build:plugin-sdk:dts": "tsc -p tsconfig.plugin-sdk.dts.json",
3737
"canvas:a2ui:bundle": "bash scripts/bundle-a2ui.sh",
38-
"check": "pnpm tsgo && pnpm lint && pnpm format:check",
38+
"check": "pnpm format:check && pnpm tsgo && pnpm lint",
3939
"check:docs": "pnpm format:docs:check && pnpm lint:docs && pnpm docs:build",
4040
"check:loc": "node --import tsx scripts/check-ts-max-loc.ts --max 500",
4141
"dev": "node scripts/run-node.mjs",

‎src/agents/pi-embedded-helpers.isbillingerrormessage.test.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ describe("isBillingErrorMessage", () => {
1717
"Payment Required",
1818
"HTTP 402 Payment Required",
1919
"plans & billing",
20-
"billing: please upgrade your plan",
2120
];
2221
for (const sample of samples) {
2322
expect(isBillingErrorMessage(sample)).toBe(true);

0 commit comments

Comments
 (0)