AdithyaSK HF Staff commited on
Commit
197607f
·
verified ·
1 Parent(s): 7fcd252

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-000013/environment/Dockerfile +3 -0
  2. tasks/format-code-task-000013/environment/setup/files/blocklist +33 -0
  3. tasks/format-code-task-000013/environment/setup/setup.sh +34 -0
  4. tasks/format-code-task-000013/tests/test.patch +314 -0
  5. tasks/format-code-task-000013/tests/test.sh +38 -0
  6. tasks/format-code-task-000013/tests/test_command.sh +1 -0
  7. tasks/format-code-task-000022/environment/Dockerfile +3 -0
  8. tasks/format-code-task-000022/environment/setup/files/blocklist +33 -0
  9. tasks/format-code-task-000022/environment/setup/setup.sh +34 -0
  10. tasks/format-code-task-000022/tests/test.patch +37 -0
  11. tasks/format-code-task-000022/tests/test.sh +39 -0
  12. tasks/format-code-task-000022/tests/test_command.sh +1 -0
  13. tasks/format-code-task-000025/environment/Dockerfile +3 -0
  14. tasks/format-code-task-000025/environment/setup/files/blocklist +33 -0
  15. tasks/format-code-task-000025/environment/setup/setup.sh +34 -0
  16. tasks/format-code-task-000025/tests/test.patch +115 -0
  17. tasks/format-code-task-000025/tests/test.sh +39 -0
  18. tasks/format-code-task-000025/tests/test_command.sh +1 -0
  19. tasks/format-code-task-000157/environment/Dockerfile +3 -0
  20. tasks/format-code-task-000157/environment/setup/files/blocklist +33 -0
  21. tasks/format-code-task-000157/environment/setup/setup.sh +34 -0
  22. tasks/format-code-task-000157/tests/test.patch +61 -0
  23. tasks/format-code-task-000157/tests/test.sh +41 -0
  24. tasks/format-code-task-000157/tests/test_command.sh +1 -0
  25. tasks/format-code-task-000159/environment/Dockerfile +3 -0
  26. tasks/format-code-task-000159/environment/setup/files/blocklist +33 -0
  27. tasks/format-code-task-000159/environment/setup/setup.sh +34 -0
  28. tasks/format-code-task-000159/tests/test.patch +65 -0
  29. tasks/format-code-task-000159/tests/test.sh +39 -0
  30. tasks/format-code-task-000159/tests/test_command.sh +1 -0
  31. tasks/format-code-task-000161/environment/Dockerfile +3 -0
  32. tasks/format-code-task-000161/environment/setup/files/blocklist +33 -0
  33. tasks/format-code-task-000161/environment/setup/setup.sh +34 -0
  34. tasks/format-code-task-000161/tests/test.patch +103 -0
  35. tasks/format-code-task-000161/tests/test.sh +39 -0
  36. tasks/format-code-task-000161/tests/test_command.sh +1 -0
  37. tasks/format-code-task-000166/environment/Dockerfile +3 -0
  38. tasks/format-code-task-000166/environment/setup/files/blocklist +33 -0
  39. tasks/format-code-task-000166/environment/setup/setup.sh +34 -0
  40. tasks/format-code-task-000166/tests/test.patch +203 -0
  41. tasks/format-code-task-000166/tests/test.sh +38 -0
  42. tasks/format-code-task-000166/tests/test_command.sh +1 -0
  43. tasks/format-code-task-000168/environment/Dockerfile +3 -0
  44. tasks/format-code-task-000168/environment/setup/files/blocklist +33 -0
  45. tasks/format-code-task-000168/environment/setup/setup.sh +34 -0
  46. tasks/format-code-task-000168/tests/test.patch +96 -0
  47. tasks/format-code-task-000168/tests/test.sh +38 -0
  48. tasks/format-code-task-000168/tests/test_command.sh +1 -0
  49. tasks/format-code-task-000192/environment/Dockerfile +3 -0
  50. tasks/format-code-task-000192/environment/setup/files/blocklist +33 -0
