Skip to content

Commit 9eec3e9

Browse files
genednaclaude
andcommitted
v0.41.15: BB-18 OCI tags list pagination case
Register `OCI tags list pagination` (plan-20261001 BB-18): three tags, n=2 returns exactly ["t1","t2"] for the created repository with a rel="next" Link; following it returns exactly ["t3"] and no Link header; n=abc returns 400 PAGINATION_NUMBER_INVALID. Marks BB-17 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 550a8a2 commit 9eec3e9

5 files changed

Lines changed: 29 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.14"
3+
version = "0.41.15"
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`、`OCI blob range`。
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`、`OCI tags list pagination`。
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
@@ -1321,7 +1321,7 @@
13211321
### Task BB-17: OCI blob range
13221322

13231323
**Task type:** `implementation`
1324-
**Lifecycle / Acceptance:** `in-progress` / `remote-pending`(v0.41.14;Codex R1 PASS;C 组 2023 测试通过;待 D 组 `docker` job)
1324+
**Lifecycle / Acceptance:** `done` / `complete`(v0.41.14;C 组 2023 测试通过;D 组 docker run 36950533971 success)
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:**
@@ -1370,7 +1370,7 @@
13701370
### Task BB-18: OCI tags list pagination
13711371

13721372
**Task type:** `implementation`
1373-
**Lifecycle / Acceptance:** `pending` / (空)
1373+
**Lifecycle / Acceptance:** `in-progress` / `remote-pending`(v0.41.15;Codex R2 PASS(P2 已修);C 组 2023 测试通过;待 D 组 `docker` job)
13741374
**Description:** 在 `scripts/oci_client_smoke_storage_only.sh` 注册 case `OCI tags list pagination`。同一仓库推送 3 个 tag 后分页读取。 唯一行为轴:tags/list 分页。
13751375
**Out of scope:** 其它 case(各自成卡);改 `src/**`(产品缺陷按 ADR-BB-08 立 `FIX-BB-*`);改既有 smoke 脚本(GC-BB-06);以 cargo IT 作 VER(GC-BB-04)。
13761376
**Current evidence:**

‎scripts/oci_client_smoke_storage_only.sh‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,36 @@ case_oci_blob_range() {
247247
[ "$code" = 416 ] || { echo "out-of-range GET returned $code" >&2; return 1; }
248248
}
249249

250+
# --- BB-18 OCI tags list pagination -------------------------------------
251+
case_oci_tags_pagination() {
252+
local d="$WORK/tags" repo="bb-$RUN_ID/tags" code link
253+
oci_case_begin
254+
oci_oras_push "$repo:t1" "$d" >/dev/null
255+
oci_run "$d/tag.out" oras tag --plain-http "$REGISTRY/$repo:t1" t2 t3
256+
code=$(oci_curl -D "$d/h1" -o "$d/p1.json" -w '%{http_code}' "$MEGA2_BASE_URL/v2/$repo/tags/list?n=2")
257+
[ "$code" = 200 ] || { echo "tags/list n=2 returned $code" >&2; return 1; }
258+
[ "$(jq -r .name "$d/p1.json")" = "$repo" ] || { echo "first page names another repository" >&2; return 1; }
259+
[ "$(jq -c .tags "$d/p1.json")" = '["t1","t2"]' ] || { echo "first page tags are $(jq -c .tags "$d/p1.json")" >&2; return 1; }
260+
link=$(oci_header "$d/h1" link)
261+
case "$link" in *'rel="next"'*) ;; *) echo "first page without a rel=\"next\" Link" >&2; return 1 ;; esac
262+
link=${link#<}; link=${link%%>*}
263+
code=$(oci_curl -D "$d/h2" -o "$d/p2.json" -w '%{http_code}' "$(oci_abs "$link")")
264+
[ "$code" = 200 ] || { echo "following Link returned $code" >&2; return 1; }
265+
[ "$(jq -r .name "$d/p2.json")" = "$repo" ] || { echo "second page names another repository" >&2; return 1; }
266+
[ "$(jq -c .tags "$d/p2.json")" = '["t3"]' ] || { echo "second page tags are $(jq -c .tags "$d/p2.json")" >&2; return 1; }
267+
if grep -qi '^link:' "$d/h2"; then echo "last page still has a Link header" >&2; return 1; fi
268+
code=$(oci_curl -o "$d/bad.json" -w '%{http_code}' "$MEGA2_BASE_URL/v2/$repo/tags/list?n=abc")
269+
[ "$code" = 400 ] || { echo "n=abc returned $code" >&2; return 1; }
270+
[ "$(jq -r '.errors[0].code' "$d/bad.json")" = PAGINATION_NUMBER_INVALID ] || { echo "n=abc error code mismatch" >&2; return 1; }
271+
}
272+
250273
run_case "OCI ping" case_oci_ping
251274
run_case "OCI oras push and pull" case_oci_oras_push_pull
252275
run_case "OCI reject unauthenticated push" case_oci_reject_unauth_push
253276
run_case "OCI chunked blob upload" case_oci_chunked_upload
254277
run_case "OCI cross-repo blob mount" case_oci_cross_repo_mount
255278
run_case "OCI manifest HEAD and conditional GET" case_oci_manifest_head_304
256279
run_case "OCI blob range" case_oci_blob_range
280+
run_case "OCI tags list pagination" case_oci_tags_pagination
257281

258282
finish

0 commit comments

Comments
 (0)