@usemosio/cli-linux-x64 1.0.0-next.1 → 1.0.0-next.2
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-DsbQ04kb.js +34 -0
- package/apps/studio/dist/assets/{agent-panel-CqJuv5Sn.js → agent-panel-DUWPbpew.js} +5 -5
- package/apps/studio/dist/assets/{boundary-bK2S8z05.js → boundary-DuK3AiqM.js} +1 -1
- package/apps/studio/dist/assets/{feedback-BqzXUdVd.js → feedback-x6ZumR_x.js} +1 -1
- package/apps/studio/dist/assets/index-CjDBKmB_.css +2 -0
- package/apps/studio/dist/assets/index-DPLtb0kT.js +1905 -0
- package/apps/studio/dist/assets/inspector3d-B8pkZTye.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 +111 -7
- package/crates/mosio/src/adapters/room-env-pmrem.json +1 -0
- package/crates/mosio/src/runtime.js +126 -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/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/export.sh +5 -3
- 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 +8 -0
- package/scripts/check-file-size.sh +49 -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/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 +67 -0
- package/scripts/prim.mjs +31 -13
- package/skills/mosio-3d/SKILL.md +1 -1
- 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 +10 -3
- 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 +3 -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 +18 -0
- 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 +22 -4
- 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,208 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Hub phase 0 acceptance (docs/design/HUB.md): `mosio remote serve ROOT --hub` through real CLI processes, each with its own
|
|
3
|
+
# token in MOSIO_REMOTE_TOKEN. Run as root in the sandbox; the CLI runs as the `mosio` user.
|
|
4
|
+
# hub-1 tokens: `remote hub-token` prints a token once and stores only its hash (access.json mode 600); no token or an
|
|
5
|
+
# unknown one is E_REMOTE_AUTH
|
|
6
|
+
# hub-2 a writer pushes acme/promo, which the push creates; a reader of acme/* clones it byte-identical (fsck clean) and
|
|
7
|
+
# pulls a later push fast-forward; the reflog on the Hub names the writer's user, not what the client sent
|
|
8
|
+
# hub-3 roles: the reader cannot push (E_HUB_FORBIDDEN, nothing moves); a project the token cannot read is E_HUB_NOT_FOUND
|
|
9
|
+
# whether it exists or not; a writer's push --force is E_HUB_FORBIDDEN, an admin's goes through
|
|
10
|
+
# hub-4 quota: an owner over its quota_bytes is refused (E_HUB_QUOTA with used and limit) and a second owner is not
|
|
11
|
+
# hub-5 the server's limit (GET /v1/limits) refuses a file over MOSIO_SYNC_MAX_BLOB before anything is sent (E_SYNC_LIMIT)
|
|
12
|
+
# hub-6 the reference protocol is unchanged: the same project pushed to a plain `remote serve` and to the Hub clones to the
|
|
13
|
+
# same files from both
|
|
14
|
+
# hub-7 render API: a reader's render request is E_HUB_FORBIDDEN, an unknown revision E_RENDER_REVISION; a writer's render
|
|
15
|
+
# of a pushed revision finishes, its video (token) and share link (no token) are the same MP4 and byte-identical to
|
|
16
|
+
# `mosio render` of the same tree; the second render of that revision takes every segment from the Hub's cache;
|
|
17
|
+
# a `quality: "draft"` render is byte-identical to `mosio render --draft` (half size), an unknown quality is refused
|
|
18
|
+
# hub-8 review links: a done render has a review_url; its page (no token) is HTML with a strict CSP; two comments are posted
|
|
19
|
+
# without a token, a credential-looking text and a frame past the video are refused, a visitor over the rate gets 429
|
|
20
|
+
# with Retry-After; `mosio notes pull-review` adds two human notes at the rendered revision (the owner's token),
|
|
21
|
+
# running it again adds nothing and records no revision
|
|
22
|
+
set -uo pipefail
|
|
23
|
+
REPO="$(cd "$(dirname "$0")/../.." && pwd)"; cd "$REPO"
|
|
24
|
+
W=/home/mosio/acc-hub
|
|
25
|
+
cargo build --release --locked 2>&1 | tail -1
|
|
26
|
+
chmod -R o+rX "$REPO"
|
|
27
|
+
u() { scripts/as-user.sh "$1"; }
|
|
28
|
+
declare -A R
|
|
29
|
+
u "rm -rf $W && mkdir -p $W"
|
|
30
|
+
|
|
31
|
+
# a Hub in $W/$1 (optional access.json extras in $2, a JSON object); prints its base URL. $3: extra env for the server
|
|
32
|
+
hub() {
|
|
33
|
+
local root=$W/$1 log=$W/hub-$1.log
|
|
34
|
+
u "mkdir -p $root && echo '${2:-{\}}' | jq '. + {tokens: []}' > $root/access.json && chmod 600 $root/access.json"
|
|
35
|
+
u "(${3:-} nohup mosio remote serve $root --hub --listen 127.0.0.1:0 > $log 2>&1 &); for i in \$(seq 100); do grep -q listening $log 2>/dev/null && break; sleep 0.1; done"
|
|
36
|
+
echo "http://$(jq -r .listening $log)"
|
|
37
|
+
}
|
|
38
|
+
tok() { u "mosio remote hub-token $W/$1 --user $2 $3" | jq -r .token; } # tok HUBDIR USER "--grant a/b=role ..."
|
|
39
|
+
as() { u "export MOSIO_REMOTE_TOKEN=$1; $2"; } # as TOKEN 'commands'
|
|
40
|
+
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"; }
|
|
41
|
+
code_of() { jq -r '.code // "none"' "$1" 2>/dev/null || echo unreadable; }
|
|
42
|
+
|
|
43
|
+
# hub-1
|
|
44
|
+
H=$(hub h1)
|
|
45
|
+
T1=$(tok h1 ana "--grant acme/promo=write")
|
|
46
|
+
mode=$(stat -c %a $W/h1/access.json)
|
|
47
|
+
u "mosio remote hub-token $W/h1 --user budi --grant acme/promo=read > $W/h1-tok2.json"
|
|
48
|
+
newp $W/p1 2000000
|
|
49
|
+
u "mosio remote add $W/p1 origin $H/sync/acme/promo > /dev/null"
|
|
50
|
+
u "mosio push $W/p1 --json > $W/h1-anon.out 2>&1"
|
|
51
|
+
as mhub_0000 "mosio push $W/p1 --json > $W/h1-wrong.out 2>&1"
|
|
52
|
+
if [ "${#T1}" = 69 ] && [ "$mode" = 600 ] && ! grep -q "$T1" $W/h1/access.json && ! grep -q "$(jq -r .token $W/h1-tok2.json)" $W/h1/access.json \
|
|
53
|
+
&& [ "$(code_of $W/h1-anon.out)" = E_REMOTE_AUTH ] && [ "$(code_of $W/h1-wrong.out)" = E_REMOTE_AUTH ]; then
|
|
54
|
+
R[hub-1]=PASS; else R[hub-1]=FAIL; fi
|
|
55
|
+
echo " hub-1: token=${#T1} chars, access.json mode $mode, anon=$(code_of $W/h1-anon.out) wrong=$(code_of $W/h1-wrong.out)"
|
|
56
|
+
|
|
57
|
+
# hub-2 (the writer, a reader of acme/* and an admin share one Hub for hub-2 and hub-3)
|
|
58
|
+
H=$(hub h2)
|
|
59
|
+
TW=$(tok h2 ana "--grant acme/promo=write")
|
|
60
|
+
TR=$(tok h2 budi "--grant acme/*=read")
|
|
61
|
+
TA=$(tok h2 citra "--grant acme/promo=admin")
|
|
62
|
+
newp $W/p2 3000000
|
|
63
|
+
u "mosio remote add $W/p2 origin $H/sync/acme/promo > /dev/null"
|
|
64
|
+
as "$TW" "mosio push $W/p2 --json > $W/h2-push1.json; echo \$? > $W/h2-push1.rc"
|
|
65
|
+
as "$TR" "mosio clone $H/sync/acme/promo $W/c2 --json > $W/h2-clone.json; echo \$? > $W/h2-clone.rc; mosio fsck $W/c2 --json > $W/h2-fsck.json"
|
|
66
|
+
u "echo '<p>two</p>' >> $W/p2/scenes/\$(ls $W/p2/scenes | head -1) && mosio commit $W/p2 -m two > /dev/null"
|
|
67
|
+
as "$TW" "mosio push $W/p2 --json > $W/h2-push2.json"
|
|
68
|
+
as "$TR" "mosio pull $W/c2 --json > $W/h2-pull.json; echo \$? > $W/h2-pull.rc"
|
|
69
|
+
same=0; diff -r -x .mosio $W/p2 $W/c2 > /dev/null && same=1
|
|
70
|
+
who=$(jq -r '.msg // empty' $W/h2/projects/acme/promo/logs/refs/heads/main.jsonl 2>/dev/null | sort -u | tr '\n' ' ')
|
|
71
|
+
if [ "$(cat $W/h2-push1.rc)" = 0 ] && [ "$(cat $W/h2-clone.rc)" = 0 ] && [ "$(cat $W/h2-pull.rc)" = 0 ] && [ $same = 1 ] \
|
|
72
|
+
&& jq -e '.ok' $W/h2-fsck.json > /dev/null && [ "$(u "mosio status $W/c2" | jq -r .head)" = "$(u "mosio status $W/p2" | jq -r .head)" ] \
|
|
73
|
+
&& [ -n "$who" ] && ! echo "$who" | tr ' ' '\n' | grep -v '^$' | grep -qv '^push$\|^by$\|^hub:ana$'; then
|
|
74
|
+
R[hub-2]=PASS; else R[hub-2]=FAIL; fi
|
|
75
|
+
echo " hub-2: push=$(cat $W/h2-push1.rc) clone=$(cat $W/h2-clone.rc) pull=$(cat $W/h2-pull.rc) same_files=$same reflog_who=[$who]"
|
|
76
|
+
|
|
77
|
+
# hub-3
|
|
78
|
+
u "echo '<p>three</p>' >> $W/c2/scenes/\$(ls $W/c2/scenes | head -1) && mosio commit $W/c2 -m three > /dev/null"
|
|
79
|
+
before=$(cat $W/h2/projects/acme/promo/refs/heads/main 2>/dev/null)
|
|
80
|
+
as "$TR" "mosio push $W/c2 --json > $W/h3-reader.out 2>&1"
|
|
81
|
+
after=$(cat $W/h2/projects/acme/promo/refs/heads/main 2>/dev/null)
|
|
82
|
+
as "$TR" "mosio clone $H/sync/acme/secret $W/c3a --json > $W/h3-missing.out 2>&1"
|
|
83
|
+
as "$TW" "mosio clone $H/sync/beta/promo $W/c3b --json > $W/h3-other.out 2>&1"
|
|
84
|
+
# a diverged history: another clone of the writer moves main on, then p2 (behind, with its own revision) needs --force
|
|
85
|
+
as "$TW" "mosio clone $H/sync/acme/promo $W/c3w --json > /dev/null && echo '<p>ahead</p>' >> $W/c3w/scenes/\$(ls $W/c3w/scenes | head -1) && mosio commit $W/c3w -m ahead > /dev/null && mosio push $W/c3w --json > /dev/null"
|
|
86
|
+
u "echo '<p>alt</p>' >> $W/p2/scenes/\$(ls $W/p2/scenes | head -1) && mosio commit $W/p2 -m alt > /dev/null"
|
|
87
|
+
as "$TW" "mosio push $W/p2 --json > $W/h3-diverged.out 2>&1"
|
|
88
|
+
as "$TW" "mosio push $W/p2 --force --json > $W/h3-force-writer.out 2>&1"
|
|
89
|
+
as "$TA" "mosio push $W/p2 --force --json > $W/h3-force-admin.json 2>&1; echo \$? > $W/h3-force-admin.rc"
|
|
90
|
+
if [ "$(code_of $W/h3-reader.out)" = E_HUB_FORBIDDEN ] && [ "$before" = "$after" ] \
|
|
91
|
+
&& [ "$(code_of $W/h3-missing.out)" = E_HUB_NOT_FOUND ] && [ "$(code_of $W/h3-other.out)" = E_HUB_NOT_FOUND ] \
|
|
92
|
+
&& [ "$(code_of $W/h3-diverged.out)" = E_SYNC_DIVERGED ] && [ "$(code_of $W/h3-force-writer.out)" = E_HUB_FORBIDDEN ] \
|
|
93
|
+
&& [ "$(cat $W/h3-force-admin.rc)" = 0 ] && jq -e '.forced == true' $W/h3-force-admin.json > /dev/null; then
|
|
94
|
+
R[hub-3]=PASS; else R[hub-3]=FAIL; fi
|
|
95
|
+
echo " hub-3: reader push=$(code_of $W/h3-reader.out) ref_moved=$([ "$before" = "$after" ] && echo no || echo YES) missing=$(code_of $W/h3-missing.out) other=$(code_of $W/h3-other.out) diverged=$(code_of $W/h3-diverged.out) force(writer)=$(code_of $W/h3-force-writer.out) force(admin)=$(cat $W/h3-force-admin.rc)"
|
|
96
|
+
|
|
97
|
+
# hub-4
|
|
98
|
+
H=$(hub h4 '{"quota_bytes": {"acme": 1000000}}')
|
|
99
|
+
T4=$(tok h4 ana "--grant acme/*=write --grant beta/*=write")
|
|
100
|
+
newp $W/p4 3000000
|
|
101
|
+
u "mosio remote add $W/p4 origin $H/sync/acme/big > /dev/null && mosio remote add $W/p4 beta $H/sync/beta/big > /dev/null"
|
|
102
|
+
as "$T4" "mosio push $W/p4 --json > $W/h4-over.out 2>&1"
|
|
103
|
+
as "$T4" "mosio push $W/p4 beta --json > $W/h4-beta.json 2>&1; echo \$? > $W/h4-beta.rc"
|
|
104
|
+
if [ "$(code_of $W/h4-over.out)" = E_HUB_QUOTA ] && jq -e '.details.limit == 1000000 and (.details.used | type == "number")' $W/h4-over.out > /dev/null \
|
|
105
|
+
&& [ "$(cat $W/h4-beta.rc)" = 0 ]; then
|
|
106
|
+
R[hub-4]=PASS; else R[hub-4]=FAIL; fi
|
|
107
|
+
echo " hub-4: acme=$(code_of $W/h4-over.out) $(jq -c .details $W/h4-over.out 2>/dev/null) beta_rc=$(cat $W/h4-beta.rc)"
|
|
108
|
+
|
|
109
|
+
# hub-5: a Hub with a 1 MiB single-file limit; a 2 MB unchunkable file is refused by the client before any upload
|
|
110
|
+
H=$(hub h5 '{}' "MOSIO_SYNC_MAX_BLOB=1M")
|
|
111
|
+
T5=$(tok h5 ana "--grant acme/promo=write")
|
|
112
|
+
u "mosio init $W/p5 --name acc > /dev/null && mkdir -p $W/p5/assets && head -c 2000000 /dev/urandom | gzip -1 > $W/p5/assets/clip.gz && mosio commit $W/p5 -m gz > /dev/null && mosio remote add $W/p5 origin $H/sync/acme/promo > /dev/null"
|
|
113
|
+
as "$T5" "mosio push $W/p5 --json > $W/h5.out 2>&1"
|
|
114
|
+
objs=$(find $W/h5/projects -type f 2>/dev/null | wc -l)
|
|
115
|
+
if [ "$(code_of $W/h5.out)" = E_SYNC_LIMIT ] && [ "$objs" -le 2 ]; then R[hub-5]=PASS; else R[hub-5]=FAIL; fi
|
|
116
|
+
echo " hub-5: $(code_of $W/h5.out), files on the Hub after the refusal: $objs"
|
|
117
|
+
|
|
118
|
+
# hub-6: the same project through a plain reference server and through the Hub
|
|
119
|
+
H=$(hub h6)
|
|
120
|
+
T6=$(tok h6 ana "--grant acme/promo=write")
|
|
121
|
+
u "(nohup mosio remote serve $W/plain --listen 127.0.0.1:0 > $W/plain.log 2>&1 &); for i in \$(seq 100); do grep -q listening $W/plain.log 2>/dev/null && break; sleep 0.1; done"
|
|
122
|
+
P="http://$(jq -r .listening $W/plain.log)"
|
|
123
|
+
newp $W/p6 2500000
|
|
124
|
+
u "mosio remote add $W/p6 plain $P > /dev/null && mosio remote add $W/p6 hub $H/sync/acme/promo > /dev/null"
|
|
125
|
+
u "mosio push $W/p6 plain --json > $W/h6-plain.json; mosio clone $P $W/c6p --json > /dev/null"
|
|
126
|
+
as "$T6" "mosio push $W/p6 hub --json > $W/h6-hub.json; mosio clone $H/sync/acme/promo $W/c6h --json > /dev/null"
|
|
127
|
+
s6=0; diff -r -x .mosio $W/c6p $W/c6h > /dev/null && diff -r -x .mosio $W/p6 $W/c6h > /dev/null && s6=1
|
|
128
|
+
if [ $s6 = 1 ] && jq -e '.ok' $W/h6-plain.json $W/h6-hub.json > /dev/null; then R[hub-6]=PASS; else R[hub-6]=FAIL; fi
|
|
129
|
+
echo " hub-6: plain and Hub clones identical to the source: $s6"
|
|
130
|
+
|
|
131
|
+
# hub-7
|
|
132
|
+
H=$(hub h7)
|
|
133
|
+
T7W=$(tok h7 ana "--grant acme/promo=write")
|
|
134
|
+
T7R=$(tok h7 budi "--grant acme/promo=read")
|
|
135
|
+
u "mosio init $W/p7 --name acc > /dev/null && mosio commit $W/p7 -m one > /dev/null && mosio remote add $W/p7 origin $H/sync/acme/promo > /dev/null && mosio render $W/p7 -o $W/ref7.mp4 > /dev/null && mosio render $W/p7 --draft -o $W/ref7d.mp4 > /dev/null"
|
|
136
|
+
as "$T7W" "mosio push $W/p7 --json > $W/h7-push.json"
|
|
137
|
+
rev=$(jq -r .new $W/h7-push.json)
|
|
138
|
+
api() { u "curl -sS -H 'Authorization: Bearer $1' $2"; } # api TOKEN 'curl args'
|
|
139
|
+
api "$T7R" "-X POST -d '{\"revision\":\"$rev\"}' $H/api/v1/projects/acme/promo/renders" > $W/h7-reader.json
|
|
140
|
+
api "$T7W" "-X POST -d '{\"revision\":\"0123456789abcdef\"}' $H/api/v1/projects/acme/promo/renders" > $W/h7-norev.json
|
|
141
|
+
wait_job() { # wait_job TOKEN ID OUT
|
|
142
|
+
for i in $(seq 240); do api "$1" "$H/api/v1/renders/$2" > "$3"; s=$(jq -r .job.state "$3"); [ "$s" = done ] || [ "$s" = failed ] && return; sleep 1; done
|
|
143
|
+
}
|
|
144
|
+
id1=$(api "$T7W" "-X POST -d '{\"revision\":\"$rev\",\"priority\":\"final\"}' $H/api/v1/projects/acme/promo/renders" | jq -r .job.id)
|
|
145
|
+
wait_job "$T7W" "$id1" $W/h7-job1.json
|
|
146
|
+
api "$T7R" "-o $W/h7-video.mp4 $H/api/v1/renders/$id1/video" > /dev/null
|
|
147
|
+
u "curl -sS -o $W/h7-share.mp4 $H$(jq -r .job.share_url $W/h7-job1.json)"
|
|
148
|
+
id2=$(api "$T7W" "-X POST -d '{\"revision\":\"$rev\"}' $H/api/v1/projects/acme/promo/renders" | jq -r .job.id)
|
|
149
|
+
wait_job "$T7W" "$id2" $W/h7-job2.json
|
|
150
|
+
id3=$(api "$T7W" "-X POST -d '{\"revision\":\"$rev\",\"quality\":\"draft\"}' $H/api/v1/projects/acme/promo/renders" | jq -r .job.id)
|
|
151
|
+
wait_job "$T7W" "$id3" $W/h7-job3.json
|
|
152
|
+
api "$T7W" "-o $W/h7-draft.mp4 $H/api/v1/renders/$id3/video" > /dev/null
|
|
153
|
+
api "$T7W" "-X POST -d '{\"revision\":\"$rev\",\"quality\":\"low\"}' $H/api/v1/projects/acme/promo/renders" > $W/h7-badq.json
|
|
154
|
+
sha() { sha256sum "$1" | cut -d' ' -f1; }
|
|
155
|
+
if [ "$(code_of $W/h7-reader.json)" = E_HUB_FORBIDDEN ] && [ "$(code_of $W/h7-norev.json)" = E_RENDER_REVISION ] \
|
|
156
|
+
&& jq -e '.job.state == "done"' $W/h7-job1.json > /dev/null && [ -s $W/h7-video.mp4 ] \
|
|
157
|
+
&& [ "$(sha $W/h7-video.mp4)" = "$(sha $W/h7-share.mp4)" ] && [ "$(sha $W/h7-video.mp4)" = "$(sha $W/ref7.mp4)" ] \
|
|
158
|
+
&& jq -e '.job.state == "done" and .job.segments_cached == .job.segments_total and .job.segments_total >= 1' $W/h7-job2.json > /dev/null \
|
|
159
|
+
&& jq -e '.job.state == "done" and .job.quality == "draft"' $W/h7-job3.json > /dev/null && [ "$(sha $W/h7-draft.mp4)" = "$(sha $W/ref7d.mp4)" ] \
|
|
160
|
+
&& [ "$(sha $W/h7-draft.mp4)" != "$(sha $W/ref7.mp4)" ] && [ "$(code_of $W/h7-badq.json)" = E_SYNC_PROTOCOL ]; then
|
|
161
|
+
R[hub-7]=PASS; else R[hub-7]=FAIL; fi
|
|
162
|
+
echo " hub-7: reader=$(code_of $W/h7-reader.json) norev=$(code_of $W/h7-norev.json) job1=$(jq -c '.job|{state,segments_total,segments_cached,error_code}' $W/h7-job1.json) same_as_local=$([ "$(sha $W/h7-video.mp4)" = "$(sha $W/ref7.mp4)" ] && echo yes || echo NO) job2=$(jq -c '.job|{state,segments_cached}' $W/h7-job2.json) draft=$(jq -c '.job|{state,quality,error_code}' $W/h7-job3.json) draft_same_as_local=$([ "$(sha $W/h7-draft.mp4)" = "$(sha $W/ref7d.mp4)" ] && echo yes || echo NO) badq=$(code_of $W/h7-badq.json)"
|
|
163
|
+
|
|
164
|
+
# hub-8: the per-IP rate is 6 comments a minute here, so the last of the extra posts below is refused
|
|
165
|
+
H=$(hub h8 '{}' "MOSIO_HUB_REVIEW_IP_PER_MINUTE=6")
|
|
166
|
+
T8W=$(tok h8 ana "--grant acme/promo=write")
|
|
167
|
+
u "mosio init $W/p8 --name acc > /dev/null && mosio commit $W/p8 -m one > /dev/null && mosio remote add $W/p8 origin $H/sync/acme/promo > /dev/null"
|
|
168
|
+
as "$T8W" "mosio push $W/p8 --json > $W/h8-push.json"
|
|
169
|
+
rev8=$(jq -r .new $W/h8-push.json)
|
|
170
|
+
id8=$(api "$T8W" "-X POST -d '{\"revision\":\"$rev8\"}' $H/api/v1/projects/acme/promo/renders" | jq -r .job.id)
|
|
171
|
+
wait_job "$T8W" "$id8" $W/h8-job.json
|
|
172
|
+
share8=$(jq -r .job.share $W/h8-job.json)
|
|
173
|
+
u "curl -sS -D $W/h8-page.hdr -o $W/h8-page.html $H/r/$share8"
|
|
174
|
+
post8() { u "curl -sS -o $2 -w '%{http_code}' -X POST -d '$1' $H/r/$share8/comments"; } # post8 JSON OUTFILE -> status
|
|
175
|
+
K="sk-ant-api03-"; K+="A1b2C3d4E5f6G7h8I9j0K1l2M3n4O5p6"
|
|
176
|
+
s1=$(post8 '{"name":"Budi","text":"Title is too small","frame":0}' $W/h8-c1.json)
|
|
177
|
+
s2=$(post8 '{"name":"Citra","text":"Cut this scene shorter","frame":1}' $W/h8-c2.json)
|
|
178
|
+
s3=$(post8 "{\"name\":\"Budi\",\"text\":\"log in with $K\",\"frame\":0}" $W/h8-secret.json)
|
|
179
|
+
s4=$(post8 '{"name":"Budi","text":"too late","frame":99999}' $W/h8-frame.json)
|
|
180
|
+
u "curl -sS $H/r/$share8/comments" > $W/h8-list.json
|
|
181
|
+
u "mosio notes pull-review $W/p8 --hub $H --render $id8 > $W/h8-noauth.out 2>&1"
|
|
182
|
+
as "$T8W" "mosio notes pull-review $W/p8 --hub $H --render $id8 > $W/h8-pull1.json 2>&1"
|
|
183
|
+
head8=$(u "mosio status $W/p8" | jq -r .head)
|
|
184
|
+
as "$T8W" "mosio notes pull-review $W/p8 --hub $H --render $id8 > $W/h8-pull2.json 2>&1"
|
|
185
|
+
head8b=$(u "mosio status $W/p8" | jq -r .head)
|
|
186
|
+
u "mosio notes list $W/p8 --full" > $W/h8-notes.json
|
|
187
|
+
s5=$(post8 '{"name":"Spam","text":"a","frame":0}' $W/h8-s5.json); s6=$(post8 '{"name":"Spam","text":"b","frame":0}' $W/h8-s6.json)
|
|
188
|
+
s7=$(post8 '{"name":"Spam","text":"c","frame":0}' $W/h8-s7.json)
|
|
189
|
+
u "curl -sS -D $W/h8-rate.hdr -o /dev/null -X POST -d '{}' $H/r/$share8/comments"
|
|
190
|
+
if jq -e '.job.state == "done" and .job.review_url == "/r/'$share8'"' $W/h8-job.json > /dev/null \
|
|
191
|
+
&& grep -qi '^content-security-policy: default-src .none.' $W/h8-page.hdr && grep -qi '^content-type: text/html' $W/h8-page.hdr \
|
|
192
|
+
&& grep -q '<video' $W/h8-page.html && ! grep -q 'https\?://' $W/h8-page.html \
|
|
193
|
+
&& [ "$s1" = 201 ] && [ "$s2" = 201 ] && [ "$s3" = 422 ] && [ "$(code_of $W/h8-secret.json)" = E_SECRET_IN_TEXT ] \
|
|
194
|
+
&& [ "$s4" = 400 ] && [ "$(code_of $W/h8-frame.json)" = E_HUB_INVALID ] \
|
|
195
|
+
&& jq -e '.comments | length == 2' $W/h8-list.json > /dev/null \
|
|
196
|
+
&& jq -e '.ok and (.added | length == 2) and .commit != null' $W/h8-pull1.json > /dev/null \
|
|
197
|
+
&& jq -e '.ok and (.added | length == 0) and .already_imported == 2 and .commit == null' $W/h8-pull2.json > /dev/null \
|
|
198
|
+
&& [ "$head8" = "$head8b" ] && [ "$(code_of $W/h8-noauth.out)" = E_REMOTE_AUTH ] \
|
|
199
|
+
&& jq -e --arg rev "$rev8" '.notes | length == 2' $W/h8-notes.json > /dev/null \
|
|
200
|
+
&& [ "$(u "mosio notes show $W/p8 n1" | jq -r '[.note.author.kind, .note.author.id, .note.text, .note.revision.id, .note.review.comment[0:1]] | join("|")')" = "human|Budi|Title is too small|$rev8|c" ] \
|
|
201
|
+
&& [ "$s7" = 429 ] && grep -qi '^retry-after: [0-9]' $W/h8-rate.hdr; then
|
|
202
|
+
R[hub-8]=PASS; else R[hub-8]=FAIL; fi
|
|
203
|
+
echo " hub-8: page=$(head -1 $W/h8-page.hdr | tr -d '\r') posts=$s1/$s2 secret=$s3 frame=$s4 pull1=$(jq -c '{added: (.added|length), commit: (.commit != null)}' $W/h8-pull1.json 2>/dev/null) pull2=$(jq -c '{added: (.added|length), already: .already_imported}' $W/h8-pull2.json 2>/dev/null) head_same=$([ "$head8" = "$head8b" ] && echo yes || echo NO) rate=$s7"
|
|
204
|
+
|
|
205
|
+
u "pkill -u mosio -f 'mosio remote serv[e]' || true"
|
|
206
|
+
for k in hub-1 hub-2 hub-3 hub-4 hub-5 hub-6 hub-7 hub-8; do echo "== $k ${R[$k]}"; done
|
|
207
|
+
jq -n '$ARGS.named' --arg h1 "${R[hub-1]}" --arg h2 "${R[hub-2]}" --arg h3 "${R[hub-3]}" --arg h4 "${R[hub-4]}" --arg h5 "${R[hub-5]}" --arg h6 "${R[hub-6]}" --arg h7 "${R[hub-7]}" --arg h8 "${R[hub-8]}" > $W/summary.json
|
|
208
|
+
! grep -q FAIL $W/summary.json
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
# inspect-8 craft: blank first frame, short text hold, dead span and silent film flagged; the clean controls are not
|
|
11
11
|
# inspect-9 text outside its card: a 3-line title hanging out of a glass card is E_TEXT_OUTSIDE_CARD; a fitting title and a clipping card are not
|
|
12
12
|
# inspect-10 marks outside their card: a barcode running past its label is W_MARK_OUTSIDE_CARD; a barcode that fits, a clipping label and full-bleed layers are not
|
|
13
|
+
# inspect-11 motion physics: fast unblurred move, text moving while read, measured text overshoot, mixed directions and
|
|
14
|
+
# a pointer miss flagged; the clean control scene is not
|
|
13
15
|
set -uo pipefail
|
|
14
16
|
REPO="$(cd "$(dirname "$0")/../.." && pwd)"; cd "$REPO"
|
|
15
17
|
W=/home/mosio/acc-inspect; F="$REPO/fixtures"
|
|
@@ -93,7 +95,24 @@ manon=$(jq '[.findings[]|select(.code=="W_MARK_OUTSIDE_CARD" and .scene=="anon"
|
|
|
93
95
|
mtext=$(jq '[.findings[]|select(.code=="E_TEXT_OUTSIDE_CARD")]|length' $W/mark.json)
|
|
94
96
|
echo " mark: barcode overrun $mhit, barcode without an ID of its own $manon, false reports (inside, clips, fullbleed) $mfalse, text-card reports $mtext; $(jq -c '[.findings[]|{code,scene,id,detail}]' $W/mark.json | head -c 700)"
|
|
95
97
|
[ "$mhit" = 1 ] && [ "$manon" = 1 ] && [ "$mfalse" = 0 ] && [ "$mtext" = 0 ] && R[inspect-10]=PASS || R[inspect-10]=FAIL
|
|
96
|
-
|
|
97
|
-
|
|
98
|
+
# inspect-11: motion-physics checks (expected and clean findings listed in the fixture's expect.json; `source` when given)
|
|
99
|
+
u "mosio inspect $F/inspect-physics --motion --no-crops -o $W/physics > $W/physics.json"
|
|
100
|
+
m='.code==$e.code and ($e.scene==null or .scene==$e.scene) and ($e.id==null or .id==$e.id) and ($e.source==null or .source==$e.source)'
|
|
101
|
+
phit=0; pn=0
|
|
102
|
+
while read -r e; do
|
|
103
|
+
pn=$((pn+1))
|
|
104
|
+
if jq -e --argjson e "$e" "[.findings[]|select($m)]|length>0" $W/physics.json >/dev/null; then
|
|
105
|
+
phit=$((phit+1)); echo " detected: $e"
|
|
106
|
+
else echo " MISSED: $e"; fi
|
|
107
|
+
done < <(jq -c '.expect_findings[]' $F/inspect-physics/expect.json)
|
|
108
|
+
pfp=0
|
|
109
|
+
while read -r e; do
|
|
110
|
+
c=$(jq --argjson e "$e" "[.findings[]|select($m)]|length" $W/physics.json); pfp=$((pfp+c))
|
|
111
|
+
[ "$c" = 0 ] || echo " CLEAN-CONTROL FINDING: $e"
|
|
112
|
+
done < <(jq -c '.expect_clean[]' $F/inspect-physics/expect.json)
|
|
113
|
+
echo " physics: $phit/$pn detected, $pfp on clean controls; $(jq -c '[.findings[]|select(.code|test("FAST_UNBLURRED|MOVES_WHILE_READ|OVERSHOOT_TEXT|MIXED_DIRECTIONS|POINTER_MISS"))|{code,scene,id,frame,detail:(.detail|.[0:120])}]' $W/physics.json)"
|
|
114
|
+
[ "$phit" = "$pn" ] && [ "$pfp" = 0 ] && R[inspect-11]=PASS || R[inspect-11]=FAIL
|
|
115
|
+
for k in inspect-1 inspect-2 inspect-3 inspect-4 inspect-5 inspect-6 inspect-7 inspect-8 inspect-9 inspect-10 inspect-11; do echo "== $k ${R[$k]}"; done
|
|
116
|
+
jq -n '$ARGS.named' --arg A1 "${R[inspect-1]}" --arg A2 "${R[inspect-2]}" --arg A3 "${R[inspect-3]}" --arg A4 "${R[inspect-4]}" --arg A5 "${R[inspect-5]}" --arg A6 "${R[inspect-6]}" --arg A7 "${R[inspect-7]}" --arg A8 "${R[inspect-8]}" --arg A9 "${R[inspect-9]}" --arg A10 "${R[inspect-10]}" --arg A11 "${R[inspect-11]}" > /tmp/acc-inspect.json
|
|
98
117
|
cp /tmp/acc-inspect.json $W/summary.json
|
|
99
118
|
! grep -q FAIL $W/summary.json
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Git bridge acceptance (`mosio git export` / `mosio git import`), through real CLI processes. Run as root in the sandbox.
|
|
3
|
+
# revisions-40 export: the repository passes `git fsck --strict`, has the takes as branches, the tags, one commit per revision, trailers,
|
|
4
|
+
# the same commit ids on a second export (deterministic) and no change on re-export (idempotent)
|
|
5
|
+
# revisions-41 round trip: export then import into a fresh directory gives identical revision ids and tree ids, the same tips and tags,
|
|
6
|
+
# and `mosio fsck` is clean (lfs and inline)
|
|
7
|
+
# revisions-42 lfs: pointer format and object layout (`.git/lfs/objects/aa/bb/<sha256>`) always; with git-lfs installed, `git lfs fsck`
|
|
8
|
+
# and a push to a local LFS server (a python batch API) land every object
|
|
9
|
+
# revisions-43 re-import after one new git commit adds exactly one revision; importing again adds none
|
|
10
|
+
# revisions-44 exclude: .gitignore block and media.manifest.json; an import into an empty project leaves placeholders that `mosio check`
|
|
11
|
+
# flags (E_MEDIA_PLACEHOLDER) and the project's own store restores the media
|
|
12
|
+
# revisions-45 a build without the git-bridge feature still builds and runs the core; the git commands say E_GIT_DISABLED
|
|
13
|
+
set -uo pipefail
|
|
14
|
+
REPO="$(cd "$(dirname "$0")/../.." && pwd)"; cd "$REPO"
|
|
15
|
+
W=/home/mosio/acc-revisions-git; F="$REPO/fixtures"
|
|
16
|
+
cargo build --release --locked 2>&1 | tail -1
|
|
17
|
+
chmod -R o+rX "$REPO"
|
|
18
|
+
u() { scripts/as-user.sh "$1"; }
|
|
19
|
+
declare -A R
|
|
20
|
+
GC='git -c user.name=Acc -c user.email=acc@example.org'
|
|
21
|
+
u "rm -rf $W && mkdir -p $W && cp -r $F/w3-promo $W/p && cd $W && mosio commit p -m base --prompt 'make it pop' --model model-a --author agent:acc/1 > /dev/null"
|
|
22
|
+
# media (two different pictures) and a second revision, a tag, a take with its own revision
|
|
23
|
+
u "cd $W && mkdir -p p/assets && head -c 3000 /dev/urandom > p/assets/pic.png && mosio commit p -m 'add picture' > /dev/null && mosio tag add p v1 > /dev/null"
|
|
24
|
+
u "cd $W && mosio take new p alt --switch > /dev/null && mosio edit p text hook/title 'alt title' > /dev/null && head -c 4000 /dev/urandom > p/assets/pic.png && mosio commit p -m 'alt picture' > /dev/null"
|
|
25
|
+
u "cd $W && mosio log p > p-log.json && mosio take list p > p-takes.json && mosio tag list p > p-tags.json"
|
|
26
|
+
nrev=$(jq '.revisions | length' $W/p-log.json)
|
|
27
|
+
ids() { jq -c '[.revisions[] | {id, tree, message}]' "$1"; }
|
|
28
|
+
|
|
29
|
+
# R40: export
|
|
30
|
+
u "cd $W && mosio git export p r1 --json > e1.json && mosio git export p r2 --json > e2.json && mosio git export p r1 --json > e1b.json"
|
|
31
|
+
fsck_rc=$(u "cd $W/r1 && git fsck --strict --no-dangling > /dev/null 2>&1; echo \$?")
|
|
32
|
+
heads1=$(u "cd $W/r1 && git rev-parse alt main v1 | tr '\n' ' '"); heads2=$(u "cd $W/r2 && git rev-parse alt main v1 | tr '\n' ' '")
|
|
33
|
+
count=$(u "cd $W/r1 && git rev-list --count alt")
|
|
34
|
+
tip=$(u "cd $W/r1 && git log -1 --format=%B alt")
|
|
35
|
+
if [ "$fsck_rc" = 0 ] && [ "$heads1" = "$heads2" ] && [ "$count" = "$nrev" ] && jq -e '.new_commits == 0' $W/e1b.json >/dev/null \
|
|
36
|
+
&& [ "$(u "cd $W/r1 && git branch --format='%(refname:short)' | tr '\n' ' '")" = "alt main " ] && [ "$(u "cd $W/r1 && git tag")" = v1 ] \
|
|
37
|
+
&& echo "$tip" | grep -q '^Mosio-Revision: [0-9a-f]\{16\}$'; then R[revisions-40]=PASS; else R[revisions-40]=FAIL; fi
|
|
38
|
+
echo " R40: fsck_rc=$fsck_rc commits=$count/$nrev same_ids=$([ "$heads1" = "$heads2" ] && echo yes || echo NO) re-export_new=$(jq -r .new_commits $W/e1b.json)"
|
|
39
|
+
|
|
40
|
+
# R41: round trip, lfs (default) and inline
|
|
41
|
+
ok41=1
|
|
42
|
+
for m in lfs inline; do
|
|
43
|
+
u "cd $W && mosio git export p rt-$m --media $m --inline-cap 4000000000 > /dev/null && mosio git import q-$m rt-$m --json > imp-$m.json && mosio log q-$m > q-$m-log.json && mosio take list q-$m > q-$m-takes.json && mosio tag list q-$m > q-$m-tags.json && mosio fsck q-$m --json > q-$m-fsck.json; echo \$? > q-$m-fsck.rc"
|
|
44
|
+
[ "$(ids $W/p-log.json)" = "$(ids $W/q-$m-log.json)" ] || ok41=0
|
|
45
|
+
[ "$(jq -c '[.takes[] | {name, tip}]' $W/p-takes.json)" = "$(jq -c '[.takes[] | {name, tip}]' $W/q-$m-takes.json)" ] || ok41=0
|
|
46
|
+
[ "$(jq -c . $W/p-tags.json)" = "$(jq -c . $W/q-$m-tags.json)" ] || ok41=0
|
|
47
|
+
[ "$(cat $W/q-$m-fsck.rc)" = 0 ] || ok41=0
|
|
48
|
+
jq -e '.placeholders == 0' $W/imp-$m.json >/dev/null || ok41=0
|
|
49
|
+
done
|
|
50
|
+
if [ "$ok41" = 1 ]; then R[revisions-41]=PASS; else R[revisions-41]=FAIL; fi
|
|
51
|
+
echo " R41: lfs ids_equal=$([ "$(ids $W/p-log.json)" = "$(ids $W/q-lfs-log.json)" ] && echo yes || echo NO) inline ids_equal=$([ "$(ids $W/p-log.json)" = "$(ids $W/q-inline-log.json)" ] && echo yes || echo NO)"
|
|
52
|
+
|
|
53
|
+
# R42: lfs pointers, objects, and (when git-lfs is available) a real push
|
|
54
|
+
ptr=$(u "cd $W/rt-lfs && cat assets/pic.png")
|
|
55
|
+
oid=$(echo "$ptr" | sed -n 's/^oid sha256://p'); sz=$(echo "$ptr" | sed -n 's/^size //p')
|
|
56
|
+
objfile="$W/rt-lfs/.git/lfs/objects/${oid:0:2}/${oid:2:2}/$oid"
|
|
57
|
+
layout=0
|
|
58
|
+
if [ "$(echo "$ptr" | head -1)" = "version https://git-lfs.github.com/spec/v1" ] && [ -f "$objfile" ] && [ "$(sha256sum < $objfile | cut -d' ' -f1)" = "$oid" ] && [ "$(stat -c %s $objfile)" = "$sz" ] \
|
|
59
|
+
&& grep -q '^\*\.png filter=lfs' $W/rt-lfs/.gitattributes; then layout=1; fi
|
|
60
|
+
lfs_note="git-lfs not available: pointer format and object layout checked only"
|
|
61
|
+
lfs_ok=1
|
|
62
|
+
if ! command -v git-lfs >/dev/null 2>&1; then apt-get install -y git-lfs >/dev/null 2>&1 || true; fi
|
|
63
|
+
if ! command -v git-lfs >/dev/null 2>&1 && [ -n "${CI:-}" ]; then
|
|
64
|
+
# CI must never skip the real push: a missing git-lfs is a failure, not a note
|
|
65
|
+
lfs_ok=0; lfs_note="git-lfs MISSING in CI (CI=$CI): the push check cannot be skipped"
|
|
66
|
+
fi
|
|
67
|
+
if command -v git-lfs >/dev/null 2>&1; then
|
|
68
|
+
lfs_note="git-lfs $(git lfs version | cut -d' ' -f1)"
|
|
69
|
+
cat > $W/lfs-server.py <<'PY'
|
|
70
|
+
import hashlib, http.server, json, os, sys
|
|
71
|
+
store, port = sys.argv[1], int(sys.argv[2])
|
|
72
|
+
os.makedirs(store, exist_ok=True)
|
|
73
|
+
class H(http.server.BaseHTTPRequestHandler):
|
|
74
|
+
def log_message(self, *a): pass
|
|
75
|
+
def _json(self, code, obj):
|
|
76
|
+
b = json.dumps(obj).encode()
|
|
77
|
+
self.send_response(code); self.send_header("Content-Type", "application/vnd.git-lfs+json"); self.send_header("Content-Length", str(len(b))); self.end_headers(); self.wfile.write(b)
|
|
78
|
+
def do_POST(self):
|
|
79
|
+
n = int(self.headers.get("Content-Length", 0)); req = json.loads(self.rfile.read(n) or b"{}")
|
|
80
|
+
objs = []
|
|
81
|
+
for o in req.get("objects", []):
|
|
82
|
+
href = "http://127.0.0.1:%d/o/%s" % (port, o["oid"])
|
|
83
|
+
if req.get("operation") == "upload":
|
|
84
|
+
objs.append({"oid": o["oid"], "size": o["size"], "actions": {} if os.path.exists(os.path.join(store, o["oid"])) else {"upload": {"href": href}}})
|
|
85
|
+
else:
|
|
86
|
+
objs.append({"oid": o["oid"], "size": o["size"], "actions": {"download": {"href": href}}})
|
|
87
|
+
self._json(200, {"transfer": "basic", "objects": objs})
|
|
88
|
+
def do_PUT(self):
|
|
89
|
+
oid = self.path.rsplit("/", 1)[1]; n = int(self.headers.get("Content-Length", 0)); data = self.rfile.read(n)
|
|
90
|
+
if hashlib.sha256(data).hexdigest() != oid:
|
|
91
|
+
self.send_response(422); self.end_headers(); return
|
|
92
|
+
open(os.path.join(store, oid), "wb").write(data); self.send_response(200); self.send_header("Content-Length", "0"); self.end_headers()
|
|
93
|
+
def do_GET(self):
|
|
94
|
+
p = os.path.join(store, self.path.rsplit("/", 1)[1])
|
|
95
|
+
if not os.path.exists(p): self.send_response(404); self.end_headers(); return
|
|
96
|
+
d = open(p, "rb").read(); self.send_response(200); self.send_header("Content-Length", str(len(d))); self.end_headers(); self.wfile.write(d)
|
|
97
|
+
http.server.HTTPServer(("127.0.0.1", port), H).serve_forever()
|
|
98
|
+
PY
|
|
99
|
+
chmod o+r $W/lfs-server.py
|
|
100
|
+
u "cd $W && (python3 lfs-server.py $W/lfs-store 8765 > lfs-server.log 2>&1 &) ; sleep 1; rm -rf remote.git; git init -q --bare remote.git"
|
|
101
|
+
u "cd $W/rt-lfs && git lfs install --local > /dev/null 2>&1; git config lfs.url http://127.0.0.1:8765/ && git remote add origin $W/remote.git && git lfs fsck > $W/lfs-fsck.log 2>&1; echo \$? > $W/lfs-fsck.rc; git lfs push --all origin > $W/lfs-push.log 2>&1; echo \$? > $W/lfs-push.rc"
|
|
102
|
+
want=$(cd $W/rt-lfs/.git/lfs/objects && find . -type f | wc -l); got=$(ls $W/lfs-store 2>/dev/null | wc -l)
|
|
103
|
+
[ "$(cat $W/lfs-fsck.rc)" = 0 ] && [ "$(cat $W/lfs-push.rc)" = 0 ] && [ "$want" -ge 2 ] && [ "$want" = "$got" ] || lfs_ok=0
|
|
104
|
+
pkill -f "lfs-server.py $W/lfs-store" 2>/dev/null || true
|
|
105
|
+
lfs_note="$lfs_note fsck_rc=$(cat $W/lfs-fsck.rc) push_rc=$(cat $W/lfs-push.rc) objects=$want pushed=$got"
|
|
106
|
+
fi
|
|
107
|
+
if [ "$layout" = 1 ] && [ "$lfs_ok" = 1 ]; then R[revisions-42]=PASS; else R[revisions-42]=FAIL; fi
|
|
108
|
+
echo " R42: layout=$layout $lfs_note"
|
|
109
|
+
|
|
110
|
+
# R43: one new git commit is one new revision
|
|
111
|
+
before=$(ls $W/q-lfs/.mosio/revs/*.json | wc -l)
|
|
112
|
+
u "cd $W/rt-lfs && printf '\n<!-- from git -->\n' >> scenes/01-hook.html && git add -A && $GC commit -q -m 'edit in git' && cd $W && mosio git import q-lfs rt-lfs --json > imp43.json && mosio git import q-lfs rt-lfs --json > imp43b.json"
|
|
113
|
+
after=$(ls $W/q-lfs/.mosio/revs/*.json | wc -l)
|
|
114
|
+
if jq -e '.new_commits == 1 and .new_revisions == 1' $W/imp43.json >/dev/null && jq -e '.new_commits == 0 and .new_revisions == 0' $W/imp43b.json >/dev/null && [ "$after" = $((before + 1)) ]; then R[revisions-43]=PASS; else R[revisions-43]=FAIL; fi
|
|
115
|
+
echo " R43: first=$(jq -c '{new_commits,new_revisions}' $W/imp43.json) again=$(jq -c '{new_commits,new_revisions}' $W/imp43b.json) records $before -> $after"
|
|
116
|
+
|
|
117
|
+
# R44: exclude
|
|
118
|
+
u "cd $W && mosio git export p rx --media exclude > /dev/null && mosio git import qx rx --json > impx.json; mosio git import p rx --json > impx2.json"
|
|
119
|
+
fsck_x=$(u "cd $W/rx && git fsck --strict --no-dangling > /dev/null 2>&1; echo \$?")
|
|
120
|
+
# a placeholder only shows in a working tree: check out the imported take main
|
|
121
|
+
u "cd $W && mosio take switch qx main --discard > /dev/null 2>&1; mosio check qx > checkx2.json; echo \$? > checkx2.rc"
|
|
122
|
+
if [ "$fsck_x" = 0 ] && [ ! -e $W/rx/assets/pic.png ] && grep -q 'assets/pic.png' $W/rx/media.manifest.json && grep -q '^/assets/pic.png' $W/rx/.gitignore \
|
|
123
|
+
&& jq -e '.placeholders >= 1' $W/impx.json >/dev/null && jq -e '[.reports[].errors[]? | select(.code == "E_MEDIA_PLACEHOLDER")] | length >= 1' $W/checkx2.json >/dev/null \
|
|
124
|
+
&& jq -e '.placeholders == 0' $W/impx2.json >/dev/null; then R[revisions-44]=PASS; else R[revisions-44]=FAIL; fi
|
|
125
|
+
echo " R44: fsck_rc=$fsck_x placeholders=$(jq -r .placeholders $W/impx.json) check_flags=$(jq '[.reports[].errors[]? | select(.code == "E_MEDIA_PLACEHOLDER")] | length' $W/checkx2.json) own_store_placeholders=$(jq -r .placeholders $W/impx2.json)"
|
|
126
|
+
|
|
127
|
+
# R45: feature off still builds the core
|
|
128
|
+
cargo build --locked --no-default-features --target-dir target/nogit 2>&1 | tail -1
|
|
129
|
+
u "cd $W && $REPO/target/nogit/debug/mosio git export p rnog > nog.json 2>&1; mosio status p > /dev/null; $REPO/target/nogit/debug/mosio status p > nog-status.json 2>&1; echo \$? > nog-status.rc"
|
|
130
|
+
if jq -e '.code == "E_GIT_DISABLED"' $W/nog.json >/dev/null && [ "$(cat $W/nog-status.rc)" = 0 ]; then R[revisions-45]=PASS; else R[revisions-45]=FAIL; fi
|
|
131
|
+
echo " R45: git export on a build without the feature: $(jq -r .code $W/nog.json), status rc=$(cat $W/nog-status.rc)"
|
|
132
|
+
|
|
133
|
+
for k in revisions-40 revisions-41 revisions-42 revisions-43 revisions-44 revisions-45; do echo "== $k ${R[$k]}"; done
|
|
134
|
+
jq -n '$ARGS.named' --arg R40 "${R[revisions-40]}" --arg R41 "${R[revisions-41]}" --arg R42 "${R[revisions-42]}" --arg R43 "${R[revisions-43]}" \
|
|
135
|
+
--arg R44 "${R[revisions-44]}" --arg R45 "${R[revisions-45]}" > /tmp/acc-revisions-git.json
|
|
136
|
+
cp /tmp/acc-revisions-git.json $W/summary.json
|
|
137
|
+
! grep -q FAIL $W/summary.json
|