@usemosio/cli-linux-x64 1.0.0-next.1 → 1.0.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_NOTICES.md +22 -0
- package/apps/studio/dist/assets/Workspace-Dr-hVeFd.js +34 -0
- package/apps/studio/dist/assets/{agent-panel-CqJuv5Sn.js → agent-panel-DMrVed-J.js} +5 -5
- package/apps/studio/dist/assets/{boundary-bK2S8z05.js → boundary-DL9veUlN.js} +1 -1
- package/apps/studio/dist/assets/{feedback-BqzXUdVd.js → feedback-x6ZumR_x.js} +1 -1
- package/apps/studio/dist/assets/index-C6juWzGV.js +1984 -0
- package/apps/studio/dist/assets/index-CjDBKmB_.css +2 -0
- package/apps/studio/dist/assets/inspector3d-sqergHSP.js +1 -0
- package/apps/studio/dist/index.html +4 -3
- package/apps/studio/dist-host/studio-host.mjs +262 -3
- package/bin/mosio +0 -0
- package/bin/mosio-agent +0 -0
- package/crates/mosio/src/adapters/mosio-three.js +112 -8
- package/crates/mosio/src/adapters/room-env-pmrem.json +1 -0
- package/crates/mosio/src/runtime.js +205 -6
- package/fixtures/camera-inspect/mosio.json +56 -0
- package/fixtures/camera-inspect/scenes/behind.html +22 -0
- package/fixtures/camera-inspect/scenes/cut.html +18 -0
- package/fixtures/camera-inspect/scenes/edges.html +18 -0
- package/fixtures/camera-inspect/scenes/good.html +23 -0
- package/fixtures/camera-inspect/scenes/read.html +22 -0
- package/fixtures/camera-inspect/scenes/shake.html +23 -0
- package/fixtures/camera-inspect/scenes/speed.html +18 -0
- package/fixtures/camera-inspect-vertical/mosio.json +31 -0
- package/fixtures/camera-inspect-vertical/scenes/good.html +20 -0
- package/fixtures/camera-inspect-vertical/scenes/safe.html +18 -0
- package/fixtures/cloudrun-gpu/audio/music.wav +0 -0
- package/fixtures/cloudrun-gpu/audio/vo.wav +0 -0
- package/fixtures/cloudrun-gpu/mosio.json +18 -0
- package/fixtures/cloudrun-gpu/scenes/cube.html +25 -0
- package/fixtures/direct-seek/mosio.json +4 -0
- package/fixtures/direct-seek/scenes/clock.html +9 -0
- package/fixtures/direct-seek/scenes/meta.html +11 -0
- package/fixtures/direct-seek/scenes/pure.html +11 -0
- package/fixtures/direct-seek/scenes/slow.html +11 -0
- package/fixtures/direct-seek-media/mosio.json +6 -0
- package/fixtures/direct-seek-media/scenes/pure.html +11 -0
- package/fixtures/gl-readback/mosio.json +16 -0
- package/fixtures/gl-readback/scenes/compositor.html +23 -0
- package/fixtures/gl-readback/scenes/readback.html +23 -0
- package/fixtures/inspect-physics/expect.json +18 -0
- package/fixtures/inspect-physics/mosio.json +29 -0
- package/fixtures/inspect-physics/scenes/calm.html +46 -0
- package/fixtures/inspect-physics/scenes/physics.html +47 -0
- package/package.json +1 -1
- package/primitives/README.md +23 -2
- package/primitives/example/shared/mosio-prims.js +349 -1
- package/primitives/impact-burst/golden/f030.png +0 -0
- package/primitives/impact-burst/golden/f032.png +0 -0
- package/primitives/impact-burst/golden/f036.png +0 -0
- package/primitives/impact-burst/impact-burst.js +51 -0
- package/primitives/impact-burst/primitive.json +130 -0
- package/primitives/impact-burst/scene.html +24 -0
- package/primitives/stick-figure/golden/f030.png +0 -0
- package/primitives/stick-figure/golden/f092.png +0 -0
- package/primitives/stick-figure/golden/f140.png +0 -0
- package/primitives/stick-figure/primitive.json +179 -0
- package/primitives/stick-figure/scene.html +40 -0
- package/primitives/stick-figure/stick-figure.js +297 -0
- package/primitives/zoom-through/primitive.json +7 -2
- package/primitives/zoom-through/zoom-through.js +6 -5
- package/scripts/3d-acceptance.sh +8 -1
- package/scripts/3d-attach-bench.mjs +119 -0
- package/scripts/3d-bake-room-env.mjs +74 -0
- package/scripts/3d-e2b-job.sh +1 -0
- package/scripts/3d-gen-heavy-fixture.py +65 -0
- package/scripts/3d-trace-summary.py +14 -0
- package/scripts/acceptance/camera-inspect.sh +49 -0
- package/scripts/acceptance/direct-seek.sh +68 -0
- package/scripts/acceptance/export.sh +5 -3
- package/scripts/acceptance/frames.sh +7 -2
- package/scripts/acceptance/hardening.sh +37 -6
- package/scripts/acceptance/hub.sh +208 -0
- package/scripts/acceptance/inspect.sh +21 -2
- package/scripts/acceptance/revisions-git.sh +137 -0
- package/scripts/acceptance/revisions-sync.sh +323 -0
- package/scripts/acceptance/revisions.sh +118 -4
- package/scripts/acceptance/segcache.sh +100 -0
- package/scripts/acceptance/split.sh +78 -0
- package/scripts/bootstrap.sh +20 -1
- package/scripts/check-error-codes.py +9 -1
- package/scripts/check-file-size.sh +45 -0
- package/scripts/ci.sh +4 -4
- package/scripts/dedupe-report.sh +47 -0
- package/scripts/e2b/template/provision.sh +1 -1
- package/scripts/fastpath/cdp.mjs +25 -0
- package/scripts/fastpath/dbg.mjs +11 -0
- package/scripts/fastpath/e2b.mjs +40 -0
- package/scripts/fastpath/features/gen.py +109 -0
- package/scripts/fastpath/features/mosio.json +100 -0
- package/scripts/fastpath/features/scenes/backdrop.html +11 -0
- package/scripts/fastpath/features/scenes/blend.html +11 -0
- package/scripts/fastpath/features/scenes/canvas2d.html +11 -0
- package/scripts/fastpath/features/scenes/filter.html +11 -0
- package/scripts/fastpath/features/scenes/gradient.html +11 -0
- package/scripts/fastpath/features/scenes/iframe.html +11 -0
- package/scripts/fastpath/features/scenes/image.html +11 -0
- package/scripts/fastpath/features/scenes/svg.html +11 -0
- package/scripts/fastpath/features/scenes/text.html +11 -0
- package/scripts/fastpath/features/scenes/typo.html +11 -0
- package/scripts/fastpath/features/scenes/video.html +11 -0
- package/scripts/fastpath/features/scenes/video2.html +11 -0
- package/scripts/fastpath/features-xfade/mosio.json +49 -0
- package/scripts/fastpath/features-xfade/scenes/image.html +11 -0
- package/scripts/fastpath/features-xfade/scenes/video.html +11 -0
- package/scripts/fastpath/fixtures/gen_layout.py +80 -0
- package/scripts/fastpath/fixtures/l12-no-reset/assets/img/photo-1015.jpg +0 -0
- package/scripts/fastpath/fixtures/l12-no-reset/mosio.json +34 -0
- package/scripts/fastpath/fixtures/l12-no-reset/scenes/main.html +20 -0
- package/scripts/fastpath/fp.mjs +91 -0
- package/scripts/fastpath/inpage.js +68 -0
- package/scripts/fastpath/recipes.py +49 -0
- package/scripts/fastpath/sandbox.sh +68 -0
- package/scripts/fastpath/sandbox10.sh +57 -0
- package/scripts/fastpath/sandbox11.sh +18 -0
- package/scripts/fastpath/sandbox12.sh +30 -0
- package/scripts/fastpath/sandbox13.sh +16 -0
- package/scripts/fastpath/sandbox14.sh +28 -0
- package/scripts/fastpath/sandbox15.sh +36 -0
- package/scripts/fastpath/sandbox16.sh +60 -0
- package/scripts/fastpath/sandbox17.sh +34 -0
- package/scripts/fastpath/sandbox18.sh +59 -0
- package/scripts/fastpath/sandbox19.sh +67 -0
- package/scripts/fastpath/sandbox2.sh +41 -0
- package/scripts/fastpath/sandbox20.sh +34 -0
- package/scripts/fastpath/sandbox21.sh +22 -0
- package/scripts/fastpath/sandbox22.sh +22 -0
- package/scripts/fastpath/sandbox23.sh +21 -0
- package/scripts/fastpath/sandbox3.sh +151 -0
- package/scripts/fastpath/sandbox4.sh +161 -0
- package/scripts/fastpath/sandbox5.sh +69 -0
- package/scripts/fastpath/sandbox6.sh +85 -0
- package/scripts/fastpath/sandbox7.sh +81 -0
- package/scripts/fastpath/sandbox8.sh +62 -0
- package/scripts/fastpath/sandbox9.sh +130 -0
- package/scripts/fastpath/srv.mjs +15 -0
- package/scripts/fastpath/www/probe.html +1 -0
- package/scripts/gen-media-fixtures.sh +1 -0
- package/scripts/gl-readback-check.sh +26 -0
- package/scripts/hpbench/make-bench-fixtures.sh +43 -0
- package/scripts/hpbench/render-cgroup.sh +56 -0
- package/scripts/install.sh +2 -1
- package/scripts/npm-clean-install-proof-win.sh +64 -0
- package/scripts/platform-smoke.sh +80 -0
- package/scripts/prim.mjs +31 -13
- package/scripts/user-journey.sh +68 -0
- package/skills/mosio-3d/SKILL.md +31 -3
- package/skills/mosio-brief/SKILL.md +80 -0
- package/skills/mosio-brief/references/brief.md +141 -0
- package/skills/mosio-brief/references/copy.md +99 -0
- package/skills/mosio-brief/references/narration.md +61 -0
- package/skills/mosio-brief/references/storyboard.md +98 -0
- package/skills/mosio-collab/SKILL.md +104 -0
- package/skills/mosio-collab/references/hub.md +62 -0
- package/skills/mosio-engine/SKILL.md +44 -13
- package/skills/mosio-engine/references/camera.md +12 -2
- package/skills/mosio-engine/references/character.md +88 -0
- package/skills/mosio-engine/references/checks.md +11 -4
- package/skills/mosio-engine/references/delivery.md +29 -2
- package/skills/mosio-engine/references/kit-primitives.md +8 -4
- package/skills/mosio-engine/references/layout.md +8 -0
- package/skills/mosio-engine/references/plan.md +3 -1
- package/skills/mosio-engine/references/project.md +15 -3
- package/skills/mosio-engine/references/publish.md +79 -0
- package/skills/mosio-engine/references/registry.md +27 -15
- package/skills/mosio-engine/references/timeline.md +19 -1
- package/skills/mosio-engine/references/timing.md +2 -1
- package/skills/mosio-import/SKILL.md +1 -1
- package/skills/mosio-import/references/from-hyperframes.md +1 -1
- package/skills/mosio-import/references/from-remotion.md +1 -1
- package/skills/mosio-media/SKILL.md +16 -4
- package/skills/mosio-media/references/audio.md +29 -11
- package/skills/mosio-media/references/captions.md +26 -5
- package/skills/mosio-media/references/editing.md +70 -0
- package/skills/mosio-media/references/footage.md +40 -8
- package/skills/mosio-media/references/voice.md +52 -7
- package/skills/mosio-replicate/references/mosio.md +1 -1
- package/toolchain.lock.json +151 -4
- package/apps/studio/dist/assets/Workspace-KSOFeEgc.js +0 -32
- package/apps/studio/dist/assets/index-B-uuTqe9.js +0 -1785
- package/apps/studio/dist/assets/index-CajSh04l.css +0 -2
- package/apps/studio/dist/assets/inspector3d-vDz97X99.js +0 -1
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Sync acceptance (`mosio push`, `fetch`, `pull`, `clone`, `fsck --remote`) through real CLI processes, against both
|
|
3
|
+
# kinds of remote: a bare store in a directory (file) and the reference server `mosio remote serve` (http).
|
|
4
|
+
# Run as root in the sandbox.
|
|
5
|
+
# revisions-60 chunk-level dedupe: the second push of a project whose large media file grew sends only the changed chunks
|
|
6
|
+
# (counts and bytes from --json); a push with nothing new sends nothing
|
|
7
|
+
# revisions-61 an interrupted push (killed after N uploads) resumes: the rerun sends exactly what the first run did not
|
|
8
|
+
# revisions-62 two clients racing one ref: exactly one compare-and-swap wins, the loser gets E_SYNC_DIVERGED with the
|
|
9
|
+
# current tip, both revisions are in the remote store, and the loser's pull merges them into one revision
|
|
10
|
+
# revisions-63 a tampered object is refused (E_SYNC_HASH) and nothing is published; the server also refuses wrong bytes
|
|
11
|
+
# sent by a client that is not this CLI
|
|
12
|
+
# revisions-64 `fsck --remote` is clean on a good remote and reports a missing and a corrupt chunk on a damaged one
|
|
13
|
+
# revisions-65 `clone --lazy-media` leaves the large files out; a render (stills) and a revision export fetch them on
|
|
14
|
+
# demand and produce the same pixels as the source project
|
|
15
|
+
# revisions-66 clone, fetch, pull (fast-forward), a diverged take (E_SYNC_DIVERGED for push, a clean pull merges it) and push --force
|
|
16
|
+
# with its reflog entry on the remote; `remote add|list|rm`
|
|
17
|
+
# revisions-67 bearer tokens: the server refuses without one, accepts MOSIO_REMOTE_TOKEN or a private credentials file,
|
|
18
|
+
# refuses a credentials file others can read, and refuses to listen beyond loopback without a token
|
|
19
|
+
# revisions-68 tags: push sends them, clone and fetch bring them (--no-tags leaves them), a tag of this project at another
|
|
20
|
+
# revision is refused on the remote (E_SYNC_TAG_EXISTS, nothing moves) and moves only with --force, which the
|
|
21
|
+
# remote's tag reflog records as push-force; fsck --remote walks the tags
|
|
22
|
+
# revisions-69 a single unchunked file of 310 MiB (over the old 288 MiB limit; generated here, never committed): pushed and
|
|
23
|
+
# cloned as a stream with the client's anonymous memory far below the file size, byte-identical on both sides,
|
|
24
|
+
# fsck --remote clean; MOSIO_SYNC_MAX_BLOB below the file refuses it before anything is sent (E_SYNC_LIMIT)
|
|
25
|
+
# revisions-70 parallel uploads: --jobs 8 and MOSIO_SYNC_JOBS=1 land the same objects and refs on two remotes, fsck --remote is
|
|
26
|
+
# clean on both, and a bad worker count is E_ARGS
|
|
27
|
+
# revisions-71 resume: the client is killed (SIGKILL) while it streams the 310 MiB file; no ref has moved; the rerun sends
|
|
28
|
+
# only the bytes the remote did not hold (bytes.resumed), the remote's copy is byte-identical and fsck --remote
|
|
29
|
+
# is clean
|
|
30
|
+
set -uo pipefail
|
|
31
|
+
REPO="$(cd "$(dirname "$0")/../.." && pwd)"; cd "$REPO"
|
|
32
|
+
W=/home/mosio/acc-revisions-sync; F="$REPO/fixtures"
|
|
33
|
+
cargo build --release --locked 2>&1 | tail -1
|
|
34
|
+
chmod -R o+rX "$REPO"
|
|
35
|
+
u() { scripts/as-user.sh "$1"; }
|
|
36
|
+
declare -A R
|
|
37
|
+
u "rm -rf $W && mkdir -p $W"
|
|
38
|
+
|
|
39
|
+
# a remote of the given kind for test NAME: prints its URL (the store is $W/store-NAME-KIND)
|
|
40
|
+
mk() {
|
|
41
|
+
local store=$W/store-$2-$1 log=$W/srv-$2-$1.log
|
|
42
|
+
if [ "$1" = file ]; then echo "$store"; return; fi
|
|
43
|
+
u "(nohup mosio remote serve $store --listen 127.0.0.1:0 ${3:+--token $3} > $log 2>&1 &); for i in \$(seq 100); do grep -q listening $log 2>/dev/null && break; sleep 0.1; done"
|
|
44
|
+
echo "http://$(jq -r .listening $log)"
|
|
45
|
+
}
|
|
46
|
+
newp() { u "mosio init $1 --name acc > /dev/null && mkdir -p $1/assets && head -c $2 /dev/urandom > $1/assets/media.bin && mosio commit $1 -m media > /dev/null && mosio remote add $1 origin $3 > /dev/null"; }
|
|
47
|
+
head_of() { u "mosio status $1" | jq -r .head; }
|
|
48
|
+
sent() { jq '.objects.sent + .chunks.sent + .revisions.sent' "$1"; }
|
|
49
|
+
|
|
50
|
+
# R60: dedupe
|
|
51
|
+
ok=1; note=""
|
|
52
|
+
for t in file http; do
|
|
53
|
+
url=$(mk $t r60); p=$W/r60-$t
|
|
54
|
+
newp $p 12000000 $url
|
|
55
|
+
u "mosio push $p --json > $W/r60-$t-1.json; head -c 300000 /dev/urandom >> $p/assets/media.bin && mosio commit $p -m longer > /dev/null && mosio push $p --json > $W/r60-$t-2.json; mosio push $p --json > $W/r60-$t-3.json"
|
|
56
|
+
jq -e '.chunks.total >= 8 and .chunks.sent == .chunks.total and .revisions.sent == 2' $W/r60-$t-1.json > /dev/null || ok=0
|
|
57
|
+
jq -e '.revisions.sent == 1 and .chunks.sent <= 3 and (.chunks.skipped + 3 >= .chunks.total) and .bytes.sent < 2000000' $W/r60-$t-2.json > /dev/null || ok=0
|
|
58
|
+
jq -e '.up_to_date == true and .bytes.sent == 0' $W/r60-$t-3.json > /dev/null || ok=0
|
|
59
|
+
note="$note $t: first=$(jq -c '{c:.chunks,b:.bytes.sent}' $W/r60-$t-1.json) second=$(jq -c '{c:.chunks,b:.bytes.sent}' $W/r60-$t-2.json);"
|
|
60
|
+
done
|
|
61
|
+
[ $ok = 1 ] && R[revisions-60]=PASS || R[revisions-60]=FAIL
|
|
62
|
+
echo " R60:$note"
|
|
63
|
+
|
|
64
|
+
# R61: interrupted upload resumes (one upload worker, so that "killed after N uploads" is exactly N objects on the remote)
|
|
65
|
+
ok=1; note=""
|
|
66
|
+
for t in file http; do
|
|
67
|
+
ua=$(mk $t r61a); ub=$(mk $t r61b); p=$W/r61-$t
|
|
68
|
+
newp $p 12000000 $ua
|
|
69
|
+
u "mosio push $p --json > $W/r61-$t-full.json; mosio remote add $p second $ub > /dev/null"
|
|
70
|
+
total=$(sent $W/r61-$t-full.json)
|
|
71
|
+
u "MOSIO_SYNC_JOBS=1 MOSIO_SYNC_DIE_AFTER=6 mosio push $p second --json > $W/r61-$t-die.out 2>&1; echo \$? > $W/r61-$t-die.rc"
|
|
72
|
+
[ -z "$(ls $W/store-r61b-$t/refs/heads 2>/dev/null)" ] && nref=0 || nref=1
|
|
73
|
+
u "mosio push $p second --json > $W/r61-$t-resume.json; echo \$? > $W/r61-$t-resume.rc; mosio fsck $p --remote second --json > $W/r61-$t-fsck.json; echo \$? > $W/r61-$t-fsck.rc"
|
|
74
|
+
resumed=$(sent $W/r61-$t-resume.json)
|
|
75
|
+
[ "$(cat $W/r61-$t-die.rc)" = 137 ] && [ $nref = 0 ] || ok=0
|
|
76
|
+
[ "$resumed" = $((total - 6)) ] && [ "$(cat $W/r61-$t-resume.rc)" = 0 ] || ok=0
|
|
77
|
+
[ "$(cat $W/r61-$t-fsck.rc)" = 0 ] && [ "$(cat $W/store-r61b-$t/refs/heads/main)" = "$(head_of $p)" ] || ok=0
|
|
78
|
+
note="$note $t: total=$total killed_after=6 resumed=$resumed die_rc=$(cat $W/r61-$t-die.rc) resume_rc=$(cat $W/r61-$t-resume.rc) fsck_rc=$(cat $W/r61-$t-fsck.rc) refs=$(ls $W/store-r61b-$t/refs/heads 2>/dev/null | tr '\n' ' ');"
|
|
79
|
+
done
|
|
80
|
+
[ $ok = 1 ] && R[revisions-61]=PASS || R[revisions-61]=FAIL
|
|
81
|
+
echo " R61:$note"
|
|
82
|
+
|
|
83
|
+
# R62: two clients race one ref
|
|
84
|
+
ok=1; note=""
|
|
85
|
+
for t in file http; do
|
|
86
|
+
url=$(mk $t r62); a=$W/r62a-$t; b=$W/r62b-$t
|
|
87
|
+
newp $a 3000000 $url
|
|
88
|
+
u "mosio push $a > /dev/null && mosio clone $url $b > /dev/null && echo a > $a/note-a.txt && mosio commit $a -m a > /dev/null && echo b > $b/note-b.txt && mosio commit $b -m b > /dev/null"
|
|
89
|
+
ha=$(head_of $a); hb=$(head_of $b)
|
|
90
|
+
u "MOSIO_SYNC_HOLD_MS=1500 mosio push $a --json > $W/r62a-$t.out 2>&1; echo \$? > $W/r62a-$t.rc" &
|
|
91
|
+
u "MOSIO_SYNC_HOLD_MS=1500 mosio push $b --json > $W/r62b-$t.out 2>&1; echo \$? > $W/r62b-$t.rc" &
|
|
92
|
+
wait
|
|
93
|
+
ra=$(cat $W/r62a-$t.rc); rb=$(cat $W/r62b-$t.rc)
|
|
94
|
+
if [ "$ra" = 0 ] && [ "$rb" != 0 ]; then win=$ha; lose=$W/r62b-$t.out; elif [ "$rb" = 0 ] && [ "$ra" != 0 ]; then win=$hb; lose=$W/r62a-$t.out; else win=""; ok=0; fi
|
|
95
|
+
if [ -n "$win" ]; then
|
|
96
|
+
jq -e --arg w "$win" '.code == "E_SYNC_DIVERGED" and .details.current == $w' $lose > /dev/null || ok=0
|
|
97
|
+
[ "$(cat $W/store-r62-$t/refs/heads/main)" = "$win" ] || ok=0
|
|
98
|
+
fi
|
|
99
|
+
[ -f $W/store-r62-$t/revs/$ha.json ] && [ -f $W/store-r62-$t/revs/$hb.json ] || ok=0
|
|
100
|
+
# the loser pulls: one merge revision with both as parents, then pushes it; no revision is lost
|
|
101
|
+
if [ "$ra" = 0 ]; then loser=$b; else loser=$a; fi
|
|
102
|
+
u "mosio pull $loser --json > $W/r62-pull-$t.json; mosio push $loser --json > $W/r62-merge-$t.json; echo \$? > $W/r62-merge-$t.rc"
|
|
103
|
+
mh=$(head_of $loser)
|
|
104
|
+
jq -e '.action == "merged"' $W/r62-pull-$t.json > /dev/null && [ "$(cat $W/r62-merge-$t.rc)" = 0 ] && [ "$(cat $W/store-r62-$t/refs/heads/main)" = "$mh" ] \
|
|
105
|
+
&& jq -e --arg a "$ha" --arg b "$hb" '.parents | sort == ([$a, $b] | sort)' $W/store-r62-$t/revs/$mh.json > /dev/null || ok=0
|
|
106
|
+
note="$note $t: rc=$ra/$rb loser=$(jq -r .code ${lose:-/dev/null} 2>/dev/null);"
|
|
107
|
+
done
|
|
108
|
+
[ $ok = 1 ] && R[revisions-62]=PASS || R[revisions-62]=FAIL
|
|
109
|
+
echo " R62:$note"
|
|
110
|
+
|
|
111
|
+
# R63: tampered upload
|
|
112
|
+
ok=1; note=""
|
|
113
|
+
for t in file http; do
|
|
114
|
+
url=$(mk $t r63); p=$W/r63-$t
|
|
115
|
+
newp $p 6000000 $url
|
|
116
|
+
u "MOSIO_SYNC_TAMPER=1 mosio push $p --json > $W/r63-$t.out 2>&1; echo \$? > $W/r63-$t.rc"
|
|
117
|
+
jq -e '.code == "E_SYNC_HASH"' $W/r63-$t.out > /dev/null || ok=0
|
|
118
|
+
[ "$(cat $W/r63-$t.rc)" != 0 ] && [ -z "$(ls $W/store-r63-$t/refs/heads 2>/dev/null)" ] || ok=0
|
|
119
|
+
if [ $t = http ]; then
|
|
120
|
+
code=$(curl -s -o $W/r63-put.json -w '%{http_code}' -X PUT --data-binary tampered "$url/v1/objects/chunk/$(printf '%064x' 1)")
|
|
121
|
+
[ "$code" = 422 ] && jq -e '.code == "E_SYNC_HASH"' $W/r63-put.json > /dev/null || ok=0
|
|
122
|
+
note="$note direct PUT of wrong bytes: HTTP $code;"
|
|
123
|
+
fi
|
|
124
|
+
u "mosio push $p > /dev/null; echo \$? > $W/r63-$t.rc2"
|
|
125
|
+
[ "$(cat $W/r63-$t.rc2)" = 0 ] || ok=0
|
|
126
|
+
note="$note $t: $(jq -r .code $W/r63-$t.out);"
|
|
127
|
+
done
|
|
128
|
+
[ $ok = 1 ] && R[revisions-63]=PASS || R[revisions-63]=FAIL
|
|
129
|
+
echo " R63:$note"
|
|
130
|
+
|
|
131
|
+
# R64: fsck --remote
|
|
132
|
+
ok=1; note=""
|
|
133
|
+
for t in file http; do
|
|
134
|
+
url=$(mk $t r64); p=$W/r64-$t; s=$W/store-r64-$t
|
|
135
|
+
newp $p 12000000 $url
|
|
136
|
+
u "mosio push $p > /dev/null; mosio fsck $p --remote origin --json > $W/r64-$t-good.json; echo \$? > $W/r64-$t-good.rc"
|
|
137
|
+
jq -e '.ok == true and .stats.chunks >= 8' $W/r64-$t-good.json > /dev/null && [ "$(cat $W/r64-$t-good.rc)" = 0 ] || ok=0
|
|
138
|
+
c1=$(find $s/objects/chunks -type f | sort | sed -n 1p); c2=$(find $s/objects/chunks -type f | sort | sed -n 2p)
|
|
139
|
+
printf '\377' | dd of=$c1 bs=1 seek=5 conv=notrunc 2> /dev/null; rm -f $c2
|
|
140
|
+
u "mosio fsck $p --remote origin --json > $W/r64-$t-bad.json; echo \$? > $W/r64-$t-bad.rc; mosio fsck $p --remote origin --quick --json > $W/r64-$t-quick.json; echo \$? > $W/r64-$t-quick.rc"
|
|
141
|
+
jq -e '[.findings[].code] | (index("E_FSCK_REMOTE_CHUNK_CORRUPT") != null and index("E_FSCK_REMOTE_CHUNK_MISSING") != null)' $W/r64-$t-bad.json > /dev/null && [ "$(cat $W/r64-$t-bad.rc)" = 1 ] || ok=0
|
|
142
|
+
jq -e '[.findings[].code] == ["E_FSCK_REMOTE_CHUNK_MISSING"]' $W/r64-$t-quick.json > /dev/null || ok=0
|
|
143
|
+
note="$note $t: good=ok bad=$(jq -c '[.findings[].code]' $W/r64-$t-bad.json) quick=$(jq -c '[.findings[].code]' $W/r64-$t-quick.json);"
|
|
144
|
+
done
|
|
145
|
+
[ $ok = 1 ] && R[revisions-64]=PASS || R[revisions-64]=FAIL
|
|
146
|
+
echo " R64:$note"
|
|
147
|
+
|
|
148
|
+
# R65: lazy media
|
|
149
|
+
ok=1; note=""
|
|
150
|
+
for t in file http; do
|
|
151
|
+
url=$(mk $t r65); src=$W/r65src-$t; lazy=$W/r65-lazy-$t; lazy2=$W/r65-lazy2-$t
|
|
152
|
+
u "cp -r $F/w3-promo $src && head -c 6000000 /dev/urandom > $src/assets/extra.bin && mosio commit $src -m base > /dev/null && mosio remote add $src origin $url > /dev/null && mosio push $src > /dev/null"
|
|
153
|
+
u "mosio stills $src --at scene.start,scene.end -o $W/r65-src-$t > $W/r65-src-$t.json"
|
|
154
|
+
u "mosio clone $url $lazy --lazy-media --json > $W/r65-clone-$t.json; mosio status $lazy > $W/r65-status-$t.json; mosio fsck $lazy --json > $W/r65-fsck-$t.json; echo \$? > $W/r65-fsck-$t.rc"
|
|
155
|
+
jq -e '.lazy == true and .lazy_files >= 1' $W/r65-clone-$t.json > /dev/null || ok=0
|
|
156
|
+
[ ! -e $lazy/assets/extra.bin ] && [ -f $lazy/mosio.json ] || ok=0
|
|
157
|
+
jq -e '.dirty == false' $W/r65-status-$t.json > /dev/null && [ "$(cat $W/r65-fsck-$t.rc)" = 0 ] || ok=0
|
|
158
|
+
# a render reads the media: it is fetched, and the pixels are the source's
|
|
159
|
+
u "mosio stills $lazy --at scene.start,scene.end -o $W/r65-lazy-$t-img > $W/r65-lazy-$t.json; mosio status $lazy > $W/r65-status2-$t.json"
|
|
160
|
+
want=$(jq -c '[.stills[] | {scene, frame, hash}]' $W/r65-src-$t.json); got=$(jq -c '[.stills[] | {scene, frame, hash}]' $W/r65-lazy-$t.json)
|
|
161
|
+
[ -n "$want" ] && [ "$want" = "$got" ] && cmp -s $src/assets/extra.bin $lazy/assets/extra.bin || ok=0
|
|
162
|
+
jq -e '.dirty == false' $W/r65-status2-$t.json > /dev/null || ok=0
|
|
163
|
+
# an export of a revision (the path of checkout, rollback and --revision previews) fetches what it reads too
|
|
164
|
+
u "mosio clone $url $lazy2 --lazy-media > /dev/null"
|
|
165
|
+
u "mosio stills $lazy2 --revision $(head_of $lazy2) --at scene.start,scene.end -o $W/r65-lazy2-$t-img > $W/r65-lazy2-$t.json"
|
|
166
|
+
got2=$(jq -c '[.stills[] | {scene, frame, hash}]' $W/r65-lazy2-$t.json)
|
|
167
|
+
[ "$want" = "$got2" ] && [ ! -e $lazy2/assets/extra.bin ] || ok=0
|
|
168
|
+
note="$note $t: lazy_files=$(jq -r .lazy_files $W/r65-clone-$t.json) stills=$(jq '.stills|length' $W/r65-lazy-$t.json) equal=$([ "$want" = "$got" ] && echo yes || echo NO); lazy2=$(head -c 200 $W/r65-lazy2-$t.json | tr '\n' ' ');"
|
|
169
|
+
done
|
|
170
|
+
[ $ok = 1 ] && R[revisions-65]=PASS || R[revisions-65]=FAIL
|
|
171
|
+
echo " R65:$note"
|
|
172
|
+
|
|
173
|
+
# R66: clone, fetch, pull, diverge, force; remote add|list|rm
|
|
174
|
+
ok=1; note=""
|
|
175
|
+
for t in file http; do
|
|
176
|
+
url=$(mk $t r66); a=$W/r66a-$t; b=$W/r66b-$t; s=$W/store-r66-$t
|
|
177
|
+
newp $a 1500000 $url
|
|
178
|
+
u "mosio push $a > /dev/null && mosio clone $url $b --json > $W/r66-clone-$t.json && mosio fsck $b > /dev/null; echo \$? > $W/r66-fsck-$t.rc"
|
|
179
|
+
[ "$(cat $W/r66-fsck-$t.rc)" = 0 ] && cmp -s $a/assets/media.bin $b/assets/media.bin || ok=0
|
|
180
|
+
u "echo two > $a/two.txt && mosio commit $a -m two > /dev/null && mosio push $a > /dev/null && mosio fetch $b --json > $W/r66-fetch-$t.json && mosio pull $b --json > $W/r66-pull-$t.json"
|
|
181
|
+
jq -e '.action == "fast-forward"' $W/r66-pull-$t.json > /dev/null && [ "$(cat $b/two.txt)" = two ] && [ "$(head_of $a)" = "$(head_of $b)" ] || ok=0
|
|
182
|
+
u "echo mine > $b/mine.txt && mosio commit $b -m mine > /dev/null && echo theirs > $a/theirs.txt && mosio commit $a -m theirs > /dev/null && mosio push $a > /dev/null"
|
|
183
|
+
hb=$(head_of $b); ha=$(head_of $a)
|
|
184
|
+
u "mosio push $b --json > $W/r66-div-$t.out 2>&1; echo \$? > $W/r66-div-$t.rc"
|
|
185
|
+
jq -e --arg ha "$ha" '.code == "E_SYNC_DIVERGED" and .details.current == $ha' $W/r66-div-$t.out > /dev/null && [ "$(cat $W/r66-div-$t.rc)" != 0 ] || ok=0
|
|
186
|
+
# the files differ, so the pull merges them: a merge revision with both tips as parents, then a plain push
|
|
187
|
+
u "mosio pull $b --json > $W/r66-pdiv-$t.out 2>&1; mosio push $b > /dev/null; echo \$? > $W/r66-mpush-$t.rc"
|
|
188
|
+
jq -e '.action == "merged"' $W/r66-pdiv-$t.out > /dev/null && [ "$(cat $W/r66-mpush-$t.rc)" = 0 ] && [ -f $b/theirs.txt ] && [ -f $b/mine.txt ] || ok=0
|
|
189
|
+
# a second divergence, overwritten with --force (the remote's reflog records it)
|
|
190
|
+
u "echo m2 > $b/m2.txt && mosio commit $b -m m2 > /dev/null && mosio pull $a > /dev/null && echo t2 > $a/t2.txt && mosio commit $a -m t2 > /dev/null && mosio push $a > /dev/null"
|
|
191
|
+
hb=$(head_of $b)
|
|
192
|
+
u "mosio push $b --force --json > $W/r66-force-$t.json"
|
|
193
|
+
jq -e '.forced == true' $W/r66-force-$t.json > /dev/null && [ "$(cat $s/refs/heads/main)" = "$hb" ] && tail -1 $s/logs/refs/heads/main.jsonl | grep -q '"event":"push-force"' || ok=0
|
|
194
|
+
u "mosio remote list $b > $W/r66-list-$t.json; mosio remote add $b nas /mnt/nas/store > /dev/null; mosio remote rm $b nas > $W/r66-rm-$t.json; mosio remote list $b > $W/r66-list2-$t.json; mosio fsck $b > /dev/null; echo \$? > $W/r66-fsck2-$t.rc"
|
|
195
|
+
jq -e '.remotes | length == 1 and .[0].name == "origin"' $W/r66-list2-$t.json > /dev/null && [ "$(cat $W/r66-fsck2-$t.rc)" = 0 ] || ok=0
|
|
196
|
+
note="$note $t: pull=$(jq -r .action $W/r66-pull-$t.json) diverged=$(jq -r .code $W/r66-div-$t.out);"
|
|
197
|
+
done
|
|
198
|
+
[ $ok = 1 ] && R[revisions-66]=PASS || R[revisions-66]=FAIL
|
|
199
|
+
echo " R66:$note"
|
|
200
|
+
|
|
201
|
+
# R67: tokens
|
|
202
|
+
ok=1
|
|
203
|
+
url=$(mk http r67 s3cret); p=$W/r67; store=$W/store-r67-http
|
|
204
|
+
newp $p 1000000 $url
|
|
205
|
+
u "mosio push $p --json > $W/r67-anon.out 2>&1; echo \$? > $W/r67-anon.rc"
|
|
206
|
+
jq -e '.code == "E_REMOTE_AUTH"' $W/r67-anon.out > /dev/null && [ "$(cat $W/r67-anon.rc)" != 0 ] && ! grep -rq s3cret $W/r67-anon.out || ok=0
|
|
207
|
+
u "MOSIO_REMOTE_TOKEN=wrong mosio push $p --json > $W/r67-wrong.out 2>&1; MOSIO_REMOTE_TOKEN=s3cret mosio push $p --json > $W/r67-env.out 2>&1; echo \$? > $W/r67-env.rc"
|
|
208
|
+
jq -e '.code == "E_REMOTE_AUTH"' $W/r67-wrong.out > /dev/null && [ "$(cat $W/r67-env.rc)" = 0 ] || ok=0
|
|
209
|
+
host=${url#http://}
|
|
210
|
+
u "mkdir -p $W/cfg/mosio && printf '{\"$host\": \"s3cret\"}' > $W/cfg/mosio/credentials.json && chmod 600 $W/cfg/mosio/credentials.json && echo two > $p/two.txt && mosio commit $p -m two > /dev/null && XDG_CONFIG_HOME=$W/cfg mosio push $p --json > $W/r67-cred.out 2>&1; echo \$? > $W/r67-cred.rc; chmod 644 $W/cfg/mosio/credentials.json; echo three > $p/three.txt && mosio commit $p -m three > /dev/null && XDG_CONFIG_HOME=$W/cfg mosio push $p --json > $W/r67-open.out 2>&1; echo \$? > $W/r67-open.rc"
|
|
211
|
+
[ "$(cat $W/r67-cred.rc)" = 0 ] && jq -e '.code == "E_REMOTE_AUTH"' $W/r67-open.out > /dev/null && [ "$(cat $W/r67-open.rc)" != 0 ] || ok=0
|
|
212
|
+
u "mosio remote serve $W/store-r67-open --listen 0.0.0.0:0 > $W/r67-public.out 2>&1; echo \$? > $W/r67-public.rc"
|
|
213
|
+
jq -e '.code == "E_REMOTE_AUTH"' $W/r67-public.out > /dev/null && [ "$(cat $W/r67-public.rc)" != 0 ] || ok=0
|
|
214
|
+
[ $ok = 1 ] && R[revisions-67]=PASS || R[revisions-67]=FAIL
|
|
215
|
+
echo " R67: anon=$(jq -r .code $W/r67-anon.out) wrong=$(jq -r .code $W/r67-wrong.out) env_rc=$(cat $W/r67-env.rc) cred_rc=$(cat $W/r67-cred.rc) open_file=$(jq -r .code $W/r67-open.out) public=$(jq -r .code $W/r67-public.out)"
|
|
216
|
+
|
|
217
|
+
# R68: tags
|
|
218
|
+
ok=1; note=""
|
|
219
|
+
for t in file http; do
|
|
220
|
+
url=$(mk $t r68); a=$W/r68a-$t; b=$W/r68b-$t; s=$W/store-r68-$t
|
|
221
|
+
newp $a 1500000 $url
|
|
222
|
+
r1=$(head_of $a)
|
|
223
|
+
u "mosio tag add $a v1 > /dev/null && echo two > $a/two.txt && mosio commit $a -m two > /dev/null && mosio tag add $a v2 > /dev/null"
|
|
224
|
+
r2=$(head_of $a)
|
|
225
|
+
u "mosio push $a --json > $W/r68-push-$t.json; mosio fsck $a --remote origin --json > $W/r68-fsck-$t.json; echo \$? > $W/r68-fsck-$t.rc"
|
|
226
|
+
jq -e '.tags.total == 2 and .tags.sent == 2' $W/r68-push-$t.json > /dev/null && jq -e '.ok == true and .stats.tags == 2' $W/r68-fsck-$t.json > /dev/null && [ "$(cat $W/r68-fsck-$t.rc)" = 0 ] || ok=0
|
|
227
|
+
[ "$(cat $s/refs/tags/v1)" = "$r1" ] && [ "$(cat $s/refs/tags/v2)" = "$r2" ] && [ "$(cat $s/refs/heads/main)" = "$r2" ] || ok=0
|
|
228
|
+
# a clone brings the tags; a later tag arrives with fetch, and --no-tags leaves it
|
|
229
|
+
u "mosio clone $url $b --json > $W/r68-clone-$t.json; mosio tag list $b > $W/r68-tags-$t.json"
|
|
230
|
+
jq -e --arg r1 $r1 --arg r2 $r2 '[.tags[] | {name, revision}] | sort_by(.name) == [{name: "v1", revision: $r1}, {name: "v2", revision: $r2}]' $W/r68-tags-$t.json > /dev/null || ok=0
|
|
231
|
+
u "echo three > $a/three.txt && mosio commit $a -m three > /dev/null && mosio tag add $a v3 > /dev/null && mosio push $a > /dev/null && mosio fetch $b --no-tags > /dev/null && mosio tag list $b > $W/r68-nt-$t.json; mosio fetch $b --json > $W/r68-f-$t.json; mosio tag list $b > $W/r68-tl-$t.json"
|
|
232
|
+
r3=$(head_of $a)
|
|
233
|
+
jq -e '.tags | length == 2' $W/r68-nt-$t.json > /dev/null && jq -e '.tags.created == ["v3"]' $W/r68-f-$t.json > /dev/null && jq -e '.tags | length == 3' $W/r68-tl-$t.json > /dev/null || ok=0
|
|
234
|
+
# v1 moved locally: the remote keeps its v1 and says so; --force moves it and the remote's reflog marks it
|
|
235
|
+
u "mosio tag delete $a v1 > /dev/null; mosio tag add $a v1 $r3 > /dev/null; mosio push $a --json > $W/r68-nf-$t.out 2>&1; echo \$? > $W/r68-nf-$t.rc"
|
|
236
|
+
jq -e '.code == "E_SYNC_TAG_EXISTS" and .details.tags[0].name == "v1" and .details.reason == "exists"' $W/r68-nf-$t.out > /dev/null && [ "$(cat $W/r68-nf-$t.rc)" != 0 ] && [ "$(cat $s/refs/tags/v1)" = "$r1" ] || ok=0
|
|
237
|
+
u "mosio push $a --force --json > $W/r68-force-$t.json; mosio fsck $a --remote origin > /dev/null; echo \$? > $W/r68-fsck2-$t.rc"
|
|
238
|
+
jq -e '.tags.forced == ["v1"]' $W/r68-force-$t.json > /dev/null && [ "$(cat $s/refs/tags/v1)" = "$r3" ] && [ "$(cat $W/r68-fsck2-$t.rc)" = 0 ] || ok=0
|
|
239
|
+
tail -1 $s/logs/refs/tags/v1.jsonl | grep -q '"event":"push-force"' && head -1 $s/logs/refs/tags/v1.jsonl | grep -q '"event":"push"' && [ "$(wc -l < $s/logs/refs/tags/v2.jsonl)" = 1 ] || ok=0
|
|
240
|
+
note="$note $t: pushed=$(jq -r .tags.sent $W/r68-push-$t.json) refused=$(jq -r .code $W/r68-nf-$t.out) forced=$(jq -c .tags.forced $W/r68-force-$t.json);"
|
|
241
|
+
done
|
|
242
|
+
[ $ok = 1 ] && R[revisions-68]=PASS || R[revisions-68]=FAIL
|
|
243
|
+
echo " R68:$note"
|
|
244
|
+
|
|
245
|
+
# R69 and R71 share a project: one random file of 310 MiB (over the old 288 MiB limit), generated here and never committed,
|
|
246
|
+
# stored the way a git import or a store from before chunking holds it (one raw blob, no chunk list)
|
|
247
|
+
SZ=325058560
|
|
248
|
+
cat > $W/peak.py <<'PY'
|
|
249
|
+
# usage: peak.py OUT CMD... runs CMD, writes the highest anonymous resident set (KiB) the process reached to OUT
|
|
250
|
+
import subprocess, sys, time
|
|
251
|
+
p = subprocess.Popen(sys.argv[2:])
|
|
252
|
+
peak = 0
|
|
253
|
+
while p.poll() is None:
|
|
254
|
+
try:
|
|
255
|
+
for line in open(f"/proc/{p.pid}/status"):
|
|
256
|
+
if line.startswith("RssAnon:"):
|
|
257
|
+
peak = max(peak, int(line.split()[1]))
|
|
258
|
+
except OSError:
|
|
259
|
+
pass
|
|
260
|
+
time.sleep(0.02)
|
|
261
|
+
open(sys.argv[1], "w").write(str(peak))
|
|
262
|
+
sys.exit(p.returncode)
|
|
263
|
+
PY
|
|
264
|
+
chmod a+r $W/peak.py
|
|
265
|
+
ok69=1; ok71=1; note69=""; note71=""
|
|
266
|
+
for t in file http; do
|
|
267
|
+
ua=$(mk $t r69a); ub=$(mk $t r69b); p=$W/r69-$t; sa=$W/store-r69a-$t; sb=$W/store-r69b-$t; c=$W/r69c-$t
|
|
268
|
+
u "mosio init $p --name acc > /dev/null && mkdir -p $p/assets && head -c $SZ /dev/urandom > $p/assets/big.bin && mosio commit $p -m big > /dev/null && mosio remote add $p origin $ua > /dev/null && mosio remote add $p second $ub > /dev/null"
|
|
269
|
+
man=$(ls $p/.mosio/cache/cas/*/*.m | head -1); dig=$(basename $man .m); sub=${dig:0:2}
|
|
270
|
+
u "cp $p/assets/big.bin $p/.mosio/cache/cas/$sub/$dig && rm $man"
|
|
271
|
+
[ -f $p/.mosio/cache/cas/$sub/$dig ] && [ ! -e $man ] && [ "$(stat -c %s $p/.mosio/cache/cas/$sub/$dig)" = $SZ ] || ok69=0
|
|
272
|
+
# R69: up as a stream (the anonymous memory stays far below the file), down as a stream, bytes equal, remote clean
|
|
273
|
+
u "python3 $W/peak.py $W/r69-$t-up.rss mosio push $p origin --json > $W/r69-$t-push.json; echo \$? > $W/r69-$t-push.rc; mosio fsck $p --remote origin --json > $W/r69-$t-fsck.json; echo \$? > $W/r69-$t-fsck.rc"
|
|
274
|
+
jq -e --argjson sz $SZ '.objects.streamed == 1 and .chunks.total == 0 and .bytes.sent >= $sz and .bytes.resumed == 0' $W/r69-$t-push.json > /dev/null && [ "$(cat $W/r69-$t-push.rc)" = 0 ] || ok69=0
|
|
275
|
+
jq -e '.ok == true' $W/r69-$t-fsck.json > /dev/null && [ "$(cat $W/r69-$t-fsck.rc)" = 0 ] && cmp -s $sa/objects/$sub/$dig $p/assets/big.bin || ok69=0
|
|
276
|
+
u "python3 $W/peak.py $W/r69-$t-down.rss mosio clone $ua $c --json > $W/r69-$t-clone.json; echo \$? > $W/r69-$t-clone.rc; mosio fsck $c > /dev/null; echo \$? > $W/r69-$t-cfsck.rc; mosio status $c > $W/r69-$t-cstatus.json"
|
|
277
|
+
[ "$(cat $W/r69-$t-clone.rc)" = 0 ] && [ "$(cat $W/r69-$t-cfsck.rc)" = 0 ] && cmp -s $c/assets/big.bin $p/assets/big.bin && jq -e '.dirty == false' $W/r69-$t-cstatus.json > /dev/null || ok69=0
|
|
278
|
+
up=$(cat $W/r69-$t-up.rss); down=$(cat $W/r69-$t-down.rss)
|
|
279
|
+
[ "$up" -lt 122880 ] && [ "$down" -lt 122880 ] || ok69=0
|
|
280
|
+
# a limit below the file: refused before a byte is sent, nothing on the remote
|
|
281
|
+
u "MOSIO_SYNC_MAX_BLOB=100M mosio push $p second --json > $W/r69-$t-limit.out 2>&1; echo \$? > $W/r69-$t-limit.rc"
|
|
282
|
+
jq -e '.code == "E_SYNC_LIMIT"' $W/r69-$t-limit.out > /dev/null && [ "$(cat $W/r69-$t-limit.rc)" != 0 ] && [ -z "$(ls $sb/revs 2>/dev/null)" ] && [ -z "$(ls $sb/objects/partial 2>/dev/null)" ] || ok69=0
|
|
283
|
+
note69="$note69 $t: size=$SZ up_rss_anon=${up}KiB down_rss_anon=${down}KiB streamed=$(jq -r .objects.streamed $W/r69-$t-push.json) limit=$(jq -r .code $W/r69-$t-limit.out);"
|
|
284
|
+
rm -rf $c
|
|
285
|
+
# R71: kill the client with SIGKILL while it streams to a second remote, then run it again
|
|
286
|
+
u "(MOSIO_SYNC_STREAM_DELAY_MS=15 mosio push $p second --json > $W/r71-$t-kill.out 2>&1 &)"
|
|
287
|
+
for i in $(seq 1200); do sz=$(cat $sb/objects/partial/*.part 2> /dev/null | wc -c); [ "${sz:-0}" -ge 104857600 ] && break; sleep 0.05; done
|
|
288
|
+
pkill -9 -f "^mosio push $p second"; sleep 1.5
|
|
289
|
+
held=$(cat $sb/objects/partial/*.part 2> /dev/null | wc -c)
|
|
290
|
+
[ "$held" -ge 104857600 ] && [ "$held" -lt $SZ ] && [ -z "$(ls $sb/refs/heads 2>/dev/null)" ] && [ -z "$(ls $sb/revs 2>/dev/null)" ] || ok71=0
|
|
291
|
+
u "mosio push $p second --json > $W/r71-$t-resume.json; echo \$? > $W/r71-$t-resume.rc; mosio fsck $p --remote second --json > $W/r71-$t-fsck.json; echo \$? > $W/r71-$t-fsck.rc"
|
|
292
|
+
jq -e --argjson held $held --argjson sz $SZ '.bytes.resumed == $held and .bytes.sent >= ($sz - $held) and .bytes.sent < ($sz - $held + 100000) and .objects.streamed == 1' $W/r71-$t-resume.json > /dev/null && [ "$(cat $W/r71-$t-resume.rc)" = 0 ] || ok71=0
|
|
293
|
+
jq -e '.ok == true' $W/r71-$t-fsck.json > /dev/null && [ "$(cat $W/r71-$t-fsck.rc)" = 0 ] && cmp -s $sb/objects/$sub/$dig $p/assets/big.bin && [ "$(cat $sb/refs/heads/main)" = "$(head_of $p)" ] && [ -z "$(ls $sb/objects/partial 2>/dev/null)" ] || ok71=0
|
|
294
|
+
note71="$note71 $t: killed_with=$held of $SZ held=$(jq -r .bytes.resumed $W/r71-$t-resume.json) resent=$(jq -r .bytes.sent $W/r71-$t-resume.json) fsck_rc=$(cat $W/r71-$t-fsck.rc);"
|
|
295
|
+
rm -rf $p $sa $sb
|
|
296
|
+
done
|
|
297
|
+
[ $ok69 = 1 ] && R[revisions-69]=PASS || R[revisions-69]=FAIL
|
|
298
|
+
[ $ok71 = 1 ] && R[revisions-71]=PASS || R[revisions-71]=FAIL
|
|
299
|
+
echo " R69:$note69"
|
|
300
|
+
echo " R71:$note71"
|
|
301
|
+
|
|
302
|
+
# R70: parallel uploads
|
|
303
|
+
ok=1; note=""
|
|
304
|
+
for t in file http; do
|
|
305
|
+
ua=$(mk $t r70a); ub=$(mk $t r70b); p=$W/r70-$t; sa=$W/store-r70a-$t; sb=$W/store-r70b-$t
|
|
306
|
+
u "mosio init $p --name acc > /dev/null && mkdir -p $p/assets && for i in 1 2 3 4 5 6; do head -c 6000000 /dev/urandom > $p/assets/m\$i.bin; done && mosio commit $p -m media > /dev/null && mosio remote add $p origin $ua > /dev/null && mosio remote add $p second $ub > /dev/null"
|
|
307
|
+
u "mosio push $p origin --jobs 8 --json > $W/r70-$t-many.json; MOSIO_SYNC_JOBS=1 mosio push $p second --json > $W/r70-$t-one.json; mosio fsck $p --remote origin > /dev/null; echo \$? > $W/r70-$t-fsck-a.rc; mosio fsck $p --remote second > /dev/null; echo \$? > $W/r70-$t-fsck-b.rc"
|
|
308
|
+
jq -e '.jobs == 8 and .chunks.total >= 20 and .chunks.sent == .chunks.total' $W/r70-$t-many.json > /dev/null && jq -e '.jobs == 1' $W/r70-$t-one.json > /dev/null || ok=0
|
|
309
|
+
[ "$(jq -c '[.objects.sent, .chunks.sent, .bytes.sent, .revisions.sent]' $W/r70-$t-many.json)" = "$(jq -c '[.objects.sent, .chunks.sent, .bytes.sent, .revisions.sent]' $W/r70-$t-one.json)" ] || ok=0
|
|
310
|
+
[ "$(cd $sa && find objects revs -type f | sort)" = "$(cd $sb && find objects revs -type f | sort)" ] && [ "$(cat $sa/refs/heads/main)" = "$(cat $sb/refs/heads/main)" ] || ok=0
|
|
311
|
+
[ "$(cat $W/r70-$t-fsck-a.rc)" = 0 ] && [ "$(cat $W/r70-$t-fsck-b.rc)" = 0 ] || ok=0
|
|
312
|
+
u "mosio push $p origin --jobs 0 --json > $W/r70-$t-bad.out 2>&1; echo \$? > $W/r70-$t-bad.rc; MOSIO_SYNC_JOBS=abc mosio push $p origin --json > $W/r70-$t-bad2.out 2>&1; echo \$? > $W/r70-$t-bad2.rc"
|
|
313
|
+
jq -e '.code == "E_ARGS"' $W/r70-$t-bad.out > /dev/null && jq -e '.code == "E_ARGS"' $W/r70-$t-bad2.out > /dev/null && [ "$(cat $W/r70-$t-bad.rc)" != 0 ] && [ "$(cat $W/r70-$t-bad2.rc)" != 0 ] || ok=0
|
|
314
|
+
note="$note $t: jobs=8 chunks=$(jq -r .chunks.sent $W/r70-$t-many.json) same_as_jobs=1=$([ "$(cd $sa && find objects revs -type f | sort | md5sum)" = "$(cd $sb && find objects revs -type f | sort | md5sum)" ] && echo yes || echo NO);"
|
|
315
|
+
done
|
|
316
|
+
[ $ok = 1 ] && R[revisions-70]=PASS || R[revisions-70]=FAIL
|
|
317
|
+
echo " R70:$note"
|
|
318
|
+
|
|
319
|
+
pkill -f "^mosio remote serve $W/" 2> /dev/null || true
|
|
320
|
+
for k in 60 61 62 63 64 65 66 67 68 69 70 71; do echo "== revisions-$k ${R[revisions-$k]}"; done
|
|
321
|
+
jq -n '$ARGS.named' $(for k in 60 61 62 63 64 65 66 67 68 69 70 71; do printf -- "--arg R%s %s " $k "${R[revisions-$k]}"; done) > $W/summary.json
|
|
322
|
+
cp $W/summary.json /tmp/acc-revisions-sync.json
|
|
323
|
+
! grep -q FAIL $W/summary.json
|
|
@@ -19,9 +19,25 @@
|
|
|
19
19
|
# revisions-14 rollback of a dirty tree keeps the uncommitted work in a pre-rollback snapshot
|
|
20
20
|
# revisions-15 render parses the manifest of the revision it commits, under the lock (a mosio.json edit made while it
|
|
21
21
|
# waits for the lock is in both the revision and the output)
|
|
22
|
+
# revisions-16 `mosio fsck` and `mosio gc` on a rendered project (commit, edit, render, rollback, gc --dry-run, gc, fsck clean): the dry run
|
|
23
|
+
# reports what the real run frees, no revision is damaged, and `mosio plan` still reports every unit as a hit
|
|
24
|
+
# revisions-17 takes: two takes diverge, `take compare` reports the base, each side's revisions and the element diff, `take list`
|
|
25
|
+
# gives ahead/behind, a diverged keep merges (here both edited the same title: E_MERGE_CONFLICT, nothing moves), a dirty switch is E_TAKE_DIRTY (nothing touched), and
|
|
26
|
+
# `undo` after a bad rollback gives back the exact working-tree token
|
|
27
|
+
# revisions-18 kill -9 between the reflog line and the ref write (MOSIO_FAULT=kill@write:3): the take did not move, `fsck` is clean,
|
|
28
|
+
# `reflog` marks the extra line unapplied, and the next commit works
|
|
29
|
+
# revisions-19 the revision id does not depend on message, prompt, model or time: the same files committed in two projects, with
|
|
30
|
+
# different message/prompt/model and seconds apart, get the same id
|
|
31
|
+
# revisions-30 chunked media and packs: a tracked large file is stored as content-defined chunks under the same whole-file digest `mosio media probe` reports,
|
|
32
|
+
# an appended and an edited-in-place copy add only a few chunks, `gc --pack --expire 0` moves everything into packs, fsck (full) stays clean and a
|
|
33
|
+
# rollback restores every file byte for byte from the packs
|
|
22
34
|
# revisions-8 kill -9 between temp write and rename (MOSIO_FAULT=kill@write:n): scene edit and commit leave the project
|
|
23
35
|
# in the old state (same token, HEAD unchanged, store loadable), never torn; the next mutation works; the
|
|
24
36
|
# stray temp is ignored by the token, kept while younger than 10 min, swept once older
|
|
37
|
+
# revisions-31 element-level merge: disjoint edits of one scene (and two style properties of one element) merge clean from two takes
|
|
38
|
+
# into one two-parent revision with no conflict markers; the same title edited two ways is E_MERGE_CONFLICT with
|
|
39
|
+
# {file, id, field} and nothing written (token and HEAD unchanged); `--resolve` answers it and records a revision whose
|
|
40
|
+
# parents are both tips; fsck is clean afterwards
|
|
25
41
|
set -uo pipefail
|
|
26
42
|
REPO="$(cd "$(dirname "$0")/../.." && pwd)"; cd "$REPO"
|
|
27
43
|
W=/home/mosio/acc-revisions; F="$REPO/fixtures"
|
|
@@ -187,17 +203,115 @@ u "rm -f $W/p/assets/new.bin"
|
|
|
187
203
|
u "rm -rf $W/w1 && cp -r $F/w1-kinetic $W/w1 && cd $W && mosio commit w1 -m base > /dev/null"
|
|
188
204
|
u "cd $W && { flock w1/.mosio/lock -c 'sleep 2; jq \".scenes[0].frames = 270\" w1/mosio.json > w1/m.json && mv w1/m.json w1/mosio.json' & sleep 0.3; mosio render w1 -o out/r15.mp4 > r15.json 2>&1; wait; }"
|
|
189
205
|
rev=$(jq -r .revision $W/r15.json)
|
|
190
|
-
|
|
191
|
-
rframes=$(cat $W/w1/.mosio/cache/cas/${rf:0:2}/$rf 2>/dev/null | jq '[.scenes[].frames] | add')
|
|
206
|
+
rframes=$(u "cd $W && mosio show w1 $rev" | jq '[.manifest.scenes[].frames] | add')
|
|
192
207
|
total=$(jq -r .total_frames $W/r15.json)
|
|
193
208
|
[ "$total" = 270 ] && [ "$rframes" = 270 ] && R[revisions-15]=PASS || R[revisions-15]=FAIL
|
|
194
209
|
echo " R15: output total_frames=$total, frames in the reported revision's mosio.json=$rframes (edit landed during the lock wait)"
|
|
195
210
|
|
|
196
|
-
|
|
211
|
+
# R16: fsck and gc on a real rendered project: commit, edit, render, rollback, gc --dry-run, gc, fsck clean, the render cache still hits
|
|
212
|
+
misses() { u "cd $W && mosio plan w1" | jq '[.units[] | select(.status == "miss")] | length'; }
|
|
213
|
+
u "cd $W && mosio commit w1 -m r16-base > /dev/null && mosio render w1 -o out/r16a.mp4 > r16a.json"
|
|
214
|
+
base16=$(jq -r .revision $W/r16a.json)
|
|
215
|
+
u "cd $W && jq '.scenes[0].frames = 240' w1/mosio.json > w1/m.json && mv w1/m.json w1/mosio.json && mosio render w1 -o out/r16b.mp4 > r16b.json && mosio rollback w1 $base16 > r16-rb.json"
|
|
216
|
+
m0=$(misses)
|
|
217
|
+
u "cd $W && mosio gc w1 --dry-run --json > r16-dry.json; echo \$? > r16-dry.rc; mosio gc w1 --json > r16-gc.json; echo \$? > r16-gc.rc; mosio fsck w1 --json > r16-fsck.json; echo \$? > r16-fsck.rc"
|
|
218
|
+
m1=$(misses)
|
|
219
|
+
dry=$(jq -c '.would_free' $W/r16-dry.json); real=$(jq -c '.freed' $W/r16-gc.json)
|
|
220
|
+
# a second pass with no grace: only what the current render uses survives, and it still hits
|
|
221
|
+
u "cd $W && mosio render w1 -o out/r16c.mp4 > r16c.json && mosio gc w1 --expire 0 --dry-run --json > r16-dry0.json && mosio gc w1 --expire 0 --json > r16-gc0.json; echo \$? > r16-gc0.rc; mosio fsck w1 --json > r16-fsck0.json; echo \$? > r16-fsck0.rc"
|
|
222
|
+
m2=$(misses)
|
|
223
|
+
dry0=$(jq -c '.would_free' $W/r16-dry0.json); real0=$(jq -c '.freed' $W/r16-gc0.json)
|
|
224
|
+
if [ "$m0" = 0 ] && [ "$m1" = 0 ] && [ "$m2" = 0 ] && [ "$dry" = "$real" ] && [ "$dry0" = "$real0" ] && jq -e '.freed.blobs > 0 and .cache_entries.dropped > 0' $W/r16-gc0.json >/dev/null && [ "$(cat $W/r16-dry.rc $W/r16-gc.rc $W/r16-fsck.rc $W/r16-gc0.rc $W/r16-fsck0.rc | tr -d '\n')" = 00000 ] \
|
|
225
|
+
&& jq -e '.ok and .summary.errors == 0' $W/r16-fsck.json $W/r16-fsck0.json >/dev/null; then R[revisions-16]=PASS; else R[revisions-16]=FAIL; fi
|
|
226
|
+
echo " R16: misses before gc=$m0, after gc=$m1, after gc --expire 0=$m2; dry-run $dry == freed $real; fsck errors=$(jq -r .summary.errors $W/r16-fsck.json)/$(jq -r .summary.errors $W/r16-fsck0.json); expire 0: dry-run $dry0 == freed $real0, dropped $(jq -r .cache_entries.dropped $W/r16-gc0.json) cache entries"
|
|
227
|
+
|
|
228
|
+
# R17: takes, compare, dirty switch, undo after a bad rollback
|
|
229
|
+
u "cd $W && mosio commit p -m r17-base > r17-base.json && mosio take new p warm --title warmer > r17-new.json"
|
|
230
|
+
base17=$(jq -r .revision $W/r17-base.json)
|
|
231
|
+
u "cd $W && mosio edit p text hook/title main-side > /dev/null && mosio commit p -m main-side > r17-m.json"
|
|
232
|
+
main17=$(jq -r .revision $W/r17-m.json)
|
|
233
|
+
u "cd $W && mosio take switch p warm > r17-sw.json && mosio edit p text hook/title warm-side > /dev/null && mosio commit p -m warm-side > r17-w.json"
|
|
234
|
+
warm17=$(jq -r .revision $W/r17-w.json)
|
|
235
|
+
u "cd $W && mosio take compare p main warm > r17-cmp.json; mosio take list p > r17-list.json; mosio take keep p warm --into main > r17-keep.json; echo \$? > r17-keep.rc"
|
|
236
|
+
u "cd $W && mosio edit p text hook/title unsaved > /dev/null; mosio take switch p main > r17-dirty.json; echo \$? > r17-dirty.rc"
|
|
237
|
+
dirty_txt=$(grep -o 'data-mosio-id="hook/title"[^<]*' $W/p/scenes/01-hook.html | sed 's/.*>//')
|
|
238
|
+
u "cd $W && mosio take switch p main --discard > r17-disc.json"
|
|
239
|
+
T17=$(tree)
|
|
240
|
+
u "cd $W && mosio rollback p $base17 > r17-rb.json && mosio undo p > r17-undo.json"
|
|
241
|
+
if jq -e '.merge == "merge" and .base == ["'"$base17"'"] and .a_only == ["'"$main17"'"] and .b_only == ["'"$warm17"'"] and ([.diff.changes[] | select(.id == "hook/title" and .before == "main-side" and .after == "warm-side")] | length) == 1' $W/r17-cmp.json >/dev/null \
|
|
242
|
+
&& jq -e '[.takes[] | select(.name == "warm" and .ahead == 1 and .behind == 1)] | length == 1' $W/r17-list.json >/dev/null \
|
|
243
|
+
&& jq -e '.code == "E_MERGE_CONFLICT"' $W/r17-keep.json >/dev/null && jq -e '.code == "E_TAKE_DIRTY"' $W/r17-dirty.json >/dev/null && [ "$dirty_txt" = unsaved ] \
|
|
244
|
+
&& jq -e '.ok and .undone == "rollback" and .to == "'"$main17"'"' $W/r17-undo.json >/dev/null && [ "$(tree)" = "$T17" ] && [ "$(head)" = "$main17" ]; then R[revisions-17]=PASS; else R[revisions-17]=FAIL; fi
|
|
245
|
+
echo " R17: compare=$(jq -c '{merge,base}' $W/r17-cmp.json) keep=$(jq -r .code $W/r17-keep.json) dirty_switch=$(jq -r .code $W/r17-dirty.json) undo=$(jq -c '{undone,to}' $W/r17-undo.json) token_restored=$([ "$(tree)" = "$T17" ] && echo yes || echo NO)"
|
|
246
|
+
|
|
247
|
+
# R18: kill -9 between the reflog line and the ref write
|
|
248
|
+
u "cd $W && mosio edit p text hook/title r18 > /dev/null"
|
|
249
|
+
H18=$(head)
|
|
250
|
+
u "cd $W && MOSIO_FAULT=kill@write:3 mosio commit p -m r18-killed > r18-kill.json 2>&1; echo \$? > r18-kill.rc"
|
|
251
|
+
H18b=$(head)
|
|
252
|
+
u "cd $W && mosio fsck p --json > r18-fsck.json; echo \$? > r18-fsck.rc; mosio reflog p > r18-reflog.json; mosio commit p -m r18-after > r18-after.json; mosio fsck p --json > r18-fsck2.json; echo \$? > r18-fsck2.rc"
|
|
253
|
+
if [ "$(cat $W/r18-kill.rc)" = 137 ] && [ "$H18" = "$H18b" ] && jq -e '.ok and .summary.errors == 0' $W/r18-fsck.json $W/r18-fsck2.json >/dev/null \
|
|
254
|
+
&& [ "$(cat $W/r18-fsck.rc $W/r18-fsck2.rc | tr -d '\n')" = 00 ] && jq -e '.unapplied == 1' $W/r18-reflog.json >/dev/null && jq -e '.ok' $W/r18-after.json >/dev/null; then R[revisions-18]=PASS; else R[revisions-18]=FAIL; fi
|
|
255
|
+
echo " R18: kill rc=$(cat $W/r18-kill.rc) head_unchanged=$([ "$H18" = "$H18b" ] && echo yes || echo NO) fsck_errors=$(jq -r .summary.errors $W/r18-fsck.json) unapplied=$(jq -r .unapplied $W/r18-reflog.json) next_commit=$(jq -c '{ok,revision}' $W/r18-after.json) fsck_after_errors=$(jq -r .summary.errors $W/r18-fsck2.json)"
|
|
256
|
+
|
|
257
|
+
# R19: the id is the tree and the parents, nothing else
|
|
258
|
+
u "cd $W && rm -rf q1 q2 && cp -r $F/w3-promo q1 && cp -r $F/w3-promo q2 && mosio commit q1 -m 'first words' --prompt 'make it pop' --model model-a > r19-a.json && sleep 2 && mosio commit q2 -m 'quite other words' > r19-b.json"
|
|
259
|
+
if [ "$(jq -r .revision $W/r19-a.json)" = "$(jq -r .revision $W/r19-b.json)" ] && jq -e '.revision | length == 16' $W/r19-a.json >/dev/null; then R[revisions-19]=PASS; else R[revisions-19]=FAIL; fi
|
|
260
|
+
echo " R19: ids $(jq -r .revision $W/r19-a.json) vs $(jq -r .revision $W/r19-b.json)"
|
|
261
|
+
|
|
262
|
+
# R30: chunked media, packs, zstd text: digests stay v1's, edits add few chunks, gc --pack keeps every byte readable
|
|
263
|
+
cnt() { find $W/c30/.mosio/cache/cas/chunks -type f 2>/dev/null | wc -l; }
|
|
264
|
+
# seeded bytes (not /dev/urandom): chunk boundaries, and so the chunk counts checked below, are the same every run
|
|
265
|
+
printf '%s\n' '#!/usr/bin/env python3' 'import random, sys' 'sys.stdout.buffer.write(random.Random(int(sys.argv[1])).randbytes(int(sys.argv[2])))' > $W/rnd30 && chmod 755 $W/rnd30
|
|
266
|
+
u "cd $W && rm -rf c30 *.orig && cp -r $F/w3-promo c30 && mkdir -p c30/assets && ffmpeg -hide_banner -loglevel error -nostdin -y -f lavfi -i 'testsrc2=size=1280x720:rate=30,noise=alls=60:allf=t' -t 5 -c:v libx264 -preset ultrafast -b:v 14M c30/assets/clip.mp4 && $W/rnd30 1 25165824 > c30/assets/blob.bin && cp c30/assets/clip.mp4 clip30.orig && cp c30/assets/blob.bin blob30a.orig && mosio commit c30 -m c30-a > c30a.json"
|
|
267
|
+
revA=$(jq -r .revision $W/c30a.json); a=$(cnt)
|
|
268
|
+
u "cd $W && $W/rnd30 2 2097152 > extra30 && cat extra30 >> c30/assets/blob.bin && cp c30/assets/blob.bin blob30b.orig && mosio commit c30 -m c30-b > c30b.json"
|
|
269
|
+
b=$(cnt)
|
|
270
|
+
u "cd $W && cp blob30a.orig c30/assets/blob.bin && $W/rnd30 3 204800 | dd of=c30/assets/blob.bin bs=1k seek=9000 count=200 conv=notrunc iflag=fullblock status=none && cp c30/assets/blob.bin blob30c.orig && mosio commit c30 -m c30-c > c30c.json"
|
|
271
|
+
c=$(cnt)
|
|
272
|
+
dg=$(jq -r '.entries["assets/clip.mp4"].digest' $W/c30/.mosio/index.json); [ -f $W/c30/.mosio/cache/cas/${dg:0:2}/$dg.m ] || dg=no-manifest-under-v1-digest; v1=$(u "cd $W && mosio media probe c30/assets/clip.mp4" | jq -r .media.blake3)
|
|
273
|
+
textz=$(find $W/c30/.mosio/cache/cas -name '*.z' | wc -l)
|
|
274
|
+
u "cd $W && mosio gc c30 --pack --expire 0 --dry-run --json > c30-dry.json; mosio gc c30 --pack --expire 0 --json > c30-gc.json; echo \$? > c30-gc.rc; mosio fsck c30 --json > c30-fsck.json; echo \$? > c30-fsck.rc"
|
|
275
|
+
left=$(cnt); packs=$(ls $W/c30/.mosio/cache/cas/packs/*.pack 2>/dev/null | wc -l)
|
|
276
|
+
u "cd $W && mosio rollback c30 $revA > c30-rb.json; cmp c30/assets/blob.bin blob30a.orig && cmp c30/assets/clip.mp4 clip30.orig && echo same > c30-same"
|
|
277
|
+
if [ "$a" -ge 15 ] && [ $((b - a)) -le 6 ] && [ $((c - b)) -le 5 ] && [ "$dg" = "$v1" ] && [ -n "$dg" ] && [ "$textz" -ge 1 ] \
|
|
278
|
+
&& jq -e '.ok and .dry_run' $W/c30-dry.json >/dev/null \
|
|
279
|
+
&& jq -e --argjson d "$(jq .packs.would_pack.objects $W/c30-dry.json)" '.ok and .packs.packed.objects == $d and $d > 0' $W/c30-gc.json >/dev/null \
|
|
280
|
+
&& [ "$left" = 0 ] && [ "$packs" -ge 1 ] && [ "$(cat $W/c30-gc.rc $W/c30-fsck.rc | tr -d '\n')" = 00 ] && jq -e '.ok and .summary.errors == 0 and .stats.packs >= 1' $W/c30-fsck.json >/dev/null \
|
|
281
|
+
&& [ "$(cat $W/c30-same 2>/dev/null)" = same ]; then R[revisions-30]=PASS; else R[revisions-30]=FAIL; fi
|
|
282
|
+
echo " R30: chunks A=$a, +append=$((b - a)), +edit=$((c - b)); clip digest $dg == v1 $v1; text blobs zstd=$textz; packed $(jq -c .packs.packed $W/c30-gc.json), loose chunks left=$left, packs=$packs; fsck errors=$(jq -r .summary.errors $W/c30-fsck.json); rollback byte-identical=$(cat $W/c30-same 2>/dev/null || echo NO)"
|
|
283
|
+
|
|
284
|
+
# R31: element-level merge
|
|
285
|
+
u "rm -rf $W/m31 && cp -r $F/w3-promo $W/m31 && cd $W && mosio commit m31 -m base > r31-base.json && mosio take new m31 feat > /dev/null"
|
|
286
|
+
u "cd $W && mosio edit m31 text hook/kicker main-kicker > /dev/null && mosio edit m31 style hook/price top 12px > /dev/null && mosio commit m31 -m main > r31-main.json"
|
|
287
|
+
u "cd $W && mosio take switch m31 feat > /dev/null && mosio edit m31 text hook/title feat-title > /dev/null && mosio edit m31 style hook/price left 30px > /dev/null && mosio commit m31 -m feat > r31-feat.json && mosio take switch m31 main > /dev/null"
|
|
288
|
+
u "cd $W && mosio status m31" > $W/r31-st0.json
|
|
289
|
+
u "cd $W && mosio merge m31 feat --dry-run > r31-dry.json; mosio status m31 > r31-st1.json; mosio merge m31 feat > r31-merge.json; echo \$? > r31-merge.rc; mosio fsck m31 --json > r31-fsck1.json; echo \$? >> r31-merge.rc"
|
|
290
|
+
S31=$W/m31/scenes/01-hook.html
|
|
291
|
+
c1=0; grep -q 'main-kicker' $S31 && grep -q 'feat-title' $S31 && grep -q 'top: *12px' $S31 && grep -q 'left: *30px' $S31 && c1=1
|
|
292
|
+
# the same title edited two ways
|
|
293
|
+
u "cd $W && mosio take new m31 c1 > /dev/null && mosio edit m31 text hook/title main-title > /dev/null && mosio commit m31 -m main-title > /dev/null && mosio take switch m31 c1 > /dev/null && mosio edit m31 text hook/title c1-title > /dev/null && mosio commit m31 -m c1-title > /dev/null && mosio take switch m31 main > /dev/null"
|
|
294
|
+
u "cd $W && mosio status m31" > $W/r31-st2.json
|
|
295
|
+
u "cd $W && mosio merge m31 c1 > r31-conf.json; echo \$? > r31-conf.rc; mosio status m31 > r31-st3.json"
|
|
296
|
+
markers=$(grep -rlE '^(<<<<<<<|>>>>>>>|=======)' $W/m31/scenes $W/m31/mosio.json 2>/dev/null | wc -l)
|
|
297
|
+
u "cd $W && mosio merge m31 c1 --resolve 'scenes/01-hook.html#hook/title.text=theirs' > r31-res.json; mosio fsck m31 --json > r31-fsck2.json; echo \$? > r31-fsck2.rc"
|
|
298
|
+
if jq -e '.merge == "clean" and .dry_run == true and (.conflicts | length) == 0' $W/r31-dry.json >/dev/null \
|
|
299
|
+
&& [ "$(jq -r .head $W/r31-st0.json)" = "$(jq -r .head $W/r31-st1.json)" ] && [ "$(jq -r .tree $W/r31-st0.json)" = "$(jq -r .tree $W/r31-st1.json)" ] \
|
|
300
|
+
&& jq -e '.ok and .merge == "clean" and (.parents | length) == 2' $W/r31-merge.json >/dev/null && [ "$(tr -d '\n' < $W/r31-merge.rc)" = 00 ] && [ "$c1" = 1 ] \
|
|
301
|
+
&& [ "$(jq -r .code $W/r31-conf.json)" = E_MERGE_CONFLICT ] && [ "$(cat $W/r31-conf.rc)" = 2 ] \
|
|
302
|
+
&& jq -e '.conflicts | length == 1 and (.[0] | .kind == "edit_edit" and .file == "scenes/01-hook.html" and .id == "hook/title" and .field == "text" and .ours == "main-title" and .theirs == "c1-title")' $W/r31-conf.json >/dev/null \
|
|
303
|
+
&& [ "$(jq -r .head $W/r31-st2.json)" = "$(jq -r .head $W/r31-st3.json)" ] && [ "$(jq -r .tree $W/r31-st2.json)" = "$(jq -r .tree $W/r31-st3.json)" ] && [ "$markers" = 0 ] \
|
|
304
|
+
&& jq -e '.ok and .merge == "clean" and (.parents | length) == 2' $W/r31-res.json >/dev/null && grep -q 'c1-title' $S31 \
|
|
305
|
+
&& jq -e '.ok and .summary.errors == 0' $W/r31-fsck1.json $W/r31-fsck2.json >/dev/null && [ "$(cat $W/r31-fsck2.rc)" = 0 ]; then R[revisions-31]=PASS; else R[revisions-31]=FAIL; fi
|
|
306
|
+
echo " R31: dry=$(jq -c '{merge,dry_run}' $W/r31-dry.json) merge=$(jq -c '{merge,parents}' $W/r31-merge.json) both_edits_in_file=$c1 conflict=$(jq -c '[.code, (.conflicts[0] | [.kind,.file,.id,.field])]' $W/r31-conf.json) unchanged_on_conflict=$([ "$(jq -r .tree $W/r31-st2.json)" = "$(jq -r .tree $W/r31-st3.json)" ] && echo yes || echo NO) markers=$markers resolved=$(jq -c '{merge,parents}' $W/r31-res.json)"
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
for k in revisions-1 revisions-2 revisions-3 revisions-4 revisions-5 revisions-6 revisions-7 revisions-8 revisions-9 revisions-10 revisions-11 revisions-12 revisions-13 revisions-14 revisions-15 revisions-16 revisions-17 revisions-18 revisions-19 revisions-30 revisions-31; do echo "== $k ${R[$k]}"; done
|
|
197
310
|
jq -n '$ARGS.named' --arg R1 "${R[revisions-1]}" --arg R2 "${R[revisions-2]}" --arg R3 "${R[revisions-3]}" \
|
|
198
311
|
--arg R4 "${R[revisions-4]}" --arg R5 "${R[revisions-5]}" --arg R6 "${R[revisions-6]}" \
|
|
199
312
|
--arg R7 "${R[revisions-7]}" --arg R8 "${R[revisions-8]}" --arg R9 "${R[revisions-9]}" --arg R10 "${R[revisions-10]}" \
|
|
200
313
|
--arg R11 "${R[revisions-11]}" --arg R12 "${R[revisions-12]}" --arg R13 "${R[revisions-13]}" --arg R14 "${R[revisions-14]}" \
|
|
201
|
-
--arg R15 "${R[revisions-15]}"
|
|
314
|
+
--arg R15 "${R[revisions-15]}" --arg R16 "${R[revisions-16]}" --arg R17 "${R[revisions-17]}" --arg R18 "${R[revisions-18]}" \
|
|
315
|
+
--arg R19 "${R[revisions-19]}" --arg R30 "${R[revisions-30]}" --arg R31 "${R[revisions-31]}" > /tmp/acc-revisions.json
|
|
202
316
|
cp /tmp/acc-revisions.json $W/summary.json
|
|
203
317
|
! grep -q FAIL $W/summary.json
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Segment cache acceptance (docs/design/SEGMENT-CACHE.md). Run as root in the sandbox; rendering runs as the `mosio` user.
|
|
3
|
+
# segcache-1 W3 split into a cold cache, assembled from the cache: the MP4 is byte-identical to one `mosio render`
|
|
4
|
+
# segcache-2 one scene edited: the plan marks the untouched units cached, only the edited scene's run and its two
|
|
5
|
+
# transitions are rendered, and the result is byte-identical to a fresh full render of the edited project
|
|
6
|
+
# segcache-3 a fully warm plan has every part cached; a corrupt cached blob is refused (never served) and a part render repairs it
|
|
7
|
+
# segcache-4 the Cloud Run entrypoint (directory backend): cold run, edit, warm run; the output is byte-identical to a full render
|
|
8
|
+
set -uo pipefail
|
|
9
|
+
REPO="$(cd "$(dirname "$0")/../.." && pwd)"; cd "$REPO"
|
|
10
|
+
W=/home/mosio/acc-segcache; F="$REPO/fixtures"
|
|
11
|
+
cargo build --release --locked 2>&1 | tail -1
|
|
12
|
+
chmod -R o+rX "$REPO"
|
|
13
|
+
u() { scripts/as-user.sh "$1"; }
|
|
14
|
+
declare -A R
|
|
15
|
+
u "rm -rf $W && mkdir -p $W/out && cp -r $F/w3-promo $W/proj && cp -r $F/w3-promo $W/edit"
|
|
16
|
+
# the edit: one line of text in the third scene (features); its run and the two transitions that blend it change
|
|
17
|
+
u "cd $W && sed -i 's/Edit one word, re-render one scene/Edit one word, render one scene/' edit/scenes/03-features.html && ! cmp -s proj/scenes/03-features.html edit/scenes/03-features.html"
|
|
18
|
+
sha() { sha256sum "$1" | cut -d' ' -f1; }
|
|
19
|
+
# the frame manifests agree on everything but the path they name as their source
|
|
20
|
+
same_frames() { [ "$(jq -cS 'del(.source)' "$1")" = "$(jq -cS 'del(.source)' "$2")" ]; }
|
|
21
|
+
|
|
22
|
+
# the reference renders: no cache, one process
|
|
23
|
+
u "cd $W && mosio render proj --no-cache -o out/ref.mp4 > ref.json 2> ref.err"
|
|
24
|
+
u "cd $W && mosio render edit --no-cache -o out/ref-edit.mp4 > ref-edit.json 2> ref-edit.err"
|
|
25
|
+
|
|
26
|
+
# segcache-1: cold
|
|
27
|
+
u "cd $W && mosio render proj --plan --parts 3 --cache-dir cache -o out/cold.plan.json > cold-plan.json 2> cold-plan.err"
|
|
28
|
+
n=$(jq '.parts|length' "$W/cold-plan.json")
|
|
29
|
+
for ((i = 0; i < n; i++)); do
|
|
30
|
+
u "cd $W && mosio render proj --part $i --plan out/cold.plan.json --cache-dir cache -o out/cold-part$i.mp4 > cold-part$i.json 2> cold-part$i.err"
|
|
31
|
+
done
|
|
32
|
+
# no part files: every segment is read from the cache
|
|
33
|
+
u "cd $W && mosio render-assemble proj --plan out/cold.plan.json --cache-dir cache -o out/cold.mp4 > cold-asm.json 2> cold-asm.err"
|
|
34
|
+
if [ "$n" = 3 ] && jq -e '.cache.units_cached==0 and .cache.parts_cached==0' "$W/cold-plan.json" >/dev/null \
|
|
35
|
+
&& jq -e '.ok and .parts_from_cache==3' "$W/cold-asm.json" >/dev/null \
|
|
36
|
+
&& [ "$(sha $W/out/cold.mp4)" = "$(sha $W/out/ref.mp4)" ] && same_frames "$W/out/cold.frames.json" "$W/out/ref.frames.json"; then
|
|
37
|
+
R[segcache-1]=PASS; else R[segcache-1]=FAIL; fi
|
|
38
|
+
echo " cold: parts=$n cache=$(jq -c .cache $W/cold-plan.json) from_cache=$(jq -c .parts_from_cache $W/cold-asm.json) sha(cache)=$(sha $W/out/cold.mp4 | cut -c1-16) sha(full)=$(sha $W/out/ref.mp4 | cut -c1-16)"
|
|
39
|
+
echo " rendered per part: $(for ((i = 0; i < n; i++)); do jq -r '.segments_rendered' $W/cold-part$i.json; done | tr '\n' ' ')"
|
|
40
|
+
|
|
41
|
+
# segcache-2: edit, plan against the warm cache, render only what is not cached
|
|
42
|
+
u "cd $W && mosio render edit --plan --parts 3 --cache-dir cache -o out/warm.plan.json > warm-plan.json 2> warm-plan.err"
|
|
43
|
+
total=$(jq '.units|length' "$W/warm-plan.json")
|
|
44
|
+
miss=$(jq '[.units[]|select(.cached|not)]|length' "$W/warm-plan.json")
|
|
45
|
+
missing_ids=$(jq -r '[.units[]|select(.cached|not)|.id]|sort|join(" ")' "$W/warm-plan.json")
|
|
46
|
+
want_ids=$(printf '%s\n' body:features transition:product\>features transition:features\>demo | sort | tr '\n' ' ' | sed 's/ $//')
|
|
47
|
+
rendered=0; ran=""
|
|
48
|
+
for ((i = 0; i < n; i++)); do
|
|
49
|
+
if jq -e ".parts[$i].cached" "$W/warm-plan.json" >/dev/null; then continue; fi
|
|
50
|
+
u "cd $W && mosio render edit --part $i --plan out/warm.plan.json --cache-dir cache -o out/warm-part$i.mp4 > warm-part$i.json 2> warm-part$i.err"
|
|
51
|
+
rendered=$((rendered + $(jq -r '.segments_rendered' "$W/warm-part$i.json"))); ran="$ran $i"
|
|
52
|
+
done
|
|
53
|
+
u "cd $W && mosio render-assemble edit --plan out/warm.plan.json --cache-dir cache -o out/warm.mp4 > warm-asm.json 2> warm-asm.err"
|
|
54
|
+
if [ "$total" = 11 ] && [ "$miss" = 3 ] && [ "$missing_ids" = "$want_ids" ] && [ "$rendered" = 3 ] \
|
|
55
|
+
&& jq -e '.ok and .parts_from_cache==3' "$W/warm-asm.json" >/dev/null \
|
|
56
|
+
&& [ "$(sha $W/out/warm.mp4)" = "$(sha $W/out/ref-edit.mp4)" ] && same_frames "$W/out/warm.frames.json" "$W/out/ref-edit.frames.json" \
|
|
57
|
+
&& [ "$(sha $W/out/warm.mp4)" != "$(sha $W/out/ref.mp4)" ]; then
|
|
58
|
+
R[segcache-2]=PASS; else R[segcache-2]=FAIL; fi
|
|
59
|
+
echo " edit: units=$total uncached=$miss ($missing_ids) parts rendered:$ran segments rendered=$rendered cache=$(jq -c .cache $W/warm-plan.json)"
|
|
60
|
+
echo " edit: sha(cache)=$(sha $W/out/warm.mp4 | cut -c1-16) sha(full)=$(sha $W/out/ref-edit.mp4 | cut -c1-16)"
|
|
61
|
+
|
|
62
|
+
# segcache-3: everything warm; then damage one blob
|
|
63
|
+
u "cd $W && mosio render edit --plan --parts 3 --cache-dir cache -o out/hot.plan.json > hot-plan.json 2> hot-plan.err"
|
|
64
|
+
victim=$(jq -r '.units[0].key' "$W/hot-plan.json")
|
|
65
|
+
blob=$(jq -r .blob "$W/cache/ac/${victim:0:2}/$victim.json")
|
|
66
|
+
u "cd $W && chmod u+w cache/cas/${blob:0:2}/$blob && head -c 100 cache/cas/${blob:0:2}/$blob > cache/cas/trunc && mv cache/cas/trunc cache/cas/${blob:0:2}/$blob"
|
|
67
|
+
u "cd $W && mosio render edit --plan --parts 3 --cache-dir cache -o out/dmg.plan.json > dmg-plan.json 2> dmg-plan.err"
|
|
68
|
+
u "cd $W && mosio render-assemble edit --plan out/dmg.plan.json --cache-dir cache -o out/dmg.mp4 > dmg-asm.json 2> dmg-asm.err; echo \$? > dmg-asm.rc"
|
|
69
|
+
# the first part holds the damaged unit; rendering it again repairs the cache entry
|
|
70
|
+
u "cd $W && mosio render edit --part 0 --plan out/dmg.plan.json --cache-dir cache -o out/dmg-part0.mp4 > dmg-part0.json 2> dmg-part0.err"
|
|
71
|
+
u "cd $W && mosio render-assemble edit --plan out/dmg.plan.json --cache-dir cache -o out/fix.mp4 > fix-asm.json 2> fix-asm.err"
|
|
72
|
+
if jq -e '.cache.parts_cached==3 and .cache.units_cached==11' "$W/hot-plan.json" >/dev/null \
|
|
73
|
+
&& jq -e '.cache.parts_cached==2 and (.parts[0].cached|not)' "$W/dmg-plan.json" >/dev/null \
|
|
74
|
+
&& [ "$(cat $W/dmg-asm.rc)" != 0 ] && grep -q E_SPLIT_PART "$W/dmg-asm.json" "$W/dmg-asm.err" && [ ! -e "$W/out/dmg.mp4" ] \
|
|
75
|
+
&& jq -e '.segments_rendered>=1' "$W/dmg-part0.json" >/dev/null \
|
|
76
|
+
&& [ "$(sha $W/out/fix.mp4)" = "$(sha $W/out/ref-edit.mp4)" ]; then
|
|
77
|
+
R[segcache-3]=PASS; else R[segcache-3]=FAIL; fi
|
|
78
|
+
echo " warm plan: $(jq -c .cache $W/hot-plan.json); damaged blob: $(jq -c .cache $W/dmg-plan.json) assemble rc=$(cat $W/dmg-asm.rc)"
|
|
79
|
+
|
|
80
|
+
# segcache-4: the entrypoint, directory backend (the same two functions drive gs://)
|
|
81
|
+
EP="$REPO/deploy/cloudrun/entrypoint.py"
|
|
82
|
+
ep() { # ep KIND PROJECT RUN OUT LOG [extra env]: stdout to $W/LOG.json, stderr to $W/LOG.err
|
|
83
|
+
u "cd $W && env MOSIO_PROJECT_DIR=$W/$2 MOSIO_SPLIT_PREFIX=$W/ep-$3 MOSIO_CACHE_URL=$W/ep-cache MOSIO_WORK_DIR=$W/ep-work MOSIO_OUTPUT=$W/out/$4 MOSIO_PARTS=3 ${6:-} python3 -I $EP $1 > $W/$5.json 2> $W/$5.err"
|
|
84
|
+
}
|
|
85
|
+
epfail=0
|
|
86
|
+
ep plan proj r1 x ep-plan1 || epfail=1
|
|
87
|
+
for i in 0 1 2; do ep part proj r1 x "ep-part1-$i" "MOSIO_PART=$i" || epfail=1; done
|
|
88
|
+
ep assemble proj r1 ep1.mp4 ep-asm1 || epfail=1
|
|
89
|
+
ep plan edit r2 x ep-plan2 || epfail=1
|
|
90
|
+
for i in 0 1 2; do ep part edit r2 x "ep-part2-$i" "MOSIO_PART=$i" || epfail=1; done
|
|
91
|
+
ep assemble edit r2 ep2.mp4 ep-asm2 || epfail=1
|
|
92
|
+
stored=$(for i in 0 1 2; do jq -r '.segments_stored // 0' "$W/ep-part2-$i.json"; done | awk '{s+=$1} END{print s+0}')
|
|
93
|
+
if [ "$epfail" = 0 ] && [ "$(sha $W/out/ep1.mp4)" = "$(sha $W/out/ref.mp4)" ] && [ "$(sha $W/out/ep2.mp4)" = "$(sha $W/out/ref-edit.mp4)" ] \
|
|
94
|
+
&& [ "$stored" = 3 ] && jq -e '.parts_cached|length>=1' "$W/ep-plan2.json" >/dev/null; then
|
|
95
|
+
R[segcache-4]=PASS; else R[segcache-4]=FAIL; fi
|
|
96
|
+
echo " entrypoint: fail=$epfail stored(edit)=$stored skipped parts=$(jq -c .parts_cached $W/ep-plan2.json) sha=$(sha $W/out/ep2.mp4 | cut -c1-16)"
|
|
97
|
+
|
|
98
|
+
for k in segcache-1 segcache-2 segcache-3 segcache-4; do echo "== $k ${R[$k]}"; done
|
|
99
|
+
jq -n '$ARGS.named' --arg s1 "${R[segcache-1]}" --arg s2 "${R[segcache-2]}" --arg s3 "${R[segcache-3]}" --arg s4 "${R[segcache-4]}" > $W/summary.json
|
|
100
|
+
! grep -q FAIL $W/summary.json
|