-
Notifications
You must be signed in to change notification settings - Fork 286
333 lines (300 loc) · 13 KB
/
ccbd-real-platform.yml
File metadata and controls
333 lines (300 loc) · 13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
name: CCBD Real Platform Smoke
on:
workflow_dispatch:
push:
branches:
- "**"
pull_request:
permissions:
contents: read
jobs:
macos-real:
name: macOS real ccbd/ask smoke
runs-on: macos-latest
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
shell: bash
run: |
set -euo pipefail
python -m pip install --upgrade pip
python -m pip install pytest tomli
brew install tmux
- name: Syntax check
shell: bash
run: |
set -euo pipefail
python -m compileall -q lib bin ccb
bash -n test/system_comm_matrix.sh test/system_linux_soak.sh test/system_fastpath_stress.sh
- name: Lifecycle smoke
shell: bash
run: |
set -euo pipefail
export TERM=xterm-256color
python -m pytest -q -m ccb_lifecycle_smoke \
test/test_v2_phase2_entrypoint.py \
test/test_v2_ccbd_start_matrix.py
- name: Communication matrix
shell: bash
run: |
set -euo pipefail
export TERM=xterm-256color
bash test/system_comm_matrix.sh
- name: Short soak
shell: bash
run: |
set -euo pipefail
export TERM=xterm-256color
CCB_LINUX_SOAK_SECONDS=35 \
CCB_LINUX_SOAK_KILL_EVERY=2 \
CCB_LINUX_SOAK_STUB_DELAY=0.2 \
CCB_LINUX_SOAK_WATCH_TIMEOUT_S=90 \
bash test/system_linux_soak.sh
- name: Fastpath stress smoke
shell: bash
run: |
set -euo pipefail
export TERM=xterm-256color
CCB_FASTPATH_STRESS_ASK_COUNT=12 \
CCB_FASTPATH_STRESS_STUB_DELAY=0.3 \
CCB_FASTPATH_STRESS_WATCH_TIMEOUT_S=240 \
bash test/system_fastpath_stress.sh
- name: Storage doctor and cleanup smoke
shell: bash
run: |
set -euo pipefail
export TERM=xterm-256color
python - <<'PY'
import os
import sys
from pathlib import Path
sys.path.insert(0, "lib")
from storage.paths import PathLayout
project = Path(os.environ["RUNNER_TEMP"]) / "ccb-storage-cleanup-smoke"
if project.exists():
import shutil
shutil.rmtree(project)
(project / ".ccb").mkdir(parents=True)
(project / ".ccb" / "ccb.config").write_text("alpha:claude,gamma:gemini\n", encoding="utf-8")
layout = PathLayout(project)
claude_home = layout.agent_provider_state_dir("alpha", "claude") / "home"
gemini_home = layout.agent_provider_state_dir("gamma", "gemini") / "home"
for version, body in {"2.1.132": "old", "2.1.133": "rollback", "2.1.137": "current"}.items():
target = claude_home / ".local" / "share" / "claude" / "versions" / version / "claude"
target.parent.mkdir(parents=True, exist_ok=True)
target.write_text(body, encoding="utf-8")
bin_dir = claude_home / ".local" / "bin"
bin_dir.mkdir(parents=True, exist_ok=True)
link = bin_dir / "claude"
link.unlink(missing_ok=True)
link.symlink_to("../share/claude/versions/2.1.137/claude")
for relative, body in {
".npm/_cacache/blob": "cache",
".cache/node-gyp/state": "nodegyp",
".gemini/tmp/session.json": "session",
}.items():
target = gemini_home / relative
target.parent.mkdir(parents=True, exist_ok=True)
target.write_text(body, encoding="utf-8")
print(project)
PY
project="${RUNNER_TEMP}/ccb-storage-cleanup-smoke"
export CCB_SOURCE_ALLOWED_ROOTS="$project"
./ccb --project "$project" doctor storage --json >"$RUNNER_TEMP/storage-before.json"
./ccb --project "$project" cleanup >"$RUNNER_TEMP/cleanup.out"
./ccb --project "$project" doctor storage --json >"$RUNNER_TEMP/storage-after.json"
python - <<'PY'
import json
import os
import sys
from pathlib import Path
sys.path.insert(0, "lib")
from storage.paths import PathLayout
root = Path(os.environ["RUNNER_TEMP"])
project = root / "ccb-storage-cleanup-smoke"
before = json.loads((root / "storage-before.json").read_text(encoding="utf-8"))
after = json.loads((root / "storage-after.json").read_text(encoding="utf-8"))
layout = PathLayout(project)
claude_home = layout.agent_provider_state_dir("alpha", "claude") / "home"
gemini_home = layout.agent_provider_state_dir("gamma", "gemini") / "home"
cleanup_text = (root / "cleanup.out").read_text(encoding="utf-8")
assert "cleanup_status: ok" in cleanup_text
assert "old_claude_version_cache" in cleanup_text
assert "rebuildable_gemini_cache" in cleanup_text
checks = {
"old_removed": not (claude_home / ".local/share/claude/versions/2.1.132").exists(),
"rollback_kept": (claude_home / ".local/share/claude/versions/2.1.133/claude").exists(),
"current_kept": (claude_home / ".local/share/claude/versions/2.1.137/claude").exists(),
"gemini_cache_removed": not (gemini_home / ".npm/_cacache").exists(),
"node_gyp_removed": not (gemini_home / ".cache/node-gyp").exists(),
"gemini_session_kept": (gemini_home / ".gemini/tmp/session.json").exists(),
"storage_reduced": after["by_class"]["rebuildable_cache"]["bytes"] < before["by_class"]["rebuildable_cache"]["bytes"],
}
failed = [name for name, passed in checks.items() if not passed]
if failed:
raise AssertionError(f"storage cleanup smoke failed: {failed}")
PY
- name: Upload macOS artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: macos-ccbd-real-artifacts
path: |
${{ runner.workspace }}/test_ccb*
if-no-files-found: ignore
wsl-real:
name: WSL mounted-drive ccbd/ask smoke
runs-on: windows-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup WSL
uses: Vampire/setup-wsl@v3
with:
distribution: Ubuntu-22.04
- name: Install dependencies in WSL
shell: wsl-bash {0}
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y python3 python3-venv python3-pip tmux git
python3 -m pip install --upgrade pip
python3 -m pip install pytest tomli
- name: Syntax check in WSL
shell: wsl-bash {0}
run: |
set -euo pipefail
python3 -m compileall -q lib bin ccb
bash -n test/system_comm_matrix.sh test/system_linux_soak.sh test/system_fastpath_stress.sh
- name: Lifecycle smoke in WSL
shell: wsl-bash {0}
run: |
set -euo pipefail
export TERM=xterm-256color
python3 -m pytest -q -m ccb_lifecycle_smoke \
test/test_v2_phase2_entrypoint.py \
test/test_v2_ccbd_start_matrix.py
- name: WSL path and relocation tests
shell: wsl-bash {0}
run: |
set -euo pipefail
python3 -m pytest -q \
test/test_v2_storage_paths.py \
test/test_wsl_path_utils.py \
test/test_opencode_paths_runtime.py \
test/test_project_id.py \
-k "wsl or mounted or relocation or socket or path or storage"
- name: Communication matrix in WSL mounted checkout
shell: wsl-bash {0}
run: |
set -euo pipefail
export TERM=xterm-256color
bash test/system_comm_matrix.sh
- name: Short soak in WSL mounted checkout
shell: wsl-bash {0}
run: |
set -euo pipefail
export TERM=xterm-256color
CCB_LINUX_SOAK_SECONDS=35 \
CCB_LINUX_SOAK_KILL_EVERY=2 \
CCB_LINUX_SOAK_STUB_DELAY=0.2 \
CCB_LINUX_SOAK_WATCH_TIMEOUT_S=90 \
bash test/system_linux_soak.sh
- name: Fastpath stress smoke in WSL mounted checkout
shell: wsl-bash {0}
run: |
set -euo pipefail
export TERM=xterm-256color
CCB_FASTPATH_STRESS_ASK_COUNT=12 \
CCB_FASTPATH_STRESS_STUB_DELAY=0.3 \
CCB_FASTPATH_STRESS_P95_RECEIPT_MS=2500 \
CCB_FASTPATH_STRESS_WATCH_TIMEOUT_S=240 \
bash test/system_fastpath_stress.sh
- name: Storage doctor and cleanup smoke in WSL mounted checkout
shell: wsl-bash {0}
run: |
set -euo pipefail
export TERM=xterm-256color
smoke_root="/mnt/c/Temp/ccb-storage-cleanup-smoke-${{ github.run_id }}-${{ github.run_attempt }}"
rm -rf "$smoke_root"
mkdir -p "$smoke_root/.ccb"
printf 'alpha:claude,gamma:gemini\n' >"$smoke_root/.ccb/ccb.config"
python3 - "$smoke_root" <<'PY'
import sys
from pathlib import Path
sys.path.insert(0, "lib")
from storage.paths import PathLayout
project = Path(sys.argv[1])
layout = PathLayout(project)
claude_home = layout.agent_provider_state_dir("alpha", "claude") / "home"
gemini_home = layout.agent_provider_state_dir("gamma", "gemini") / "home"
for version, body in {"2.1.132": "old", "2.1.133": "rollback", "2.1.137": "current"}.items():
target = claude_home / ".local" / "share" / "claude" / "versions" / version / "claude"
target.parent.mkdir(parents=True, exist_ok=True)
target.write_text(body, encoding="utf-8")
bin_dir = claude_home / ".local" / "bin"
bin_dir.mkdir(parents=True, exist_ok=True)
link = bin_dir / "claude"
link.unlink(missing_ok=True)
link.symlink_to("../share/claude/versions/2.1.137/claude")
for relative, body in {
".npm/_cacache/blob": "cache",
".cache/node-gyp/state": "nodegyp",
".gemini/tmp/session.json": "session",
}.items():
target = gemini_home / relative
target.parent.mkdir(parents=True, exist_ok=True)
target.write_text(body, encoding="utf-8")
PY
export CCB_SOURCE_ALLOWED_ROOTS="$smoke_root"
./ccb --project "$smoke_root" doctor storage --json >/tmp/ccb-storage-before.json
./ccb --project "$smoke_root" cleanup >/tmp/ccb-cleanup.out
./ccb --project "$smoke_root" doctor storage --json >/tmp/ccb-storage-after.json
python3 - "$smoke_root" <<'PY'
import json
import sys
from pathlib import Path
sys.path.insert(0, "lib")
from storage.paths import PathLayout
project = Path(sys.argv[1])
before = json.loads(Path("/tmp/ccb-storage-before.json").read_text(encoding="utf-8"))
after = json.loads(Path("/tmp/ccb-storage-after.json").read_text(encoding="utf-8"))
layout = PathLayout(project)
claude_home = layout.agent_provider_state_dir("alpha", "claude") / "home"
gemini_home = layout.agent_provider_state_dir("gamma", "gemini") / "home"
cleanup_text = Path("/tmp/ccb-cleanup.out").read_text(encoding="utf-8")
assert "cleanup_status: ok" in cleanup_text
assert "old_claude_version_cache" in cleanup_text
assert "rebuildable_gemini_cache" in cleanup_text
assert before["runtime_root_kind"] == "relocated"
assert before["shared_cache_status"] == "enabled"
assert before["shared_cache_reason"] == "enabled"
checks = {
"old_removed": not (claude_home / ".local/share/claude/versions/2.1.132").exists(),
"rollback_kept": (claude_home / ".local/share/claude/versions/2.1.133/claude").exists(),
"current_kept": (claude_home / ".local/share/claude/versions/2.1.137/claude").exists(),
"gemini_cache_removed": not (gemini_home / ".npm/_cacache").exists(),
"node_gyp_removed": not (gemini_home / ".cache/node-gyp").exists(),
"gemini_session_kept": (gemini_home / ".gemini/tmp/session.json").exists(),
"storage_reduced": after["by_class"]["rebuildable_cache"]["bytes"] < before["by_class"]["rebuildable_cache"]["bytes"],
}
failed = [name for name, passed in checks.items() if not passed]
if failed:
raise AssertionError(f"storage cleanup smoke failed: {failed}")
PY
rm -rf "$smoke_root"
- name: Upload WSL artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: wsl-ccbd-real-artifacts
path: |
${{ runner.workspace }}/test_ccb*
if-no-files-found: ignore