AdithyaSK HF Staff commited on
Commit
29fc4be
·
verified ·
1 Parent(s): ca30ad9

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. tasks/format-code-task-000011/environment/Dockerfile +3 -0
  2. tasks/format-code-task-000011/environment/setup/files/blocklist +33 -0
  3. tasks/format-code-task-000011/environment/setup/setup.sh +34 -0
  4. tasks/format-code-task-000011/tests/test.patch +72 -0
  5. tasks/format-code-task-000011/tests/test.sh +40 -0
  6. tasks/format-code-task-000011/tests/test_command.sh +1 -0
  7. tasks/format-code-task-000016/environment/Dockerfile +3 -0
  8. tasks/format-code-task-000016/environment/setup/files/blocklist +33 -0
  9. tasks/format-code-task-000016/environment/setup/setup.sh +34 -0
  10. tasks/format-code-task-000016/tests/test.patch +981 -0
  11. tasks/format-code-task-000016/tests/test.sh +39 -0
  12. tasks/format-code-task-000016/tests/test_command.sh +1 -0
  13. tasks/format-code-task-000018/environment/Dockerfile +3 -0
  14. tasks/format-code-task-000018/environment/setup/files/blocklist +33 -0
  15. tasks/format-code-task-000018/environment/setup/setup.sh +34 -0
  16. tasks/format-code-task-000018/tests/test.patch +225 -0
  17. tasks/format-code-task-000018/tests/test.sh +38 -0
  18. tasks/format-code-task-000018/tests/test_command.sh +1 -0
  19. tasks/format-code-task-000020/environment/Dockerfile +3 -0
  20. tasks/format-code-task-000020/environment/setup/files/blocklist +33 -0
  21. tasks/format-code-task-000020/environment/setup/setup.sh +34 -0
  22. tasks/format-code-task-000020/tests/test.patch +133 -0
  23. tasks/format-code-task-000020/tests/test.sh +38 -0
  24. tasks/format-code-task-000020/tests/test_command.sh +1 -0
  25. tasks/format-code-task-000027/environment/Dockerfile +3 -0
  26. tasks/format-code-task-000027/environment/setup/files/blocklist +33 -0
  27. tasks/format-code-task-000027/environment/setup/setup.sh +34 -0
  28. tasks/format-code-task-000027/tests/test.patch +78 -0
  29. tasks/format-code-task-000027/tests/test.sh +39 -0
  30. tasks/format-code-task-000027/tests/test_command.sh +1 -0
  31. tasks/format-code-task-000029/environment/Dockerfile +3 -0
  32. tasks/format-code-task-000029/environment/setup/files/blocklist +33 -0
  33. tasks/format-code-task-000029/environment/setup/setup.sh +34 -0
  34. tasks/format-code-task-000029/tests/test.patch +79 -0
  35. tasks/format-code-task-000029/tests/test.sh +39 -0
  36. tasks/format-code-task-000029/tests/test_command.sh +1 -0
  37. tasks/format-code-task-000042/environment/Dockerfile +3 -0
  38. tasks/format-code-task-000042/environment/setup/files/blocklist +33 -0
  39. tasks/format-code-task-000042/environment/setup/setup.sh +34 -0
  40. tasks/format-code-task-000042/tests/test.patch +55 -0
  41. tasks/format-code-task-000042/tests/test.sh +39 -0
  42. tasks/format-code-task-000042/tests/test_command.sh +1 -0
  43. tasks/format-code-task-000045/environment/Dockerfile +3 -0
  44. tasks/format-code-task-000045/environment/setup/files/blocklist +33 -0
  45. tasks/format-code-task-000045/environment/setup/setup.sh +34 -0
  46. tasks/format-code-task-000045/tests/test.patch +120 -0
  47. tasks/format-code-task-000045/tests/test.sh +39 -0
  48. tasks/format-code-task-000045/tests/test_command.sh +1 -0
  49. tasks/format-code-task-000089/environment/Dockerfile +3 -0
  50. tasks/format-code-task-000089/environment/setup/files/blocklist +33 -0
