Skip to content

Commit 163ff23

Browse files
committed
Merge remote-tracking branch 'origin/main' into copilot/remove-checker-checks
2 parents 88f025b + e369990 commit 163ff23

File tree

2,328 files changed

+95195
-48571
lines changed

Some content is hidden

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

2,328 files changed

+95195
-48571
lines changed

.custom-gcl.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# yaml-language-server: $schema=https://golangci-lint.run/jsonschema/custom-gcl.jsonschema.json
22

3-
version: v2.9.0
3+
version: v2.10.1
44

55
destination: ./_tools
66

.devcontainer/devcontainer.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"name": "TypeScript Compiler Development",
55
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6-
"image": "mcr.microsoft.com/devcontainers/go:2-1.25-bookworm",
6+
"image": "mcr.microsoft.com/devcontainers/go:dev-1.26-bookworm",
77
// Features to add to the dev container. More info: https://containers.dev/features.
88
"features": {
99
"ghcr.io/devcontainers/features/node:1": {
@@ -13,8 +13,7 @@
1313
},
1414
"ghcr.io/devcontainers-extra/features/dprint-asdf:2": {
1515
"version": "latest"
16-
},
17-
"ghcr.io/devcontainers/features/rust:1": {}
16+
}
1817
},
1918

2019
// Use 'forwardPorts' to make a list of ports inside the container available locally.
@@ -28,10 +27,6 @@
2827
"Install Graphviz": "sudo apt update -y; sudo apt install -y graphviz"
2928
},
3029

31-
"containerEnv": {
32-
"GOTOOLCHAIN": "auto"
33-
},
34-
3530
// Configure tool-specific properties.
3631
"customizations": {
3732
"vscode": {

.dprint.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@
5959
"https://plugins.dprint.dev/typescript-0.95.15.wasm",
6060
"https://plugins.dprint.dev/json-0.21.1.wasm",
6161
"https://plugins.dprint.dev/g-plane/pretty_yaml-v0.6.0.wasm",
62-
"https://plugins.dprint.dev/jakebailey/gofumpt-v0.0.6.wasm"
62+
"https://plugins.dprint.dev/jakebailey/gofumpt-v0.0.7.wasm"
6363
]
6464
}

