Skip to content

Commit 2482ab3

Browse files
authored
Use d2x 2026.10.21.1 and verify real first-use versions (#94)
* ci: verify d2x versions and exercise cross-repository cold-start candidates * fix: verify README tools in the installer's actual shell environment * ci: isolate public README installation from ancestor course manifests * ci: distinguish cold mcpp run from standalone build and checker * fix: activate candidates with container-native paths and Python 3 * feat: activate the latest d2x release and verify legacy upgrades * ci: preserve preparation stdout and stderr before checker startup * docs: pin the verified cancellation and startup release * docs: record final release provenance and public install validation
1 parent 5b836b0 commit 2482ab3

21 files changed

Lines changed: 585 additions & 22 deletions

‎.agents/docs/2026-10-20-d2x-d2mcpp-first-use-plan.md‎

Lines changed: 183 additions & 0 deletions
Large diffs are not rendered by default.

‎.github/workflows/dslings-ref-ci.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ jobs:
7272
run: ./scripts/ci/mask-msvc.ps1
7373
- name: Prepare course (Unix)
7474
if: runner.os != 'Windows'
75-
run: bash scripts/setup.sh
75+
run: python3 scripts/ci/prepare.py
7676
- name: Prepare course (Windows PowerShell 5.1)
7777
if: runner.os == 'Windows'
7878
shell: powershell
79-
run: ./scripts/setup.ps1
79+
run: python scripts/ci/prepare.py
8080
- name: Assert MinGW fallback
8181
if: matrix.mask_msvc
8282
run: |

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

Lines changed: 108 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,34 @@ on:
4040
- "book/src/changelog.md"
4141
- "book/en/src/changelog.md"
4242
workflow_dispatch:
43+
inputs:
44+
candidate_run:
45+
description: 'Optional successful d2learn/d2x CI run ID (explicit prerelease override)'
46+
type: string
47+
default: ''
48+
candidate_sha:
49+
description: 'Exact checkout SHA recorded in that candidate provenance'
50+
type: string
51+
default: ''
52+
diagnose:
53+
description: 'Also compare standalone build and checker in separate cold Windows environments'
54+
type: boolean
55+
default: false
4356
schedule:
4457
- cron: '23 4 * * 1'
4558

4659
permissions:
4760
contents: read
61+
actions: read
62+
63+
env:
64+
XLINGS_NON_INTERACTIVE: '1'
65+
D2X_CANDIDATE_SHA: ${{ inputs.candidate_sha }}
66+
D2X_CANDIDATE_DIR: .d2x/candidate
4867

4968
jobs:
5069
native:
70+
if: ${{ !inputs.diagnose }}
5171
name: fresh (${{ matrix.os }}, ${{ matrix.route }}, MSVC=${{ !matrix.mask_msvc }})
5272
runs-on: ${{ matrix.os }}
5373
timeout-minutes: 60
@@ -62,6 +82,18 @@ jobs:
6282
- {os: windows-2025, route: cold, mask_msvc: true}
6383
steps:
6484
- uses: actions/checkout@v4
85+
- uses: actions/download-artifact@v4
86+
if: inputs.candidate_run != ''
87+
with:
88+
repository: d2learn/d2x
89+
run-id: ${{ inputs.candidate_run }}
90+
github-token: ${{ github.token }}
91+
name: ${{ runner.os == 'Linux' && 'candidate-linux-x86_64' || format('candidate-{0}', matrix.os) }}
92+
path: ${{ env.D2X_CANDIDATE_DIR }}
93+
- name: Verify explicit candidate provenance
94+
if: inputs.candidate_run != ''
95+
shell: bash
96+
run: ${{ runner.os == 'Windows' && 'python' || 'python3' }} scripts/ci/candidate.py
6597
- name: Select an empty toolchain home
6698
shell: bash
6799
run: echo "MCPP_HOME=$RUNNER_TEMP/d2mcpp-fresh" >> "$GITHUB_ENV"
@@ -85,11 +117,11 @@ jobs:
85117
run: python scripts/ci/readme.py
86118
- name: Cold install only (Unix)
87119
if: runner.os != 'Windows' && matrix.route == 'cold'
88-
run: bash scripts/setup.sh --install-only
120+
run: python3 scripts/ci/prepare.py --install-only
89121
- name: Cold install only (PowerShell 5.1)
90122
if: runner.os == 'Windows' && matrix.route == 'cold'
91123
shell: powershell
92-
run: ./scripts/setup.ps1 -InstallOnly
124+
run: python scripts/ci/prepare.py --install-only
93125
- name: First check, save, advance and resume
94126
if: matrix.route == 'cold'
95127
shell: bash
@@ -104,7 +136,7 @@ jobs:
104136
ROUTE: ${{ matrix.route }}
105137
run: |
106138
logs="$(pwd)/.d2x/ci-logs"
107-
if [[ "$ROUTE" == readme ]]; then cd .d2x/ci-work/download/d2mcpp; fi
139+
if [[ "$ROUTE" == readme ]]; then cd "$(cat "$logs/readme-course-path.txt")"; fi
108140
# doctor returns nonzero for warnings too (missing MSVC is expected).
109141
mcpp self doctor > "$logs/doctor.txt" 2>&1 || true
110142
cat "$logs/doctor.txt"
@@ -121,6 +153,7 @@ jobs:
121153
include-hidden-files: true
122154

123155
linux-minimal:
156+
if: ${{ !inputs.diagnose }}
124157
name: fresh (Linux without a compiler, ${{ matrix.route }})
125158
runs-on: ubuntu-24.04
126159
container: ubuntu:24.04
@@ -138,6 +171,18 @@ jobs:
138171
! command -v g++
139172
! command -v clang++
140173
- uses: actions/checkout@v4
174+
- uses: actions/download-artifact@v4
175+
if: inputs.candidate_run != ''
176+
with:
177+
repository: d2learn/d2x
178+
run-id: ${{ inputs.candidate_run }}
179+
github-token: ${{ github.token }}
180+
name: candidate-linux-x86_64
181+
path: ${{ env.D2X_CANDIDATE_DIR }}
182+
- name: Verify explicit candidate provenance
183+
if: inputs.candidate_run != ''
184+
shell: bash
185+
run: ${{ runner.os == 'Windows' && 'python' || 'python3' }} scripts/ci/candidate.py
141186
- name: Give the ordinary user a fresh checkout
142187
shell: bash
143188
env:
@@ -158,7 +203,7 @@ jobs:
158203
run: |
159204
cd "$COURSE_DIR"
160205
if [[ "$ROUTE" == cold ]]; then
161-
runuser -u learner -- bash scripts/setup.sh --install-only
206+
runuser -u learner -- python3 scripts/ci/prepare.py --install-only
162207
runuser -u learner -- env MCPP_HOME=/home/learner/.mcpp PATH="/home/learner/.xlings/subos/current/bin:$PATH" python3 scripts/ci/first-run.py --allow-source-edit --cold
163208
runuser -u learner -- env PATH="/home/learner/.xlings/subos/current/bin:$PATH" python3 scripts/ci/solutions.py
164209
else
@@ -174,7 +219,7 @@ jobs:
174219

175220
released-course:
176221
name: Published d2x install route (main only)
177-
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
222+
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && inputs.candidate_run == ''
178223
runs-on: ubuntu-24.04
179224
timeout-minutes: 60
180225
steps:
@@ -188,3 +233,61 @@ jobs:
188233
path: .d2x/ci-logs/
189234
if-no-files-found: ignore
190235
include-hidden-files: true
236+
237+
cold-diagnostics:
238+
if: inputs.diagnose
239+
runs-on: windows-2025
240+
strategy:
241+
fail-fast: false
242+
matrix:
243+
route: [build, run, checker]
244+
steps:
245+
- uses: actions/checkout@v4
246+
- name: Mask MSVC
247+
shell: powershell
248+
run: ./scripts/ci/mask-msvc.ps1
249+
- name: Select independent cold home
250+
shell: bash
251+
run: echo "MCPP_HOME=$RUNNER_TEMP/diagnostic-${{ matrix.route }}" >> "$GITHUB_ENV"
252+
- name: Install tools only
253+
shell: powershell
254+
run: python scripts/ci/prepare.py --install-only
255+
- name: Diagnose baseline cold startup
256+
shell: bash
257+
env:
258+
DIAGNOSTIC_ROUTE: ${{ matrix.route }}
259+
run: python scripts/ci/cold-diagnostics.py
260+
- uses: actions/upload-artifact@v4
261+
if: always()
262+
with:
263+
name: cold-diagnostic-${{ matrix.route }}
264+
path: .d2x/ci-logs/
265+
include-hidden-files: true
266+
267+
latest-stable:
268+
if: github.ref == 'refs/heads/main' && inputs.candidate_run == ''
269+
runs-on: ${{ matrix.os }}
270+
strategy:
271+
fail-fast: false
272+
matrix:
273+
os: [ubuntu-24.04, macos-14, windows-2025]
274+
steps:
275+
- uses: actions/checkout@v4
276+
- name: Install xlings (Unix)
277+
if: runner.os != 'Windows'
278+
run: bash scripts/install-xlings.sh
279+
- name: Install xlings (PowerShell 5.1)
280+
if: runner.os == 'Windows'
281+
shell: powershell
282+
run: ./scripts/install-xlings.ps1
283+
- name: Check stable release, public latest and course pin
284+
shell: bash
285+
env:
286+
GH_TOKEN: ${{ github.token }}
287+
run: ${{ runner.os == 'Windows' && 'python' || 'python3' }} scripts/ci/latest.py
288+
- uses: actions/upload-artifact@v4
289+
if: always()
290+
with:
291+
name: latest-stable-versions-${{ matrix.os }}
292+
path: .d2x/ci-logs/
293+
include-hidden-files: true

‎.xlings.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"workspace": {
3-
"d2x": "2026.08.02.2",
3+
"d2x": "2026.10.21.1",
44
"mdbook": "0.4.43",
55
"mcpp": "2026.10.17.1"
66
}

‎README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ Wait for the environment to be ready, then run `d2x checker` in the terminal.
4848
Install [xlings](docs/environment.md#install-xlings), reopen your terminal, then run:
4949

5050
```bash
51-
xlings install d2x mcpp -y
51+
xlings update
52+
xlings install --use d2x@latest mcpp@latest -y
5253
```
5354

5455
**2. Get the course**

‎README.zh.hant.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
安裝 [xlings](docs/environment.zh.md#install-xlings),重新開啟終端後執行:
4949

5050
```bash
51-
xlings install d2x mcpp -y
51+
xlings update
52+
xlings install --use d2x@latest mcpp@latest -y
5253
```
5354

5455
**第二步:取得課程**

‎README.zh.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
安装 [xlings](docs/environment.zh.md#install-xlings),重新打开终端后执行:
4949

5050
```bash
51-
xlings install d2x mcpp -y
51+
xlings update
52+
xlings install --use d2x@latest mcpp@latest -y
5253
```
5354

5455
**第二步:获取课程**

‎book/en/src/base/chapter_1.md‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ git clone https://github.com/mcpp-community/d2mcpp.git
2121
cd d2mcpp
2222
```
2323

24-
**2. Prepare the environment.** These scripts install xlings **2026.10.18.1**, the versions in `.xlings.json` (mcpp **2026.10.17.1**, d2x **2026.08.02.2**, mdBook **0.4.43**), and build and check the Provider. The first build may take several minutes.
24+
**2. Prepare the environment.** These scripts install xlings **2026.10.18.1**, the versions in `.xlings.json` (mcpp **2026.10.17.1**, d2x **2026.10.21.1**, mdBook **0.4.43**), and build and check the Provider. The first build may take several minutes.
2525

2626
Linux / macOS:
2727

@@ -59,7 +59,8 @@ $env:Path = "$env:USERPROFILE\.xlings\subos\current\bin;$env:Path"
5959
Then, on either system:
6060

6161
```text
62-
xlings install d2x@2026.08.02.2 -y
62+
xlings update
63+
xlings install --use d2x@latest mcpp@latest -y
6364
d2x install d2mcpp
6465
cd d2mcpp
6566
```
@@ -266,3 +267,16 @@ xlings install
266267
**Tutorial Repository:** [https://github.com/mcpp-community/d2mcpp](https://github.com/mcpp-community/d2mcpp)
267268

268269
**Tutorial Video Collection:** [https://space.bilibili.com/65858958/lists/5208246](https://space.bilibili.com/65858958/lists/5208246)
270+
271+
## First-start preparation and version checks
272+
273+
`d2x install` installs the downloaded course's declared workspace dependencies.
274+
After a Git update, rerun the preparation script to apply changed versions.
275+
Run `d2x --version` from the course directory and compare it with `.xlings.json`;
276+
updating a global tool alone does not establish which project version is selected.
277+
278+
The checker shows preparation before the first exercise. Initial Provider startup
279+
has a total 900-second budget; subsequent Provider calls have a 120-second idle
280+
limit. Preparation messages do not extend the startup deadline. On failure, keep
281+
`.d2x/provider.stdout.log`, `.d2x/provider.stderr.log` and the command output.
282+
Startup/transport errors exit nonzero; an unfinished exercise verdict is expected.

‎book/en/src/changelog.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010

1111
## 2026/10
1212

13+
**d2x upgrade and cold-start diagnostics**
14+
15+
Upgrade d2x to 2026.10.21.1 and verify the selected executable; bound first Provider startup separately, show preparation and retain raw logs.
16+
17+
- `Book`: [zh](https://mcpp-community.github.io/d2mcpp/base/chapter_1.html) / [en](https://mcpp-community.github.io/d2mcpp/en/base/chapter_1.html) - 2026/10/20
18+
- `Code`: [first-use CI](https://github.com/mcpp-community/d2mcpp/blob/main/.github/workflows/fresh-install.yml) - 2026/10/20
19+
1320
**Environment upgrade and first-use validation**
1421

1522
Pin mcpp 2026.10.17.1, add platform setup scripts and fresh/legacy environment checks, and update the Codespaces entry point.

‎book/src/base/chapter_1.md‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ git clone https://github.com/mcpp-community/d2mcpp.git
2121
cd d2mcpp
2222
```
2323

24-
**第二步:准备环境。** 脚本安装 xlings **2026.10.18.1** 及 `.xlings.json` 声明的版本(mcpp **2026.10.17.1**、d2x **2026.08.02.2**、mdBook **0.4.43**),构建并检查 Provider。首次构建可能需要几分钟。
24+
**第二步:准备环境。** 脚本安装 xlings **2026.10.18.1** 及 `.xlings.json` 声明的版本(mcpp **2026.10.17.1**、d2x **2026.10.21.1**、mdBook **0.4.43**),构建并检查 Provider。首次构建可能需要几分钟。
2525

2626
Linux / macOS:
2727

@@ -59,7 +59,8 @@ $env:Path = "$env:USERPROFILE\.xlings\subos\current\bin;$env:Path"
5959
然后在任一系统执行:
6060

6161
```text
62-
xlings install d2x@2026.08.02.2 -y
62+
xlings update
63+
xlings install --use d2x@latest mcpp@latest -y
6364
d2x install d2mcpp
6465
cd d2mcpp
6566
```
@@ -263,3 +264,12 @@ xlings install
263264
**教程仓库:** [https://github.com/mcpp-community/d2mcpp](https://github.com/mcpp-community/d2mcpp)
264265

265266
**教程视频合集:** [https://space.bilibili.com/65858958/lists/5208246](https://space.bilibili.com/65858958/lists/5208246)
267+
268+
## 首次启动准备与版本核对
269+
270+
`d2x install` 会安装下载课程所声明的项目依赖。通过 Git 更新后,重新运行准备脚本以应用版本变化。
271+
在课程目录执行 `d2x --version`,与 `.xlings.json` 对照;仅更新全局工具不能证明项目实际使用的版本。
272+
273+
checker 在第一题之前显示准备信息。首次 Provider 启动的总期限为 900 秒,后续调用的空闲期限为 120 秒;
274+
准备提示不会延长期限。失败时保留 `.d2x/provider.stdout.log`、`.d2x/provider.stderr.log` 与命令输出。
275+
启动和传输错误会非零退出;未完成练习的 fail 判定属于预期行为。

0 commit comments

Comments
 (0)