Skip to content

Commit be5c6b9

Browse files
genednaclaude
andcommitted
v0.41.3: BB-04 interop-smoke compose service with loopback relays
Add the `interop-smoke` service (profile `interop`) to the storage-only compose stack (plan-20261001 BB-04). It builds Dockerfile.interop-smoke, waits for a healthy mega2 and opens socat relays 127.0.0.1:9000 -> mega2:8000, :2222 -> mega2:2222 and :29000 -> rustfs:9000 so the runner sees host addresses; the healthcheck probes all three. Registers the service in test-infra and documents the start command in deploy-trunk §8. Also marks BB-06 done/complete after its docker job succeeded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018bJDjze83ToyPysYzmxxWS Signed-off-by: Eli Ma <eli@patch.sh>
1 parent 0b0629d commit be5c6b9

6 files changed

Lines changed: 79 additions & 4 deletions

File tree

‎Cargo.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mega2"
3-
version = "0.41.2"
3+
version = "0.41.3"
44
edition = "2024"
55
license = "MIT OR Apache-2.0"
66
description = "Monorepo engine and Git hosting server for AI agents: trunk-based storage, Git Smart HTTP, Git LFS, OCI registry, and Agent Session Capture"

‎docker/docker-compose-storage-only.yml‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,51 @@ services:
227227
timeout: 5s
228228
retries: 20
229229

230+
# Interop black-box runner (docs/plan/plan-20261001.md, ADR-BB-02 / ADR-BB-09):
231+
# oras, curl, jq, libra (libra.tools stable), git, git-lfs, ssh. Only started
232+
# with `--profile interop`. On start it opens three loopback relays so the
233+
# runner sees the same addresses as the host:
234+
# 127.0.0.1:9000 -> mega2:8000 (HTTP; libra only sends credentials to
235+
# https or loopback hosts)
236+
# 127.0.0.1:2222 -> mega2:2222 (SSH)
237+
# 127.0.0.1:29000 -> rustfs:9000 (presigned URLs signed for the host port)
238+
interop-smoke:
239+
image: mega2-interop-smoke:local
240+
build:
241+
context: ..
242+
dockerfile: Dockerfile.interop-smoke
243+
profiles: ["interop"]
244+
init: true
245+
depends_on:
246+
mega2:
247+
condition: service_healthy
248+
environment:
249+
MEGA2_BASE_URL: http://127.0.0.1:9000
250+
MEGA2_SSH_URL: ssh://git@127.0.0.1:2222
251+
MEGA2_IT_SEED_TOKEN: mega2-storage-only-local-dev-token-0001
252+
volumes:
253+
- ${MEGA2_IT_INTEROP_WORKDIR:-/tmp/mega2-trunk-interop}:/work
254+
- ..:/repo:ro
255+
working_dir: /work
256+
command:
257+
- bash
258+
- -c
259+
- |
260+
socat TCP-LISTEN:9000,bind=127.0.0.1,fork,reuseaddr TCP:mega2:8000 &
261+
socat TCP-LISTEN:2222,bind=127.0.0.1,fork,reuseaddr TCP:mega2:2222 &
262+
socat TCP-LISTEN:29000,bind=127.0.0.1,fork,reuseaddr TCP:rustfs:9000 &
263+
exec sleep infinity
264+
healthcheck:
265+
test:
266+
- CMD-SHELL
267+
- >-
268+
curl -fsS -o /dev/null http://127.0.0.1:9000/api/openapi.json
269+
&& curl -sS -o /dev/null http://127.0.0.1:29000/
270+
&& ssh-keyscan -T 3 -p 2222 127.0.0.1 >/dev/null 2>&1
271+
interval: 2s
272+
timeout: 10s
273+
retries: 30
274+
230275
secrets:
231276
mega2-push-token:
232277
# Override for real deployments: MEGA2_PUSH_TOKEN_FILE=/path/to/secret

