Skip to content

Commit 26c7f23

Browse files
genednaclaude
andcommitted
v0.41.8: BB-11 OCI ping case
Register `OCI ping` in scripts/oci_client_smoke_storage_only.sh (plan-20261001 BB-11): anonymous GET /v2/ is 200 with an exact Docker-Distribution-API-Version: registry/2.0 header, and an invalid Bearer token gets 401 with WWW-Authenticate. Adds the bounded oci_curl and exact oci_header helpers and lists the case in deploy-trunk §10.4. Marks BB-10 done. 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 5ba0dcd commit 26c7f23

5 files changed

Lines changed: 30 additions & 5 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.7"
3+
version = "0.41.8"
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"

‎docs/deploy-trunk.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,5 +395,7 @@ CASE='OCI ping' # 换成要跑的 case 名
395395
docker compose -p mega2-trunk -f docker/docker-compose-storage-only.yml --profile interop exec -T -e MEGA2_SMOKE_CASE="$CASE" interop-smoke bash /repo/scripts/oci_client_smoke_storage_only.sh 2>&1 | tee target/tmp/bb-oci-case.log
396396
```
397397

398+
已登记 case:`OCI ping`。
399+
398400
不设 `MEGA2_SMOKE_CASE` 时整跑全部默认栈 case;opt-in case(auth-none)只经 `scripts/bb_optin_run.sh none oci_client_smoke_storage_only.sh '<case>' <log>` 运行。
399401

‎docs/plan/plan-20261001.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@
952952
### Task BB-10: OCI client smoke 脚本骨架
953953

954954
**Task type:** `implementation`
955-
**Lifecycle / Acceptance:** `in-progress` / `remote-pending`(v0.41.7;Codex R4 PASS;C 组 2023 测试通过(`RUST_TEST_THREADS=4`、`NO_PROXY` 环境下;此前三次环境抖动);待 D 组 `docker` job)
955+
**Lifecycle / Acceptance:** `done` / `complete`(v0.41.7;Codex R4 PASS;C 组 2023 测试通过;D 组 docker run 36923427965 success)
956956
**Description:** 新建 `scripts/oci_client_smoke_storage_only.sh`:引入共享 runner 库、生成 `RUN_ID`(ADR-BB-07)、做前置检查、**零 case**;同步 `docs/deploy-trunk.md` §10.4。唯一行为轴:oci client smoke 运行框架。
957957
**Out of scope:** 任何 case(本域场景卡逐一承接);改既有 smoke 脚本(GC-BB-06)。
958958
**Current evidence:**
@@ -1021,7 +1021,7 @@
10211021
### Task BB-11: OCI ping
10221022

10231023
**Task type:** `implementation`
1024-
**Lifecycle / Acceptance:** `pending` / (空)
1024+
**Lifecycle / Acceptance:** `in-progress` / `remote-pending`(v0.41.8;Codex R2 PASS;C 组 2023 测试通过;待 D 组 `docker` job)
10251025
**Description:** 在 `scripts/oci_client_smoke_storage_only.sh` 注册 case `OCI ping`。匿名 `GET /v2/` 与无效 Bearer 的质询。 唯一行为轴:OCI 匿名 ping。
10261026
**Out of scope:** 其它 case(各自成卡);改 `src/**`(产品缺陷按 ADR-BB-08 立 `FIX-BB-*`);改既有 smoke 脚本(GC-BB-06);以 cargo IT 作 VER(GC-BB-04)。
10271027
**Current evidence:**

‎scripts/oci_client_smoke_storage_only.sh‎

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ SCRIPT_DIR="${BASH_SOURCE[0]%/*}"
1919
source "$SCRIPT_DIR/lib/smoke-runner.sh"
2020

2121
smoke_init "oci client"
22-
require_tools curl jq oras sha256sum mktemp date rm perl
22+
require_tools curl jq oras sha256sum mktemp date rm perl awk tr
2323

2424
MEGA2_BASE_URL="${MEGA2_BASE_URL:-http://127.0.0.1:9000}"
2525
MEGA2_BASE_URL="${MEGA2_BASE_URL%/}"
@@ -37,4 +37,27 @@ code=$(curl -sS --connect-timeout 3 --max-time 5 -o /dev/null -w '%{http_code}'
3737

3838
export REGISTRY RUN_ID WORK TOKEN MEGA2_BASE_URL
3939

40+
# --- shared OCI helpers -------------------------------------------------
41+
# oci_curl: curl with bounded connection and total time.
42+
oci_curl() { curl -sS --connect-timeout 5 --max-time 30 "$@"; }
43+
# oci_header <file> <name>: exact value of a response header (case-insensitive name).
44+
oci_header() {
45+
awk -v n="$(printf '%s' "$2" | tr '[:upper:]' '[:lower:]')" \
46+
'tolower($1) == n":" {sub(/^[^:]*:[ \t]*/, ""); sub(/\r$/, ""); print; exit}' "$1"
47+
}
48+
49+
# --- BB-11 OCI ping -----------------------------------------------------
50+
case_oci_ping() {
51+
local hdr="$WORK/ping.hdr" code
52+
code=$(oci_curl -D "$hdr" -o /dev/null -w '%{http_code}' "$MEGA2_BASE_URL/v2/")
53+
[ "$code" = 200 ] || { echo "anonymous GET /v2/ returned $code" >&2; return 1; }
54+
[ "$(oci_header "$hdr" docker-distribution-api-version)" = "registry/2.0" ] \
55+
|| { echo "Docker-Distribution-API-Version is not registry/2.0" >&2; return 1; }
56+
code=$(oci_curl -D "$hdr" -o /dev/null -w '%{http_code}' -H 'Authorization: Bearer bb-invalid-token' "$MEGA2_BASE_URL/v2/")
57+
[ "$code" = 401 ] || { echo "invalid Bearer returned $code" >&2; return 1; }
58+
[ -n "$(oci_header "$hdr" www-authenticate)" ] || { echo "401 without WWW-Authenticate" >&2; return 1; }
59+
}
60+
61+
run_case "OCI ping" case_oci_ping
62+
4063
finish

0 commit comments

Comments
 (0)