Skip to content

Commit e090459

Browse files
committed
chore(ci): qualify ESM script type coverage
1 parent 769e5ba commit e090459

7 files changed

Lines changed: 76 additions & 2 deletions

File tree

‎.github/CI.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# CI selection and acceptance ownership
22

3+
Root `bun run type-check` and CI's lint job also check ESM maintenance scripts through `scripts/tsconfig.mts.json`, which inherits the shared scripts compiler options and selects every `.mts` file. The shared scripts project includes `.ts`, `.tsx`, and `.mts` for editor checking; CI's additional scripts gate is scoped to `.mts`.
4+
35
The `changes` job runs Turborepo 2.11.10's `affectedTasks` query before installing application dependencies or provisioning services. `turbo.json` records package dependency propagation; `apps/sim/turbo.json` partitions the app into shared runtime, server, workspace UI, and acceptance tasks. `.github/ci-suites.json` turns those tasks into job matrices. The uploaded `ci-plan` artifact names changed files, selected tasks, attribution reasons, and any fallback.
46

57
A PR compares the checked-out GitHub merge commit with its first parent: the actual target revision tested by that merge. The PR event's base SHA can become stale when the target advances. Scoping requires a matching GitHub merge ref and SHA, exactly two merge parents, and a usable target parent; otherwise every check runs. This works with the existing depth-two checkout without fetching older ancestry. Main/staging pushes execute all checks; the parent `ci` workflow skips checks on `dev` pushes, while PRs targeting `dev` still run checks. A manual `checks` run executes all checks unless supplied a full base commit SHA to reproduce a scoped plan. Missing history, an empty diff, unknown files outside the workspace graph, root script/CI changes, or a planner error run every check. Missing selection outputs fail the aggregate gate. The gate also rejects an omitted dependency, any failed/cancelled job, and any skip that its explicit selection flag did not authorize.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from pathlib import Path
2+
import json,os,subprocess,time
3+
out=Path(os.environ['RUNNER_TEMP']);config=Path('scripts/tsconfig.json');source=Path('scripts/prune-turbopack-cache.mts');original_config=config.read_text();original_source=source.read_text();report={}
4+
def run(args):
5+
start=time.monotonic();r=subprocess.run(args,capture_output=True,text=True,timeout=120);return r,(time.monotonic()-start)
6+
def included(text):
7+
return any(Path(line.strip()).resolve()==source.resolve() for line in text.splitlines() if line.strip())
8+
try:
9+
r,_=run(['bunx','tsc','--version']);assert r.returncode==0 and 'Version 7.' in r.stdout,(r.stdout,r.stderr);report['compiler']=r.stdout.strip()
10+
old=json.loads(original_config);old['include']=[p for p in old['include'] if not p.endswith('.mts')];config.write_text(json.dumps(old))
11+
r,seconds=run(['bunx','tsc','--project',str(config),'--listFilesOnly']);report['before']={'included':included(r.stdout),'exit':r.returncode,'seconds':seconds};assert not included(r.stdout),'Old project unexpectedly includes maintenance script'
12+
config.write_text(original_config)
13+
r,seconds=run(['bunx','tsc','--project',str(config),'--listFilesOnly']);report['after']={'included':included(r.stdout),'exit':r.returncode,'seconds':seconds};assert included(r.stdout),'Fixed project still excludes maintenance script'
14+
command=['bun','run','type-check:scripts:esm']
15+
r,seconds=run(command);report['typecheck']={'exit':r.returncode,'seconds':seconds};assert r.returncode==0,(r.stdout+r.stderr)
16+
old='const limit = BUILD_CACHE ?';assert original_source.count(old)==1;source.write_text(original_source.replace(old,'const limit: string = BUILD_CACHE ?'))
17+
r,seconds=run(command);text=r.stdout+r.stderr;(out/'mts-negative-control.log').write_text(text);report['negative']={'exit':r.returncode,'seconds':seconds,'expectedDiagnostic':'TS2322' in text and 'prune-turbopack-cache.mts' in text};assert r.returncode!=0 and report['negative']['expectedDiagnostic'],text
18+
source.write_text(original_source)
19+
r,seconds=run(command);report['restored']={'exit':r.returncode,'seconds':seconds};assert r.returncode==0,r.stdout+r.stderr
20+
finally:
21+
config.write_text(original_config);source.write_text(original_source);(out/'mts-typecheck-proof.json').write_text(json.dumps(report,indent=2));print(json.dumps(report,indent=2))