‎docs/deploy-trunk.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,14 @@ docker compose -p mega2-trunk -f docker/docker-compose-storage-only.yml \
132132
# push token 默认: mega2-storage-only-local-dev-token-0001
133133
```
134134

135+
互通黑盒 runner `interop-smoke`(profile `interop`,[plan-20261001](plan/plan-20261001.md);登记见 [test-infra](refactoring/test-infra.md))不随默认 `up` 启动,需要时单独构建并启动:
136+
137+
```bash
138+
docker compose -p mega2-trunk -f docker/docker-compose-storage-only.yml --profile interop up -d --wait --build interop-smoke
139+
```
140+
141+
容器内的环回中继让 `127.0.0.1:9000`(HTTP)、`127.0.0.1:2222`(SSH)、`127.0.0.1:29000`(RustFS)与宿主机地址一致。
142+
135143
### 8.1 Compose 黑盒 Git 协议 smoke(`git` 客户端)
136144

137145
Trunk / storage-only 协议冒烟使用 **`scripts/git_protocol_smoke_storage_only.sh`**,经 compose `--profile smoke` 的 `git-smoke` 容器内真实 **`git` / `git-lfs` / `ssh`** 调用已发布端口。这是 **compose 黑盒**,与 cargo `CARGO_BIN_EXE` 黑盒分层并存;**不要**用 `libra` 作协议客户端,也**不要**在 trunk 上跑 review/CL 语义的 `scripts/git_protocol_smoke.sh`。

‎docs/plan/plan-20261001.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@
567567
### Task BB-06: interop-smoke 安装 libra 最新 stable
568568

569569
**Task type:** `implementation`
570-
**Lifecycle / Acceptance:** `in-progress` / `remote-pending`(v0.41.2;Codex R1 PASS;C 组 2023 测试通过(ER-10 两次重试:端口 / 连接抖动,停 trunk 栈后全绿);待 D 组 `docker` job)
570+
**Lifecycle / Acceptance:** `done` / `complete`(v0.41.2 / `0b0629d`;Codex R1 PASS;C 组 2023 测试通过;D 组 docker run 36895928971 success)
571571
**Description:** 在 `Dockerfile.interop-smoke` 的最终阶段(基于 BB-01 的 `base`)按 ADR-BB-02 §3 用 libra.tools 官方安装器安装最新 stable libra(`LIBRA_REQUIRE_CHECKSUM=1`,禁用 fallback),并把 `libra --version` 写入 `/etc/interop-smoke/libra-version`。唯一行为轴:runner 中的 libra 客户端。
572572
**Out of scope:** 基础工具链(BB-01);libra 版本下限检查(BB-50 前置检查)。
573573
**Current evidence:**
@@ -633,7 +633,7 @@
633633
### Task BB-04: interop-smoke compose 服务与环回中继
634634

635635
**Task type:** `implementation`
636-
**Lifecycle / Acceptance:** `pending` / (空)
636+
**Lifecycle / Acceptance:** `in-progress` / `remote-pending`(v0.41.3;Codex R1 PASS;C 组 2023 测试通过;待 D 组 `docker` job)
637637
**Description:** 在 `docker/docker-compose-storage-only.yml` 新增 profile `interop` 的服务 `interop-smoke`(镜像 `mega2-interop-smoke:local`,build 指向 `Dockerfile.interop-smoke`),启动命令先用 socat 建立 ADR-BB-09 的三条环回中继再 `sleep infinity`,健康检查探测三条中继;同步 `docs/refactoring/test-infra.md` 服务登记与 `docs/deploy-trunk.md` §8。唯一行为轴:runner 服务接线。
638638
**Out of scope:** 镜像内容(BB-01);任何 smoke 脚本;改 `git-smoke` 服务(GC-BB-06,永久非目标)。
639639
**Current evidence:**

‎docs/refactoring/test-infra.md‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,28 @@ git-smoke runner git-lfs 固定版本: `git-lfs/3.8.0`
191191
| secret | **不**注入任何 secret;token 由 seed 步骤写入 compose `postgres`,经 URL 注入 |
192192
| 目标 OS / 降级 | 跨平台(bridge 网络,非 host 网络);macOS/Windows Docker Desktop 亦可跑。git pin 与 `git-cli` 一致 |
193193

194+
### interop-smoke(storage-only 栈互通黑盒 runner,profile `interop`)
195+
196+
`docker/docker-compose-storage-only.yml`(项目 `mega2-trunk`)里的互通黑盒 runner,供 [`plan-20261001`](../plan/plan-20261001.md) 的 OCI / Artifacts / Libra 三个 smoke 脚本使用。与 `git-smoke` 并存、互不替代:`git-smoke` 只用 `git` 观察 Git 协议面,`interop-smoke` 用 `oras` / `curl` / `jq` / `libra` 观察其余公开面。
197+
198+
interop-smoke libra 版本: 构建时 libra.tools 最新 stable(镜像内 `/etc/interop-smoke/libra-version` 记录实际版本,下限 `0.30.8`)
199+
200+
| 项 | 值 |
201+
|---|---|
202+
| 服务名 | `interop-smoke` |
203+
| 镜像 | `mega2-interop-smoke:local`(本地构建,`build: Dockerfile.interop-smoke`)。`base` 阶段为固定 digest 的 `debian:trixie-slim`(glibc 2.41,libra 官方二进制要求 ≥ 2.39)+ bash / curl / git / jq / openssh-client / openssl / ripgrep / shellcheck / socat,git-lfs `3.8.0` 与 oras `1.3.4` 按固定 sha256 校验;最终阶段用 libra.tools 官方安装器(`LIBRA_REQUIRE_CHECKSUM=1`)安装 libra |
204+
| 端口 | 无宿主端口映射。容器内以 socat 建三条只绑定 `127.0.0.1` 的环回中继:`9000 → mega2:8000`、`2222 → mega2:2222`、`29000 → rustfs:9000`,使 runner 看到与宿主机相同的地址(libra 只对 https 或环回地址附带凭据;presigned URL 签名主机为 `127.0.0.1:29000`) |
205+
| healthcheck | 三条中继均可达:`curl` 拉 `http://127.0.0.1:9000/api/openapi.json`、`curl` 访问 `http://127.0.0.1:29000/`、`ssh-keyscan -p 2222 127.0.0.1` |
206+
| entrypoint / init | `command` 启动三个 socat 后 `exec sleep infinity`(常驻供 `exec`);`init: true` |
207+
| 网络 | 默认 `mega2-trunk-network` |
208+
| 卷 / 工作目录 | `${MEGA2_IT_INTEROP_WORKDIR:-/tmp/mega2-trunk-interop}` → `/work`(`working_dir: /work`);仓库根只读挂载到 `/repo` |
209+
| 环境 | `MEGA2_BASE_URL=http://127.0.0.1:9000`、`MEGA2_SSH_URL=ssh://git@127.0.0.1:2222`、`MEGA2_IT_SEED_TOKEN`(与 git-smoke 相同的公开本地开发 token) |
210+
| profiles | `profiles: ["interop"]`(**不**参与默认 `up -d --wait`) |
211+
| depends_on | `mega2`(`condition: service_healthy`) |
212+
| 清理 | `docker compose -p mega2-trunk -f docker/docker-compose-storage-only.yml --profile interop down`(加 `-v` 为破坏性清卷) |
213+
| 运行示例 | `docker compose -p mega2-trunk -f docker/docker-compose-storage-only.yml --profile interop up -d --wait --build interop-smoke`,再 `… --profile interop exec -T interop-smoke bash /repo/scripts/<smoke>.sh` |
214+
| secret | 不注入 secret;token 为公开本地开发值,脚本输出经 `redact` 脱敏 |
215+
194216
### mega2(compose 常驻 HTTP,profile `app`)
195217

196218
被测产品进程进入 compose 拓扑的登记条目。**与 cargo 黑盒分层并存**:`bin/tests/integration_*.rs` 仍通过 `CARGO_BIN_EXE_mega2` 按用例拉起隔离进程(唯一端口 / 临时 `MEGA_BASE_DIR` / 隔离 DB);本服务提供**栈级常驻** `service http`,供 compose smoke、手工联调与 CI 健康探针使用,**不**替代 per-case 隔离门。

0 commit comments

Comments
 (0)