Skip to content

Commit 809d1d2

Browse files
genednaclaude
andcommitted
v0.41.28: BB-36 ART commit with missing objects case
Register the Artifacts black-box case `ART commit with missing objects` (plan-20261001 BB-36): a commit naming one uploaded and one never-uploaded oid returns 200 with `status` `missing_objects` listing only the absent oid, and the set is not created (`GET sets/{id}` returns 404). Marks BB-35 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 af0265b commit 809d1d2

5 files changed

Lines changed: 32 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.27"
3+
version = "0.41.28"
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
@@ -421,6 +421,6 @@ CASE='<case>'
421421
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/artifacts_smoke_storage_only.sh 2>&1 | tee target/tmp/bb-art-case.log
422422
```
423423

424-
已登记 case:`ART discovery`、`ART presigned upload and commit`、`ART server PUT upload and commit`、`ART presigned download`、`ART reject unauthenticated write`。
424+
已登记 case:`ART discovery`、`ART presigned upload and commit`、`ART server PUT upload and commit`、`ART presigned download`、`ART reject unauthenticated write`、`ART commit with missing objects`。
425425

426426
不设 `MEGA2_SMOKE_CASE` 时整跑全部默认栈 case;opt-in case(auth-none、GC、本地存储)只经 `scripts/bb_optin_run.sh <none|gc|local> artifacts_smoke_storage_only.sh '<case>' <log>` 运行。

‎docs/plan/plan-20261001.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2236,7 +2236,7 @@
22362236
### Task BB-35: ART reject unauthenticated write
22372237

22382238
**Task type:** `implementation`
2239-
**Lifecycle / Acceptance:** `in-progress` / `remote-pending`(v0.41.27;Codex R1 PASS;C 组 2036 测试通过;待 D 组 `docker` job)
2239+
**Lifecycle / Acceptance:** `done` / `complete`(v0.41.27;C 组 2036 测试通过;D 组 docker run 36998337243 success)
22402240
**Description:** 在 `scripts/artifacts_smoke_storage_only.sh` 注册 case `ART reject unauthenticated write`。无 token 调用三个写端点。 唯一行为轴:无凭据写拒绝。
22412241
**Out of scope:** 其它 case(各自成卡);改 `src/**`(产品缺陷按 ADR-BB-08 立 `FIX-BB-*`);改既有 smoke 脚本(GC-BB-06);以 cargo IT 作 VER(GC-BB-04)。
22422242
**Current evidence:**
@@ -2284,7 +2284,7 @@
22842284
### Task BB-36: ART commit with missing objects
22852285

22862286
**Task type:** `implementation`
2287-
**Lifecycle / Acceptance:** `pending` / (空)
2287+
**Lifecycle / Acceptance:** `in-progress` / `remote-pending`(v0.41.28;Codex R1 PASS;C 组 2036 测试通过;待 D 组 `docker` job)
22882288
**Description:** 在 `scripts/artifacts_smoke_storage_only.sh` 注册 case `ART commit with missing objects`。commit 引用一个已上传 oid 与一个从未上传的 oid(文档修正由 BB-48 承接)。 唯一行为轴:缺失对象的提交语义。
22892289
**Out of scope:** 其它 case(各自成卡);改 `src/**`(产品缺陷按 ADR-BB-08 立 `FIX-BB-*`);改既有 smoke 脚本(GC-BB-06);以 cargo IT 作 VER(GC-BB-04)。
22902290
**Current evidence:**

‎scripts/artifacts_smoke_storage_only.sh‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,37 @@ case_art_reject_unauth_write() {
253253
[ "$code" = 401 ] || { echo "fallback PUT without a token returned $code" >&2; return 1; }
254254
}
255255

256+
# --- BB-36 ART commit with missing objects ------------------------------
257+
# Any missing object aborts the whole commit: no artifact set or manifest is
258+
# committed, the set does not exist afterwards, and only the absent oid is
259+
# reported.
260+
case_art_commit_missing_objects() {
261+
local d="$WORK/bb36" ns="bb36-$RUN_ID" present missing set_id size code
262+
mkdir -p "$d"
263+
art_case_begin
264+
present=$(art_oid)
265+
missing=$(art_oid)
266+
set_id=$(art_set_id)
267+
printf 'bb36 present %s\n' "$RUN_ID" > "$d/obj"
268+
size=$(wc -c < "$d/obj" | tr -d ' ')
269+
code=$(art_server_put "$present" "$d/obj")
270+
[ "$code" = 204 ] || { echo "fallback PUT returned $code" >&2; return 1; }
271+
jq -n --arg ns "$ns" --arg set "$set_id" --arg p "$present" --arg m "$missing" --arg dir "bb36/$RUN_ID" --argjson size "$size" \
272+
'{namespace: $ns, object_type: "snapshot", artifact_set_id: $set,
273+
files: [{path: "\($dir)/present.txt", oid: $p, size: $size}, {path: "\($dir)/missing.txt", oid: $m, size: 7}]}' > "$d/commit.json"
274+
code=$(art_post commit "$d/commit.json" "$d/commit.out")
275+
[ "$code" = 200 ] || { echo "commit returned $code" >&2; return 1; }
276+
jq -e '.status == "missing_objects"' "$d/commit.out" > /dev/null || { echo "commit status is $(art_show .status "$d/commit.out"), want \"missing_objects\"" >&2; return 1; }
277+
jq -e --arg m "$missing" '.missing_objects == [$m]' "$d/commit.out" > /dev/null || { echo "missing_objects is $(art_show .missing_objects "$d/commit.out"), want only the never-uploaded oid" >&2; return 1; }
278+
code=$(art_curl -o /dev/null -w '%{http_code}' "$ART_API/sets/$set_id?namespace=$ns&object_type=snapshot")
279+
[ "$code" = 404 ] || { echo "GET sets/{id} for the uncommitted set returned $code" >&2; return 1; }
280+
}
281+
256282
run_case "ART discovery" case_art_discovery
257283
run_case "ART presigned upload and commit" case_art_presigned_upload_commit
258284
run_case "ART server PUT upload and commit" case_art_server_put_commit
259285
run_case "ART presigned download" case_art_presigned_download
260286
run_case "ART reject unauthenticated write" case_art_reject_unauth_write
287+
run_case "ART commit with missing objects" case_art_commit_missing_objects
261288

262289
finish

0 commit comments

Comments
 (0)