.github/agents/replay-minimizer.md

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
---
2+
name: replay-minimizer
3+
description: "Use this agent when the user asks to triage, reproduce, minimize, or analyze a crash from a replay file.\n\nTrigger phrases include:\n- 'minimize this crash'\n- 'triage this replay'\n- 'reduce this repro'\n- 'analyze this crash'\n- 'create a minimal reproduction'\n- 'build a fourslash test for this crash'\n\nExamples:\n- User provides a replay file and says 'minimize this crash' → invoke this agent to reproduce, extract signature, and reduce the replay\n- User says 'triage this replay.json' → invoke this agent to reproduce the crash and characterize the failure\n- User asks 'build a fourslash test from this crash' → invoke this agent to create a Go fourslash test that replicates the issue\n- User says 'is this crash reproducible?' → invoke this agent to run the replay and assess determinism"
4+
---
5+
6+
# replay-minimizer instructions
7+
8+
You are a crash triage and replay minimization agent.
9+
10+
## Goal
11+
12+
Given a replay file and a project directory provided by the user, you MUST use the built-in Go replay test (`TestReplay` in `internal/lsp/replay_test.go`) to:
13+
14+
1. Reproduce the crash deterministically (or characterize flakiness)
15+
2. Identify a stable crash signature (stack/exception/location)
16+
3. Reduce the replay file to a minimal form that still triggers the same crash
17+
4. Output the minimized replay file plus a short report
18+
5. Build out a fourslash test case in Go to replicate the issue
19+
20+
## Required inputs
21+
22+
The user MUST provide two things:
23+
1. **A replay file** — a newline-delimited JSON file (typically `*.replay.txt`) containing recorded LSP messages
24+
2. **A project directory** — the path to the project directory the replay was recorded against
25+
26+
If either is missing, ask the user to provide it before proceeding.
27+
28+
## How to run replays
29+
30+
Use the built-in Go test `TestReplay` located at `internal/lsp/replay_test.go`. Run it from the repository root with:
31+
32+
```bash
33+
cd <typescript-go repo root>
34+
go test ./internal/lsp/ -run ^TestReplay$ -replay <path/to/replay.txt> -testDir <path/to/project/dir> -timeout 120s 2>&1
35+
```
36+
37+
### Available flags
38+
39+
| Flag | Description |
40+
|------|-------------|
41+
| `-replay <path>` | **(Required)** Path to the replay file |
42+
| `-testDir <path>` | **(Required)** Path to the project directory the replay was recorded against |
43+
| `-simple` | Replay only file open/change/close messages plus the final request (useful for faster reduction passes) |
44+
| `-superSimple` | Replay only the last file open and the final request (most aggressive simplification) |
45+
| `-timeout <duration>` | Go test timeout (e.g., `120s`, `5m`). Use to detect hangs. |
46+
47+
### Replay file format
48+
49+
The replay file is newline-delimited JSON:
50+
- **Line 1**: metadata object with `rootDirUriPlaceholder` and/or `rootDirPlaceholder` fields, plus optional `serverArgs`
51+
- **Lines 2+**: message objects with `kind` (`"request"` or `"notification"`), `method`, and `params` fields
52+
53+
Path placeholders in the file (e.g., `@PROJECT_ROOT@`, `@PROJECT_ROOT_URI@`) are automatically replaced with the `-testDir` value at runtime.
54+
55+
### Interpreting results
56+
57+
- **Exit 0 / PASS**: The replay completed without a crash — the candidate does NOT reproduce the bug.
58+
- **Non-zero exit / FAIL**: The test failed. Check stderr/stdout for the crash signature (panic, fatal error, etc.).
59+
- **Timeout**: The replay hung. Treat separately unless the baseline also hangs.
60+
61+
## Non-negotiable constraints
62+
63+
- Do NOT guess. Every claim must be backed by running the replay test.
64+
- Do NOT "fix" the crash. Only minimize the repro.
65+
- Every candidate reduction MUST be validated by re-running the replay test.
66+
- The minimized replay MUST still crash with the SAME signature, not merely "a crash".
67+
- Keep the output file valid (newline-delimited JSON) at all times.
68+
- Prefer determinism: same inputs, same command, same environment.
69+
- If the crash is flaky, quantify it and use an "interestingness" predicate that is robust.
70+
71+
## Procedure (must follow in order)
72+
73+
### Step 0 — Baseline reproduction
74+
75+
- Run the baseline replay at least once using the command above.
76+
- Capture:
77+
- exact command used
78+
- exit status
79+
- crash output (panic, stack trace, fatal error message)
80+
- If it does NOT crash, try with `-simple` and `-superSimple` flags to see if a reduced replay still crashes.
81+
- If it still does NOT crash, stop and report "not reproducible".
82+
83+
### Step 1 — Extract a crash signature
84+
85+
- From baseline crash output, derive a signature that is:
86+
- specific enough to avoid matching unrelated crashes
87+
- stable across re-runs
88+
- Example signature fields (use what is available):
89+
- exception name/type (e.g., Go panic message)
90+
- message substring
91+
- top 3–10 stack frames (normalized)
92+
- "culprit" function/file:line if present
93+
- crash category or bucket if available
94+
- Re-run baseline 2 more times (or more if needed) to confirm stability.
95+
- If unstable, redefine signature to the stable core or treat as flaky (see Step 2b).
96+
97+
### Step 2 — Define interestingness predicate
98+
99+
- Implement the predicate as:
100+
- Run candidate replay with the Go test
101+
- Return TRUE iff:
102+
- it crashes AND
103+
- it matches the target signature (or the stable core for flaky crashes)
104+
- Timeouts:
105+
- enforce a reasonable `-timeout`; treat "hang" separately (not our target) unless baseline hangs.
106+
107+
### Step 2b — If flaky
108+
109+
- Run baseline N times (e.g., N=10) and estimate crash rate.
110+
- Define predicate TRUE iff crash rate ≥ threshold (e.g., ≥30%) AND signature matches.
111+
- Use repeated trials only when necessary; otherwise keep runs minimal.
112+
113+
### Step 3 — Try built-in simplification modes first
114+
115+
Before doing manual delta debugging, try the built-in simplification flags:
116+
117+
1. Run with `-simple` — if it still crashes with the same signature, use this as the new baseline (it strips out all messages except file open/change/close and the final request).
118+
2. Run with `-superSimple` — if it still crashes, use this as the new baseline (only the last file open and final request).
119+
120+
These can dramatically reduce the replay before manual minimization begins.
121+
122+
### Step 4 — Minimize structure (coarse ddmin)
123+
124+
- Treat the replay as a sequence of message lines (after the first metadata line).
125+
- First pass: remove large chunks (delta debugging / ddmin):
126+
- partition message lines into k chunks
127+
- try deleting each chunk
128+
- keep deletion if predicate remains TRUE
129+
- adaptively reduce chunk size until no chunk deletion works
130+
- Second pass: try removing individual message lines.
131+
- **Important**: Always preserve the first line (metadata) and ensure `initialize`/`initialized` and `shutdown`/`exit` messages remain if present.
132+
133+
### Step 5 — Minimize within units (fine-grained)
134+
135+
For each remaining message:
136+
- attempt to simplify data while preserving validity:
137+
- delete optional fields from `params`
138+
- shorten strings
139+
- reduce arrays/objects
140+
- replace numbers with smaller equivalents (0, 1, -1) where valid
141+
- normalize to minimal required shape
142+
- After EACH simplification attempt, validate via predicate.
143+
144+
### Step 6 — Canonicalize and clean up
145+
146+
- Remove irrelevant metadata not required for reproduction (timestamps, random IDs) IF predicate stays TRUE.
147+
- Ensure the minimized replay is still readable and stable:
148+
- consistent formatting
149+
- stable ordering if your harness cares
150+
151+
### Step 7 — Produce outputs
152+
153+
**Output A:** minimized replay file (the final candidate that still matches predicate)
154+
155+
**Output B:** minimization report (plain text) including:
156+
- How to run it (exact `go test` invocation with all flags)
157+
- Baseline signature and final signature (should match)
158+
- Reduction summary:
159+
- original size (bytes, message count)
160+
- minimized size
161+
- what kinds of deletions/simplifications were applied
162+
- Notes on determinism/flakiness and required config if any
163+
164+
**Output C:** Go fourslash test case
165+
- Must replicate the crash
166+
- Implement based on Go fourslash tests
167+
- Run the test to verify that it encounters the bug and fails under the current implementation
168+
169+
### Step 8 — Clean up workspace
170+
171+
- Leave only the outputs requested in the previous step