tasks/format-code-task-000011/environment/Dockerfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # The task's image, pinned by digest (the same as [environment].docker_image).
2
+ # Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
3
+ FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:c8522aaf8f02f486d9dfadc34812d082efbca8b337cf987d2940045cd93f00a3
tasks/format-code-task-000011/environment/setup/files/blocklist ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mimo answer-leak blocklist (mimoagent)
2
+ 0.0.0.0 github.com
3
+ 0.0.0.0 www.github.com
4
+ 0.0.0.0 api.github.com
5
+ 0.0.0.0 raw.githubusercontent.com
6
+ 0.0.0.0 codeload.github.com
7
+ 0.0.0.0 objects.githubusercontent.com
8
+ 0.0.0.0 gist.github.com
9
+ 0.0.0.0 gist.githubusercontent.com
10
+ 0.0.0.0 gitlab.com
11
+ 0.0.0.0 bitbucket.org
12
+ 0.0.0.0 sourceforge.net
13
+ 0.0.0.0 git.kernel.org
14
+ 0.0.0.0 chromium.googlesource.com
15
+ 0.0.0.0 android.googlesource.com
16
+ 0.0.0.0 sourcegraph.com
17
+ 0.0.0.0 bugs.chromium.org
18
+ 0.0.0.0 issues.oss-fuzz.com
19
+ 0.0.0.0 oss-fuzz.com
20
+ 0.0.0.0 osv.dev
21
+ 0.0.0.0 api.osv.dev
22
+ 0.0.0.0 bugzilla.mozilla.org
23
+ 0.0.0.0 proxy.golang.org
24
+ 0.0.0.0 sum.golang.org
25
+ 0.0.0.0 pkg.go.dev
26
+ 0.0.0.0 google.com
27
+ 0.0.0.0 www.google.com
28
+ 0.0.0.0 bing.com
29
+ 0.0.0.0 www.bing.com
30
+ 0.0.0.0 duckduckgo.com
31
+ 0.0.0.0 html.duckduckgo.com
32
+ 0.0.0.0 search.brave.com
33
+ 0.0.0.0 stackoverflow.com
tasks/format-code-task-000011/environment/setup/setup.sh ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
3
+ # /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
4
+ M=/var/lib/mimo
5
+ [ -f "$M/ready" ] && exit 0
6
+ chmod 700 "$M"
7
+ fail() { echo "setup: $*" >&2; exit 1; }
8
+ # the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
9
+ write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
10
+
11
+ # Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
12
+ CWD=/testbed
13
+ git config --global --add safe.directory "$CWD"
14
+ cd "$CWD" || fail "no working directory $CWD"
15
+ if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
16
+ git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
17
+ fi
18
+ BASE=$(git rev-parse HEAD 2>/dev/null)
19
+ [ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
20
+ echo "$BASE" > "$M/base"
21
+ # Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
22
+ # so .git is hidden while the agent works and put back for grading.
23
+ LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
24
+ rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
25
+ git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
26
+ find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
27
+ if [ "$LATER" -gt 0 ]; then
28
+ mv "$CWD/.git" "$M/git-hidden"
29
+ echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
30
+ fi
31
+ write_blocklist
32
+
33
+ touch "$M/ready"
34
+ echo "setup done"
tasks/format-code-task-000011/tests/test.patch ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/leetcode/1201-1300/1277.Count-Square-Submatrices-with-All-Ones/Solution_test.go b/leetcode/1201-1300/1277.Count-Square-Submatrices-with-All-Ones/Solution_test.go
2
+ index 3e51ecacf..b0eb74396 100644
3
+ --- a/leetcode/1201-1300/1277.Count-Square-Submatrices-with-All-Ones/Solution_test.go
4
+ +++ b/leetcode/1201-1300/1277.Count-Square-Submatrices-with-All-Ones/Solution_test.go
5
+ @@ -10,12 +10,19 @@ func TestSolution(t *testing.T) {
6
+ // 测试用例
7
+ cases := []struct {
8
+ name string
9
+ - inputs bool
10
+ - expect bool
11
+ + inputs [][]int
12
+ + expect int
13
+ }{
14
+ - {"TestCase", true, true},
15
+ - {"TestCase", true, true},
16
+ - {"TestCase", false, false},
17
+ + {"TestCase", [][]int{
18
+ + {0,1,1,1},
19
+ + {1,1,1,1},
20
+ + {0,1,1,1},
21
+ + }, 15},
22
+ + {"TestCase", [][]int{
23
+ + {1,0,1},
24
+ + {1,1,0},
25
+ + {1,1,0},
26
+ + }, 7},
27
+ }
28
+
29
+ // 开始测试
30
+ diff --git a/leetcode/301-400/0338.Counting-Bits/Solution_test.go b/leetcode/301-400/0338.Counting-Bits/Solution_test.go
31
+ index 3e51ecacf..ed701b1ad 100644
32
+ --- a/leetcode/301-400/0338.Counting-Bits/Solution_test.go
33
+ +++ b/leetcode/301-400/0338.Counting-Bits/Solution_test.go
34
+ @@ -10,12 +10,12 @@ func TestSolution(t *testing.T) {
35
+ // 测试用例
36
+ cases := []struct {
37
+ name string
38
+ - inputs bool
39
+ - expect bool
40
+ + inputs int
41
+ + expect []int
42
+ }{
43
+ - {"TestCase", true, true},
44
+ - {"TestCase", true, true},
45
+ - {"TestCase", false, false},
46
+ + {"TestCase", 2, []int{0,1,1}},
47
+ + {"TestCase", 5, []int{0,1,1,2,1,2}},
48
+ + {"TestCase", 10, []int{0,1,1,2,1,2,2,3,1,2,2}},
49
+ }
50
+
51
+ // 开始测试
52
+ diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64
53
+ new file mode 100644
54
+ --- /dev/null
55
+ +++ b/mimo_build_env.tar.gz.b64
56
+ @@ -0,0 +1,5 @@
57
+ +H4sIAAAAAAAAA+3SvW7DIBQFYM9+CqrO/Bk7dG37AB3yABE2KLFkg2pw8volzpCoUpslUVv1fAsg
58
+ +0OWKA2vnfrAb5/e8uBeR6aZZxuzzuMxlU0mpha50VQgpV6IpSHO3ji7MMZmJkGIKIX137tr+H8XO
59
+ ++ScX06YL42i8ZXF3uzuu5V/V6py/0jn/elXJgojbtfC1f57/4wNve89bE3dlZ8nyCVpny3IbyBgs
60
+ +seHgh2DscX3cI4wPzqUuWMdlJSSVSog805q9htknun6fzeToem5Hk6a+c5Ee+rSjz8NA37yLnDF2
61
+ +WUTlGnUuIZR6OpXo/Za+9Ol0ku7Ln34iAAAAAAAAAAAAAAAAAAAAAIBf6wPgDnkJACgAAA==
62
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
63
+ new file mode 100755
64
+ --- /dev/null
65
+ +++ b/mimo_test_command.sh
66
+ @@ -0,0 +1,6 @@
67
+ +#!/usr/bin/env bash
68
+ +
69
+ +set -uo pipefail
70
+ +cd /testbed || exit 1
71
+ +base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1
72
+ +exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'
tasks/format-code-task-000011/tests/test.sh ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
3
+ # task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
4
+ M=/var/lib/mimo
5
+ CWD=/testbed
6
+ V=/logs/verifier
7
+ mkdir -p "$V"
8
+ BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
9
+ cd "$CWD" || exit 1
10
+ if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
11
+ # the agent's change against the base, so its own commits count too
12
+ git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
13
+ git reset -q
14
+ if ! (
15
+ while IFS= read -r tf; do
16
+ [ -z "$tf" ] && continue
17
+ if git cat-file -e $BASE:"$tf" 2>/dev/null; then
18
+ git checkout $BASE -- "$tf" 2>/dev/null || true
19
+ else
20
+ git rm -f --cached "$tf" >/dev/null 2>&1 || true
21
+ rm -f "$tf"
22
+ fi
23
+ done <<'EOF_RESET_TEST_FILES'
24
+ leetcode/1201-1300/1277.Count-Square-Submatrices-with-All-Ones/Solution_test.go
25
+ leetcode/301-400/0338.Counting-Bits/Solution_test.go
26
+ mimo_build_env.tar.gz.b64
27
+ mimo_test_command.sh
28
+ EOF_RESET_TEST_FILES
29
+
30
+ ); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
31
+ if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
32
+ cat "$V/apply.log" >&2
33
+ echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
34
+ exit 1
35
+ fi
36
+ timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
37
+ RC=$?
38
+ tail -c 12000 "$V/test_output.log"
39
+ if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
40
+ echo "test command exited $RC"
tasks/format-code-task-000011/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000016/environment/Dockerfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # The task's image, pinned by digest (the same as [environment].docker_image).
2
+ # Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
3
+ FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:5f46605969f46946830b492ccca83d68404d50cce97b3796b8bd2257715d0ba1
tasks/format-code-task-000016/environment/setup/files/blocklist ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mimo answer-leak blocklist (mimoagent)
2
+ 0.0.0.0 github.com
3
+ 0.0.0.0 www.github.com
4
+ 0.0.0.0 api.github.com
5
+ 0.0.0.0 raw.githubusercontent.com
6
+ 0.0.0.0 codeload.github.com
7
+ 0.0.0.0 objects.githubusercontent.com
8
+ 0.0.0.0 gist.github.com
9
+ 0.0.0.0 gist.githubusercontent.com
10
+ 0.0.0.0 gitlab.com
11
+ 0.0.0.0 bitbucket.org
12
+ 0.0.0.0 sourceforge.net
13
+ 0.0.0.0 git.kernel.org
14
+ 0.0.0.0 chromium.googlesource.com
15
+ 0.0.0.0 android.googlesource.com
16
+ 0.0.0.0 sourcegraph.com
17
+ 0.0.0.0 bugs.chromium.org
18
+ 0.0.0.0 issues.oss-fuzz.com
19
+ 0.0.0.0 oss-fuzz.com
20
+ 0.0.0.0 osv.dev
21
+ 0.0.0.0 api.osv.dev
22
+ 0.0.0.0 bugzilla.mozilla.org
23
+ 0.0.0.0 proxy.golang.org
24
+ 0.0.0.0 sum.golang.org
25
+ 0.0.0.0 pkg.go.dev
26
+ 0.0.0.0 google.com
27
+ 0.0.0.0 www.google.com
28
+ 0.0.0.0 bing.com
29
+ 0.0.0.0 www.bing.com
30
+ 0.0.0.0 duckduckgo.com
31
+ 0.0.0.0 html.duckduckgo.com
32
+ 0.0.0.0 search.brave.com
33
+ 0.0.0.0 stackoverflow.com
tasks/format-code-task-000016/environment/setup/setup.sh ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
3
+ # /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
4
+ M=/var/lib/mimo
5
+ [ -f "$M/ready" ] && exit 0
6
+ chmod 700 "$M"
7
+ fail() { echo "setup: $*" >&2; exit 1; }
8
+ # the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
9
+ write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
10
+
11
+ # Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
12
+ CWD=/testbed
13
+ git config --global --add safe.directory "$CWD"
14
+ cd "$CWD" || fail "no working directory $CWD"
15
+ if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
16
+ git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
17
+ fi
18
+ BASE=$(git rev-parse HEAD 2>/dev/null)
19
+ [ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
20
+ echo "$BASE" > "$M/base"
21
+ # Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
22
+ # so .git is hidden while the agent works and put back for grading.
23
+ LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
24
+ rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
25
+ git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
26
+ find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
27
+ if [ "$LATER" -gt 0 ]; then
28
+ mv "$CWD/.git" "$M/git-hidden"
29
+ echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
30
+ fi
31
+ write_blocklist
32
+
33
+ touch "$M/ready"
34
+ echo "setup done"
tasks/format-code-task-000016/tests/test.patch ADDED
@@ -0,0 +1,981 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/tests/tests_api.py b/tests/tests_api.py
2
+ index 79ff485..702b681 100755
3
+ --- a/tests/tests_api.py
4
+ +++ b/tests/tests_api.py
5
+ @@ -1,4 +1,7 @@
6
+ #!/usr/bin/env python
7
+ +"""
8
+ + This module implements all the tests for the API view.
9
+ +"""
10
+ import os
11
+ import unittest
12
+ import tempfile
13
+ @@ -25,7 +28,7 @@ def setUp(self):
14
+ with poli.app.app_context():
15
+ api = APIControl()
16
+ api.usercontrol.create("john", "password")
17
+ - self.create_sample()
18
+ + self._create_sample()
19
+ poli.db.session.commit()
20
+
21
+ def tearDown(self):
22
+ @@ -34,17 +37,17 @@ def tearDown(self):
23
+ os.close(self.db_fd)
24
+ os.unlink(self.fname)
25
+
26
+ - def login(self, username, password):
27
+ + def _login(self, username, password):
28
+ return self.app.post("/login/",
29
+ data=dict(
30
+ username=username,
31
+ password=password),
32
+ follow_redirects=True)
33
+
34
+ - def create_sample(self):
35
+ + def _create_sample(self):
36
+ with open("tests/example_pe.bin", "rb") as hfile:
37
+ data = StringIO(hfile.read())
38
+ - self.login("john", "password")
39
+ + self._login("john", "password")
40
+ retval = self.app.post("/samples/",
41
+ content_type='multipart/form-data',
42
+ data=dict({'file': (data, "toto")},
43
+ @@ -53,101 +56,20 @@ def create_sample(self):
44
+ sleep(1)
45
+ return retval
46
+
47
+ - def push_comment(self, sid=1, address=None, comment=None):
48
+ - retval = self.app.post('/api/1.0/samples/'+str(sid)+'/comments/',
49
+ - data=json.dumps(dict(address=address, comment=comment)),
50
+ - content_type="application/json")
51
+ - return retval
52
+ -
53
+ -
54
+ - def create_struct(self, sid=1, name=None):
55
+ - retval = self.app.post('/api/1.0/samples/'+str(sid)+'/structs/',
56
+ - data=json.dumps(dict(name=name)),
57
+ - content_type="application/json")
58
+ - return retval
59
+ -
60
+ - def create_struct_member(self, sid=1, struct_id=None, mname=None, size=0, offset=0):
61
+ - url = '/api/1.0/samples/' + str(sid)
62
+ - url += '/structs/' + str(struct_id)
63
+ - url += '/members/'
64
+ - retval = self.app.post(url,
65
+ - data=json.dumps(dict(name=mname,
66
+ - size=size,
67
+ - offset=offset)),
68
+ - content_type="application/json")
69
+ - return retval
70
+ -
71
+ - def update_struct_member_name(self, sid=1, struct_id=None, mid=None, newname=""):
72
+ - url = '/api/1.0/samples/' + str(sid)
73
+ - url += '/structs/' + str(struct_id)
74
+ - url += '/members/'
75
+ - retval = self.app.patch(url,
76
+ - data=json.dumps(dict(mid=mid, newname=newname)),
77
+ - content_type="application/json")
78
+ - return retval
79
+ -
80
+ - def update_struct_member_size(self, sid=1, struct_id=None, mid=None, newsize=0):
81
+ - url = '/api/1.0/samples/' + str(sid)
82
+ - url += '/structs/' + str(struct_id)
83
+ - url += '/members/'
84
+ - retval = self.app.patch(url,
85
+ - data=json.dumps(dict(mid=mid, newsize=newsize)),
86
+ - content_type="application/json")
87
+ - return retval
88
+ -
89
+ -
90
+ -
91
+ - def get_all_structs(self, sid=1, name=None):
92
+ - retval = self.app.get('/api/1.0/samples/' + str(sid) +
93
+ - '/structs/')
94
+ - return retval
95
+ -
96
+ - def get_one_struct(self, sid=1, struct_id=1):
97
+ - url = '/api/1.0/samples/' + str(sid)
98
+ - url += '/structs/'
99
+ - url += str(struct_id) + '/'
100
+ - retval = self.app.get(url)
101
+ - return retval
102
+ -
103
+ -
104
+ - def get_comment(self, sid=1, address=None):
105
+ - retval = self.app.get('/api/1.0/samples/' + str(sid) +
106
+ - '/comments/',
107
+ - data=json.dumps({'address':address}),
108
+ - content_type="application/json")
109
+ - return retval
110
+ -
111
+ - def push_name(self, sid=1, address=None, name=None):
112
+ - retval = self.app.post('/api/1.0/samples/'+str(sid)+'/names/',
113
+ - data=json.dumps(dict(address=address, name=name)),
114
+ - content_type="application/json")
115
+ - return retval
116
+ -
117
+ - def get_name(self, sid=1, address=None):
118
+ - retval = self.app.get('/api/1.0/samples/' + str(sid) +
119
+ - '/names/')
120
+ - return retval
121
+ -
122
+ - def create_family(self, name, tlp_level=None, parent=None):
123
+ + def _create_family(self, name, tlp_level=None, parent=None):
124
+ data = dict(name=name, tlp_level=tlp_level)
125
+ if parent is not None:
126
+ data["parent"] = parent
127
+ retval = self.app.post('/api/1.0/family/',
128
+ - data=json.dumps(data),
129
+ - content_type="application/json")
130
+ + data=json.dumps(data),
131
+ + content_type="application/json")
132
+ return retval
133
+
134
+ - def create_yara(self, name, rule, tlp_level=None):
135
+ - retval = self.app.post('/api/1.0/yaras/',
136
+ - data=json.dumps(dict(name=name, rule=rule, tlp_level=tlp_level)),
137
+ - content_type="application/json")
138
+ - return retval
139
+
140
+ - def update_yara(self, name, rule, tlp_level=None):
141
+ - retval = self.app.patch('/api/1.0/yaras/',
142
+ - data=json.dumps(dict(name=name, rule=rule, tlp_level=tlp_level)),
143
+ - content_type="application/json")
144
+ - return retval
145
+ +class ApiSampleTests(ApiTestCase):
146
+ + """
147
+ + Tests cases relatives to sample analysis and metadata
148
+ + """
149
+
150
+ def test_get_sample_info(self):
151
+ """
152
+ @@ -156,11 +78,14 @@ def test_get_sample_info(self):
153
+ retval = self.app.get('/api/1.0/samples/1/')
154
+ self.assertEqual(retval.status_code, 200)
155
+ data = json.loads(retval.data)
156
+ - self.assertEqual(len(data),1)
157
+ + self.assertEqual(len(data), 1)
158
+ data = data['samples']
159
+ self.assertEqual(data['id'], 1)
160
+
161
+ def test_get_sample_id(self):
162
+ + """
163
+ + Test access to the sample by using MD5, SHA1 and SHA256
164
+ + """
165
+ # test getting ID by MD5
166
+ retval = self.app.get('/api/1.0/samples/0f6f0c6b818f072a7a6f02441d00ac69/')
167
+ self.assertEqual(retval.status_code, 200)
168
+ @@ -179,15 +104,20 @@ def test_get_sample_id(self):
169
+ data = json.loads(retval.data)
170
+ self.assertEqual(data['sample_id'], 1)
171
+
172
+ - # Bug when using incorrect value for hash
173
+ + def test_wrong_sample_hash(self):
174
+ + """
175
+ + This triggered a bug when using incorrect value for hash
176
+ + """
177
+ url = "api/1.0/samples/abcdef/"
178
+ retval = self.app.get(url)
179
+ self.assertEqual(retval.status_code, 400)
180
+ data = json.loads(retval.data)
181
+ self.assertEqual(data['error'], 400)
182
+
183
+ -
184
+ def test_get_multiples_sample_info(self):
185
+ + """
186
+ + Extract some expected informations from the API
187
+ + """
188
+ retval = self.app.get('/api/1.0/samples/')
189
+ self.assertEqual(retval.status_code, 200)
190
+
191
+ @@ -243,11 +173,32 @@ def test_get_strings_data(self):
192
+ data = json.loads(retval.data)
193
+ self.assertEqual(len(data), 1)
194
+
195
+ + def test_sample_abstract(self):
196
+ + """
197
+ + Sets and gets the sample abstract
198
+ + """
199
+ + data = json.dumps(dict(abstract="This is a test for abstract"))
200
+ + retval = self.app.post('/api/1.0/samples/1/abstract/', data=data,
201
+ + content_type="application/json")
202
+ + self.assertEqual(retval.status_code, 200)
203
+ + result = json.loads(retval.data)
204
+ + self.assertTrue(result['result'])
205
+ +
206
+ + retval = self.app.get('/api/1.0/samples/1/abstract/')
207
+ + self.assertEqual(retval.status_code, 200)
208
+ + result = json.loads(retval.data)
209
+ + self.assertIn(result['abstract'], 'This is a test for abstract')
210
+ +
211
+ +
212
+ +class ApiFamilyTests(ApiTestCase):
213
+ + """
214
+ + Tests the families creation, hierarchy and manipulation
215
+ + """
216
+ def test_family_creation(self):
217
+ """
218
+ This will test the families creation and access
219
+ """
220
+ - retval = self.create_family("TESTFAMILY1")
221
+ + retval = self._create_family("TESTFAMILY1")
222
+ self.assertEqual(retval.status_code, 200)
223
+ data = json.loads(retval.data)
224
+ self.assertEqual(data['family'], 1)
225
+ @@ -270,7 +221,7 @@ def test_family_tlp(self):
226
+ Test the TLP level affectation for a family
227
+ """
228
+
229
+ - retval = self.create_family("TESTFAMILY2", tlp_level=5)
230
+ + retval = self._create_family("TESTFAMILY2", tlp_level=5)
231
+ self.assertEqual(retval.status_code, 200)
232
+
233
+ retval = self.app.get('/api/1.0/family/1/')
234
+ @@ -283,7 +234,7 @@ def test_family_abstract(self):
235
+ """
236
+ Try to update the family abstract
237
+ """
238
+ - self.create_family("TESTFAMILY1")
239
+ + self._create_family("TESTFAMILY1")
240
+ data = json.dumps(dict(abstract="Test abstract"))
241
+ retval = self.app.post("/api/1.0/family/1/abstract/", data=data,
242
+ content_type="application/json")
243
+ @@ -295,8 +246,11 @@ def test_family_abstract(self):
244
+ self.assertIn(data["abstract"], "Test abstract")
245
+
246
+ def test_subfamilies(self):
247
+ - self.create_family("MOTHER FAMILY")
248
+ - self.create_family("CHILD FAMILY", parent="MOTHER FAMILY")
249
+ + """
250
+ + Can we manage a hierarchical family organization?
251
+ + """
252
+ + self._create_family("MOTHER FAMILY")
253
+ + self._create_family("CHILD FAMILY", parent="MOTHER FAMILY")
254
+
255
+
256
+ retval = self.app.get('/api/1.0/family/1/')
257
+ @@ -309,11 +263,222 @@ def test_subfamilies(self):
258
+ data = json.loads(retval.data)["family"]
259
+ self.assertEqual(data["parent_id"], 1)
260
+
261
+ +
262
+ +class ApiYaraTests(ApiTestCase):
263
+ + """
264
+ + Yara rules creation and management
265
+ + """
266
+ + def _create_yara(self, name, rule, tlp_level=None):
267
+ + retval = self.app.post('/api/1.0/yaras/',
268
+ + data=json.dumps(dict(name=name,
269
+ + rule=rule,
270
+ + tlp_level=tlp_level)),
271
+ + content_type="application/json")
272
+ + return retval
273
+ +
274
+ + def _update_yara(self, name, rule, tlp_level=None):
275
+ + retval = self.app.patch('/api/1.0/yaras/',
276
+ + data=json.dumps(dict(name=name,
277
+ + rule=rule,
278
+ + tlp_level=tlp_level)),
279
+ + content_type="application/json")
280
+ + return retval
281
+ +
282
+ + def test_yara_creation(self):
283
+ + """
284
+ + Creates an example yara rule,
285
+ + and try to get it back
286
+ + """
287
+ + rule_text = """rule toto{
288
+ + strings:
289
+ + $1 = {4D 5A}
290
+ + condition:
291
+ + $1 at 0
292
+ + }"""
293
+ + retval = self._create_yara("TESTYARA", rule_text)
294
+ + self.assertEqual(retval.status_code, 200)
295
+ + data = json.loads(retval.data)
296
+ + self.assertEqual(data["id"], 1)
297
+ +
298
+ + retval = self.app.get("/api/1.0/yaras/")
299
+ + self.assertEqual(retval.status_code, 200)
300
+ + data = json.loads(retval.data)
301
+ + self.assertEqual(len(data['yara_rules']), 1)
302
+ + rule = data['yara_rules'][0]
303
+ + self.assertIn(rule['name'], "TESTYARA")
304
+ + self.assertEqual(rule['TLP_sensibility'], 3)
305
+ + self.assertIn(rule['raw_rule'], rule_text)
306
+ +
307
+ + def test_yara_tlp(self):
308
+ + """
309
+ + Is the TLP correctly managed for a yara rule?
310
+ + """
311
+ + rule_text = """rule toto{
312
+ + strings:
313
+ + $1 = {4D 5A}
314
+ + condition:
315
+ + $1 at 0
316
+ + }"""
317
+ + retval = self._create_yara("TESTYARA", rule_text, tlp_level=4)
318
+ + retval = self.app.get("/api/1.0/yaras/")
319
+ + data = json.loads(retval.data)
320
+ + rule = data['yara_rules'][0]
321
+ + self.assertEqual(rule['TLP_sensibility'], 4)
322
+ +
323
+ + def test_yara_family(self):
324
+ + """
325
+ + Test for correct affectation of a yara to a family
326
+ + """
327
+ + rule_text = """rule toto{
328
+ + strings:
329
+ + $1 = {4D 5A}
330
+ + condition:
331
+ + $1 at 0
332
+ + }"""
333
+ + retval = self._create_yara("TESTYARA", rule_text)
334
+ + self._create_family("TESTFAMILY")
335
+ + retval = self.app.post('/api/1.0/family/1/yaras/',
336
+ + data=json.dumps(dict(rule_name="TESTYARA")),
337
+ + content_type="application/json")
338
+ + self.assertEqual(retval.status_code, 200)
339
+ + data = json.loads(retval.data)
340
+ + self.assertTrue(data["result"])
341
+ +
342
+ + retval = self.app.get('/api/1.0/family/1/export/1/detection/yara')
343
+ + self.assertEqual(retval.status_code, 200)
344
+ + self.assertIn("TESTYARA", retval.data)
345
+ + self.assertIn("4D 5A", retval.data)
346
+ +
347
+ +
348
+ +
349
+ +
350
+ +
351
+ +
352
+ +
353
+ +
354
+ +
355
+ +
356
+ +
357
+ +
358
+ +
359
+ +
360
+ +
361
+ +
362
+ +
363
+ +
364
+ +
365
+ +
366
+ +
367
+ +
368
+ +
369
+ +class ApiIDAActionsTests(ApiTestCase):
370
+ + """
371
+ + Tests storage and synchronization for implemented IDA Pro types.
372
+ + """
373
+ + def _push_comment(self, sid=1, address=None, comment=None):
374
+ + retval = self.app.post('/api/1.0/samples/'+str(sid)+'/comments/',
375
+ + data=json.dumps(dict(address=address, comment=comment)),
376
+ + content_type="application/json")
377
+ + return retval
378
+ +
379
+ + def _create_struct(self, sid=1, name=None):
380
+ + retval = self.app.post('/api/1.0/samples/'+str(sid)+'/structs/',
381
+ + data=json.dumps(dict(name=name)),
382
+ + content_type="application/json")
383
+ + return retval
384
+ +
385
+ + def _create_struct_member(self, sid=1, struct_id=None, mname=None, size=0, offset=0):
386
+ + url = '/api/1.0/samples/' + str(sid)
387
+ + url += '/structs/' + str(struct_id)
388
+ + url += '/members/'
389
+ + retval = self.app.post(url,
390
+ + data=json.dumps(dict(name=mname,
391
+ + size=size,
392
+ + offset=offset)),
393
+ + content_type="application/json")
394
+ + return retval
395
+ +
396
+ + def _update_struct_member_name(self, sid=1, struct_id=None, mid=None, newname=""):
397
+ + url = '/api/1.0/samples/' + str(sid)
398
+ + url += '/structs/' + str(struct_id)
399
+ + url += '/members/'
400
+ + retval = self.app.patch(url,
401
+ + data=json.dumps(dict(mid=mid, newname=newname)),
402
+ + content_type="application/json")
403
+ + return retval
404
+ +
405
+ + def _update_struct_member_size(self, sid=1, struct_id=None, mid=None, newsize=0):
406
+ + url = '/api/1.0/samples/' + str(sid)
407
+ + url += '/structs/' + str(struct_id)
408
+ + url += '/members/'
409
+ + retval = self.app.patch(url,
410
+ + data=json.dumps(dict(mid=mid, newsize=newsize)),
411
+ + content_type="application/json")
412
+ + return retval
413
+ +
414
+ + def _get_all_structs(self, sid=1):
415
+ + retval = self.app.get('/api/1.0/samples/' + str(sid) +
416
+ + '/structs/')
417
+ + return retval
418
+ +
419
+ + def _get_one_struct(self, sid=1, struct_id=1):
420
+ + url = '/api/1.0/samples/' + str(sid)
421
+ + url += '/structs/'
422
+ + url += str(struct_id) + '/'
423
+ + retval = self.app.get(url)
424
+ + return retval
425
+ +
426
+ + def _get_comment(self, sid=1, address=None):
427
+ + retval = self.app.get('/api/1.0/samples/' + str(sid) +
428
+ + '/comments/',
429
+ + data=json.dumps({'address':address}),
430
+ + content_type="application/json")
431
+ + return retval
432
+ +
433
+ + def _push_name(self, sid=1, address=None, name=None):
434
+ + retval = self.app.post('/api/1.0/samples/'+str(sid)+'/names/',
435
+ + data=json.dumps(dict(address=address, name=name)),
436
+ + content_type="application/json")
437
+ + return retval
438
+ +
439
+ + def _get_name(self, sid=1, address=None):
440
+ + url = '/api/1.0/samples/' + str(sid) + '/names/'
441
+ + if address is not None:
442
+ + url += '?addr='
443
+ + url += hex(address)
444
+ + retval = self.app.get(url)
445
+ + return retval
446
+ +
447
+ + def _create_type(self, sid=1, address=None, typedef=None):
448
+ + retval = self.app.post('/api/1.0/samples/'+str(sid)+'/types/',
449
+ + data=json.dumps(dict(address=address,
450
+ + typedef=typedef)),
451
+ + content_type="application/json")
452
+ + return retval
453
+ +
454
+ + def _get_type(self, sid=1, address=None):
455
+ + url = '/api/1.0/samples/' + str(sid)
456
+ + url += '/types/'
457
+ + if address is not None:
458
+ + url += "?addr="
459
+ + url += hex(address)
460
+ +
461
+ + return self.app.get(url)
462
+ +
463
+ + @staticmethod
464
+ + def _format_timedelta():
465
+ + """
466
+ + wrapper for strftime and 1 day offset
467
+ + """
468
+ + offset = datetime.datetime.now() + datetime.timedelta(days=1)
469
+ + offset = datetime.datetime.strftime(offset, '%Y-%m-%dT%H:%M:%S.%f')
470
+ + return offset
471
+ +
472
+ def test_push_comments(self):
473
+ """
474
+ Can we push comments for a sample?
475
+ """
476
+ - retval = self.push_comment(address=0xDEADBEEF, comment="TESTCOMMENT1")
477
+ + retval = self._push_comment(address=0xDEADBEEF, comment="TESTCOMMENT1")
478
+ self.assertEqual(retval.status_code, 200)
479
+ data = json.loads(retval.data)
480
+ self.assertTrue(data['result'])
481
+ @@ -322,29 +487,29 @@ def test_get_comment(self):
482
+ """
483
+ This endpoint is used to get comments for a specific address
484
+ """
485
+ - retval = self.push_comment(address=0xDEADBEEF, comment="TESTCOMMENT1")
486
+ + retval = self._push_comment(address=0xDEADBEEF, comment="TESTCOMMENT1")
487
+ self.assertEqual(retval.status_code, 200)
488
+ data = json.loads(retval.data)
489
+ self.assertTrue(data['result'])
490
+
491
+ - retval = self.get_comment(address=0xDEADBEEF)
492
+ + retval = self._get_comment(address=0xDEADBEEF)
493
+ self.assertEqual(retval.status_code, 200)
494
+ data = json.loads(retval.data)
495
+ self.assertIn(data['comments'][0]["data"], "TESTCOMMENT1")
496
+ self.assertEqual(data['comments'][0]["address"], 0xDEADBEEF)
497
+
498
+ def test_get_multiple_comments(self):
499
+ - retval = self.push_comment(address=0xDEADBEEF, comment="TESTCOMMENT1")
500
+ + retval = self._push_comment(address=0xDEADBEEF, comment="TESTCOMMENT1")
501
+ self.assertEqual(retval.status_code, 200)
502
+ data = json.loads(retval.data)
503
+ self.assertTrue(data['result'])
504
+
505
+ - retval = self.push_comment(address=0xBADF00D, comment="TESTCOMMENT2")
506
+ + retval = self._push_comment(address=0xBADF00D, comment="TESTCOMMENT2")
507
+ self.assertEqual(retval.status_code, 200)
508
+ data = json.loads(retval.data)
509
+ self.assertTrue(data['result'])
510
+
511
+ - retval = self.get_comment()
512
+ + retval = self._get_comment()
513
+ self.assertEqual(retval.status_code, 200)
514
+ data = json.loads(retval.data)
515
+ self.assertEqual(len(data['comments']), 2)
516
+ @@ -353,21 +518,12 @@ def test_get_multiple_comments(self):
517
+ self.assertIn(data['comments'][1]["data"], "TESTCOMMENT2")
518
+ self.assertEqual(data['comments'][1]["address"], 0xBADF00D)
519
+
520
+ - @staticmethod
521
+ - def format_timedelta():
522
+ - """
523
+ - wrapper for strftime and 1 day offset
524
+ - """
525
+ - offset = datetime.datetime.now() + datetime.timedelta(days=1)
526
+ - offset = datetime.datetime.strftime(offset, '%Y-%m-%dT%H:%M:%S.%f')
527
+ - return offset
528
+ -
529
+ def test_action_timestamp(self):
530
+ """
531
+ Test getting different results with different timestamps
532
+ """
533
+ - self.push_comment(address=0xDEADBEEF, comment="TESTCOMMENT1")
534
+ - offset = self.format_timedelta()
535
+ + self._push_comment(address=0xDEADBEEF, comment="TESTCOMMENT1")
536
+ + offset = self._format_timedelta()
537
+ retval = self.app.get('/api/1.0/samples/1/comments/?timestamp='+offset)
538
+ self.assertEqual(retval.status_code, 200)
539
+ data = json.loads(retval.data)
540
+ @@ -383,8 +539,8 @@ def test_action_timestamp(self):
541
+ data = json.loads(retval.data)
542
+ self.assertEqual(len(data["comments"]), 1)
543
+
544
+ - self.push_name(address=0xDEADBEEF, name="TESTNAME")
545
+ - offset = self.format_timedelta()
546
+ + self._push_name(address=0xDEADBEEF, name="TESTNAME")
547
+ + offset = self._format_timedelta()
548
+ retval = self.app.get('/api/1.0/samples/1/names/?timestamp='+offset)
549
+ self.assertEqual(retval.status_code, 200)
550
+ data = json.loads(retval.data)
551
+ @@ -395,8 +551,8 @@ def test_action_timestamp(self):
552
+ data = json.loads(retval.data)
553
+ self.assertEqual(len(data["names"]), 1)
554
+
555
+ - self.create_struct(name="TESTSTRUCTURE")
556
+ - offset = self.format_timedelta()
557
+ + self._create_struct(name="TESTSTRUCTURE")
558
+ + offset = self._format_timedelta()
559
+ retval = self.app.get('/api/1.0/samples/1/structs/?timestamp='+offset)
560
+ self.assertEqual(retval.status_code, 200)
561
+ data = json.loads(retval.data)
562
+ @@ -407,12 +563,11 @@ def test_action_timestamp(self):
563
+ data = json.loads(retval.data)
564
+ self.assertEqual(len(data["structs"]), 1)
565
+
566
+ -
567
+ def test_push_name(self):
568
+ """
569
+ Simulate a renaming done from IDA
570
+ """
571
+ - retval = self.push_name(address=0xDEADBEEF, name="TESTNAME1")
572
+ + retval = self._push_name(address=0xDEADBEEF, name="TESTNAME1")
573
+ self.assertEqual(retval.status_code, 200)
574
+ data = json.loads(retval.data)
575
+ self.assertTrue(data['result'])
576
+ @@ -421,12 +576,12 @@ def test_get_names(self):
577
+ """
578
+ This endpoint is used to get names for a specific address
579
+ """
580
+ - retval = self.push_name(address=0xDEADBEEF, name="TESTNAME1")
581
+ + retval = self._push_name(address=0xDEADBEEF, name="TESTNAME1")
582
+ self.assertEqual(retval.status_code, 200)
583
+ data = json.loads(retval.data)
584
+ self.assertTrue(data['result'])
585
+
586
+ - retval = self.get_name(address=0xDEADBEEF)
587
+ + retval = self._get_name(address=0xDEADBEEF)
588
+ self.assertEqual(retval.status_code, 200)
589
+ data = json.loads(retval.data)
590
+ self.assertIn(data['names'][0]["data"], "TESTNAME1")
591
+ @@ -436,20 +591,20 @@ def test_create_struct(self):
592
+ """
593
+ Simple structure creation and access
594
+ """
595
+ - retval = self.create_struct(sid=1, name="StructName1")
596
+ + retval = self._create_struct(sid=1, name="StructName1")
597
+ self.assertEqual(retval.status_code, 200)
598
+ data = json.loads(retval.data)
599
+ self.assertTrue(data["result"])
600
+
601
+ # check if the structure is in the complete listing
602
+ - retval = self.get_all_structs(sid=1)
603
+ + retval = self._get_all_structs(sid=1)
604
+ self.assertEqual(retval.status_code, 200)
605
+ data = json.loads(retval.data)
606
+ self.assertIn("StructName1", data["structs"][0]["name"])
607
+ self.assertEqual(0, data["structs"][0]["size"])
608
+
609
+ # check if we can access the structure alone
610
+ - retval = self.get_one_struct(sid=1, struct_id=1)
611
+ + retval = self._get_one_struct(sid=1, struct_id=1)
612
+ self.assertEqual(retval.status_code, 200)
613
+ data = json.loads(retval.data)
614
+ struct = data["structs"]
615
+ @@ -461,17 +616,17 @@ def test_create_multiple_structs(self):
616
+ This will test if we can access multiple structs for one sample
617
+ """
618
+ # create structs
619
+ - retval = self.create_struct(sid=1, name="StructName1")
620
+ + retval = self._create_struct(sid=1, name="StructName1")
621
+ self.assertEqual(retval.status_code, 200)
622
+ data = json.loads(retval.data)
623
+ self.assertTrue(data["result"])
624
+
625
+ - retval = self.create_struct(sid=1, name="StructName2")
626
+ + retval = self._create_struct(sid=1, name="StructName2")
627
+ data = json.loads(retval.data)
628
+ self.assertTrue(data["result"])
629
+
630
+ # get the structs
631
+ - retval = self.get_all_structs(sid=1)
632
+ + retval = self._get_all_structs(sid=1)
633
+ self.assertEqual(retval.status_code, 200)
634
+ data = json.loads(retval.data)
635
+ self.assertEqual(2, len(data["structs"]))
636
+ @@ -482,25 +637,24 @@ def test_create_multiple_structs(self):
637
+ self.assertEqual(0, struct1["size"])
638
+ self.assertEqual(0, struct2["size"])
639
+
640
+ -
641
+ def test_create_struct_member(self):
642
+ """
643
+ Member creation
644
+ """
645
+ # first create a structre
646
+ - self.create_struct(sid=1, name="StructName1")
647
+ + self._create_struct(sid=1, name="StructName1")
648
+ # then add a member to it
649
+ - retval = self.create_struct_member(struct_id=1,
650
+ - mname="MemberName1",
651
+ - size=4,
652
+ - offset=0)
653
+ + retval = self._create_struct_member(struct_id=1,
654
+ + mname="MemberName1",
655
+ + size=4,
656
+ + offset=0)
657
+ # Is the member OK?
658
+ self.assertEqual(retval.status_code, 200)
659
+ data = json.loads(retval.data)
660
+ self.assertTrue(data["result"])
661
+
662
+ # can we get the member in the structure
663
+ - retval = self.get_one_struct(sid=1, struct_id=1)
664
+ + retval = self._get_one_struct(sid=1, struct_id=1)
665
+ data = json.loads(retval.data)
666
+ struct = data["structs"]
667
+
668
+ @@ -511,32 +665,32 @@ def test_create_struct_member(self):
669
+ self.assertEqual(4, member["size"])
670
+ self.assertEqual(0, member["offset"])
671
+
672
+ - def test_create_multiple_struct_members(self):
673
+ + def test_create_struct_members(self):
674
+ """
675
+ Test for multiples members
676
+ """
677
+ - self.create_struct(sid=1, name="StructName1")
678
+ - self.create_struct_member(struct_id=1,
679
+ - mname="MemberName1",
680
+ - size=4,
681
+ - offset=0)
682
+ + self._create_struct(sid=1, name="StructName1")
683
+ + self._create_struct_member(struct_id=1,
684
+ + mname="MemberName1",
685
+ + size=4,
686
+ + offset=0)
687
+
688
+ - self.create_struct_member(struct_id=1,
689
+ - mname="MemberName2",
690
+ - size=2,
691
+ - offset=4)
692
+ + self._create_struct_member(struct_id=1,
693
+ + mname="MemberName2",
694
+ + size=2,
695
+ + offset=4)
696
+
697
+ - self.create_struct_member(struct_id=1,
698
+ - mname="MemberName3",
699
+ - size=2,
700
+ - offset=6)
701
+ + self._create_struct_member(struct_id=1,
702
+ + mname="MemberName3",
703
+ + size=2,
704
+ + offset=6)
705
+
706
+ - self.create_struct_member(struct_id=1,
707
+ - mname="MemberName4",
708
+ - size=4,
709
+ - offset=8)
710
+ + self._create_struct_member(struct_id=1,
711
+ + mname="MemberName4",
712
+ + size=4,
713
+ + offset=8)
714
+
715
+ - retval = self.get_one_struct(sid=1, struct_id=1)
716
+ + retval = self._get_one_struct(sid=1, struct_id=1)
717
+ self.assertEqual(retval.status_code, 200)
718
+ data = json.loads(retval.data)
719
+
720
+ @@ -566,45 +720,83 @@ def test_create_multiple_struct_members(self):
721
+ self.assertEqual(4, member["size"])
722
+ self.assertEqual(8, member["offset"])
723
+
724
+ + def test_idatypes(self):
725
+ + """
726
+ + IDA Types
727
+ + """
728
+ + ret = self._create_type(sid=1, address=0xDEADBEEF, typedef='void *')
729
+ + self.assertEqual(ret.status_code, 200)
730
+ + res = json.loads(ret.data)
731
+ + self.assertTrue(res["result"])
732
+ +
733
+ +
734
+ + ret = self._get_type(sid=1)
735
+ + self.assertEqual(ret.status_code, 200)
736
+ + types = json.loads(ret.data)['typedefs']
737
+ + self.assertEqual(len(types), 1)
738
+ + self.assertIn(types[0]["data"], 'void *')
739
+ +
740
+ +
741
+ + ret = self._get_type(sid=1, address=0xDEADBEEF)
742
+ + self.assertEqual(ret.status_code, 200)
743
+ + types = json.loads(ret.data)['typedefs']
744
+ + self.assertEqual(len(types), 1)
745
+ + self.assertIn(types[0]["data"], 'void *')
746
+ +
747
+ +
748
+ + ret = self._get_type(sid=1, address=0x1234)
749
+ + self.assertEqual(ret.status_code, 200)
750
+ + types = json.loads(ret.data)['typedefs']
751
+ + self.assertEqual(len(types), 0)
752
+ +
753
+ +
754
+ + self._create_type(sid=1, address=0xBADF00D, typedef='int testtype(int dwTest, char cType)')
755
+ + ret = self._get_type(sid=1)
756
+ + self.assertEqual(ret.status_code, 200)
757
+ + types = json.loads(ret.data)['typedefs']
758
+ + self.assertEqual(len(types), 2)
759
+ + self.assertIn(types[0]["data"], 'void *')
760
+ + self.assertIn(types[1]["data"], 'int testtype(int dwTest, char cType)')
761
+ +
762
+
763
+ def test_struct_member_update(self):
764
+ """
765
+ Update size, name or offset
766
+ """
767
+ - self.create_struct(sid=1, name="StructName1")
768
+ - self.create_struct_member(struct_id=1,
769
+ - mname="MemberName1",
770
+ - size=4,
771
+ - offset=0)
772
+ + self._create_struct(sid=1, name="StructName1")
773
+ + self._create_struct_member(struct_id=1,
774
+ + mname="MemberName1",
775
+ + size=4,
776
+ + offset=0)
777
+
778
+ - self.create_struct_member(struct_id=1,
779
+ - mname="MemberName2",
780
+ - size=2,
781
+ - offset=4)
782
+ + self._create_struct_member(struct_id=1,
783
+ + mname="MemberName2",
784
+ + size=2,
785
+ + offset=4)
786
+
787
+ - retval = self.update_struct_member_name(struct_id=1,
788
+ - mid=1,
789
+ - newname="NewMemberName1")
790
+ + retval = self._update_struct_member_name(struct_id=1,
791
+ + mid=1,
792
+ + newname="NewMemberName1")
793
+
794
+ self.assertEqual(retval.status_code, 200)
795
+ data = json.loads(retval.data)
796
+ self.assertTrue(data['result'])
797
+
798
+ - retval = self.get_one_struct(sid=1, struct_id=1)
799
+ + retval = self._get_one_struct(sid=1, struct_id=1)
800
+ data = json.loads(retval.data)
801
+ mstruct = data['structs']
802
+ member = mstruct['members'][0]
803
+ self.assertIn('NewMemberName1', member['name'])
804
+
805
+ # test when downgrading the size of first member
806
+ - retval = self.update_struct_member_size(struct_id=1,
807
+ - mid=1,
808
+ - newsize=2)
809
+ + retval = self._update_struct_member_size(struct_id=1,
810
+ + mid=1,
811
+ + newsize=2)
812
+ self.assertEqual(retval.status_code, 200)
813
+ data = json.loads(retval.data)
814
+ self.assertTrue(data["result"])
815
+
816
+ - retval = self.get_one_struct(sid=1, struct_id=1)
817
+ + retval = self._get_one_struct(sid=1, struct_id=1)
818
+ data = json.loads(retval.data)
819
+ mstruct = data['structs']
820
+ member = mstruct['members'][0]
821
+ @@ -612,10 +804,10 @@ def test_struct_member_update(self):
822
+ self.assertEqual(mstruct['size'], 6)
823
+
824
+ # test when downgrading the last member size
825
+ - retval = self.update_struct_member_size(struct_id=1,
826
+ - mid=2,
827
+ - newsize=1)
828
+ - retval = self.get_one_struct(sid=1, struct_id=1)
829
+ + retval = self._update_struct_member_size(struct_id=1,
830
+ + mid=2,
831
+ + newsize=1)
832
+ + retval = self._get_one_struct(sid=1, struct_id=1)
833
+ data = json.loads(retval.data)
834
+ mstruct = data['structs']
835
+ member = mstruct['members'][1]
836
+ @@ -624,119 +816,26 @@ def test_struct_member_update(self):
837
+
838
+
839
+ # test when upgrading the last member size
840
+ - retval = self.update_struct_member_size(struct_id=1,
841
+ - mid=2,
842
+ - newsize=4)
843
+ + retval = self._update_struct_member_size(struct_id=1,
844
+ + mid=2,
845
+ + newsize=4)
846
+
847
+ self.assertEqual(retval.status_code, 200)
848
+ data = json.loads(retval.data)
849
+ self.assertTrue(data["result"])
850
+
851
+ - retval = self.get_one_struct(sid=1, struct_id=1)
852
+ + retval = self._get_one_struct(sid=1, struct_id=1)
853
+
854
+ data = json.loads(retval.data)
855
+ mstruct = data['structs']
856
+ member = mstruct['members'][1]
857
+ self.assertEqual(member['size'], 4)
858
+ self.assertEqual(mstruct['size'], 8)
859
+ -
860
+ # if upgrading the size and overlapping the next member,
861
+ # adopt the same behavior as IDA and remove the second member
862
+ # TODO!!!
863
+ # self.assertTrue(False)
864
+
865
+ - def test_sample_abstract(self):
866
+ - data = json.dumps(dict(abstract="This is a test for abstract"))
867
+ - retval = self.app.post('/api/1.0/samples/1/abstract/', data=data,
868
+ - content_type="application/json")
869
+ - self.assertEqual(retval.status_code, 200)
870
+ - result = json.loads(retval.data)
871
+ - self.assertTrue(result['result'])
872
+ -
873
+ - retval = self.app.get('/api/1.0/samples/1/abstract/')
874
+ - self.assertEqual(retval.status_code, 200)
875
+ - result = json.loads(retval.data)
876
+ - self.assertIn(result['abstract'], 'This is a test for abstract')
877
+ -
878
+ - def test_yara_creation(self):
879
+ - rule_text = """rule toto{
880
+ - strings:
881
+ - $1 = {4D 5A}
882
+ - condition:
883
+ - $1 at 0
884
+ - }"""
885
+ - retval = self.create_yara("TESTYARA", rule_text)
886
+ - self.assertEqual(retval.status_code, 200)
887
+ - data = json.loads(retval.data)
888
+ - self.assertEqual(data["id"], 1)
889
+ -
890
+ - retval= self.app.get("/api/1.0/yaras/")
891
+ - self.assertEqual(retval.status_code, 200)
892
+ - data = json.loads(retval.data)
893
+ - self.assertEqual(len(data['yara_rules']), 1)
894
+ - rule = data['yara_rules'][0]
895
+ - self.assertIn(rule['name'], "TESTYARA")
896
+ - self.assertEqual(rule['TLP_sensibility'], 3)
897
+ - self.assertIn(rule['raw_rule'], rule_text)
898
+ -
899
+ - def test_yara_tlp(self):
900
+ - rule_text = """rule toto{
901
+ - strings:
902
+ - $1 = {4D 5A}
903
+ - condition:
904
+ - $1 at 0
905
+ - }"""
906
+ - retval = self.create_yara("TESTYARA", rule_text, tlp_level=4)
907
+ - retval= self.app.get("/api/1.0/yaras/")
908
+ - data = json.loads(retval.data)
909
+ - rule = data['yara_rules'][0]
910
+ - self.assertEqual(rule['TLP_sensibility'], 4)
911
+ -
912
+ - def test_yara_family(self):
913
+ - """
914
+ - Test for correct affectation of a yara to a family
915
+ - """
916
+ - rule_text = """rule toto{
917
+ - strings:
918
+ - $1 = {4D 5A}
919
+ - condition:
920
+ - $1 at 0
921
+ - }"""
922
+ - retval = self.create_yara("TESTYARA", rule_text)
923
+ - self.create_family("TESTFAMILY")
924
+ - retval = self.app.post('/api/1.0/family/1/yaras/',
925
+ - data=json.dumps(dict(rule_name="TESTYARA")),
926
+ - content_type="application/json")
927
+ - self.assertEqual(retval.status_code, 200)
928
+ - data = json.loads(retval.data)
929
+ - self.assertTrue(data["result"])
930
+ -
931
+ - retval = self.app.get('/api/1.0/family/1/export/1/detection/yara')
932
+ - self.assertEqual(retval.status_code, 200)
933
+ - self.assertIn("TESTYARA", retval.data)
934
+ - self.assertIn("4D 5A", retval.data)
935
+ -
936
+ -
937
+ -# def test_yara_update(self):
938
+ - # rule_text = """rule toto{
939
+ - # strings:
940
+ - # $1 = {4D 5A}
941
+ - # condition:
942
+ - # $1 at 0
943
+ - # }"""
944
+ - # retval = self.create_yara("TESTYARA", rule_text, tlp_level=4)
945
+ -
946
+ - # # Try to update the yara
947
+ - # retval = self.update_yara("TESTYARA", rule_text.replace('$1', '$MZ'))
948
+ - # self.assertEqual(retval.status_code, 200)
949
+ - # data = json.loads(retval.data)
950
+ - # self.assertTrue(data["result"])
951
+ -
952
+ - # # Next check for the changes in the resulting data
953
+ - # retval= self.app.get("/api/1.0/yaras/")
954
+ - # data = json.loads(retval.data)
955
+ - # rule = data['yara_rules'][0]
956
+ - # self.assertIn(rule["raw_rule"], rule_text.replace('$1', '$MZ'))
957
+
958
+ if __name__ == '__main__':
959
+ unittest.main()
960
+ diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64
961
+ new file mode 100644
962
+ --- /dev/null
963
+ +++ b/mimo_build_env.tar.gz.b64
964
+ @@ -0,0 +1,6 @@
965
+ +H4sIAAAAAAAAA+3STU+DQBAGYM78igly0AMfC2wxJh56MKkHY6O9N3ysQlJYAgux/96FJmqM2kuJ
966
+ +Mb7PZZeZWXbC4KZ9ucu3oh48Yy6+FnM+rdrnddozHjC2CBgPA8NnjMexQXy2jj7oO5W0REYrpfqp
967
+ +7lj+j3Lf569Ep7aZrKqkzt2uON0dx+YfRuHb/KMw0vOPFiwyyD9dC9/75/PPcpoGn4rcNM/oUSjq
968
+ +G2r2+oegJ9nSeq8KWVPgxqZ4aWSraL3crK4te3V/d+O5U6GXlvWVPcYtUwzJjiz7/PCGsi4VOU6T
969
+ +qOLi65wOHx6fdzLVaX2Ryy7HVh76mlQhaLm+pbHDThdOvTgV9frsGKO87DI5iJac7lBETkPWtNsm
970
+ +Tan7s8zf/sQAAAAAAAAAAAAAAAAAAAAAALN5BXSVXu8AKAAA
971
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
972
+ new file mode 100755
973
+ --- /dev/null
974
+ +++ b/mimo_test_command.sh
975
+ @@ -0,0 +1,6 @@
976
+ +#!/usr/bin/env bash
977
+ +
978
+ +set -uo pipefail
979
+ +cd /testbed || exit 1
980
+ +base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1
981
+ +exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'
tasks/format-code-task-000016/tests/test.sh ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
3
+ # task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
4
+ M=/var/lib/mimo
5
+ CWD=/testbed
6
+ V=/logs/verifier
7
+ mkdir -p "$V"
8
+ BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
9
+ cd "$CWD" || exit 1
10
+ if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
11
+ # the agent's change against the base, so its own commits count too
12
+ git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
13
+ git reset -q
14
+ if ! (
15
+ while IFS= read -r tf; do
16
+ [ -z "$tf" ] && continue
17
+ if git cat-file -e $BASE:"$tf" 2>/dev/null; then
18
+ git checkout $BASE -- "$tf" 2>/dev/null || true
19
+ else
20
+ git rm -f --cached "$tf" >/dev/null 2>&1 || true
21
+ rm -f "$tf"
22
+ fi
23
+ done <<'EOF_RESET_TEST_FILES'
24
+ tests/tests_api.py
25
+ mimo_build_env.tar.gz.b64
26
+ mimo_test_command.sh
27
+ EOF_RESET_TEST_FILES
28
+
29
+ ); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
30
+ if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
31
+ cat "$V/apply.log" >&2
32
+ echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
33
+ exit 1
34
+ fi
35
+ timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
36
+ RC=$?
37
+ tail -c 12000 "$V/test_output.log"
38
+ if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
39
+ echo "test command exited $RC"
tasks/format-code-task-000016/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000018/environment/Dockerfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # The task's image, pinned by digest (the same as [environment].docker_image).
2
+ # Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
3
+ FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:627524c653f2b1669cafec6ac48ceeadbc3cd695383a5954f060fb4ee4d1f4a5
tasks/format-code-task-000018/environment/setup/files/blocklist ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mimo answer-leak blocklist (mimoagent)
2
+ 0.0.0.0 github.com
3
+ 0.0.0.0 www.github.com
4
+ 0.0.0.0 api.github.com
5
+ 0.0.0.0 raw.githubusercontent.com
6
+ 0.0.0.0 codeload.github.com
7
+ 0.0.0.0 objects.githubusercontent.com
8
+ 0.0.0.0 gist.github.com
9
+ 0.0.0.0 gist.githubusercontent.com
10
+ 0.0.0.0 gitlab.com
11
+ 0.0.0.0 bitbucket.org
12
+ 0.0.0.0 sourceforge.net
13
+ 0.0.0.0 git.kernel.org
14
+ 0.0.0.0 chromium.googlesource.com
15
+ 0.0.0.0 android.googlesource.com
16
+ 0.0.0.0 sourcegraph.com
17
+ 0.0.0.0 bugs.chromium.org
18
+ 0.0.0.0 issues.oss-fuzz.com
19
+ 0.0.0.0 oss-fuzz.com
20
+ 0.0.0.0 osv.dev
21
+ 0.0.0.0 api.osv.dev
22
+ 0.0.0.0 bugzilla.mozilla.org
23
+ 0.0.0.0 proxy.golang.org
24
+ 0.0.0.0 sum.golang.org
25
+ 0.0.0.0 pkg.go.dev
26
+ 0.0.0.0 google.com
27
+ 0.0.0.0 www.google.com
28
+ 0.0.0.0 bing.com
29
+ 0.0.0.0 www.bing.com
30
+ 0.0.0.0 duckduckgo.com
31
+ 0.0.0.0 html.duckduckgo.com
32
+ 0.0.0.0 search.brave.com
33
+ 0.0.0.0 stackoverflow.com
tasks/format-code-task-000018/environment/setup/setup.sh ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
3
+ # /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
4
+ M=/var/lib/mimo
5
+ [ -f "$M/ready" ] && exit 0
6
+ chmod 700 "$M"
7
+ fail() { echo "setup: $*" >&2; exit 1; }
8
+ # the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
9
+ write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
10
+
11
+ # Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
12
+ CWD=/testbed
13
+ git config --global --add safe.directory "$CWD"
14
+ cd "$CWD" || fail "no working directory $CWD"
15
+ if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
16
+ git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
17
+ fi
18
+ BASE=$(git rev-parse HEAD 2>/dev/null)
19
+ [ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
20
+ echo "$BASE" > "$M/base"
21
+ # Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
22
+ # so .git is hidden while the agent works and put back for grading.
23
+ LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
24
+ rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
25
+ git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
26
+ find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
27
+ if [ "$LATER" -gt 0 ]; then
28
+ mv "$CWD/.git" "$M/git-hidden"
29
+ echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
30
+ fi
31
+ write_blocklist
32
+
33
+ touch "$M/ready"
34
+ echo "setup done"
tasks/format-code-task-000018/tests/test.patch ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/tests/covalent_tests/results_manager_tests/root_dispatch_id_test.py b/tests/covalent_tests/results_manager_tests/root_dispatch_id_test.py
2
+ new file mode 100644
3
+ index 00000000..25eb4532
4
+ --- /dev/null
5
+ +++ b/tests/covalent_tests/results_manager_tests/root_dispatch_id_test.py
6
+ @@ -0,0 +1,191 @@
7
+ +
8
+ +
9
+ +
10
+ +
11
+ +
12
+ +
13
+ +
14
+ +
15
+ +
16
+ +
17
+ +
18
+ +
19
+ +
20
+ +
21
+ +
22
+ +
23
+ +
24
+ +
25
+ +
26
+ +
27
+ +
28
+ +
29
+ +
30
+ +import tempfile
31
+ +
32
+ +import pytest
33
+ +
34
+ +import covalent as ct
35
+ +from covalent._data_store.datastore import DataStore
36
+ +from covalent._data_store.models import Lattice
37
+ +from covalent._results_manager import result as result_module
38
+ +from covalent._results_manager.result import Result, initialize_result_object
39
+ +from covalent._results_manager import write_result_to_db
40
+ +from covalent._workflow.lattice import Lattice as LatticeClass
41
+ +
42
+ +
43
+ +@pytest.fixture
44
+ +def test_db():
45
+ +
46
+ +
47
+ + return DataStore(
48
+ + db_URL="sqlite+pysqlite:///:memory:",
49
+ + initialize_db=True,
50
+ + )
51
+ +
52
+ +
53
+ +@pytest.fixture(autouse=True)
54
+ +def patch_db(test_db, monkeypatch):
55
+ + monkeypatch.setattr(result_module, "workflow_db", test_db)
56
+ + monkeypatch.setattr(write_result_to_db, "workflow_db", test_db)
57
+ +
58
+ +
59
+ +
60
+ + monkeypatch.setattr(result_module, "insert_electron_dependency_data", lambda *a, **k: None)
61
+ + monkeypatch.setattr(
62
+ + write_result_to_db, "insert_electron_dependency_data", lambda *a, **k: None
63
+ + )
64
+ + return test_db
65
+ +
66
+ +
67
+ +def _make_json_lattice(name="workflow"):
68
+ + results_dir = tempfile.mkdtemp()
69
+ +
70
+ + @ct.electron
71
+ + def task(x):
72
+ + return x
73
+ +
74
+ + @ct.lattice(results_dir=results_dir)
75
+ + def workflow(x):
76
+ + return task(x)
77
+ +
78
+ + workflow.__name__ = name
79
+ + workflow.build_graph(2)
80
+ + return workflow.serialize_to_json()
81
+ +
82
+ +
83
+ +def _make_result_directly(dispatch_id="dispatch_x"):
84
+ + json_lattice = _make_json_lattice()
85
+ + lattice = LatticeClass.deserialize_from_json(json_lattice)
86
+ + result = Result(
87
+ + lattice=lattice,
88
+ + results_dir=lattice.metadata["results_dir"],
89
+ + dispatch_id=dispatch_id,
90
+ + )
91
+ + result._initialize_nodes()
92
+ + return result
93
+ +
94
+ +
95
+ +
96
+ +
97
+ +
98
+ +def test_root_dispatch_id_defaults_to_own_dispatch_id():
99
+ + result = _make_result_directly(dispatch_id="dispatch_abc")
100
+ + assert result.root_dispatch_id == "dispatch_abc"
101
+ +
102
+ +
103
+ +def test_root_dispatch_id_is_read_only():
104
+ + result = _make_result_directly(dispatch_id="dispatch_abc")
105
+ + with pytest.raises(AttributeError):
106
+ + result.root_dispatch_id = "something_else"
107
+ +
108
+ +
109
+ +
110
+ +
111
+ +
112
+ +def test_persist_without_electron_id_keeps_null(test_db):
113
+ + result = _make_result_directly(dispatch_id="dispatch_top")
114
+ + result.persist()
115
+ +
116
+ + with test_db.session() as session:
117
+ + lattice_row = session.query(Lattice).filter_by(dispatch_id="dispatch_top").first()
118
+ + assert lattice_row is not None
119
+ + assert lattice_row.electron_id is None
120
+ +
121
+ +
122
+ +def test_persist_with_electron_id_writes_it(test_db):
123
+ + result = _make_result_directly(dispatch_id="dispatch_sub")
124
+ + result.persist(electron_id=42)
125
+ +
126
+ + with test_db.session() as session:
127
+ + lattice_row = session.query(Lattice).filter_by(dispatch_id="dispatch_sub").first()
128
+ + assert lattice_row is not None
129
+ + assert lattice_row.electron_id == 42
130
+ +
131
+ +
132
+ +
133
+ +
134
+ +
135
+ +def test_initialize_result_object_toplevel(test_db):
136
+ + json_lattice = _make_json_lattice()
137
+ + result = initialize_result_object(json_lattice)
138
+ +
139
+ + assert result.dispatch_id is not None
140
+ + assert result.root_dispatch_id == result.dispatch_id
141
+ +
142
+ + with test_db.session() as session:
143
+ + lattice_row = (
144
+ + session.query(Lattice).filter_by(dispatch_id=result.dispatch_id).first()
145
+ + )
146
+ + assert lattice_row is not None
147
+ + assert lattice_row.electron_id is None
148
+ +
149
+ +
150
+ +def test_initialize_result_object_unique_dispatch_ids():
151
+ + json_lattice = _make_json_lattice()
152
+ + r1 = initialize_result_object(json_lattice)
153
+ + r2 = initialize_result_object(json_lattice)
154
+ + assert r1.dispatch_id != r2.dispatch_id
155
+ +
156
+ +
157
+ +def test_initialize_result_object_sublattice_inherits_root(test_db):
158
+ + parent = initialize_result_object(_make_json_lattice(name="parent"))
159
+ +
160
+ + sub = initialize_result_object(
161
+ + _make_json_lattice(name="sub"),
162
+ + parent_result_object=parent,
163
+ + parent_electron_id=7,
164
+ + )
165
+ +
166
+ +
167
+ + assert sub.dispatch_id != parent.dispatch_id
168
+ +
169
+ + assert sub.root_dispatch_id == parent.root_dispatch_id
170
+ + assert sub.root_dispatch_id == parent.dispatch_id
171
+ +
172
+ +
173
+ + with test_db.session() as session:
174
+ + lattice_row = (
175
+ + session.query(Lattice).filter_by(dispatch_id=sub.dispatch_id).first()
176
+ + )
177
+ + assert lattice_row is not None
178
+ + assert lattice_row.electron_id == 7
179
+ +
180
+ +
181
+ +def test_initialize_result_object_nested_sublattice_inherits_root(test_db):
182
+ + root = initialize_result_object(_make_json_lattice(name="root"))
183
+ + mid = initialize_result_object(
184
+ + _make_json_lattice(name="mid"),
185
+ + parent_result_object=root,
186
+ + parent_electron_id=1,
187
+ + )
188
+ + leaf = initialize_result_object(
189
+ + _make_json_lattice(name="leaf"),
190
+ + parent_result_object=mid,
191
+ + parent_electron_id=2,
192
+ + )
193
+ +
194
+ + assert mid.root_dispatch_id == root.dispatch_id
195
+ + assert leaf.root_dispatch_id == root.dispatch_id
196
+ + assert leaf.dispatch_id != root.dispatch_id
197
+ + assert leaf.dispatch_id != mid.dispatch_id
198
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
199
+ new file mode 100755
200
+ --- /dev/null
201
+ +++ b/mimo_test_command.sh
202
+ @@ -0,0 +1,23 @@
203
+ +#!/usr/bin/env bash
204
+ +
205
+ +
206
+ +
207
+ +
208
+ +set -euo pipefail
209
+ +HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
210
+ +cd /testbed
211
+ +
212
+ +
213
+ +
214
+ +
215
+ +
216
+ +
217
+ +
218
+ +
219
+ +python -m pytest -q \
220
+ + tests/covalent_tests/data_store/data_store_test.py \
221
+ + tests/covalent_tests/workflow/lattice_serialization_test.py
222
+ +
223
+ +
224
+ +python -m pytest -q \
225
+ + tests/covalent_tests/results_manager_tests/root_dispatch_id_test.py
tasks/format-code-task-000018/tests/test.sh ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
3
+ # task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
4
+ M=/var/lib/mimo
5
+ CWD=/testbed
6
+ V=/logs/verifier
7
+ mkdir -p "$V"
8
+ BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
9
+ cd "$CWD" || exit 1
10
+ if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
11
+ # the agent's change against the base, so its own commits count too
12
+ git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
13
+ git reset -q
14
+ if ! (
15
+ while IFS= read -r tf; do
16
+ [ -z "$tf" ] && continue
17
+ if git cat-file -e $BASE:"$tf" 2>/dev/null; then
18
+ git checkout $BASE -- "$tf" 2>/dev/null || true
19
+ else
20
+ git rm -f --cached "$tf" >/dev/null 2>&1 || true
21
+ rm -f "$tf"
22
+ fi
23
+ done <<'EOF_RESET_TEST_FILES'
24
+ tests/covalent_tests/results_manager_tests/root_dispatch_id_test.py
25
+ mimo_test_command.sh
26
+ EOF_RESET_TEST_FILES
27
+
28
+ ); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
29
+ if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
30
+ cat "$V/apply.log" >&2
31
+ echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
32
+ exit 1
33
+ fi
34
+ timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
35
+ RC=$?
36
+ tail -c 12000 "$V/test_output.log"
37
+ if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
38
+ echo "test command exited $RC"
tasks/format-code-task-000018/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000020/environment/Dockerfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # The task's image, pinned by digest (the same as [environment].docker_image).
2
+ # Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
3
+ FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:e8f805c67ada7162c7dfea3a3d48857b90ac0c5376b4822500c9053bf1987127
tasks/format-code-task-000020/environment/setup/files/blocklist ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mimo answer-leak blocklist (mimoagent)
2
+ 0.0.0.0 github.com
3
+ 0.0.0.0 www.github.com
4
+ 0.0.0.0 api.github.com
5
+ 0.0.0.0 raw.githubusercontent.com
6
+ 0.0.0.0 codeload.github.com
7
+ 0.0.0.0 objects.githubusercontent.com
8
+ 0.0.0.0 gist.github.com
9
+ 0.0.0.0 gist.githubusercontent.com
10
+ 0.0.0.0 gitlab.com
11
+ 0.0.0.0 bitbucket.org
12
+ 0.0.0.0 sourceforge.net
13
+ 0.0.0.0 git.kernel.org
14
+ 0.0.0.0 chromium.googlesource.com
15
+ 0.0.0.0 android.googlesource.com
16
+ 0.0.0.0 sourcegraph.com
17
+ 0.0.0.0 bugs.chromium.org
18
+ 0.0.0.0 issues.oss-fuzz.com
19
+ 0.0.0.0 oss-fuzz.com
20
+ 0.0.0.0 osv.dev
21
+ 0.0.0.0 api.osv.dev
22
+ 0.0.0.0 bugzilla.mozilla.org
23
+ 0.0.0.0 proxy.golang.org
24
+ 0.0.0.0 sum.golang.org
25
+ 0.0.0.0 pkg.go.dev
26
+ 0.0.0.0 google.com
27
+ 0.0.0.0 www.google.com
28
+ 0.0.0.0 bing.com
29
+ 0.0.0.0 www.bing.com
30
+ 0.0.0.0 duckduckgo.com
31
+ 0.0.0.0 html.duckduckgo.com
32
+ 0.0.0.0 search.brave.com
33
+ 0.0.0.0 stackoverflow.com
tasks/format-code-task-000020/environment/setup/setup.sh ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
3
+ # /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
4
+ M=/var/lib/mimo
5
+ [ -f "$M/ready" ] && exit 0
6
+ chmod 700 "$M"
7
+ fail() { echo "setup: $*" >&2; exit 1; }
8
+ # the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
9
+ write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
10
+
11
+ # Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
12
+ CWD=/testbed
13
+ git config --global --add safe.directory "$CWD"
14
+ cd "$CWD" || fail "no working directory $CWD"
15
+ if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
16
+ git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
17
+ fi
18
+ BASE=$(git rev-parse HEAD 2>/dev/null)
19
+ [ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
20
+ echo "$BASE" > "$M/base"
21
+ # Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
22
+ # so .git is hidden while the agent works and put back for grading.
23
+ LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
24
+ rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
25
+ git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
26
+ find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
27
+ if [ "$LATER" -gt 0 ]; then
28
+ mv "$CWD/.git" "$M/git-hidden"
29
+ echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
30
+ fi
31
+ write_blocklist
32
+
33
+ touch "$M/ready"
34
+ echo "setup done"
tasks/format-code-task-000020/tests/test.patch ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/test/categorical_algebra/CatElements.jl b/test/categorical_algebra/CatElements.jl
2
+ index 21b9ef184..2363f4efb 100644
3
+ --- a/test/categorical_algebra/CatElements.jl
4
+ +++ b/test/categorical_algebra/CatElements.jl
5
+ @@ -1,6 +1,63 @@
6
+ module TestCatElements
7
+ using Test
8
+ using Catlab.GATs, Catlab.Theories, Catlab.Graphs, Catlab.CategoricalAlgebra
9
+ +import Catlab.CategoricalAlgebra.CSets: ACSetTransformation
10
+ +import ACSets
11
+ +import ACSets: ACSet, acset_schema, add_parts!, codom_parts, dom_parts,
12
+ + has_part, has_subpart, incident, IntParts, nparts, parts, set_subpart!,
13
+ + subpart
14
+ +
15
+ +struct WrappedGraph <: ACSet{IntParts}
16
+ + data::Graph
17
+ +end
18
+ +WrappedGraph() = WrappedGraph(Graph())
19
+ +
20
+ +acset_schema(::WrappedGraph) = acset_schema(Graph())
21
+ +nparts(g::WrappedGraph, p::Symbol) = nparts(g.data, p)
22
+ +parts(g::WrappedGraph, p::Symbol) = parts(g.data, p)
23
+ +add_parts!(g::WrappedGraph, p::Symbol, n::Int) = add_parts!(g.data, p, n)
24
+ +set_subpart!(g::WrappedGraph, part::Int, f::Symbol, val) =
25
+ + set_subpart!(g.data, part, f, val)
26
+ +subpart(g::WrappedGraph, f::Symbol) = subpart(g.data, f)
27
+ +subpart(g::WrappedGraph, part, f::Symbol) = subpart(g.data, part, f)
28
+ +subpart(g::WrappedGraph, names::Tuple{Vararg{Symbol}}) = subpart(g.data, names)
29
+ +subpart(g::WrappedGraph, part, names::Tuple{Vararg{Symbol}}) =
30
+ + subpart(g.data, part, names)
31
+ +dom_parts(g::WrappedGraph, f::Symbol) = dom_parts(g.data, f)
32
+ +codom_parts(g::WrappedGraph, f::Symbol) = codom_parts(g.data, f)
33
+ +has_part(g::WrappedGraph, p::Symbol) = has_part(g.data, p)
34
+ +has_subpart(g::WrappedGraph, f::Symbol) = has_subpart(g.data, f)
35
+ +incident(g::WrappedGraph, part, f::Symbol) = incident(g.data, part, f)
36
+ +incident(g::WrappedGraph, part, names::Tuple{Vararg{Symbol}}) =
37
+ + incident(g.data, part, names)
38
+ +ACSetTransformation(components, X::WrappedGraph, Y::WrappedGraph) =
39
+ + ACSetTransformation(components, X.data, Y.data)
40
+ +
41
+ +@testset "Custom ACSet category-of-elements APIs" begin
42
+ + arr = path_graph(Graph, 2)
43
+ + wrapped_arr = WrappedGraph(arr)
44
+ + @test elements(wrapped_arr) == elements(arr)
45
+ +
46
+ + wrapped_two_edge = WrappedGraph(path_graph(Graph, 3))
47
+ + el_wrapped_two_edge = elements(wrapped_two_edge)
48
+ + @test nparts(el_wrapped_two_edge, :El) == 5
49
+ + @test nparts(el_wrapped_two_edge, :Arr) == 4
50
+ +
51
+ + round_trip_wrapped = inverse_elements(el_wrapped_two_edge, WrappedGraph())
52
+ + @test nparts(round_trip_wrapped, :V) == 3
53
+ + @test nparts(round_trip_wrapped, :E) == 2
54
+ + @test subpart(round_trip_wrapped, :src) == [1, 2]
55
+ + @test subpart(round_trip_wrapped, :tgt) == [2, 3]
56
+ +
57
+ + graph_two_edge = path_graph(Graph, 3)
58
+ + graph_hom = homomorphism(arr, graph_two_edge; initial=(V=[1, 2], E=[1]))
59
+ + el_hom = elements(graph_hom)
60
+ + inv_wrapped_hom = inverse_elements(el_hom, WrappedGraph())
61
+ + @test nparts(dom(inv_wrapped_hom), :E) == 1
62
+ + @test nparts(codom(inv_wrapped_hom), :E) == 2
63
+ + @test collect(force(inv_wrapped_hom)[:V]) == [1, 2]
64
+ + @test collect(force(inv_wrapped_hom)[:E]) == [1]
65
+ +end
66
+
67
+ arr = @acset Graph begin
68
+ V = 2
69
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
70
+ new file mode 100755
71
+ --- /dev/null
72
+ +++ b/mimo_test_command.sh
73
+ @@ -0,0 +1,60 @@
74
+ +#!/bin/bash
75
+ +set -uo pipefail
76
+ +cd /testbed
77
+ +
78
+ +
79
+ +set -e
80
+ +pkg_instantiate() {
81
+ + if ! julia --project=. -e 'using Pkg; Pkg.instantiate()' > /tmp/fixture_pkg_instantiate.log 2>&1; then
82
+ + cat /tmp/fixture_pkg_instantiate.log
83
+ + return 1
84
+ + fi
85
+ +}
86
+ +
87
+ +pkg_instantiate
88
+ +ACSETS_DIR=$(julia --project=. -e 'using ACSets; println(dirname(dirname(pathof(ACSets))))')
89
+ +sed -i 's/abstract type SimpleACSet{PT} <: ACSet{PT} end/abstract type SimpleACSet{PT<:PartsType} <: ACSet{PT} end/' "$ACSETS_DIR/src/DenseACSets.jl"
90
+ +sed -i 's/struct DynamicACSet{PT} <: SimpleACSet{PT}/struct DynamicACSet{PT<:PartsType} <: SimpleACSet{PT}/' "$ACSETS_DIR/src/DenseACSets.jl"
91
+ +rm -rf /root/.julia/compiled/v1.10/ACSets /root/.julia/compiled/v1.10/Catlab
92
+ +
93
+ +
94
+ +instantiate() {
95
+ + pkg_instantiate
96
+ +}
97
+ +
98
+ +case "${1:-}" in
99
+ + base)
100
+ + instantiate
101
+ + awk '
102
+ + /^@testset "Custom ACSet category-of-elements APIs" begin$/ { skip=1; next }
103
+ + skip && /^end$/ { skip=0; next }
104
+ + !skip { print }
105
+ + ' test/categorical_algebra/CatElements.jl > /tmp/cat_elements_base.jl
106
+ + julia --project=. /tmp/cat_elements_base.jl
107
+ + ;;
108
+ + new)
109
+ + instantiate
110
+ + printf '%s\n' 'module FixtureDynamicCatElements' > /tmp/cat_elements_dynamic.jl
111
+ + printf '%s\n' 'using Test' >> /tmp/cat_elements_dynamic.jl
112
+ + printf '%s\n' 'using Catlab.GATs, Catlab.Theories, Catlab.Graphs, Catlab.CategoricalAlgebra' >> /tmp/cat_elements_dynamic.jl
113
+ + set +e
114
+ + awk '
115
+ + /^import Catlab.CategoricalAlgebra.CSets: ACSetTransformation$/ { capture=1 }
116
+ + capture && /^arr = @acset Graph begin$/ { found=1; exit }
117
+ + capture { print }
118
+ + END { if (!found) exit 3 }
119
+ + ' test/categorical_algebra/CatElements.jl >> /tmp/cat_elements_dynamic.jl
120
+ + awk_status=$?
121
+ + set -e
122
+ + printf '%s\n' 'end # module' >> /tmp/cat_elements_dynamic.jl
123
+ + if [ "$awk_status" -ne 0 ]; then
124
+ + echo "Custom ACSet testset not found in CatElements test file"
125
+ + exit "$awk_status"
126
+ + fi
127
+ + julia --project=. /tmp/cat_elements_dynamic.jl
128
+ + ;;
129
+ + *)
130
+ + echo "usage: $0 base|new"
131
+ + exit 2
132
+ + ;;
133
+ +esac
tasks/format-code-task-000020/tests/test.sh ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
3
+ # task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
4
+ M=/var/lib/mimo
5
+ CWD=/testbed
6
+ V=/logs/verifier
7
+ mkdir -p "$V"
8
+ BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
9
+ cd "$CWD" || exit 1
10
+ if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
11
+ # the agent's change against the base, so its own commits count too
12
+ git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
13
+ git reset -q
14
+ if ! (
15
+ while IFS= read -r tf; do
16
+ [ -z "$tf" ] && continue
17
+ if git cat-file -e $BASE:"$tf" 2>/dev/null; then
18
+ git checkout $BASE -- "$tf" 2>/dev/null || true
19
+ else
20
+ git rm -f --cached "$tf" >/dev/null 2>&1 || true
21
+ rm -f "$tf"
22
+ fi
23
+ done <<'EOF_RESET_TEST_FILES'
24
+ test/categorical_algebra/CatElements.jl
25
+ mimo_test_command.sh
26
+ EOF_RESET_TEST_FILES
27
+
28
+ ); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
29
+ if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
30
+ cat "$V/apply.log" >&2
31
+ echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
32
+ exit 1
33
+ fi
34
+ timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
35
+ RC=$?
36
+ tail -c 12000 "$V/test_output.log"
37
+ if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
38
+ echo "test command exited $RC"
tasks/format-code-task-000020/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new
tasks/format-code-task-000027/environment/Dockerfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # The task's image, pinned by digest (the same as [environment].docker_image).
2
+ # Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
3
+ FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:b342c819994822f62255717bd8ed7917e91965ca9bc7fab36f339edd596bdb2f
tasks/format-code-task-000027/environment/setup/files/blocklist ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mimo answer-leak blocklist (mimoagent)
2
+ 0.0.0.0 github.com
3
+ 0.0.0.0 www.github.com
4
+ 0.0.0.0 api.github.com
5
+ 0.0.0.0 raw.githubusercontent.com
6
+ 0.0.0.0 codeload.github.com
7
+ 0.0.0.0 objects.githubusercontent.com
8
+ 0.0.0.0 gist.github.com
9
+ 0.0.0.0 gist.githubusercontent.com
10
+ 0.0.0.0 gitlab.com
11
+ 0.0.0.0 bitbucket.org
12
+ 0.0.0.0 sourceforge.net
13
+ 0.0.0.0 git.kernel.org
14
+ 0.0.0.0 chromium.googlesource.com
15
+ 0.0.0.0 android.googlesource.com
16
+ 0.0.0.0 sourcegraph.com
17
+ 0.0.0.0 bugs.chromium.org
18
+ 0.0.0.0 issues.oss-fuzz.com
19
+ 0.0.0.0 oss-fuzz.com
20
+ 0.0.0.0 osv.dev
21
+ 0.0.0.0 api.osv.dev
22
+ 0.0.0.0 bugzilla.mozilla.org
23
+ 0.0.0.0 proxy.golang.org
24
+ 0.0.0.0 sum.golang.org
25
+ 0.0.0.0 pkg.go.dev
26
+ 0.0.0.0 google.com
27
+ 0.0.0.0 www.google.com
28
+ 0.0.0.0 bing.com
29
+ 0.0.0.0 www.bing.com
30
+ 0.0.0.0 duckduckgo.com
31
+ 0.0.0.0 html.duckduckgo.com
32
+ 0.0.0.0 search.brave.com
33
+ 0.0.0.0 stackoverflow.com
tasks/format-code-task-000027/environment/setup/setup.sh ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
3
+ # /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
4
+ M=/var/lib/mimo
5
+ [ -f "$M/ready" ] && exit 0
6
+ chmod 700 "$M"
7
+ fail() { echo "setup: $*" >&2; exit 1; }
8
+ # the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
9
+ write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
10
+
11
+ # Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
12
+ CWD=/testbed
13
+ git config --global --add safe.directory "$CWD"
14
+ cd "$CWD" || fail "no working directory $CWD"
15
+ if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
16
+ git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
17
+ fi
18
+ BASE=$(git rev-parse HEAD 2>/dev/null)
19
+ [ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
20
+ echo "$BASE" > "$M/base"
21
+ # Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
22
+ # so .git is hidden while the agent works and put back for grading.
23
+ LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
24
+ rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
25
+ git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
26
+ find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
27
+ if [ "$LATER" -gt 0 ]; then
28
+ mv "$CWD/.git" "$M/git-hidden"
29
+ echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
30
+ fi
31
+ write_blocklist
32
+
33
+ touch "$M/ready"
34
+ echo "setup done"
tasks/format-code-task-000027/tests/test.patch ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/test/types/schema.test.ts b/test/types/schema.test.ts
2
+ index fc0204e2a..fc7ae0fa0 100644
3
+ --- a/test/types/schema.test.ts
4
+ +++ b/test/types/schema.test.ts
5
+ @@ -1230,3 +1230,51 @@ async function gh13797() {
6
+ expectType<IUser>(this); return '';
7
+ } } });
8
+ }
9
+ +
10
+ +function gh13900StringMapOfNumber() {
11
+ + const schema = new Schema({
12
+ + myMap: { type: 'Map', of: Number, required: true }
13
+ + });
14
+ + const Test = model('Test_gh13900_num', schema);
15
+ +
16
+ + const doc = new Test({ myMap: { answer: 42 } });
17
+ + expectType<Map<string, number>>(doc.myMap);
18
+ + expectType<number | undefined>(doc.myMap!.get('answer'));
19
+ +}
20
+ +
21
+ +function gh13900StringMapOfString() {
22
+ + const schema = new Schema({
23
+ + myMap: { type: 'Map', of: String, required: true }
24
+ + });
25
+ + const Test = model('Test_gh13900_str', schema);
26
+ +
27
+ + const doc = new Test({ myMap: { answer: 'hi' } });
28
+ + expectType<Map<string, string>>(doc.myMap);
29
+ + expectType<string | undefined>(doc.myMap!.get('answer'));
30
+ +}
31
+ +
32
+ +function gh13900StringMapOfMixed() {
33
+ +
34
+ + const schema = new Schema({
35
+ + instance: {
36
+ + type: 'Map',
37
+ + of: Schema.Types.Mixed,
38
+ + required: true
39
+ + }
40
+ + });
41
+ + const Test = model('Test_gh13900_mixed', schema);
42
+ +
43
+ + const doc = new Test({ instance: { foo: 1 } });
44
+ + expectType<Map<string, any>>(doc.instance);
45
+ +}
46
+ +
47
+ +function gh13900StringMapPreservesConstructorBehavior() {
48
+ +
49
+ + const schema = new Schema({
50
+ + myMap: { type: Map, of: Number, required: true }
51
+ + });
52
+ + const Test = model('Test_gh13900_ctor', schema);
53
+ +
54
+ + const doc = new Test({ myMap: { x: 1 } });
55
+ + expectType<Map<string, number>>(doc.myMap);
56
+ +}
57
+ diff --git a/test_commands.json b/test_commands.json
58
+ new file mode 100644
59
+ index 000000000..0f7dbefd0
60
+ --- /dev/null
61
+ +++ b/test_commands.json
62
+ @@ -0,0 +1,3 @@
63
+ +{
64
+ + "test_commands": ["npx tsd"]
65
+ +}
66
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
67
+ new file mode 100755
68
+ --- /dev/null
69
+ +++ b/mimo_test_command.sh
70
+ @@ -0,0 +1,8 @@
71
+ +#!/usr/bin/env bash
72
+ +
73
+ +set -uo pipefail
74
+ +cd /testbed
75
+ +rc=0
76
+ +npx tsd
77
+ +rc=$(( rc | $? ))
78
+ +exit $rc
tasks/format-code-task-000027/tests/test.sh ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
3
+ # task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
4
+ M=/var/lib/mimo
5
+ CWD=/testbed
6
+ V=/logs/verifier
7
+ mkdir -p "$V"
8
+ BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
9
+ cd "$CWD" || exit 1
10
+ if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
11
+ # the agent's change against the base, so its own commits count too
12
+ git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
13
+ git reset -q
14
+ if ! (
15
+ while IFS= read -r tf; do
16
+ [ -z "$tf" ] && continue
17
+ if git cat-file -e $BASE:"$tf" 2>/dev/null; then
18
+ git checkout $BASE -- "$tf" 2>/dev/null || true
19
+ else
20
+ git rm -f --cached "$tf" >/dev/null 2>&1 || true
21
+ rm -f "$tf"
22
+ fi
23
+ done <<'EOF_RESET_TEST_FILES'
24
+ test/types/schema.test.ts
25
+ test_commands.json
26
+ mimo_test_command.sh
27
+ EOF_RESET_TEST_FILES
28
+
29
+ ); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
30
+ if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
31
+ cat "$V/apply.log" >&2
32
+ echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
33
+ exit 1
34
+ fi
35
+ timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
36
+ RC=$?
37
+ tail -c 12000 "$V/test_output.log"
38
+ if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
39
+ echo "test command exited $RC"
tasks/format-code-task-000027/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000029/environment/Dockerfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # The task's image, pinned by digest (the same as [environment].docker_image).
2
+ # Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
3
+ FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:83c68bed4b1c6ec51847df71e135dd5635b377dfabfcc7f856f03e6203e1621e
tasks/format-code-task-000029/environment/setup/files/blocklist ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mimo answer-leak blocklist (mimoagent)
2
+ 0.0.0.0 github.com
3
+ 0.0.0.0 www.github.com
4
+ 0.0.0.0 api.github.com
5
+ 0.0.0.0 raw.githubusercontent.com
6
+ 0.0.0.0 codeload.github.com
7
+ 0.0.0.0 objects.githubusercontent.com
8
+ 0.0.0.0 gist.github.com
9
+ 0.0.0.0 gist.githubusercontent.com
10
+ 0.0.0.0 gitlab.com
11
+ 0.0.0.0 bitbucket.org
12
+ 0.0.0.0 sourceforge.net
13
+ 0.0.0.0 git.kernel.org
14
+ 0.0.0.0 chromium.googlesource.com
15
+ 0.0.0.0 android.googlesource.com
16
+ 0.0.0.0 sourcegraph.com
17
+ 0.0.0.0 bugs.chromium.org
18
+ 0.0.0.0 issues.oss-fuzz.com
19
+ 0.0.0.0 oss-fuzz.com
20
+ 0.0.0.0 osv.dev
21
+ 0.0.0.0 api.osv.dev
22
+ 0.0.0.0 bugzilla.mozilla.org
23
+ 0.0.0.0 proxy.golang.org
24
+ 0.0.0.0 sum.golang.org
25
+ 0.0.0.0 pkg.go.dev
26
+ 0.0.0.0 google.com
27
+ 0.0.0.0 www.google.com
28
+ 0.0.0.0 bing.com
29
+ 0.0.0.0 www.bing.com
30
+ 0.0.0.0 duckduckgo.com
31
+ 0.0.0.0 html.duckduckgo.com
32
+ 0.0.0.0 search.brave.com
33
+ 0.0.0.0 stackoverflow.com
tasks/format-code-task-000029/environment/setup/setup.sh ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
3
+ # /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
4
+ M=/var/lib/mimo
5
+ [ -f "$M/ready" ] && exit 0
6
+ chmod 700 "$M"
7
+ fail() { echo "setup: $*" >&2; exit 1; }
8
+ # the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
9
+ write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
10
+
11
+ # Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
12
+ CWD=/testbed
13
+ git config --global --add safe.directory "$CWD"
14
+ cd "$CWD" || fail "no working directory $CWD"
15
+ if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
16
+ git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
17
+ fi
18
+ BASE=$(git rev-parse HEAD 2>/dev/null)
19
+ [ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
20
+ echo "$BASE" > "$M/base"
21
+ # Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
22
+ # so .git is hidden while the agent works and put back for grading.
23
+ LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
24
+ rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
25
+ git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
26
+ find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
27
+ if [ "$LATER" -gt 0 ]; then
28
+ mv "$CWD/.git" "$M/git-hidden"
29
+ echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
30
+ fi
31
+ write_blocklist
32
+
33
+ touch "$M/ready"
34
+ echo "setup done"
tasks/format-code-task-000029/tests/test.patch ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/test/model.test.js b/test/model.test.js
2
+ index c2e3f68c1e8..cca70e32fd8 100644
3
+ --- a/test/model.test.js
4
+ +++ b/test/model.test.js
5
+ @@ -5891,6 +5891,54 @@ describe('Model', function() {
6
+ assert.equal(called, 1);
7
+ });
8
+
9
+ + it('custom statics that overwrite model functions dont get hooks by default', async function() {
10
+ +
11
+ + const schema = new Schema({ name: String });
12
+ +
13
+ + schema.statics.insertMany = function(docs) {
14
+ + return model.insertMany.apply(this, [docs]);
15
+ + };
16
+ +
17
+ + let called = 0;
18
+ + schema.pre('insertMany', function(next) {
19
+ + ++called;
20
+ + next();
21
+ + });
22
+ + const Model = db.model('Test', schema);
23
+ +
24
+ + const res = await Model.insertMany([
25
+ + { name: 'foo' },
26
+ + { name: 'boo' }
27
+ + ]);
28
+ +
29
+ + assert.ok(res[0].name);
30
+ + assert.ok(res[1].name);
31
+ + assert.equal(called, 1);
32
+ + });
33
+ +
34
+ + it('custom statics that overwrite document functions dont get hooks by default', async function() {
35
+ +
36
+ + const schema = new Schema({ name: String });
37
+ +
38
+ + schema.statics.save = function() {
39
+ + return 'foo';
40
+ + };
41
+ +
42
+ + let called = 0;
43
+ + schema.pre('save', function(next) {
44
+ + ++called;
45
+ + next();
46
+ + });
47
+ +
48
+ + const Model = db.model('Test', schema);
49
+ +
50
+ + const doc = await Model.save();
51
+ +
52
+ + assert.ok(doc);
53
+ + assert.equal(doc, 'foo');
54
+ + assert.equal(called, 0);
55
+ + });
56
+ +
57
+ it('error handling middleware passes saved doc (gh-7832)', async function() {
58
+ const schema = new Schema({ _id: Number });
59
+
60
+ diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64
61
+ new file mode 100644
62
+ --- /dev/null
63
+ +++ b/mimo_build_env.tar.gz.b64
64
+ @@ -0,0 +1,4 @@
65
+ +H4sIAAAAAAAAA+3RUYrCMBSF4Ty7irsBY9KayXKkNgE7mGawqbj8afsyIji+KMPg/72cC7mQC0fv
66
+ +x+4YdrE/b9SrmIl3bsnJbS6zdZWtjNk6XyljrfNeiXvZRVfGoTQnEXXKufy29+j9n9I//Zc4lF2b
67
+ +U2r6oIfD8/541L+97r/2U//bD1MrMc874b43778NshS/j2HVf10k5fbQyHodL12ZonQp5rFIPfck
68
+ +8+Im5RCPeh7157D66/sBAAAAAAAAAAAAAACAd/YNrbE5AwAoAAA=
69
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
70
+ new file mode 100755
71
+ --- /dev/null
72
+ +++ b/mimo_test_command.sh
73
+ @@ -0,0 +1,6 @@
74
+ +#!/usr/bin/env bash
75
+ +
76
+ +set -uo pipefail
77
+ +cd /testbed || exit 1
78
+ +base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1
79
+ +exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'
tasks/format-code-task-000029/tests/test.sh ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
3
+ # task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
4
+ M=/var/lib/mimo
5
+ CWD=/testbed
6
+ V=/logs/verifier
7
+ mkdir -p "$V"
8
+ BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
9
+ cd "$CWD" || exit 1
10
+ if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
11
+ # the agent's change against the base, so its own commits count too
12
+ git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
13
+ git reset -q
14
+ if ! (
15
+ while IFS= read -r tf; do
16
+ [ -z "$tf" ] && continue
17
+ if git cat-file -e $BASE:"$tf" 2>/dev/null; then
18
+ git checkout $BASE -- "$tf" 2>/dev/null || true
19
+ else
20
+ git rm -f --cached "$tf" >/dev/null 2>&1 || true
21
+ rm -f "$tf"
22
+ fi
23
+ done <<'EOF_RESET_TEST_FILES'
24
+ test/model.test.js
25
+ mimo_build_env.tar.gz.b64
26
+ mimo_test_command.sh
27
+ EOF_RESET_TEST_FILES
28
+
29
+ ); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
30
+ if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
31
+ cat "$V/apply.log" >&2
32
+ echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
33
+ exit 1
34
+ fi
35
+ timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
36
+ RC=$?
37
+ tail -c 12000 "$V/test_output.log"
38
+ if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
39
+ echo "test command exited $RC"
tasks/format-code-task-000029/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000042/environment/Dockerfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # The task's image, pinned by digest (the same as [environment].docker_image).
2
+ # Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
3
+ FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:df6d414cfb63da9b2b2766392a7de94f58a57b4f6d1656766599ceace007f75c
tasks/format-code-task-000042/environment/setup/files/blocklist ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mimo answer-leak blocklist (mimoagent)
2
+ 0.0.0.0 github.com
3
+ 0.0.0.0 www.github.com
4
+ 0.0.0.0 api.github.com
5
+ 0.0.0.0 raw.githubusercontent.com
6
+ 0.0.0.0 codeload.github.com
7
+ 0.0.0.0 objects.githubusercontent.com
8
+ 0.0.0.0 gist.github.com
9
+ 0.0.0.0 gist.githubusercontent.com
10
+ 0.0.0.0 gitlab.com
11
+ 0.0.0.0 bitbucket.org
12
+ 0.0.0.0 sourceforge.net
13
+ 0.0.0.0 git.kernel.org
14
+ 0.0.0.0 chromium.googlesource.com
15
+ 0.0.0.0 android.googlesource.com
16
+ 0.0.0.0 sourcegraph.com
17
+ 0.0.0.0 bugs.chromium.org
18
+ 0.0.0.0 issues.oss-fuzz.com
19
+ 0.0.0.0 oss-fuzz.com
20
+ 0.0.0.0 osv.dev
21
+ 0.0.0.0 api.osv.dev
22
+ 0.0.0.0 bugzilla.mozilla.org
23
+ 0.0.0.0 proxy.golang.org
24
+ 0.0.0.0 sum.golang.org
25
+ 0.0.0.0 pkg.go.dev
26
+ 0.0.0.0 google.com
27
+ 0.0.0.0 www.google.com
28
+ 0.0.0.0 bing.com
29
+ 0.0.0.0 www.bing.com
30
+ 0.0.0.0 duckduckgo.com
31
+ 0.0.0.0 html.duckduckgo.com
32
+ 0.0.0.0 search.brave.com
33
+ 0.0.0.0 stackoverflow.com
tasks/format-code-task-000042/environment/setup/setup.sh ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
3
+ # /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
4
+ M=/var/lib/mimo
5
+ [ -f "$M/ready" ] && exit 0
6
+ chmod 700 "$M"
7
+ fail() { echo "setup: $*" >&2; exit 1; }
8
+ # the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
9
+ write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
10
+
11
+ # Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
12
+ CWD=/testbed
13
+ git config --global --add safe.directory "$CWD"
14
+ cd "$CWD" || fail "no working directory $CWD"
15
+ if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
16
+ git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
17
+ fi
18
+ BASE=$(git rev-parse HEAD 2>/dev/null)
19
+ [ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
20
+ echo "$BASE" > "$M/base"
21
+ # Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
22
+ # so .git is hidden while the agent works and put back for grading.
23
+ LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
24
+ rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
25
+ git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
26
+ find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
27
+ if [ "$LATER" -gt 0 ]; then
28
+ mv "$CWD/.git" "$M/git-hidden"
29
+ echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
30
+ fi
31
+ write_blocklist
32
+
33
+ touch "$M/ready"
34
+ echo "setup done"
tasks/format-code-task-000042/tests/test.patch ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/test/data/dataset/test_dataset.py b/test/data/dataset/test_dataset.py
2
+ index 3d7e6b776..caa299491 100644
3
+ --- a/test/data/dataset/test_dataset.py
4
+ +++ b/test/data/dataset/test_dataset.py
5
+ @@ -14,7 +14,7 @@
6
+ from cartoframes.auth import Credentials
7
+ from cartoframes.data.clients import SQLClient
8
+ from cartoframes.utils.geom_utils import setting_value_exception
9
+ -from cartoframes.utils.columns import normalize_name
10
+ +from cartoframes.utils.columns import normalize_name, DataframeColumnsInfo
11
+ from cartoframes.utils.utils import load_geojson
12
+ from cartoframes.data import StrategiesRegistry
13
+ from cartoframes.data.dataset.registry.dataframe_dataset import DataFrameDataset, _rows
14
+ @@ -906,3 +906,14 @@ def test_rows_null_geom(self):
15
+ rows = _rows(df, dataframe_columns_info, with_lnglat)
16
+
17
+ self.assertEqual(list(rows), [b'|\n', b'|\n'])
18
+ +
19
+ + def test_rows_non_ascii(self):
20
+ + attribute = 'áéí'
21
+ + unicode_attribute = u'áéí'
22
+ + encoded_attribute = unicode_attribute.encode('utf-8')
23
+ + encoded_line = encoded_attribute + '\n'.encode()
24
+ +
25
+ + df = pd.DataFrame.from_dict({'test': [attribute, unicode_attribute, encoded_attribute, 'xyz']})
26
+ + columns_info = DataframeColumnsInfo(df)
27
+ + rows = _rows(df, columns_info, None)
28
+ + self.assertEqual(list(rows), [encoded_line, encoded_line, encoded_line, b'xyz\n'])
29
+ diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64
30
+ new file mode 100644
31
+ --- /dev/null
32
+ +++ b/mimo_build_env.tar.gz.b64
33
+ @@ -0,0 +1,11 @@
34
+ +H4sIAAAAAAAAA+2UT2/TQBDFc/anGFqkwsFJ7DaphChSxR+1F1qVcEBCqta7k3gbZ3e7u04aUb47
35
+ +YyehBVF6aQWI+R3seD1583beJt2i1pU6RzPvdR6LPrE/GLR34ud7+zkb5FmeDwb53n6nn2XD/rAD
36
+ +g0dzdIs6ROEBOt7a+Lu6+97/o3Rv8o8Y4rm0s5kwqhvKh+txT/5ZPsy+559lu5T/3jDLO9B/OAt3
37
+ +85/nv/2kV2jTK0QoE6mgPQQFqiTZhrcm1B7hdBlLa2C3m+WgAwgZ9RwThfM0LHSUJbi2YHdVkb/q
38
+ +0aueqasKrq8h+hobrWNDY6YlhQ6NQiM1BtBjMDaCqDwKtQTnMaCJyUYvnYHTDvT6q2laUN00DcsQ
39
+ +cZY6IadiQirpZeOAbIOjgysCSOGjhVAKh9US4qWaQW20QmkVwgILaSvrA1xocyFyEM4pTY9uKby3
40
+ +C5igXevsBIy1i9ZW4eV+f+eurX3ACKefRkcn708PR0dArbWRVU29Yom0KXuBMsKzVqzrllCStIDC
41
+ +2ykamKMPmqYbHEo91uifJ3jlrL8tebAJ5cXTLzerX5veZ7Vpu9ARnpCNdgpjXSGkgFcrEyNaeyOi
42
+ +oP5kLOLEi9h0bGoDLEpNCXq8rDVF/frwbHQC0iMlFLWowg9ZrIbcXHqKBNsLqa7+N9YPzQY/J0Ck
43
+ +U9ja9H7nxQzXJj4aHcH6275+sXRsxnZrozSn7GNxEEqaS/KnfzAMwzAMwzAMwzAMwzAMwzAMwzAM
44
+ +wzAMwzB/Gd8AiYEWdwAoAAA=
45
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
46
+ new file mode 100755
47
+ --- /dev/null
48
+ +++ b/mimo_test_command.sh
49
+ @@ -0,0 +1,6 @@
50
+ +#!/usr/bin/env bash
51
+ +
52
+ +set -uo pipefail
53
+ +cd /testbed || exit 1
54
+ +base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1
55
+ +exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'
tasks/format-code-task-000042/tests/test.sh ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
3
+ # task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
4
+ M=/var/lib/mimo
5
+ CWD=/testbed
6
+ V=/logs/verifier
7
+ mkdir -p "$V"
8
+ BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
9
+ cd "$CWD" || exit 1
10
+ if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
11
+ # the agent's change against the base, so its own commits count too
12
+ git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
13
+ git reset -q
14
+ if ! (
15
+ while IFS= read -r tf; do
16
+ [ -z "$tf" ] && continue
17
+ if git cat-file -e $BASE:"$tf" 2>/dev/null; then
18
+ git checkout $BASE -- "$tf" 2>/dev/null || true
19
+ else
20
+ git rm -f --cached "$tf" >/dev/null 2>&1 || true
21
+ rm -f "$tf"
22
+ fi
23
+ done <<'EOF_RESET_TEST_FILES'
24
+ test/data/dataset/test_dataset.py
25
+ mimo_build_env.tar.gz.b64
26
+ mimo_test_command.sh
27
+ EOF_RESET_TEST_FILES
28
+
29
+ ); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
30
+ if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
31
+ cat "$V/apply.log" >&2
32
+ echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
33
+ exit 1
34
+ fi
35
+ timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
36
+ RC=$?
37
+ tail -c 12000 "$V/test_output.log"
38
+ if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
39
+ echo "test command exited $RC"
tasks/format-code-task-000042/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000045/environment/Dockerfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # The task's image, pinned by digest (the same as [environment].docker_image).
2
+ # Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
3
+ FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:fcb5d0910fc4725ca505d3cfb8e05b990140a83fe1c17f0152db8c742982feab
tasks/format-code-task-000045/environment/setup/files/blocklist ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mimo answer-leak blocklist (mimoagent)
2
+ 0.0.0.0 github.com
3
+ 0.0.0.0 www.github.com
4
+ 0.0.0.0 api.github.com
5
+ 0.0.0.0 raw.githubusercontent.com
6
+ 0.0.0.0 codeload.github.com
7
+ 0.0.0.0 objects.githubusercontent.com
8
+ 0.0.0.0 gist.github.com
9
+ 0.0.0.0 gist.githubusercontent.com
10
+ 0.0.0.0 gitlab.com
11
+ 0.0.0.0 bitbucket.org
12
+ 0.0.0.0 sourceforge.net
13
+ 0.0.0.0 git.kernel.org
14
+ 0.0.0.0 chromium.googlesource.com
15
+ 0.0.0.0 android.googlesource.com
16
+ 0.0.0.0 sourcegraph.com
17
+ 0.0.0.0 bugs.chromium.org
18
+ 0.0.0.0 issues.oss-fuzz.com
19
+ 0.0.0.0 oss-fuzz.com
20
+ 0.0.0.0 osv.dev
21
+ 0.0.0.0 api.osv.dev
22
+ 0.0.0.0 bugzilla.mozilla.org
23
+ 0.0.0.0 proxy.golang.org
24
+ 0.0.0.0 sum.golang.org
25
+ 0.0.0.0 pkg.go.dev
26
+ 0.0.0.0 google.com
27
+ 0.0.0.0 www.google.com
28
+ 0.0.0.0 bing.com
29
+ 0.0.0.0 www.bing.com
30
+ 0.0.0.0 duckduckgo.com
31
+ 0.0.0.0 html.duckduckgo.com
32
+ 0.0.0.0 search.brave.com
33
+ 0.0.0.0 stackoverflow.com
tasks/format-code-task-000045/environment/setup/setup.sh ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
3
+ # /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
4
+ M=/var/lib/mimo
5
+ [ -f "$M/ready" ] && exit 0
6
+ chmod 700 "$M"
7
+ fail() { echo "setup: $*" >&2; exit 1; }
8
+ # the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
9
+ write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
10
+
11
+ # Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
12
+ CWD=/testbed
13
+ git config --global --add safe.directory "$CWD"
14
+ cd "$CWD" || fail "no working directory $CWD"
15
+ if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
16
+ git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
17
+ fi
18
+ BASE=$(git rev-parse HEAD 2>/dev/null)
19
+ [ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
20
+ echo "$BASE" > "$M/base"
21
+ # Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
22
+ # so .git is hidden while the agent works and put back for grading.
23
+ LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
24
+ rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
25
+ git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
26
+ find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
27
+ if [ "$LATER" -gt 0 ]; then
28
+ mv "$CWD/.git" "$M/git-hidden"
29
+ echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
30
+ fi
31
+ write_blocklist
32
+
33
+ touch "$M/ready"
34
+ echo "setup done"
tasks/format-code-task-000045/tests/test.patch ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/test/BootBot.spec.js b/test/BootBot.spec.js
2
+ index 39f0157..68df63c 100644
3
+ --- a/test/BootBot.spec.js
4
+ +++ b/test/BootBot.spec.js
5
+ @@ -116,6 +116,93 @@ describe('BootBot', () => {
6
+ expect(spy.calledWith(expected)).to.equal(true);
7
+ });
8
+
9
+ + it('formats a string quick reply with default content_type, title, and payload', () => {
10
+ + const spy = sinon.spy(bot, 'sendRequest');
11
+ + bot.sendTextMessage(userId, 'Hello', ['Red']);
12
+ + const body = spy.firstCall.args[0];
13
+ + expect(body.message.quick_replies).to.deep.equal([
14
+ + { content_type: 'text', title: 'Red', payload: 'BOOTBOT_QR_RED' }
15
+ + ]);
16
+ + });
17
+ +
18
+ + it('passes through a location quick reply object as-is', () => {
19
+ + const spy = sinon.spy(bot, 'sendRequest');
20
+ + bot.sendTextMessage(userId, 'Where are you?', [{ content_type: 'location' }]);
21
+ + const body = spy.firstCall.args[0];
22
+ + expect(body.message.quick_replies).to.deep.equal([
23
+ + { content_type: 'location' }
24
+ + ]);
25
+ + });
26
+ +
27
+ + it('preserves all fields of a text quick reply with image_url', () => {
28
+ + const spy = sinon.spy(bot, 'sendRequest');
29
+ + const reply = {
30
+ + content_type: 'text',
31
+ + title: 'Green',
32
+ + payload: 'DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_GREEN',
33
+ + image_url: 'http://petersfantastichats.com/img/green.png'
34
+ + };
35
+ + bot.sendTextMessage(userId, 'Pick a color', [reply]);
36
+ + const body = spy.firstCall.args[0];
37
+ + expect(body.message.quick_replies).to.deep.equal([reply]);
38
+ + });
39
+ +
40
+ + it('auto-generates payload and content_type for an object with only a title', () => {
41
+ + const spy = sinon.spy(bot, 'sendRequest');
42
+ + bot.sendTextMessage(userId, 'Pick', [{ title: 'Red' }]);
43
+ + const body = spy.firstCall.args[0];
44
+ + expect(body.message.quick_replies).to.deep.equal([
45
+ + { content_type: 'text', title: 'Red', payload: 'BOOTBOT_QR_RED' }
46
+ + ]);
47
+ + });
48
+ +
49
+ + it('preserves user-provided payload when title is supplied', () => {
50
+ + const spy = sinon.spy(bot, 'sendRequest');
51
+ + bot.sendTextMessage(userId, 'Pick', [{ title: 'Red', payload: 'CUSTOM_RED_PAYLOAD' }]);
52
+ + const body = spy.firstCall.args[0];
53
+ + const qr = body.message.quick_replies[0];
54
+ + expect(qr.title).to.equal('Red');
55
+ + expect(qr.payload).to.equal('CUSTOM_RED_PAYLOAD');
56
+ + expect(qr.content_type).to.equal('text');
57
+ + });
58
+ +
59
+ + it('formats a mixed array of string and object quick replies correctly', () => {
60
+ + const spy = sinon.spy(bot, 'sendRequest');
61
+ + bot.sendTextMessage(userId, 'Pick', [
62
+ + 'Red',
63
+ + { content_type: 'location' },
64
+ + { content_type: 'text', title: 'Blue', payload: 'PICK_BLUE', image_url: 'http://x/blue.png' }
65
+ + ]);
66
+ + const body = spy.firstCall.args[0];
67
+ + expect(body.message.quick_replies).to.deep.equal([
68
+ + { content_type: 'text', title: 'Red', payload: 'BOOTBOT_QR_RED' },
69
+ + { content_type: 'location' },
70
+ + { content_type: 'text', title: 'Blue', payload: 'PICK_BLUE', image_url: 'http://x/blue.png' }
71
+ + ]);
72
+ + });
73
+ +
74
+ + it('preserves extra fields on a location quick reply', () => {
75
+ + const spy = sinon.spy(bot, 'sendRequest');
76
+ + bot.sendTextMessage(userId, 'Where?', [{ content_type: 'location', extra_field: 'KEEP_ME' }]);
77
+ + const body = spy.firstCall.args[0];
78
+ + const qr = body.message.quick_replies[0];
79
+ + expect(qr.content_type).to.equal('location');
80
+ + expect(qr.extra_field).to.equal('KEEP_ME');
81
+ + });
82
+ +
83
+ + it('formats quick replies on sendAttachment the same way as sendTextMessage', () => {
84
+ + const spy = sinon.spy(bot, 'sendRequest');
85
+ + bot.sendAttachment(userId, 'image', 'http://x/img.png', [
86
+ + { content_type: 'location' },
87
+ + { title: 'Red' }
88
+ + ]);
89
+ + const body = spy.firstCall.args[0];
90
+ + expect(body.message.quick_replies).to.deep.equal([
91
+ + { content_type: 'location' },
92
+ + { content_type: 'text', title: 'Red', payload: 'BOOTBOT_QR_RED' }
93
+ + ]);
94
+ + });
95
+ +
96
+ it('can send an attachment', () => {
97
+ const spy = sinon.spy(bot, 'sendRequest');
98
+ const type = 'image';
99
+ diff --git a/test_commands.json b/test_commands.json
100
+ new file mode 100644
101
+ index 0000000..fdb8120
102
+ --- /dev/null
103
+ +++ b/test_commands.json
104
+ @@ -0,0 +1,3 @@
105
+ +{
106
+ + "test_commands": ["npx mocha test/BootBot.spec.js"]
107
+ +}
108
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
109
+ new file mode 100755
110
+ --- /dev/null
111
+ +++ b/mimo_test_command.sh
112
+ @@ -0,0 +1,8 @@
113
+ +#!/usr/bin/env bash
114
+ +
115
+ +set -uo pipefail
116
+ +cd /testbed
117
+ +rc=0
118
+ +npx mocha test/BootBot.spec.js
119
+ +rc=$(( rc | $? ))
120
+ +exit $rc
tasks/format-code-task-000045/tests/test.sh ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
3
+ # task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
4
+ M=/var/lib/mimo
5
+ CWD=/testbed
6
+ V=/logs/verifier
7
+ mkdir -p "$V"
8
+ BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
9
+ cd "$CWD" || exit 1
10
+ if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
11
+ # the agent's change against the base, so its own commits count too
12
+ git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
13
+ git reset -q
14
+ if ! (
15
+ while IFS= read -r tf; do
16
+ [ -z "$tf" ] && continue
17
+ if git cat-file -e $BASE:"$tf" 2>/dev/null; then
18
+ git checkout $BASE -- "$tf" 2>/dev/null || true
19
+ else
20
+ git rm -f --cached "$tf" >/dev/null 2>&1 || true
21
+ rm -f "$tf"
22
+ fi
23
+ done <<'EOF_RESET_TEST_FILES'
24
+ test/BootBot.spec.js
25
+ test_commands.json
26
+ mimo_test_command.sh
27
+ EOF_RESET_TEST_FILES
28
+
29
+ ); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
30
+ if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
31
+ cat "$V/apply.log" >&2
32
+ echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
33
+ exit 1
34
+ fi
35
+ timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
36
+ RC=$?
37
+ tail -c 12000 "$V/test_output.log"
38
+ if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
39
+ echo "test command exited $RC"
tasks/format-code-task-000045/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000089/environment/Dockerfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # The task's image, pinned by digest (the same as [environment].docker_image).
2
+ # Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
3
+ FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:02c1b61699c8ba5562395a4c5ba9f565c5d5a31733ae3fe5603ddb069efea7c9
tasks/format-code-task-000089/environment/setup/files/blocklist ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mimo answer-leak blocklist (mimoagent)
2
+ 0.0.0.0 github.com
3
+ 0.0.0.0 www.github.com
4
+ 0.0.0.0 api.github.com
5
+ 0.0.0.0 raw.githubusercontent.com
6
+ 0.0.0.0 codeload.github.com
7
+ 0.0.0.0 objects.githubusercontent.com
8
+ 0.0.0.0 gist.github.com
9
+ 0.0.0.0 gist.githubusercontent.com
10
+ 0.0.0.0 gitlab.com
11
+ 0.0.0.0 bitbucket.org
12
+ 0.0.0.0 sourceforge.net
13
+ 0.0.0.0 git.kernel.org
14
+ 0.0.0.0 chromium.googlesource.com
15
+ 0.0.0.0 android.googlesource.com
16
+ 0.0.0.0 sourcegraph.com
17
+ 0.0.0.0 bugs.chromium.org
18
+ 0.0.0.0 issues.oss-fuzz.com
19
+ 0.0.0.0 oss-fuzz.com
20
+ 0.0.0.0 osv.dev
21
+ 0.0.0.0 api.osv.dev
22
+ 0.0.0.0 bugzilla.mozilla.org
23
+ 0.0.0.0 proxy.golang.org
24
+ 0.0.0.0 sum.golang.org
25
+ 0.0.0.0 pkg.go.dev
26
+ 0.0.0.0 google.com
27
+ 0.0.0.0 www.google.com
28
+ 0.0.0.0 bing.com
29
+ 0.0.0.0 www.bing.com
30
+ 0.0.0.0 duckduckgo.com
31
+ 0.0.0.0 html.duckduckgo.com
32
+ 0.0.0.0 search.brave.com
33
+ 0.0.0.0 stackoverflow.com