tasks/format-code-task-000013/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:7f52223c1e597cfb277e8814377ecc2166d70708273938e0b8d60631d84a9470
tasks/format-code-task-000013/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-000013/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-000013/tests/test.patch ADDED
@@ -0,0 +1,314 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/lib/lru/synthesis_lru_contract_test.go b/lib/lru/synthesis_lru_contract_test.go
2
+ new file mode 100644
3
+ index 00000000..27fc3fc9
4
+ --- /dev/null
5
+ +++ b/lib/lru/synthesis_lru_contract_test.go
6
+ @@ -0,0 +1,298 @@
7
+ +package lru_test
8
+ +
9
+ +import (
10
+ + "reflect"
11
+ + "testing"
12
+ +
13
+ + "awesome-golang-algorithm/lib/lru"
14
+ +)
15
+ +
16
+ +type synthesisStringValue string
17
+ +
18
+ +func (v synthesisStringValue) Len() int { return len(v) }
19
+ +
20
+ +func synthesisBytes(t *testing.T, c *lru.Cache) int64 {
21
+ + t.Helper()
22
+ + v, ok := any(c).(interface{ Bytes() int64 })
23
+ + if !ok {
24
+ + t.Fatal("Cache must expose Bytes() int64")
25
+ + }
26
+ + return v.Bytes()
27
+ +}
28
+ +
29
+ +func synthesisRemove(t *testing.T, c *lru.Cache, key string) (lru.Value, bool) {
30
+ + t.Helper()
31
+ + v, ok := any(c).(interface {
32
+ + Remove(string) (lru.Value, bool)
33
+ + })
34
+ + if !ok {
35
+ + t.Fatal("Cache must expose Remove(string) (Value, bool)")
36
+ + }
37
+ + return v.Remove(key)
38
+ +}
39
+ +
40
+ +func synthesisClear(t *testing.T, c *lru.Cache) {
41
+ + t.Helper()
42
+ + v, ok := any(c).(interface{ Clear() })
43
+ + if !ok {
44
+ + t.Fatal("Cache must expose Clear()")
45
+ + }
46
+ + v.Clear()
47
+ +}
48
+ +
49
+ +func synthesisPeek(t *testing.T, c *lru.Cache, key string) (lru.Value, bool) {
50
+ + t.Helper()
51
+ + v, ok := any(c).(interface {
52
+ + Peek(string) (lru.Value, bool)
53
+ + })
54
+ + if !ok {
55
+ + t.Fatal("Cache must expose Peek(string) (Value, bool)")
56
+ + }
57
+ + return v.Peek(key)
58
+ +}
59
+ +
60
+ +func synthesisKeys(t *testing.T, c *lru.Cache) []string {
61
+ + t.Helper()
62
+ + v, ok := any(c).(interface{ Keys() []string })
63
+ + if !ok {
64
+ + t.Fatal("Cache must expose Keys() []string")
65
+ + }
66
+ + return v.Keys()
67
+ +}
68
+ +
69
+ +func synthesisResize(t *testing.T, c *lru.Cache, maxBytes int64) {
70
+ + t.Helper()
71
+ + v, ok := any(c).(interface{ Resize(int64) })
72
+ + if !ok {
73
+ + t.Fatal("Cache must expose Resize(int64)")
74
+ + }
75
+ + v.Resize(maxBytes)
76
+ +}
77
+ +
78
+ +func synthesisStats(t *testing.T, c *lru.Cache) (uint64, uint64) {
79
+ + t.Helper()
80
+ + method := reflect.ValueOf(c).MethodByName("Stats")
81
+ + if !method.IsValid() || method.Type().NumIn() != 0 || method.Type().NumOut() != 1 {
82
+ + t.Fatal("Cache must expose Stats() Stats")
83
+ + }
84
+ + result := method.Call(nil)[0]
85
+ + if result.Kind() != reflect.Struct {
86
+ + t.Fatalf("Stats result has kind %s, want struct", result.Kind())
87
+ + }
88
+ + hits, misses := result.FieldByName("Hits"), result.FieldByName("Misses")
89
+ + if !hits.IsValid() || !misses.IsValid() || hits.Kind() != reflect.Uint64 || misses.Kind() != reflect.Uint64 {
90
+ + t.Fatal("Stats must expose uint64 fields Hits and Misses")
91
+ + }
92
+ + return hits.Uint(), misses.Uint()
93
+ +}
94
+ +
95
+ +func synthesisResetStats(t *testing.T, c *lru.Cache) {
96
+ + t.Helper()
97
+ + v, ok := any(c).(interface{ ResetStats() })
98
+ + if !ok {
99
+ + t.Fatal("Cache must expose ResetStats()")
100
+ + }
101
+ + v.ResetStats()
102
+ +}
103
+ +
104
+ +func TestSynthesisReplacementAccountingAndEviction(t *testing.T) {
105
+ + var evicted []string
106
+ + c := lru.New(10, func(key string, _ lru.Value) { evicted = append(evicted, key) })
107
+ + c.Add("a", synthesisStringValue("1234"))
108
+ + c.Add("b", synthesisStringValue("1234"))
109
+ + if got := synthesisBytes(t, c); got != 10 {
110
+ + t.Fatalf("initial byte count = %d, want 10", got)
111
+ + }
112
+ +
113
+ + c.Add("a", synthesisStringValue("123456"))
114
+ + if got := synthesisBytes(t, c); got != 7 {
115
+ + t.Fatalf("byte count after replacement = %d, want 7", got)
116
+ + }
117
+ + if _, ok := c.Get("a"); !ok {
118
+ + t.Fatal("updated key a should remain present")
119
+ + }
120
+ + if _, ok := c.Get("b"); ok {
121
+ + t.Fatal("least-recently-used key b should be evicted")
122
+ + }
123
+ + if !reflect.DeepEqual(evicted, []string{"b"}) {
124
+ + t.Fatalf("evictions = %v, want [b]", evicted)
125
+ + }
126
+ +
127
+ + var replacementCallbacks []string
128
+ + unlimited := lru.New(0, func(key string, _ lru.Value) {
129
+ + replacementCallbacks = append(replacementCallbacks, key)
130
+ + })
131
+ + unlimited.Add("key", synthesisStringValue("12345"))
132
+ + unlimited.Add("key", synthesisStringValue("1"))
133
+ + if got := synthesisBytes(t, unlimited); got != 4 {
134
+ + t.Fatalf("byte count after smaller replacement = %d, want 4", got)
135
+ + }
136
+ + if len(replacementCallbacks) != 0 {
137
+ + t.Fatalf("replacement invoked eviction callback for %v", replacementCallbacks)
138
+ + }
139
+ +}
140
+ +
141
+ +func TestSynthesisOversizedEntryIsImmediatelyEvicted(t *testing.T) {
142
+ + var evicted []string
143
+ + c := lru.New(5, func(key string, _ lru.Value) { evicted = append(evicted, key) })
144
+ + c.Add("long", synthesisStringValue("12"))
145
+ + if c.Len() != 0 || synthesisBytes(t, c) != 0 {
146
+ + t.Fatalf("oversized entry left cache state len=%d bytes=%d", c.Len(), synthesisBytes(t, c))
147
+ + }
148
+ + if _, ok := c.Get("long"); ok {
149
+ + t.Fatal("oversized entry should not be retrievable")
150
+ + }
151
+ + if !reflect.DeepEqual(evicted, []string{"long"}) {
152
+ + t.Fatalf("evictions = %v, want [long]", evicted)
153
+ + }
154
+ +}
155
+ +
156
+ +func TestSynthesisRemoveCallbackAndAccounting(t *testing.T) {
157
+ + var evicted []string
158
+ + c := lru.New(0, func(key string, _ lru.Value) { evicted = append(evicted, key) })
159
+ + c.Add("a", synthesisStringValue("1"))
160
+ + c.Add("b", synthesisStringValue("2"))
161
+ + c.Add("c", synthesisStringValue("3"))
162
+ + if value, ok := synthesisRemove(t, c, "c"); !ok || value != synthesisStringValue("3") {
163
+ + t.Fatalf("Remove(c) = (%v, %v), want (3, true)", value, ok)
164
+ + }
165
+ + if got := synthesisBytes(t, c); got != 4 {
166
+ + t.Fatalf("after Remove(c), bytes = %d, want 4", got)
167
+ + }
168
+ + if value, ok := synthesisRemove(t, c, "missing"); ok || value != nil {
169
+ + t.Fatalf("Remove(missing) = (%v, %v), want (nil, false)", value, ok)
170
+ + }
171
+ + if !reflect.DeepEqual(evicted, []string{"c"}) {
172
+ + t.Fatalf("callbacks = %v, want [c]", evicted)
173
+ + }
174
+ +}
175
+ +
176
+ +func TestSynthesisClearCallbacksOldestFirst(t *testing.T) {
177
+ + var evicted []string
178
+ + c := lru.New(0, func(key string, _ lru.Value) { evicted = append(evicted, key) })
179
+ + c.Add("a", synthesisStringValue("1"))
180
+ + c.Add("b", synthesisStringValue("2"))
181
+ + c.Add("c", synthesisStringValue("3"))
182
+ + if _, ok := c.Get("a"); !ok {
183
+ + t.Fatal("expected cache hit for a")
184
+ + }
185
+ + synthesisClear(t, c)
186
+ + if c.Len() != 0 || synthesisBytes(t, c) != 0 {
187
+ + t.Fatalf("Clear left cache state len=%d bytes=%d", c.Len(), synthesisBytes(t, c))
188
+ + }
189
+ + if !reflect.DeepEqual(evicted, []string{"b", "c", "a"}) {
190
+ + t.Fatalf("callbacks = %v, want [b c a]", evicted)
191
+ + }
192
+ +}
193
+ +
194
+ +func TestSynthesisPeekDoesNotAffectOrderOrStats(t *testing.T) {
195
+ + c := lru.New(0, nil)
196
+ + c.Add("x", synthesisStringValue("one"))
197
+ + c.Add("y", synthesisStringValue("two"))
198
+ + if value, ok := synthesisPeek(t, c, "x"); !ok || value != synthesisStringValue("one") {
199
+ + t.Fatalf("Peek(x) = (%v, %v), want (one, true)", value, ok)
200
+ + }
201
+ + if _, ok := synthesisPeek(t, c, "missing"); ok {
202
+ + t.Fatal("Peek(missing) should report false")
203
+ + }
204
+ + if got := synthesisKeys(t, c); !reflect.DeepEqual(got, []string{"y", "x"}) {
205
+ + t.Fatalf("Peek changed order: Keys = %v", got)
206
+ + }
207
+ + hits, misses := synthesisStats(t, c)
208
+ + if hits != 0 || misses != 0 {
209
+ + t.Fatalf("Peek changed Stats to (%d, %d), want (0, 0)", hits, misses)
210
+ + }
211
+ +}
212
+ +
213
+ +func TestSynthesisKeysReflectGetRecency(t *testing.T) {
214
+ + c := lru.New(0, nil)
215
+ + c.Add("x", synthesisStringValue("one"))
216
+ + c.Add("y", synthesisStringValue("two"))
217
+ + if got := synthesisKeys(t, c); !reflect.DeepEqual(got, []string{"y", "x"}) {
218
+ + t.Fatalf("initial Keys = %v, want [y x]", got)
219
+ + }
220
+ + if got := synthesisKeys(t, c); !reflect.DeepEqual(got, []string{"y", "x"}) {
221
+ + t.Fatalf("repeated Keys changed order: got %v, want [y x]", got)
222
+ + }
223
+ + if _, ok := c.Get("x"); !ok {
224
+ + t.Fatal("Get(x) should hit")
225
+ + }
226
+ + if got := synthesisKeys(t, c); !reflect.DeepEqual(got, []string{"x", "y"}) {
227
+ + t.Fatalf("Get did not promote x: Keys = %v", got)
228
+ + }
229
+ +}
230
+ +
231
+ +func TestSynthesisStatsAndReset(t *testing.T) {
232
+ + c := lru.New(0, nil)
233
+ + c.Add("x", synthesisStringValue("one"))
234
+ + if _, ok := c.Get("x"); !ok {
235
+ + t.Fatal("Get(x) should hit")
236
+ + }
237
+ + if _, ok := c.Get("missing"); ok {
238
+ + t.Fatal("Get(missing) should miss")
239
+ + }
240
+ + hits, misses := synthesisStats(t, c)
241
+ + if hits != 1 || misses != 1 {
242
+ + t.Fatalf("Stats = (%d, %d), want one hit and one miss", hits, misses)
243
+ + }
244
+ + synthesisResetStats(t, c)
245
+ + if hits, misses = synthesisStats(t, c); hits != 0 || misses != 0 {
246
+ + t.Fatalf("ResetStats left counters = (%d, %d)", hits, misses)
247
+ + }
248
+ + if c.Len() != 1 {
249
+ + t.Fatalf("ResetStats changed cache length to %d, want 1", c.Len())
250
+ + }
251
+ +}
252
+ +
253
+ +func TestSynthesisResizeEvictsOldestAndZeroIsUnlimited(t *testing.T) {
254
+ + var evicted []string
255
+ + c := lru.New(0, func(key string, _ lru.Value) { evicted = append(evicted, key) })
256
+ + c.Add("a", synthesisStringValue("11"))
257
+ + c.Add("b", synthesisStringValue("22"))
258
+ + c.Add("c", synthesisStringValue("33"))
259
+ + if _, ok := c.Get("a"); !ok {
260
+ + t.Fatal("expected cache hit for a")
261
+ + }
262
+ + synthesisResize(t, c, 6)
263
+ + if got := synthesisKeys(t, c); !reflect.DeepEqual(got, []string{"a", "c"}) {
264
+ + t.Fatalf("after Resize(6), Keys = %v, want [a c]", got)
265
+ + }
266
+ + if got := synthesisBytes(t, c); got != 6 {
267
+ + t.Fatalf("after Resize(6), bytes = %d, want 6", got)
268
+ + }
269
+ + if !reflect.DeepEqual(evicted, []string{"b"}) {
270
+ + t.Fatalf("Resize callback keys = %v, want [b]", evicted)
271
+ + }
272
+ + synthesisResize(t, c, 3)
273
+ + if got := synthesisKeys(t, c); !reflect.DeepEqual(got, []string{"a"}) {
274
+ + t.Fatalf("after Resize(3), Keys = %v, want [a]", got)
275
+ + }
276
+ + if !reflect.DeepEqual(evicted, []string{"b", "c"}) {
277
+ + t.Fatalf("second Resize callback keys = %v, want [b c]", evicted)
278
+ + }
279
+ + synthesisResize(t, c, 0)
280
+ + c.Add("d", synthesisStringValue("44"))
281
+ + if got := synthesisKeys(t, c); !reflect.DeepEqual(got, []string{"d", "a"}) {
282
+ + t.Fatalf("zero-capacity cache Keys = %v, want [d a]", got)
283
+ + }
284
+ +}
285
+ +
286
+ +func TestSynthesisExistingRemoveOldestCompatibility(t *testing.T) {
287
+ + var evicted []string
288
+ + c := lru.New(0, func(key string, _ lru.Value) { evicted = append(evicted, key) })
289
+ + c.Add("a", synthesisStringValue("1"))
290
+ + c.Add("b", synthesisStringValue("2"))
291
+ + if _, ok := c.Get("a"); !ok {
292
+ + t.Fatal("expected cache hit for a")
293
+ + }
294
+ + c.RemoveOldest()
295
+ + if _, ok := c.Get("b"); ok {
296
+ + t.Fatal("RemoveOldest should remove least-recently-used key b")
297
+ + }
298
+ + if _, ok := c.Get("a"); !ok || c.Len() != 1 {
299
+ + t.Fatalf("RemoveOldest should retain a as the sole entry, len=%d", c.Len())
300
+ + }
301
+ + if !reflect.DeepEqual(evicted, []string{"b"}) {
302
+ + t.Fatalf("RemoveOldest callback keys = %v, want [b]", evicted)
303
+ + }
304
+ +}
305
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
306
+ new file mode 100755
307
+ --- /dev/null
308
+ +++ b/mimo_test_command.sh
309
+ @@ -0,0 +1,5 @@
310
+ +#!/bin/bash
311
+ +set -euo pipefail
312
+ +
313
+ +
314
+ +go test ./lib/lru
tasks/format-code-task-000013/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
+ lib/lru/synthesis_lru_contract_test.go
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-000013/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000022/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:e5915160e52cff553af177130ed7a1e58011a84b9f7d1efe47800d77bba975c1
tasks/format-code-task-000022/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-000022/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-000022/tests/test.patch ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/tests/functional/test_accounts.py b/tests/functional/test_accounts.py
2
+ index f3f387c7bb..2d32cc5e16 100644
3
+ --- a/tests/functional/test_accounts.py
4
+ +++ b/tests/functional/test_accounts.py
5
+ @@ -95,9 +95,8 @@ def test_recover_signer(signer, message):
6
+
7
+ def test_sign_eip712_message(signer):
8
+ foo = Foo(signer.address) # type: ignore[call-arg]
9
+ - message = foo.signable_message
10
+ - signature = signer.sign_message(message)
11
+ - assert signer.check_signature(message, signature)
12
+ + signature = signer.sign_message(foo)
13
+ + assert signer.check_signature(foo, signature)
14
+
15
+
16
+ def test_sign_message_with_prompts(runner, keyfile_account, message):
17
+ diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64
18
+ new file mode 100644
19
+ --- /dev/null
20
+ +++ b/mimo_build_env.tar.gz.b64
21
+ @@ -0,0 +1,5 @@
22
+ +H4sIAAAAAAAAA+3S3YrCMBAF4F73KUb22vzURh9H0jRLCzaRJin49qYV3EVwvVEWd8930QnthCac
23
+ +YU3qD+3euokXryKynVJLzW7rspaqkpUUstrl91KqXEi97ETfpBD1SFSM3sef+h59f1PsK/9oQ9wb
24
+ +PwzatSx0z/vHo/yl2l7zF5s6519vRV2QeN4R7vvn+X+seNM73ujQlaalZQga25bBp9FY4vO1OZvm
25
+ ++Zj7tIn9pKMtj6fYeUfrgfIq76H5EfhncrnDO324jJM2xicXAzueaD2Vv31bAAAAAAAAAAAAAAAA
26
+ +AAAAAIC/5QyAQt2qACgAAA==
27
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
28
+ new file mode 100755
29
+ --- /dev/null
30
+ +++ b/mimo_test_command.sh
31
+ @@ -0,0 +1,6 @@
32
+ +#!/usr/bin/env bash
33
+ +
34
+ +set -uo pipefail
35
+ +cd /testbed || exit 1
36
+ +base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1
37
+ +exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'
tasks/format-code-task-000022/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/functional/test_accounts.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-000022/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000025/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:4fe75c4a4c4e6210d4a87aa10998fcb93c66a6ec1f851bdcbd96415bf286c4bd
tasks/format-code-task-000025/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-000025/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-000025/tests/test.patch ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/test/types/lean.test.ts b/test/types/lean.test.ts
2
+ index b6f9e5380..caa572c29 100644
3
+ --- a/test/types/lean.test.ts
4
+ +++ b/test/types/lean.test.ts
5
+ @@ -1,4 +1,5 @@
6
+ -import { Schema, model, Types, InferSchemaType, FlattenMaps } from 'mongoose';
7
+ +import { Schema, model, Types, InferSchemaType, FlattenMaps, UpdateWriteOpResult } from 'mongoose';
8
+ +import { DeleteResult } from 'mongodb';
9
+ import { expectAssignable, expectError, expectType } from 'tsd';
10
+
11
+ function gh10345() {
12
+ @@ -196,3 +197,81 @@ async function gh13345_3() {
13
+ const place = await PlaceModel.findOne().lean().orFail().exec();
14
+ expectAssignable<Place>(place);
15
+ }
16
+ +
17
+ +async function gh13345_lean_updateOne() {
18
+ + interface IDBUser {
19
+ + name: string;
20
+ + email: string;
21
+ + }
22
+ + const UserModel = model<IDBUser>('GH13345UpdateOne', new Schema<IDBUser>({ name: String, email: String }));
23
+ +
24
+ + const res = await UserModel.updateOne({}, { name: 'foo' }).lean();
25
+ + expectType<UpdateWriteOpResult>(res);
26
+ +
27
+ + const resMany = await UserModel.updateMany({}, { name: 'foo' }).lean();
28
+ + expectType<UpdateWriteOpResult>(resMany);
29
+ +}
30
+ +
31
+ +async function gh13345_lean_deleteOne() {
32
+ + interface IDBUser {
33
+ + name: string;
34
+ + }
35
+ + const UserModel = model<IDBUser>('GH13345DeleteOne', new Schema<IDBUser>({ name: String }));
36
+ +
37
+ + const res = await UserModel.deleteOne({}).lean();
38
+ + expectType<DeleteResult>(res);
39
+ +
40
+ + const resMany = await UserModel.deleteMany({}).lean();
41
+ + expectType<DeleteResult>(resMany);
42
+ +}
43
+ +
44
+ +async function gh13345_lean_count() {
45
+ + interface IDBUser {
46
+ + name: string;
47
+ + }
48
+ + const UserModel = model<IDBUser>('GH13345Count', new Schema<IDBUser>({ name: String }));
49
+ +
50
+ + const cnt = await UserModel.count({}).lean();
51
+ + expectType<number>(cnt);
52
+ +
53
+ + const cntDocs = await UserModel.countDocuments({}).lean();
54
+ + expectType<number>(cntDocs);
55
+ +
56
+ + const est = await UserModel.estimatedDocumentCount().lean();
57
+ + expectType<number>(est);
58
+ +}
59
+ +
60
+ +async function gh13345_lean_distinct() {
61
+ + interface IDBUser {
62
+ + name: string;
63
+ + }
64
+ + const UserModel = model<IDBUser>('GH13345Distinct', new Schema<IDBUser>({ name: String }));
65
+ +
66
+ + const values = await UserModel.distinct<string>('name').lean();
67
+ + expectType<string[]>(values);
68
+ +}
69
+ +
70
+ +async function gh13345_lean_findOne_preserved() {
71
+ + interface IDBUser {
72
+ + name: string;
73
+ + email: string;
74
+ + }
75
+ + const UserModel = model<IDBUser>('GH13345FindOne', new Schema<IDBUser>({ name: String, email: String }));
76
+ +
77
+ + const doc = await UserModel.findOne({}).lean();
78
+ + if (doc) {
79
+ + expectType<string>(doc.name);
80
+ + expectType<string>(doc.email);
81
+ + }
82
+ +}
83
+ +
84
+ +async function gh13345_lean_find_preserved() {
85
+ + interface IDBUser {
86
+ + name: string;
87
+ + }
88
+ + const UserModel = model<IDBUser>('GH13345Find', new Schema<IDBUser>({ name: String }));
89
+ +
90
+ + const docs = await UserModel.find({}).lean();
91
+ + expectType<string>(docs[0].name);
92
+ + expectType<Types.ObjectId>(docs[0]._id);
93
+ +}
94
+ diff --git a/test_commands.json b/test_commands.json
95
+ new file mode 100644
96
+ index 000000000..0f7dbefd0
97
+ --- /dev/null
98
+ +++ b/test_commands.json
99
+ @@ -0,0 +1,3 @@
100
+ +{
101
+ + "test_commands": ["npx tsd"]
102
+ +}
103
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
104
+ new file mode 100755
105
+ --- /dev/null
106
+ +++ b/mimo_test_command.sh
107
+ @@ -0,0 +1,8 @@
108
+ +#!/usr/bin/env bash
109
+ +
110
+ +set -uo pipefail
111
+ +cd /testbed
112
+ +rc=0
113
+ +npx tsd
114
+ +rc=$(( rc | $? ))
115
+ +exit $rc
tasks/format-code-task-000025/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/lean.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-000025/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000157/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:47e3207c887b99e4e5ba56c100dc7b801b7c171022130db0611c177f1e828c93
tasks/format-code-task-000157/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-000157/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-000157/tests/test.patch ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/test_commands.json b/test_commands.json
2
+ new file mode 100644
3
+ index 0000000..c00841c
4
+ --- /dev/null
5
+ +++ b/test_commands.json
6
+ @@ -0,0 +1,3 @@
7
+ +{
8
+ + "test_commands": ["python -m pytest tests/atest/rules/misc/argument_overwritten_before_usage/test_rule.py -v"]
9
+ +}
10
+ diff --git a/tests/atest/rules/misc/argument_overwritten_before_usage/expected_output_leak.txt b/tests/atest/rules/misc/argument_overwritten_before_usage/expected_output_leak.txt
11
+ new file mode 100644
12
+ index 0000000..e69de29
13
+ diff --git a/tests/atest/rules/misc/argument_overwritten_before_usage/test_leak.robot b/tests/atest/rules/misc/argument_overwritten_before_usage/test_leak.robot
14
+ new file mode 100644
15
+ index 0000000..2b476f9
16
+ --- /dev/null
17
+ +++ b/tests/atest/rules/misc/argument_overwritten_before_usage/test_leak.robot
18
+ @@ -0,0 +1,14 @@
19
+ +*** Keywords ***
20
+ +Keyword With Unused Arg
21
+ + [Arguments] ${resp}
22
+ + Log Hello
23
+ +
24
+ +
25
+ +*** Test Cases ***
26
+ +Test Reusing Arg Name From Previous Keyword
27
+ + ${resp}= Set Variable foo
28
+ + Log ${resp}
29
+ +
30
+ +Second Test Reusing Arg Name
31
+ + ${resp}= Set Variable bar
32
+ + Log ${resp}
33
+ diff --git a/tests/atest/rules/misc/argument_overwritten_before_usage/test_rule.py b/tests/atest/rules/misc/argument_overwritten_before_usage/test_rule.py
34
+ index 6f16891..0a0e390 100644
35
+ --- a/tests/atest/rules/misc/argument_overwritten_before_usage/test_rule.py
36
+ +++ b/tests/atest/rules/misc/argument_overwritten_before_usage/test_rule.py
37
+ @@ -14,3 +14,11 @@ class TestRuleAcceptance(RuleAcceptance):
38
+ issue_format="end_col",
39
+ target_version="<5",
40
+ )
41
+ +
42
+ + def test_arguments_do_not_leak_into_test_case(self):
43
+ + self.check_rule(
44
+ + src_files=["test_leak.robot"],
45
+ + expected_file="expected_output_leak.txt",
46
+ + issue_format="end_col",
47
+ + target_version=">=5",
48
+ + )
49
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
50
+ new file mode 100755
51
+ --- /dev/null
52
+ +++ b/mimo_test_command.sh
53
+ @@ -0,0 +1,8 @@
54
+ +#!/usr/bin/env bash
55
+ +
56
+ +set -uo pipefail
57
+ +cd /testbed
58
+ +rc=0
59
+ +python -m pytest -v -rA tests/atest/rules/misc/argument_overwritten_before_usage/test_rule.py::TestRuleAcceptance::test_arguments_do_not_leak_into_test_case
60
+ +rc=$(( rc | $? ))
61
+ +exit $rc
tasks/format-code-task-000157/tests/test.sh ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_commands.json
25
+ tests/atest/rules/misc/argument_overwritten_before_usage/expected_output_leak.txt
26
+ tests/atest/rules/misc/argument_overwritten_before_usage/test_leak.robot
27
+ tests/atest/rules/misc/argument_overwritten_before_usage/test_rule.py
28
+ mimo_test_command.sh
29
+ EOF_RESET_TEST_FILES
30
+
31
+ ); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
32
+ if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
33
+ cat "$V/apply.log" >&2
34
+ echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
35
+ exit 1
36
+ fi
37
+ timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
38
+ RC=$?
39
+ tail -c 12000 "$V/test_output.log"
40
+ if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
41
+ echo "test command exited $RC"
tasks/format-code-task-000157/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000159/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:2260ba9564e3b8fd5b8163f14e752cc9c8cc8caa4b8f6f6292b2c4f1e78fb116
tasks/format-code-task-000159/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-000159/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-000159/tests/test.patch ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/test_commands.json b/test_commands.json
2
+ new file mode 100644
3
+ index 0000000..d18025a
4
+ --- /dev/null
5
+ +++ b/test_commands.json
6
+ @@ -0,0 +1,3 @@
7
+ +{
8
+ + "test_commands": ["python -m pytest tests/test_simplify.py -k sim118"]
9
+ +}
10
+ diff --git a/tests/test_simplify.py b/tests/test_simplify.py
11
+ index 7246b63..9099897 100644
12
+ --- a/tests/test_simplify.py
13
+ +++ b/tests/test_simplify.py
14
+ @@ -571,3 +571,38 @@ def test_sim300_int():
15
+ assert ret == {
16
+ "1:0 SIM300 Use 'age == 42' instead of '42 == age' (Yoda-conditions)"
17
+ }
18
+ +
19
+ +
20
+ +def test_sim118_basic():
21
+ + ret = _results("key in d.keys()")
22
+ + assert ret == {
23
+ + "1:0 SIM118 Use 'key in d' instead of 'key in d.keys()'"
24
+ + }
25
+ +
26
+ +
27
+ +def test_sim118_actual_key_name():
28
+ +
29
+ +
30
+ + ret = _results("x in foo.keys()")
31
+ + assert ret == {
32
+ + "1:0 SIM118 Use 'x in foo' instead of 'x in foo.keys()'"
33
+ + }
34
+ +
35
+ +
36
+ +def test_sim118_no_trigger_plain_in():
37
+ + ret = _results("key in d")
38
+ + sim118 = {r for r in ret if "SIM118" in r}
39
+ + assert sim118 == set()
40
+ +
41
+ +
42
+ +def test_sim118_no_trigger_values():
43
+ + ret = _results("key in d.values()")
44
+ + sim118 = {r for r in ret if "SIM118" in r}
45
+ + assert sim118 == set()
46
+ +
47
+ +
48
+ +def test_sim118_attribute_dict():
49
+ + ret = _results("k in obj.attr.keys()")
50
+ + assert ret == {
51
+ + "1:0 SIM118 Use 'k in obj.attr' instead of 'k in obj.attr.keys()'"
52
+ + }
53
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
54
+ new file mode 100755
55
+ --- /dev/null
56
+ +++ b/mimo_test_command.sh
57
+ @@ -0,0 +1,8 @@
58
+ +#!/usr/bin/env bash
59
+ +
60
+ +set -uo pipefail
61
+ +cd /testbed
62
+ +rc=0
63
+ +python -m pytest -rA tests/test_simplify.py::test_sim118_basic tests/test_simplify.py::test_sim118_actual_key_name tests/test_simplify.py::test_sim118_no_trigger_plain_in tests/test_simplify.py::test_sim118_no_trigger_values tests/test_simplify.py::test_sim118_attribute_dict
64
+ +rc=$(( rc | $? ))
65
+ +exit $rc
tasks/format-code-task-000159/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_commands.json
25
+ tests/test_simplify.py
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-000159/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000161/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:22f7adcead3eec653474086724a2eaac7da8104bc561de2cd8fd15d5db5ce5e3
tasks/format-code-task-000161/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-000161/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-000161/tests/test.patch ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/test_commands.json b/test_commands.json
2
+ new file mode 100644
3
+ index 0000000..3e09ceb
4
+ --- /dev/null
5
+ +++ b/test_commands.json
6
+ @@ -0,0 +1,3 @@
7
+ +{
8
+ + "test_commands": ["python -m pytest tests/test_simplify.py -k sim905 -v"]
9
+ +}
10
+ diff --git a/tests/test_simplify.py b/tests/test_simplify.py
11
+ index 0304702..ab9aad0 100644
12
+ --- a/tests/test_simplify.py
13
+ +++ b/tests/test_simplify.py
14
+ @@ -943,3 +943,76 @@ def test_sim904():
15
+ a['b'] = 'c'"""
16
+ )
17
+ assert results == {"1:0 SIM904 Initialize dictionary 'a' directly"}
18
+ +
19
+ +
20
+ +def _sim905_results(code: str):
21
+ + return [r for r in _results(code) if " SIM905 " in r]
22
+ +
23
+ +
24
+ +def test_sim905():
25
+ + sim905 = _sim905_results('domains = "de com net org".split()')
26
+ + # Exactly one SIM905 fired on line 1
27
+ + assert len(sim905) == 1
28
+ + msg = next(iter(sim905))
29
+ + assert msg.startswith("1:")
30
+ + assert " SIM905 " in msg
31
+ + # Suggestion mentions all four split parts
32
+ + for token in ("de", "com", "net", "org"):
33
+ + assert token in msg
34
+ + # Suggestion references the original split call
35
+ + assert ".split()" in msg
36
+ +
37
+ +
38
+ +def test_sim905_already_list_not_flagged():
39
+ + results = _results('domains = ["de", "com", "net", "org"]')
40
+ + assert not any("SIM905" in r for r in results)
41
+ +
42
+ +
43
+ +def test_sim905_variable_split_not_flagged():
44
+ + results = _results("x = y.split()")
45
+ + assert not any("SIM905" in r for r in results)
46
+ +
47
+ +
48
+ +def test_sim905_fstring_not_flagged():
49
+ + results = _results('x = f"a b c".split()')
50
+ + assert not any("SIM905" in r for r in results)
51
+ +
52
+ +
53
+ +def test_sim905_non_split_method_not_flagged():
54
+ + results = _results('x = "a b c".upper()')
55
+ + assert not any("SIM905" in r for r in results)
56
+ +
57
+ +
58
+ +def test_sim905_non_constant_value_not_flagged():
59
+ + results = _results("x = (a + b).split()")
60
+ + assert not any("SIM905" in r for r in results)
61
+ +
62
+ +
63
+ +def test_sim905_empty_string():
64
+ + sim905 = _sim905_results('x = "".split()')
65
+ + assert len(sim905) == 1
66
+ + msg = next(iter(sim905))
67
+ + assert msg.startswith("1:")
68
+ + assert " SIM905 " in msg
69
+ + # The empty list should appear in the suggestion
70
+ + assert "[]" in msg
71
+ +
72
+ +
73
+ +def test_sim905_single_word():
74
+ + sim905 = _sim905_results('x = "hello".split()')
75
+ + assert len(sim905) == 1
76
+ + msg = next(iter(sim905))
77
+ + assert msg.startswith("1:")
78
+ + assert " SIM905 " in msg
79
+ + assert "hello" in msg
80
+ +
81
+ +
82
+ +def test_sim905_inside_function_call():
83
+ + """SIM905 should fire even when not part of an assignment."""
84
+ + sim905 = _sim905_results('print("a b c".split())')
85
+ + assert len(sim905) == 1
86
+ + msg = next(iter(sim905))
87
+ + assert msg.startswith("1:")
88
+ + assert " SIM905 " in msg
89
+ + for token in ("a", "b", "c"):
90
+ + assert token in msg
91
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
92
+ new file mode 100755
93
+ --- /dev/null
94
+ +++ b/mimo_test_command.sh
95
+ @@ -0,0 +1,8 @@
96
+ +#!/usr/bin/env bash
97
+ +
98
+ +set -uo pipefail
99
+ +cd /testbed
100
+ +rc=0
101
+ +python -m pytest -v -rA tests/test_simplify.py::test_sim905 tests/test_simplify.py::test_sim905_already_list_not_flagged tests/test_simplify.py::test_sim905_variable_split_not_flagged tests/test_simplify.py::test_sim905_fstring_not_flagged tests/test_simplify.py::test_sim905_non_split_method_not_flagged tests/test_simplify.py::test_sim905_non_constant_value_not_flagged tests/test_simplify.py::test_sim905_empty_string tests/test_simplify.py::test_sim905_single_word tests/test_simplify.py::test_sim905_inside_function_call
102
+ +rc=$(( rc | $? ))
103
+ +exit $rc
tasks/format-code-task-000161/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_commands.json
25
+ tests/test_simplify.py
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-000161/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000166/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:b5fc24cc7260d2d7eec429a2c71cd74e5aeb724e452cd2427984cca82d939656
tasks/format-code-task-000166/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-000166/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-000166/tests/test.patch ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/pkg/copier/mapfields_test.go b/pkg/copier/mapfields_test.go
2
+ new file mode 100644
3
+ index 0000000..059279e
4
+ --- /dev/null
5
+ +++ b/pkg/copier/mapfields_test.go
6
+ @@ -0,0 +1,172 @@
7
+ +
8
+ +
9
+ +
10
+ +
11
+ +
12
+ +
13
+ +
14
+ +
15
+ +
16
+ +
17
+ +
18
+ +
19
+ +
20
+ +
21
+ +package copier
22
+ +
23
+ +import (
24
+ + "reflect"
25
+ + "testing"
26
+ +)
27
+ +
28
+ +
29
+ +
30
+ +
31
+ +func replacer(name string) string {
32
+ + values := map[string]string{
33
+ + "key": "realkey",
34
+ + "val": "realval",
35
+ + "x": "X",
36
+ + "y": "Y",
37
+ + }
38
+ + if v, ok := values[name]; ok {
39
+ + return v
40
+ + }
41
+ + return "$" + name
42
+ +}
43
+ +
44
+ +type mapHolder struct {
45
+ + Data map[string]string
46
+ + Other map[string]string
47
+ +}
48
+ +
49
+ +func TestSubstituteMapValuesOnly(t *testing.T) {
50
+ + src := &mapHolder{Data: map[string]string{"$key": "$val"}}
51
+ + got := CopyWithReplacements(src, replacer, "Data.Values").(*mapHolder)
52
+ +
53
+ + want := map[string]string{"$key": "realval"}
54
+ + if !reflect.DeepEqual(got.Data, want) {
55
+ + t.Fatalf("Data.Values: expected %v, got %v", want, got.Data)
56
+ + }
57
+ +}
58
+ +
59
+ +func TestSubstituteMapKeysOnly(t *testing.T) {
60
+ + src := &mapHolder{Data: map[string]string{"$key": "$val"}}
61
+ + got := CopyWithReplacements(src, replacer, "Data.Keys").(*mapHolder)
62
+ +
63
+ + want := map[string]string{"realkey": "$val"}
64
+ + if !reflect.DeepEqual(got.Data, want) {
65
+ + t.Fatalf("Data.Keys: expected %v, got %v", want, got.Data)
66
+ + }
67
+ +}
68
+ +
69
+ +func TestSubstituteMapFieldSelectsBoth(t *testing.T) {
70
+ + src := &mapHolder{Data: map[string]string{"$key": "$val"}}
71
+ + got := CopyWithReplacements(src, replacer, "Data").(*mapHolder)
72
+ +
73
+ + want := map[string]string{"realkey": "realval"}
74
+ + if !reflect.DeepEqual(got.Data, want) {
75
+ + t.Fatalf("Data: expected %v, got %v", want, got.Data)
76
+ + }
77
+ +}
78
+ +
79
+ +func TestSubstituteMapNothingSelected(t *testing.T) {
80
+ + src := &mapHolder{Data: map[string]string{"$key": "$val"}}
81
+ + got := CopyWithReplacements(src, replacer).(*mapHolder)
82
+ +
83
+ + want := map[string]string{"$key": "$val"}
84
+ + if !reflect.DeepEqual(got.Data, want) {
85
+ + t.Fatalf("no selection: expected %v, got %v", want, got.Data)
86
+ + }
87
+ +}
88
+ +
89
+ +func TestSubstituteMapOnlySelectedMapAffected(t *testing.T) {
90
+ + src := &mapHolder{
91
+ + Data: map[string]string{"$key": "$val"},
92
+ + Other: map[string]string{"$key": "$val"},
93
+ + }
94
+ + got := CopyWithReplacements(src, replacer, "Data.Keys", "Data.Values").(*mapHolder)
95
+ +
96
+ + if !reflect.DeepEqual(got.Data, map[string]string{"realkey": "realval"}) {
97
+ + t.Fatalf("Data: expected fully substituted map, got %v", got.Data)
98
+ + }
99
+ + if !reflect.DeepEqual(got.Other, map[string]string{"$key": "$val"}) {
100
+ + t.Fatalf("Other: expected untouched map, got %v", got.Other)
101
+ + }
102
+ +}
103
+ +
104
+ +type inner struct {
105
+ + Title string
106
+ + Note string
107
+ +}
108
+ +
109
+ +type nestedHolder struct {
110
+ + Cfg map[string]inner
111
+ +}
112
+ +
113
+ +func TestSubstituteIntoMapValueStructField(t *testing.T) {
114
+ + src := &nestedHolder{Cfg: map[string]inner{
115
+ + "$key": {Title: "$x", Note: "$y"},
116
+ + }}
117
+ + got := CopyWithReplacements(src, replacer, "Cfg.Values.Title").(*nestedHolder)
118
+ +
119
+ + want := map[string]inner{
120
+ + "$key": {Title: "X", Note: "$y"},
121
+ + }
122
+ + if !reflect.DeepEqual(got.Cfg, want) {
123
+ + t.Fatalf("Cfg.Values.Title: expected %v, got %v", want, got.Cfg)
124
+ + }
125
+ +}
126
+ +
127
+ +func TestSubstituteWildcardCoversMapKeysAndValues(t *testing.T) {
128
+ + src := &mapHolder{Data: map[string]string{"$key": "$val"}}
129
+ + got := CopyWithReplacements(src, replacer, "*").(*mapHolder)
130
+ +
131
+ + want := map[string]string{"realkey": "realval"}
132
+ + if !reflect.DeepEqual(got.Data, want) {
133
+ + t.Fatalf("wildcard: expected %v, got %v", want, got.Data)
134
+ + }
135
+ +}
136
+ +
137
+ +type strHolder struct {
138
+ + Name string
139
+ + Plain string
140
+ +}
141
+ +
142
+ +func TestSubstituteStringFieldByPath(t *testing.T) {
143
+ + src := &strHolder{Name: "$x", Plain: "$y"}
144
+ + got := CopyWithReplacements(src, replacer, "Name").(*strHolder)
145
+ +
146
+ + if got.Name != "X" {
147
+ + t.Fatalf("Name: expected substituted value X, got %q", got.Name)
148
+ + }
149
+ + if got.Plain != "$y" {
150
+ + t.Fatalf("Plain: expected untouched $y, got %q", got.Plain)
151
+ + }
152
+ +}
153
+ +
154
+ +func TestCopyProducesIndependentDeepCopy(t *testing.T) {
155
+ + src := &mapHolder{Data: map[string]string{"$key": "$val"}}
156
+ + got := Copy(src).(*mapHolder)
157
+ +
158
+ +
159
+ + if !reflect.DeepEqual(got.Data, map[string]string{"$key": "$val"}) {
160
+ + t.Fatalf("Copy should not substitute, got %v", got.Data)
161
+ + }
162
+ +
163
+ +
164
+ + got.Data["$key"] = "changed"
165
+ + if src.Data["$key"] != "$val" {
166
+ + t.Fatalf("Copy is not a deep copy: source mutated to %q", src.Data["$key"])
167
+ + }
168
+ +}
169
+ +
170
+ +func TestCopyWithReplacementsIndependentFromSource(t *testing.T) {
171
+ + src := &mapHolder{Data: map[string]string{"$key": "$val"}}
172
+ + got := CopyWithReplacements(src, replacer, "Data.Values").(*mapHolder)
173
+ +
174
+ + got.Data["$key"] = "changed"
175
+ + if src.Data["$key"] != "$val" {
176
+ + t.Fatalf("result shares storage with source: source mutated to %q", src.Data["$key"])
177
+ + }
178
+ +}
179
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
180
+ new file mode 100755
181
+ --- /dev/null
182
+ +++ b/mimo_test_command.sh
183
+ @@ -0,0 +1,20 @@
184
+ +#!/usr/bin/env bash
185
+ +
186
+ +
187
+ +
188
+ +set -euo pipefail
189
+ +HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
190
+ +cd /testbed
191
+ +
192
+ +
193
+ +
194
+ +
195
+ +
196
+ +export GO111MODULE=off
197
+ +PKG=github.com/Mirantis/k8s-AppController
198
+ +
199
+ +
200
+ +go test "${PKG}/pkg/resources/"
201
+ +
202
+ +
203
+ +go test "${PKG}/pkg/copier/"
tasks/format-code-task-000166/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
+ pkg/copier/mapfields_test.go
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-000166/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000168/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:c19722a4554d1acf1607308ee921d0831829e952f19235d0d9701945300fb7e4
tasks/format-code-task-000168/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-000168/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-000168/tests/test.patch ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/test/python/pycute/test_swizzle_composed_layout.py b/test/python/pycute/test_swizzle_composed_layout.py
2
+ new file mode 100644
3
+ index 00000000..395ca1e4
4
+ --- /dev/null
5
+ +++ b/test/python/pycute/test_swizzle_composed_layout.py
6
+ @@ -0,0 +1,81 @@
7
+ +
8
+ +
9
+ +
10
+ +
11
+ +
12
+ +
13
+ +
14
+ +import unittest
15
+ +
16
+ +from pycute import *
17
+ +
18
+ +
19
+ +class TestSwizzleComposedLayout(unittest.TestCase):
20
+ + def _call(self, fn):
21
+ + try:
22
+ + return fn()
23
+ + except Exception as exc:
24
+ + self.fail(f"public layout operation raised {type(exc).__name__}: {exc}")
25
+ +
26
+ + def test_swizzle_is_layout_and_has_extent(self):
27
+ + swizzle = Swizzle(2, 1, 2)
28
+ + self.assertTrue(is_layout(swizzle))
29
+ + self.assertEqual(self._call(swizzle.size), 32)
30
+ + self.assertEqual(self._call(swizzle.cosize), 32)
31
+ +
32
+ + def test_swizzle_mapping_is_bijective_for_both_shift_directions(self):
33
+ + for swizzle in (Swizzle(2, 1, 2), Swizzle(2, 0, -3)):
34
+ + extent = 32
35
+ + values = [swizzle(i) for i in range(extent)]
36
+ + self.assertEqual(sorted(values), list(range(extent)))
37
+ + self.assertEqual([swizzle(value) for value in values], list(range(extent)))
38
+ +
39
+ + def test_zero_bit_swizzle_is_identity(self):
40
+ + swizzle = Swizzle(0, 3, 0)
41
+ + self.assertEqual(self._call(swizzle.size), 8)
42
+ + self.assertEqual(self._call(swizzle.cosize), 8)
43
+ + self.assertEqual([swizzle(i) for i in range(8)], list(range(8)))
44
+ +
45
+ + def test_swizzle_value_equality_is_structural(self):
46
+ + self.assertEqual(Swizzle(2, 1, 2), Swizzle(2, 1, 2))
47
+ + self.assertNotEqual(Swizzle(2, 1, 2), Swizzle(1, 1, 2))
48
+ + self.assertNotEqual(Swizzle(2, 1, 2), Swizzle(2, 0, -2))
49
+ + self.assertFalse(Swizzle(2, 1, 2) == Layout(32))
50
+ +
51
+ + def _composed(self):
52
+ + return ComposedLayout(Layout(64, 3), 5, Layout((2, 3), (1, 2)))
53
+ +
54
+ + def test_composed_mapping_and_extents(self):
55
+ + composed = self._composed()
56
+ + self.assertTrue(is_layout(composed))
57
+ + self.assertEqual(composed(1, 2), 30)
58
+ + self.assertEqual(size(composed), 6)
59
+ + self.assertEqual(cosize(composed), 190)
60
+ +
61
+ + def test_composed_mode_indexing_preserves_mapping(self):
62
+ + composed = self._composed()
63
+ + self.assertEqual(composed[0](1), composed(1, 0))
64
+ + self.assertEqual(composed[1](2), composed(0, 2))
65
+ +
66
+ + def test_composed_value_equality_is_type_safe(self):
67
+ + composed = self._composed()
68
+ + self.assertEqual(composed, self._composed())
69
+ + self.assertNotEqual(composed, ComposedLayout(Layout(64, 3), 6, Layout((2, 3), (1, 2))))
70
+ + self.assertFalse(self._call(lambda: composed.__eq__(Layout((2, 3), (1, 2)))))
71
+ +
72
+ + def test_composed_slicing_preserves_outer_mapping(self):
73
+ + composed = self._composed()
74
+ + sliced = self._call(lambda: composed(None, 1))
75
+ + self.assertEqual(size(sliced), 2)
76
+ + self.assertEqual(cosize(sliced), 190)
77
+ + self.assertEqual([sliced(i) for i in range(2)], [composed(i, 1) for i in range(2)])
78
+ +
79
+ + def test_swizzled_composed_slicing_preserves_mapping(self):
80
+ + composed = ComposedLayout(Swizzle(2, 0, 2), 1, Layout((2, 4), (1, 2)))
81
+ + sliced = self._call(lambda: composed(None, 2))
82
+ + self.assertEqual(size(sliced), 2)
83
+ + self.assertEqual([sliced(i) for i in range(2)], [composed(i, 2) for i in range(2)])
84
+ +
85
+ +
86
+ +if __name__ == "__main__":
87
+ + unittest.main()
88
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
89
+ new file mode 100755
90
+ --- /dev/null
91
+ +++ b/mimo_test_command.sh
92
+ @@ -0,0 +1,4 @@
93
+ +#!/bin/bash
94
+ +set -euo pipefail
95
+ +
96
+ +PYTHONPATH=python python3 test/python/pycute/run_all_tests.py
tasks/format-code-task-000168/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/python/pycute/test_swizzle_composed_layout.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-000168/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000192/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:3991049ff3e10014965fbffe0b102449ca664b29ddf0cf4484b6b6f39cda34e5
tasks/format-code-task-000192/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