.github/workflows/ci.yml

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ jobs:
3232
dotnet: false
3333
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3434
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
35-
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
3635
- uses: ./.github/actions/setup-go
3736

3837
# Avoid duplicate PR annotations.
@@ -47,12 +46,34 @@ jobs:
4746

4847
- run: npx hereby build
4948

49+
release-build:
50+
if: ${{ github.repository == 'microsoft/typescript-go' }}
51+
runs-on: ['self-hosted', '1ES.Pool=TypeScript-1ES-GitHub-XL', '1ES.ImageOverride=azure-linux-3']
52+
steps:
53+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
54+
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
55+
with:
56+
node-version: 'lts/*'
57+
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
58+
- uses: ./.github/actions/setup-go
59+
60+
# Avoid duplicate PR annotations.
61+
- name: Disable PR annotations
62+
run: |
63+
echo "::remove-matcher owner=eslint-compact::"
64+
echo "::remove-matcher owner=eslint-stylish::"
65+
echo "::remove-matcher owner=tsc::"
66+
echo "::remove-matcher owner=go::"
67+
68+
- run: npm ci
69+
70+
- run: npx hereby native-preview:release --forRelease --setPrerelease dev.0.0
71+
5072
extension:
5173
runs-on: ubuntu-latest
5274
steps:
5375
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5476
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
55-
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
5677

5778
- run: npm ci
5879

@@ -79,7 +100,7 @@ jobs:
79100
- os: ['self-hosted', '1ES.Pool=TypeScript-1ES-GitHub-XL', '1ES.ImageOverride=azure-linux-3']
80101
name: 'race mode'
81102
race: true
82-
skip: ${{ github.event_name == 'merge_group' }}
103+
skip: ${{ github.event_name == 'merge_group' || github.repository != 'microsoft/typescript-go' }}
83104
- os: ubuntu-latest
84105
name: 'noembed'
85106
noembed: true
@@ -122,7 +143,6 @@ jobs:
122143
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
123144
with:
124145
node-version: 'lts/*'
125-
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
126146
- uses: ./.github/actions/setup-go
127147

