Skip to content

Commit 550a8a2

Browse files
genednaclaude
andcommitted
v0.41.14: BB-17 OCI blob range case
Register `OCI blob range` (plan-20261001 BB-17): bytes=0-9 on a 100-byte blob returns 206 with Content-Range bytes 0-9/100 and exactly the first 10 bytes of the blob; a range starting at the blob length returns 416. Marks BB-16 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 3d6ac55 commit 550a8a2

5 files changed

Lines changed: 25 additions & 6 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.13"
3+
version = "0.41.14"
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +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`、`OCI oras push and pull`、`OCI reject unauthenticated push`、`OCI chunked blob upload`、`OCI cross-repo blob mount`、`OCI manifest HEAD and conditional GET`。
398+
已登记 case:`OCI ping`、`OCI oras push and pull`、`OCI reject unauthenticated push`、`OCI chunked blob upload`、`OCI cross-repo blob mount`、`OCI manifest HEAD and conditional GET`、`OCI blob range`。
399399

400400
不设 `MEGA2_SMOKE_CASE` 时整跑全部默认栈 case;opt-in case(auth-none)只经 `scripts/bb_optin_run.sh none oci_client_smoke_storage_only.sh '<case>' <log>` 运行。
401401

‎docs/plan/plan-20261001.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,7 @@
12711271
### Task BB-16: OCI manifest HEAD and conditional GET
12721272

12731273
**Task type:** `implementation`
1274-
**Lifecycle / Acceptance:** `in-progress` / `remote-pending`(v0.41.13;Codex R3 PASS;C 组 2023 测试通过;待 D 组 `docker` job)
1274+
**Lifecycle / Acceptance:** `done` / `complete`(v0.41.13;C 组 2023 测试通过;D 组 docker run 36947545152 success)
12751275
**Description:** 在 `scripts/oci_client_smoke_storage_only.sh` 注册 case `OCI manifest HEAD and conditional GET`。oras 推送后对 manifest 做 HEAD 与条件 GET。 唯一行为轴:manifest HEAD 与 304。
12761276
**Out of scope:** 其它 case(各自成卡);改 `src/**`(产品缺陷按 ADR-BB-08 立 `FIX-BB-*`);改既有 smoke 脚本(GC-BB-06);以 cargo IT 作 VER(GC-BB-04)。
12771277
**Current evidence:**
@@ -1321,7 +1321,7 @@
13211321
### Task BB-17: OCI blob range
13221322

13231323
**Task type:** `implementation`
1324-
**Lifecycle / Acceptance:** `pending` / (空)
1324+
**Lifecycle / Acceptance:** `in-progress` / `remote-pending`(v0.41.14;Codex R1 PASS;C 组 2023 测试通过;待 D 组 `docker` job)
13251325
**Description:** 在 `scripts/oci_client_smoke_storage_only.sh` 注册 case `OCI blob range`。对已知 blob 做区间读取与越界读取。 唯一行为轴:blob Range 读取。
13261326
**Out of scope:** 其它 case(各自成卡);改 `src/**`(产品缺陷按 ADR-BB-08 立 `FIX-BB-*`);改既有 smoke 脚本(GC-BB-06);以 cargo IT 作 VER(GC-BB-04)。
13271327
**Current evidence:**

‎scripts/oci_client_smoke_storage_only.sh‎

Lines changed: 20 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 awk tr timeout rg grep head tail cut wc
22+
require_tools curl jq oras sha256sum mktemp date rm perl awk tr timeout rg grep head tail cut wc cmp
2323

2424
MEGA2_BASE_URL="${MEGA2_BASE_URL:-http://127.0.0.1:9000}"
2525
MEGA2_BASE_URL="${MEGA2_BASE_URL%/}"
@@ -229,11 +229,30 @@ case_oci_manifest_head_304() {
229229
[ "$code" = 304 ] || { echo "conditional GET returned $code" >&2; return 1; }
230230
}
231231

232+
# --- BB-17 OCI blob range -----------------------------------------------
233+
case_oci_blob_range() {
234+
local d="$WORK/range" repo="bb-$RUN_ID/range" dg code
235+
oci_case_begin
236+
mkdir -p "$d"
237+
head -c 100 /dev/urandom > "$d/blob"
238+
dg=$(oci_digest "$d/blob")
239+
code=$(oci_put_blob "$repo" "$d/blob")
240+
[ "$code" = 201 ] || { echo "blob upload returned $code" >&2; return 1; }
241+
code=$(oci_curl -H 'Range: bytes=0-9' -D "$d/h" -o "$d/part" -w '%{http_code}' "$MEGA2_BASE_URL/v2/$repo/blobs/$dg")
242+
[ "$code" = 206 ] || { echo "Range GET returned $code" >&2; return 1; }
243+
[ "$(oci_header "$d/h" content-range)" = "bytes 0-9/100" ] || { echo "Content-Range is '$(oci_header "$d/h" content-range)'" >&2; return 1; }
244+
[ "$(wc -c < "$d/part" | tr -d ' ')" = 10 ] || { echo "Range body is not 10 bytes" >&2; return 1; }
245+
head -c 10 "$d/blob" | cmp -s - "$d/part" || { echo "Range body differs from the first 10 blob bytes" >&2; return 1; }
246+
code=$(oci_curl -H 'Range: bytes=100-' -o /dev/null -w '%{http_code}' "$MEGA2_BASE_URL/v2/$repo/blobs/$dg")
247+
[ "$code" = 416 ] || { echo "out-of-range GET returned $code" >&2; return 1; }
248+
}
249+
232250
run_case "OCI ping" case_oci_ping
233251
run_case "OCI oras push and pull" case_oci_oras_push_pull
234252
run_case "OCI reject unauthenticated push" case_oci_reject_unauth_push
235253
run_case "OCI chunked blob upload" case_oci_chunked_upload
236254
run_case "OCI cross-repo blob mount" case_oci_cross_repo_mount
237255
run_case "OCI manifest HEAD and conditional GET" case_oci_manifest_head_304
256+
run_case "OCI blob range" case_oci_blob_range
238257

239258
finish

0 commit comments

Comments
 (0)