‎.github/workflows/checks.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,9 @@ jobs:
733733
- name: Migration safety (zero-downtime) audit
734734
run: bun run check:migrations "${{ steps.audit_base.outputs.ref }}"
735735

736+
- name: Type-check ESM maintenance scripts
737+
run: bun run type-check:scripts:esm
738+
736739
# Every affected workspace, following the same real task graph as tests. Root/unknown
737740
# changes select all. packages/emcn, packages/utils,
738741
# apps/desktop and apps/docs had no type check in CI at all; apps/sim's
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: ci-mts-typecheck-proof
2+
on:
3+
push:
4+
branches: [codex/ci-mts-typecheck-proof]
5+
permissions:
6+
contents: read
7+
jobs:
8+
qualify:
9+
runs-on: ubuntu-24.04
10+
timeout-minutes: 20
11+
steps:
12+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
13+
- uses: ./.github/actions/setup
14+
with:
15+
provider: github
16+
- name: Prove actual project inclusion and native type-error detection
17+
run: python3 .github/scripts/prove-mts-typecheck.py
18+
- name: Run existing real filesystem CLI coverage
19+
run: bun run test:scripts scripts/prune-turbopack-cache.test.ts --reporter=default --reporter=json --outputFile.json="$RUNNER_TEMP/mts-cli-tests.json"
20+
- name: Regenerate disjoint committed artifacts
21+
run: |
22+
python3 - <<'PYCODE'
23+
import subprocess,concurrent.futures
24+
commands=['generate:agent-stream-docs','generate:docs-manifest','generate:tool-metadata','skills:sync']
25+
with concurrent.futures.ThreadPoolExecutor(max_workers=4) as pool:
26+
statuses=list(pool.map(lambda command:subprocess.run(['bun','run',command]).returncode,commands))
27+
assert all(status==0 for status in statuses),list(zip(commands,statuses))
28+
PYCODE
29+
- name: Format and lint repository
30+
run: bun run lint
31+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
32+
if: always()
33+
with:
34+
name: mts-typecheck-proof
35+
path: |
36+
${{ runner.temp }}/mts-typecheck-proof.json
37+
${{ runner.temp }}/mts-negative-control.log
38+
${{ runner.temp }}/mts-cli-tests.json
39+
package.json
40+
scripts/tsconfig.json
41+
scripts/tsconfig.mts.json
42+
.github/CI.md
43+
.github/workflows/checks.yml

‎package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@
133133
"check:agent-stream-docs": "bun run scripts/sync-agent-stream-docs.ts --check",
134134
"prepare": "bun husky",
135135
"test:workflow-sync": "bun --no-env-file scripts/test-integration.ts lib/workspaces/__integration__",
136-
"type-check": "turbo run type-check",
136+
"type-check": "bun run type-check:scripts:esm && turbo run type-check",
137+
"type-check:scripts:esm": "tsc --project scripts/tsconfig.mts.json",
137138
"release": "bun run scripts/create-single-release.ts",
138139
"test:scripts": "vitest run --config scripts/vitest.config.ts",
139140
"check:agent-cli-boundary": "bun run scripts/check-agent-cli-boundary.ts"

‎scripts/tsconfig.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@
2020
"esm": true,
2121
"experimentalSpecifierResolution": "node"
2222
},
23-
"include": ["./**/*.ts", "./**/*.tsx"]
23+
"include": ["./**/*.ts", "./**/*.tsx", "./**/*.mts"]
2424
}

‎scripts/tsconfig.mts.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"include": ["./**/*.mts"]
4+
}

0 commit comments

Comments
 (0)