128148
# Avoid duplicate PR annotations.
@@ -171,7 +191,7 @@ jobs:
171191
npx hereby baseline-accept
172192
git add testdata/baselines/reference
173193
git diff --staged --exit-code
174-
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
194+
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
175195
if: ${{ failure() && steps.test.conclusion == 'failure' }}
176196
with:
177197
name: ${{ matrix.config.os }}-${{ (matrix.config.race && 'race') || 'norace' }}-new-baselines-artifact
@@ -213,7 +233,6 @@ jobs:
213233
dotnet: false
214234
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
215235
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
216-
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
217236
- uses: ./.github/actions/setup-go
218237
with:
219238
lint-cache: 'true'
@@ -236,7 +255,6 @@ jobs:
236255
steps:
237256
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
238257
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
239-
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
240258
- uses: ./.github/actions/setup-go
241259

242260
- run: npm ci
@@ -258,12 +276,14 @@ jobs:
258276
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
259277
with:
260278
node-version: '>=22.16.0'
261-
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
262279
- uses: ./.github/actions/setup-go
263280

264281
- run: npm ci
265282

266283
- run: npx hereby generate
284+
- run: npx hereby generate:enums
285+
- run: npm run -w @typescript/api generate:sync
286+
- run: npm run -w @typescript/ast generate:factory
267287

268288
- run: node --experimental-strip-types ./internal/lsp/lsproto/_generate/fetchModel.mts
269289
- run: node --experimental-strip-types ./internal/lsp/lsproto/_generate/generate.mts
@@ -305,7 +325,6 @@ jobs:
305325
with:
306326
submodules: true
307327
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
308-
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
309328
- uses: ./.github/actions/setup-go
310329

311330
# Avoid duplicate PR annotations.
@@ -339,6 +358,7 @@ jobs:
339358
if: ${{ always() }}
340359
needs:
341360
- build
361+
- release-build
342362
- extension
343363
- format
344364
- generate

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848

4949
# Initializes the CodeQL tools for scanning.
5050
- name: Initialize CodeQL
51-
uses: github/codeql-action/init@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2
51+
uses: github/codeql-action/init@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5
5252
with:
5353
config-file: ./.github/codeql/codeql-configuration.yml
5454
# Override language selection by uncommenting this and choosing your languages
@@ -58,7 +58,7 @@ jobs:
5858
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5959
# If this step fails, then you should remove it and run the build manually (see below).
6060
- name: Autobuild
61-
uses: github/codeql-action/autobuild@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2
61+
uses: github/codeql-action/autobuild@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5
6262

6363
# ℹ️ Command-line programs to run using the OS shell.
6464
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -72,4 +72,4 @@ jobs:
7272
# make release
7373

7474
- name: Perform CodeQL Analysis
75-
uses: github/codeql-action/analyze@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2
75+
uses: github/codeql-action/analyze@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5

.github/workflows/copilot-setup-steps.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ jobs:
2828
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
2929
with:
3030
node-version: '>=22.16.0'
31-
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
3231
- uses: ./.github/actions/setup-go
3332
with:
3433
lint-cache: 'true'

.github/workflows/create-cache.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ jobs:
4747
with:
4848
submodules: true
4949
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
50-
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
5150

5251
- uses: ./.github/actions/setup-go
5352
with:

.vscode/launch.template.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,21 @@
4646
"request": "launch",
4747
"mode": "test",
4848
"program": "${workspaceFolder}/internal/fourslash/gen/${fileBasename}"
49+
},
50+
{
51+
"name": "Launch replay test",
52+
"type": "go",
53+
"request": "launch",
54+
"mode": "test",
55+
"program": "${workspaceFolder}/internal/lsp",
56+
"args": [
57+
"-test.run",
58+
"^TestReplay$",
59+
"-replay",
60+
"path_to_replay_log.txt",
61+
"-testDir",
62+
"path_to_project_dir"
63+
]
4964
}
5065
]
5166
}

0 commit comments

Comments
 (0)