AdithyaSK HF Staff commited on
Commit
32f3b2a
·
verified ·
1 Parent(s): 6a536e1

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-000102/environment/Dockerfile +3 -0
  2. tasks/format-code-task-000102/environment/setup/files/blocklist +33 -0
  3. tasks/format-code-task-000102/environment/setup/setup.sh +34 -0
  4. tasks/format-code-task-000102/tests/test.patch +263 -0
  5. tasks/format-code-task-000102/tests/test.sh +39 -0
  6. tasks/format-code-task-000102/tests/test_command.sh +1 -0
  7. tasks/format-code-task-000111/environment/Dockerfile +3 -0
  8. tasks/format-code-task-000111/environment/setup/files/blocklist +33 -0
  9. tasks/format-code-task-000111/environment/setup/setup.sh +34 -0
  10. tasks/format-code-task-000111/tests/test.patch +111 -0
  11. tasks/format-code-task-000111/tests/test.sh +40 -0
  12. tasks/format-code-task-000111/tests/test_command.sh +1 -0
  13. tasks/format-code-task-000116/environment/Dockerfile +3 -0
  14. tasks/format-code-task-000116/environment/setup/files/blocklist +33 -0
  15. tasks/format-code-task-000116/environment/setup/setup.sh +34 -0
  16. tasks/format-code-task-000116/tests/test.patch +36 -0
  17. tasks/format-code-task-000116/tests/test.sh +39 -0
  18. tasks/format-code-task-000116/tests/test_command.sh +1 -0
  19. tasks/format-code-task-000118/environment/Dockerfile +3 -0
  20. tasks/format-code-task-000118/environment/setup/files/blocklist +33 -0
  21. tasks/format-code-task-000118/environment/setup/setup.sh +34 -0
  22. tasks/format-code-task-000118/tests/test.patch +584 -0
  23. tasks/format-code-task-000118/tests/test.sh +40 -0
  24. tasks/format-code-task-000118/tests/test_command.sh +1 -0
  25. tasks/format-code-task-000127/environment/Dockerfile +3 -0
  26. tasks/format-code-task-000127/environment/setup/files/blocklist +33 -0
  27. tasks/format-code-task-000127/environment/setup/setup.sh +34 -0
  28. tasks/format-code-task-000127/tests/test.patch +38 -0
  29. tasks/format-code-task-000127/tests/test.sh +39 -0
  30. tasks/format-code-task-000127/tests/test_command.sh +1 -0
  31. tasks/format-code-task-000133/environment/Dockerfile +3 -0
  32. tasks/format-code-task-000133/environment/setup/files/blocklist +33 -0
  33. tasks/format-code-task-000133/environment/setup/setup.sh +34 -0
  34. tasks/format-code-task-000133/tests/test.patch +421 -0
  35. tasks/format-code-task-000133/tests/test.sh +39 -0
  36. tasks/format-code-task-000133/tests/test_command.sh +1 -0
  37. tasks/format-code-task-000134/environment/Dockerfile +3 -0
  38. tasks/format-code-task-000134/environment/setup/files/blocklist +33 -0
  39. tasks/format-code-task-000134/environment/setup/setup.sh +34 -0
  40. tasks/format-code-task-000134/tests/test.patch +184 -0
  41. tasks/format-code-task-000134/tests/test.sh +38 -0
  42. tasks/format-code-task-000134/tests/test_command.sh +1 -0
  43. tasks/format-code-task-000173/environment/Dockerfile +3 -0
  44. tasks/format-code-task-000173/environment/setup/files/blocklist +33 -0
  45. tasks/format-code-task-000173/environment/setup/setup.sh +34 -0
  46. tasks/format-code-task-000173/tests/test.patch +57 -0
  47. tasks/format-code-task-000173/tests/test.sh +39 -0
  48. tasks/format-code-task-000173/tests/test_command.sh +1 -0
  49. tasks/format-code-task-000174/environment/Dockerfile +3 -0
  50. tasks/format-code-task-000174/environment/setup/files/blocklist +33 -0
tasks/format-code-task-000102/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:4fd7f890d78d050c5505fed18089f91a9e48610085b8883956a4a2fac0fe9826
tasks/format-code-task-000102/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-000102/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-000102/tests/test.patch ADDED
@@ -0,0 +1,263 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/test_commands.json b/test_commands.json
2
+ new file mode 100644
3
+ index 0000000..b4edd94
4
+ --- /dev/null
5
+ +++ b/test_commands.json
6
+ @@ -0,0 +1,3 @@
7
+ +{
8
+ + "test_commands": ["python -m pytest tests/unit/test_iam_user_format.py -v"]
9
+ +}
10
+ diff --git a/tests/unit/test_iam_user_format.py b/tests/unit/test_iam_user_format.py
11
+ new file mode 100644
12
+ index 0000000..ddd723d
13
+ --- /dev/null
14
+ +++ b/tests/unit/test_iam_user_format.py
15
+ @@ -0,0 +1,235 @@
16
+ +
17
+ +
18
+ +
19
+ +
20
+ +
21
+ +
22
+ +
23
+ +
24
+ +
25
+ +
26
+ +
27
+ +
28
+ +
29
+ +
30
+ +
31
+ +"""
32
+ +Tests for automatic IAM database username formatting.
33
+ +
34
+ +These tests exercise the user-facing entry point Connector.connect(...)
35
+ +with enable_iam_auth=True and verify that the `user` kwarg passed down
36
+ +to the underlying driver is correctly formatted based on the Cloud SQL
37
+ +database engine version (Postgres vs. MySQL).
38
+ +"""
39
+ +import datetime
40
+ +from typing import Any, Dict
41
+ +
42
+ +import pytest # noqa F401 Needed to run the tests
43
+ +from mock import patch
44
+ +
45
+ +from google.cloud.sql.connector import Connector
46
+ +
47
+ +
48
+ +class _FakeMetadata:
49
+ +
50
+ +
51
+ + def __init__(self, database_version: str) -> None:
52
+ + self.database_version = database_version
53
+ + self.context = None
54
+ + self.ip_addrs = {"PRIMARY": "127.0.0.1"}
55
+ + self.expiration = datetime.datetime.now() + datetime.timedelta(minutes=10)
56
+ +
57
+ +
58
+ +class _FakeInstance:
59
+ +
60
+ +
61
+ + def __init__(self, database_version: str, enable_iam_auth: bool) -> None:
62
+ + self._enable_iam_auth = enable_iam_auth
63
+ + self._database_version = database_version
64
+ +
65
+ + async def connect_info(self, ip_type: Any) -> Any:
66
+ + return _FakeMetadata(self._database_version), "127.0.0.1"
67
+ +
68
+ + async def close(self) -> None:
69
+ + return None
70
+ +
71
+ + def force_refresh(self) -> None:
72
+ + return None
73
+ +
74
+ +
75
+ +def _capture_driver_kwargs(
76
+ + database_version: str,
77
+ + driver: str,
78
+ + user: str,
79
+ + enable_iam_auth: bool = True,
80
+ +) -> Dict[str, Any]:
81
+ +
82
+ +
83
+ +
84
+ +
85
+ +
86
+ +
87
+ + captured: Dict[str, Any] = {}
88
+ +
89
+ + def _fake_sync_connect(ip_address: str, ctx: Any, **kwargs: Any) -> Any:
90
+ + captured.update(kwargs)
91
+ + return "fake_connection"
92
+ +
93
+ + async def _fake_async_connect(ip_address: str, ctx: Any, **kwargs: Any) -> Any:
94
+ + captured.update(kwargs)
95
+ + return "fake_connection"
96
+ +
97
+ + connector = Connector(enable_iam_auth=enable_iam_auth)
98
+ + try:
99
+ + connect_string = "test-project:test-region:test-instance"
100
+ + connector._instances[connect_string] = _FakeInstance( # type: ignore[assignment]
101
+ + database_version, enable_iam_auth=enable_iam_auth
102
+ + )
103
+ + with patch(
104
+ + "google.cloud.sql.connector.pg8000.connect",
105
+ + side_effect=_fake_sync_connect,
106
+ + ), patch(
107
+ + "google.cloud.sql.connector.pymysql.connect",
108
+ + side_effect=_fake_sync_connect,
109
+ + ), patch(
110
+ + "google.cloud.sql.connector.asyncpg.connect",
111
+ + side_effect=_fake_async_connect,
112
+ + ):
113
+ + connector.connect(
114
+ + connect_string,
115
+ + driver,
116
+ + user=user,
117
+ + password="my-pass",
118
+ + db="my-db",
119
+ + )
120
+ + finally:
121
+ +
122
+ + try:
123
+ + connector.close()
124
+ + except Exception:
125
+ + pass
126
+ + return captured
127
+ +
128
+ +
129
+ +
130
+ +
131
+ +
132
+ +
133
+ +
134
+ +def test_postgres_iam_user_with_gserviceaccount_suffix_is_truncated() -> None:
135
+ +
136
+ +
137
+ +
138
+ +
139
+ +
140
+ + kwargs = _capture_driver_kwargs(
141
+ + database_version="POSTGRES_14",
142
+ + driver="pg8000",
143
+ + user="test-user@my-project.iam.gserviceaccount.com",
144
+ + )
145
+ + assert kwargs["user"] == "test-user@my-project.iam"
146
+ +
147
+ +
148
+ +def test_postgres_iam_user_without_suffix_is_unchanged() -> None:
149
+ +
150
+ +
151
+ +
152
+ +
153
+ + kwargs = _capture_driver_kwargs(
154
+ + database_version="POSTGRES_14",
155
+ + driver="pg8000",
156
+ + user="test-user@example.com",
157
+ + )
158
+ + assert kwargs["user"] == "test-user@example.com"
159
+ +
160
+ +
161
+ +def test_postgres_iam_bare_username_is_unchanged() -> None:
162
+ +
163
+ +
164
+ +
165
+ +
166
+ + kwargs = _capture_driver_kwargs(
167
+ + database_version="POSTGRES_14",
168
+ + driver="pg8000",
169
+ + user="test-user",
170
+ + )
171
+ + assert kwargs["user"] == "test-user"
172
+ +
173
+ +
174
+ +
175
+ +
176
+ +
177
+ +
178
+ +
179
+ +def test_mysql_iam_user_with_at_sign_is_truncated() -> None:
180
+ +
181
+ +
182
+ +
183
+ +
184
+ + kwargs = _capture_driver_kwargs(
185
+ + database_version="MYSQL_8_0",
186
+ + driver="pymysql",
187
+ + user="test-user@gmail.com",
188
+ + )
189
+ + assert kwargs["user"] == "test-user"
190
+ +
191
+ +
192
+ +def test_mysql_iam_service_account_user_is_truncated() -> None:
193
+ +
194
+ +
195
+ +
196
+ +
197
+ +
198
+ + kwargs = _capture_driver_kwargs(
199
+ + database_version="MYSQL_8_0",
200
+ + driver="pymysql",
201
+ + user="my-sa@my-project.iam.gserviceaccount.com",
202
+ + )
203
+ + assert kwargs["user"] == "my-sa"
204
+ +
205
+ +
206
+ +def test_mysql_iam_bare_username_is_unchanged() -> None:
207
+ +
208
+ +
209
+ +
210
+ +
211
+ + kwargs = _capture_driver_kwargs(
212
+ + database_version="MYSQL_8_0",
213
+ + driver="pymysql",
214
+ + user="test-user",
215
+ + )
216
+ + assert kwargs["user"] == "test-user"
217
+ +
218
+ +
219
+ +
220
+ +
221
+ +
222
+ +
223
+ +
224
+ +def test_postgres_no_iam_auth_user_is_unchanged() -> None:
225
+ +
226
+ +
227
+ +
228
+ +
229
+ +
230
+ + kwargs = _capture_driver_kwargs(
231
+ + database_version="POSTGRES_14",
232
+ + driver="pg8000",
233
+ + user="test-user@my-project.iam.gserviceaccount.com",
234
+ + enable_iam_auth=False,
235
+ + )
236
+ + assert kwargs["user"] == "test-user@my-project.iam.gserviceaccount.com"
237
+ +
238
+ +
239
+ +def test_mysql_no_iam_auth_user_is_unchanged() -> None:
240
+ +
241
+ +
242
+ +
243
+ +
244
+ + kwargs = _capture_driver_kwargs(
245
+ + database_version="MYSQL_8_0",
246
+ + driver="pymysql",
247
+ + user="test-user@gmail.com",
248
+ + enable_iam_auth=False,
249
+ + )
250
+ + assert kwargs["user"] == "test-user@gmail.com"
251
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
252
+ new file mode 100755
253
+ --- /dev/null
254
+ +++ b/mimo_test_command.sh
255
+ @@ -0,0 +1,8 @@
256
+ +#!/usr/bin/env bash
257
+ +
258
+ +set -uo pipefail
259
+ +cd /testbed
260
+ +rc=0
261
+ +python -m pytest -v -rA tests/unit/test_iam_user_format.py::test_postgres_iam_user_with_gserviceaccount_suffix_is_truncated tests/unit/test_iam_user_format.py::test_postgres_iam_user_without_suffix_is_unchanged tests/unit/test_iam_user_format.py::test_postgres_iam_bare_username_is_unchanged tests/unit/test_iam_user_format.py::test_mysql_iam_user_with_at_sign_is_truncated tests/unit/test_iam_user_format.py::test_mysql_iam_service_account_user_is_truncated tests/unit/test_iam_user_format.py::test_mysql_iam_bare_username_is_unchanged tests/unit/test_iam_user_format.py::test_postgres_no_iam_auth_user_is_unchanged tests/unit/test_iam_user_format.py::test_mysql_no_iam_auth_user_is_unchanged
262
+ +rc=$(( rc | $? ))
263
+ +exit $rc
tasks/format-code-task-000102/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/unit/test_iam_user_format.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-000102/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000111/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:91fc2eabe54156d7e7ffeb84baffd9f4fd82ec4776b09b3c8aa029fc89023bfe
tasks/format-code-task-000111/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-000111/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-000111/tests/test.patch ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/test/datepicker_test.js b/test/datepicker_test.js
2
+ index cb89f1103a..0dbed586a0 100644
3
+ --- a/test/datepicker_test.js
4
+ +++ b/test/datepicker_test.js
5
+ @@ -8,6 +8,7 @@ import Day from "../src/day";
6
+ import TestWrapper from "./test_wrapper.jsx";
7
+ import PopperComponent from "../src/popper_component.jsx";
8
+ import TimezoneDatePicker from "./timezone_date_picker.jsx";
9
+ +import CustomInput from "./helper_components/custom_input.jsx";
10
+ import * as utils from "../src/date_utils";
11
+
12
+ function getKey(key) {
13
+ @@ -791,7 +792,44 @@ describe("DatePicker", () => {
14
+ datePicker.update();
15
+ expect(datePicker.find("input").prop("value")).to.equal("1");
16
+ });
17
+ -
18
+ + it("should call onChangeRaw with all arguments", () => {
19
+ + const inputValue = "test";
20
+ + const onChangeRawSpy = sandbox.spy();
21
+ + const datePicker = TestUtils.renderIntoDocument(
22
+ + <DatePicker
23
+ + selected={utils.newDate()}
24
+ + onChange={sandbox.spy()}
25
+ + customInput={<CustomInput />}
26
+ + onChangeRaw={onChangeRawSpy}
27
+ + />
28
+ + );
29
+ + expect(onChangeRawSpy.called).to.be.false;
30
+ + const input = ReactDOM.findDOMNode(datePicker.input);
31
+ + input.value = inputValue;
32
+ + TestUtils.Simulate.change(input);
33
+ + expect(onChangeRawSpy.calledOnce).to.be.true;
34
+ + expect(onChangeRawSpy.args[0][0].target.value).to.equal(inputValue);
35
+ + expect(onChangeRawSpy.args[0][1]).to.equal("test");
36
+ + });
37
+ + it("should handle the lack of an 'event' object as the first argument to handleChange analogously to 'preventDefault' being called", () => {
38
+ + const inputValue = "test";
39
+ + const onChangeRawSpy = sandbox.spy();
40
+ + let customInput = <CustomInput onChangeArgs={e => [e.target.value]} />;
41
+ + const datePicker = TestUtils.renderIntoDocument(
42
+ + <DatePicker
43
+ + selected={utils.newDate()}
44
+ + onChange={sandbox.spy()}
45
+ + customInput={customInput}
46
+ + onChangeRaw={onChangeRawSpy}
47
+ + />
48
+ + );
49
+ + expect(onChangeRawSpy.called).to.be.false;
50
+ + const input = ReactDOM.findDOMNode(datePicker.input);
51
+ + input.value = inputValue;
52
+ + TestUtils.Simulate.change(input);
53
+ + expect(onChangeRawSpy.calledOnce).to.be.true;
54
+ + expect(onChangeRawSpy.args[0][0]).to.equal("test");
55
+ + });
56
+ it("should handle a click outside of the calendar", () => {
57
+ const datePicker = mount(
58
+ <DatePicker selected={utils.newDate()} withPortal />
59
+ diff --git a/test/helper_components/custom_input.jsx b/test/helper_components/custom_input.jsx
60
+ new file mode 100644
61
+ index 0000000000..4064b35d03
62
+ --- /dev/null
63
+ +++ b/test/helper_components/custom_input.jsx
64
+ @@ -0,0 +1,25 @@
65
+ +import React from "react";
66
+ +import PropTypes from "prop-types";
67
+ +
68
+ +class CustomInput extends React.Component {
69
+ + onChange(e) {
70
+ + var args = [e, e.target.value];
71
+ + if (this.props.onChangeArgs) {
72
+ + args = this.props.onChangeArgs(e);
73
+ + }
74
+ + this.props.onChange.apply(this, args);
75
+ + }
76
+ +
77
+ + render() {
78
+ + let { ...props } = this.props;
79
+ + delete props.onChangeArgs;
80
+ + return <input {...props} onChange={this.onChange.bind(this)} />
81
+ + }
82
+ +}
83
+ +
84
+ +CustomInput.propTypes = {
85
+ + onChange: PropTypes.func,
86
+ + onChangeArgs: PropTypes.func
87
+ +};
88
+ +
89
+ +export default CustomInput;
90
+
91
+ diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64
92
+ new file mode 100644
93
+ --- /dev/null
94
+ +++ b/mimo_build_env.tar.gz.b64
95
+ @@ -0,0 +1,5 @@
96
+ +H4sIAAAAAAAAA+3SQU/DIBQH8J77KTCeSwGlO3lz1+22awMtc50rLECXfnxpTdSY6C5bjPr/Xd7L
97
+ +g4QHD6qH7tDWxp7K7FpYspByjsnnOOdcCiYW4q5iImOcV6lE5NU6+mAIUXlCMu9c/G7fufVfir7P
98
+ +P5oQ68b1vbItDbvLnXFu/vyev81fpjwVKi4ywi7Xwtf++fxvb0rd2VKrsMublsyfQJs2N+PR+UhW
99
+ +68dlvVxtHqZ6Pp62uvCDJfY4kmfle0Wm14uvOW2c3dJ9IEUROvt0MNPW/KcvCAAAAAAAAAAAAAAA
100
+ +AAAAAADwh70AVONooQAoAAA=
101
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
102
+ new file mode 100755
103
+ --- /dev/null
104
+ +++ b/mimo_test_command.sh
105
+ @@ -0,0 +1,6 @@
106
+ +#!/usr/bin/env bash
107
+ +
108
+ +set -uo pipefail
109
+ +cd /testbed || exit 1
110
+ +base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1
111
+ +exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'
tasks/format-code-task-000111/tests/test.sh ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
3
+ # task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
4
+ M=/var/lib/mimo
5
+ CWD=/testbed
6
+ V=/logs/verifier
7
+ mkdir -p "$V"
8
+ BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
9
+ cd "$CWD" || exit 1
10
+ if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
11
+ # the agent's change against the base, so its own commits count too
12
+ git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
13
+ git reset -q
14
+ if ! (
15
+ while IFS= read -r tf; do
16
+ [ -z "$tf" ] && continue
17
+ if git cat-file -e $BASE:"$tf" 2>/dev/null; then
18
+ git checkout $BASE -- "$tf" 2>/dev/null || true
19
+ else
20
+ git rm -f --cached "$tf" >/dev/null 2>&1 || true
21
+ rm -f "$tf"
22
+ fi
23
+ done <<'EOF_RESET_TEST_FILES'
24
+ test/datepicker_test.js
25
+ test/helper_components/custom_input.jsx
26
+ mimo_build_env.tar.gz.b64
27
+ mimo_test_command.sh
28
+ EOF_RESET_TEST_FILES
29
+
30
+ ); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
31
+ if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
32
+ cat "$V/apply.log" >&2
33
+ echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
34
+ exit 1
35
+ fi
36
+ timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
37
+ RC=$?
38
+ tail -c 12000 "$V/test_output.log"
39
+ if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
40
+ echo "test command exited $RC"
tasks/format-code-task-000111/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000116/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:5191cba7cf2ae83979e1f2b4460656d03341fb022b6147bb02072ab355d3a457
tasks/format-code-task-000116/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-000116/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-000116/tests/test.patch ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/hypothesis-python/tests/cover/test_lookup_py39.py b/hypothesis-python/tests/cover/test_lookup_py39.py
2
+ index c860cd3bce..0cd538289b 100644
3
+ --- a/hypothesis-python/tests/cover/test_lookup_py39.py
4
+ +++ b/hypothesis-python/tests/cover/test_lookup_py39.py
5
+ @@ -149,3 +149,11 @@ def test_only_tuple_subclasses_in_typing_type():
6
+ with temp_registered(FooableConcrete, st.builds(FooableConcrete)):
7
+ s = st.from_type(Fooable[int])
8
+ assert_all_examples(s, lambda x: type(x) is FooableConcrete)
9
+ +
10
+ +
11
+ +def test_lookup_registered_tuple():
12
+ + sentinel = object()
13
+ + typ = tuple[int]
14
+ + with temp_registered(tuple, st.just(sentinel)):
15
+ + assert st.from_type(typ).example() is sentinel
16
+ + assert st.from_type(typ).example() is not sentinel
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,4 @@
22
+ +H4sIAAAAAAAAA+3SUYrCMBSF4T67imygNWmMMqsp2gYqY5vQpIXufkKFUQT1RRkG/+8ll+RCbjgp
23
+ +DuPx1FS2n9bZu8hkZ8yyJrfrUitTKrU1Sssyk0qZncmEedtEV8YQ94MQ2eBcfNT37PyfKi75Rxti
24
+ +Vbuu2/dNEdrX3fEsf1Xq3/yVVin/zVam/OXrRrjvw/OvG7EEf7DNys+xdb0WeSdSmTZFO3sXWxuO
25
+ +IT8fLr1hXbvJDucPc3Lue/SVn/VX4WeRT6u/fhIAAAAAAAAAAAAAAADwMX4AzZsw0wAoAAA=
26
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
27
+ new file mode 100755
28
+ --- /dev/null
29
+ +++ b/mimo_test_command.sh
30
+ @@ -0,0 +1,6 @@
31
+ +#!/usr/bin/env bash
32
+ +
33
+ +set -uo pipefail
34
+ +cd /testbed || exit 1
35
+ +base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1
36
+ +exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'
tasks/format-code-task-000116/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
+ hypothesis-python/tests/cover/test_lookup_py39.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-000116/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000118/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:8a9c417e8edbb35e8fce0b69d414a66f65f9dcf2e590aad579725a52f39263d0
tasks/format-code-task-000118/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-000118/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-000118/tests/test.patch ADDED
@@ -0,0 +1,584 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/ibm/acctest/acctest_policy_assignment_env_test.go b/ibm/acctest/acctest_policy_assignment_env_test.go
2
+ new file mode 100644
3
+ index 000000000..a9d0319c0
4
+ --- /dev/null
5
+ +++ b/ibm/acctest/acctest_policy_assignment_env_test.go
6
+ @@ -0,0 +1,62 @@
7
+ +package acctest
8
+ +
9
+ +import (
10
+ + "os"
11
+ + "os/exec"
12
+ + "strings"
13
+ + "testing"
14
+ +)
15
+ +
16
+ +const policyAssignmentEnvHelper = "IBM_POLICY_ASSIGNMENT_ENV_HELPER"
17
+ +
18
+ +func runAcctestHelper(t *testing.T, name string, env ...string) (string, error) {
19
+ + t.Helper()
20
+ + cmd := exec.Command(os.Args[0], "-test.run=^"+name+"$", "-test.v")
21
+ + cmd.Env = append(os.Environ(), policyAssignmentEnvHelper+"=1")
22
+ + cmd.Env = append(cmd.Env, env...)
23
+ + out, err := cmd.CombinedOutput()
24
+ + return string(out), err
25
+ +}
26
+ +
27
+ +func TestAcctestPolicyAssignmentTargetAccountEnv(t *testing.T) {
28
+ + out, err := runAcctestHelper(
29
+ + t,
30
+ + "TestHelperAcctestPolicyAssignmentTargetAccountEnv",
31
+ + "IBM_POLICY_ASSIGNMENT_TARGET_ACCOUNT_ID=target-account-from-env",
32
+ + )
33
+ + if err != nil {
34
+ + t.Fatalf("helper failed: %v\n%s", err, out)
35
+ + }
36
+ + if strings.Contains(out, "IBM_POLICY_ASSIGNMENT_TARGET_ACCOUNT_ID") {
37
+ + t.Fatalf("set-env output should not ask for IBM_POLICY_ASSIGNMENT_TARGET_ACCOUNT_ID; output:\n%s", out)
38
+ + }
39
+ +}
40
+ +
41
+ +func TestHelperAcctestPolicyAssignmentTargetAccountEnv(t *testing.T) {
42
+ + if os.Getenv(policyAssignmentEnvHelper) != "1" {
43
+ + t.Skip("helper test")
44
+ + }
45
+ +}
46
+ +
47
+ +func TestAcctestPolicyAssignmentTargetAccountEnvMissingNotice(t *testing.T) {
48
+ + out, err := runAcctestHelper(
49
+ + t,
50
+ + "TestHelperAcctestPolicyAssignmentTargetAccountEnvMissingNotice",
51
+ + "IBM_POLICY_ASSIGNMENT_TARGET_ACCOUNT_ID=",
52
+ + )
53
+ + if err != nil {
54
+ + t.Fatalf("helper failed: %v\n%s", err, out)
55
+ + }
56
+ + if !strings.Contains(out, "IBM_POLICY_ASSIGNMENT_TARGET_ACCOUNT_ID") {
57
+ + t.Fatalf("missing-env output should mention IBM_POLICY_ASSIGNMENT_TARGET_ACCOUNT_ID; output:\n%s", out)
58
+ + }
59
+ + if !strings.Contains(out, "ibm_iam_policy_assignment") {
60
+ + t.Fatalf("missing-env output should mention ibm_iam_policy_assignment; output:\n%s", out)
61
+ + }
62
+ +}
63
+ +
64
+ +func TestHelperAcctestPolicyAssignmentTargetAccountEnvMissingNotice(t *testing.T) {
65
+ + if os.Getenv(policyAssignmentEnvHelper) != "1" {
66
+ + t.Skip("helper test")
67
+ + }
68
+ +}
69
+ diff --git a/ibm/service/iampolicy/resource_ibm_iam_policy_assignment_schema_test.go b/ibm/service/iampolicy/resource_ibm_iam_policy_assignment_schema_test.go
70
+ new file mode 100644
71
+ index 000000000..928f23955
72
+ --- /dev/null
73
+ +++ b/ibm/service/iampolicy/resource_ibm_iam_policy_assignment_schema_test.go
74
+ @@ -0,0 +1,267 @@
75
+ +package iampolicy_test
76
+ +
77
+ +import (
78
+ + "go/ast"
79
+ + "go/parser"
80
+ + "go/token"
81
+ + "path/filepath"
82
+ + "testing"
83
+ +
84
+ + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
85
+ +
86
+ + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/provider"
87
+ +)
88
+ +
89
+ +func iamPolicyAssignmentResource(t *testing.T) *schema.Resource {
90
+ + t.Helper()
91
+ + p := provider.Provider()
92
+ + r, ok := p.ResourcesMap["ibm_iam_policy_assignment"]
93
+ + if !ok {
94
+ + t.Fatalf("provider does not register ibm_iam_policy_assignment")
95
+ + }
96
+ + return r
97
+ +}
98
+ +
99
+ +func TestIBMIAMPolicyAssignmentResourceRegistered(t *testing.T) {
100
+ + p := provider.Provider()
101
+ + if _, ok := p.ResourcesMap["ibm_iam_policy_assignment"]; !ok {
102
+ + t.Fatalf("expected provider to register ibm_iam_policy_assignment")
103
+ + }
104
+ +}
105
+ +
106
+ +func TestIBMIAMPolicyAssignmentLifecycleHandlersWired(t *testing.T) {
107
+ + r := iamPolicyAssignmentResource(t)
108
+ +
109
+ + if r.CreateContext == nil {
110
+ + t.Fatalf("ibm_iam_policy_assignment should have a create handler")
111
+ + }
112
+ + if r.ReadContext == nil {
113
+ + t.Fatalf("ibm_iam_policy_assignment should have a read handler")
114
+ + }
115
+ + if r.UpdateContext == nil {
116
+ + t.Fatalf("ibm_iam_policy_assignment should have an update handler")
117
+ + }
118
+ + if r.DeleteContext == nil {
119
+ + t.Fatalf("ibm_iam_policy_assignment should have a delete handler")
120
+ + }
121
+ +}
122
+ +
123
+ +func TestIBMIAMPolicyAssignmentRequiredTopLevelSchema(t *testing.T) {
124
+ + r := iamPolicyAssignmentResource(t)
125
+ +
126
+ + cases := []struct {
127
+ + name string
128
+ + field string
129
+ + schemaType schema.ValueType
130
+ + }{
131
+ + {name: "version", field: "version", schemaType: schema.TypeString},
132
+ + {name: "target", field: "target", schemaType: schema.TypeMap},
133
+ + {name: "templates", field: "templates", schemaType: schema.TypeList},
134
+ + {name: "options", field: "options", schemaType: schema.TypeList},
135
+ + }
136
+ +
137
+ + for _, tc := range cases {
138
+ + t.Run(tc.name, func(t *testing.T) {
139
+ + s, ok := r.Schema[tc.field]
140
+ + if !ok {
141
+ + t.Fatalf("schema missing %q", tc.field)
142
+ + }
143
+ + if !s.Required {
144
+ + t.Fatalf("%q should be required", tc.field)
145
+ + }
146
+ + if s.Type != tc.schemaType {
147
+ + t.Fatalf("%q type = %v, want %v", tc.field, s.Type, tc.schemaType)
148
+ + }
149
+ + })
150
+ + }
151
+ +}
152
+ +
153
+ +func TestIBMIAMPolicyAssignmentNestedRequiredSchema(t *testing.T) {
154
+ + r := iamPolicyAssignmentResource(t)
155
+ +
156
+ + templates, ok := r.Schema["templates"]
157
+ + if !ok {
158
+ + t.Fatalf("schema missing templates")
159
+ + }
160
+ + templateResource, ok := templates.Elem.(*schema.Resource)
161
+ + if !ok {
162
+ + t.Fatalf("templates element should be a nested resource")
163
+ + }
164
+ + for _, field := range []string{"id", "version"} {
165
+ + s, ok := templateResource.Schema[field]
166
+ + if !ok {
167
+ + t.Fatalf("templates element missing %q", field)
168
+ + }
169
+ + if !s.Required || s.Type != schema.TypeString {
170
+ + t.Fatalf("templates.%s should be a required string", field)
171
+ + }
172
+ + }
173
+ +
174
+ + options, ok := r.Schema["options"]
175
+ + if !ok {
176
+ + t.Fatalf("schema missing options")
177
+ + }
178
+ + optionsResource, ok := options.Elem.(*schema.Resource)
179
+ + if !ok {
180
+ + t.Fatalf("options element should be a nested resource")
181
+ + }
182
+ + root, ok := optionsResource.Schema["root"]
183
+ + if !ok {
184
+ + t.Fatalf("options element missing root")
185
+ + }
186
+ + if !root.Required || root.Type != schema.TypeList {
187
+ + t.Fatalf("options.root should be a required list block")
188
+ + }
189
+ + rootResource, ok := root.Elem.(*schema.Resource)
190
+ + if !ok {
191
+ + t.Fatalf("options.root element should be a nested resource")
192
+ + }
193
+ + requesterID, ok := rootResource.Schema["requester_id"]
194
+ + if !ok {
195
+ + t.Fatalf("options.root missing requester_id")
196
+ + }
197
+ + if !requesterID.Required || requesterID.Type != schema.TypeString {
198
+ + t.Fatalf("options.root.requester_id should be a required string")
199
+ + }
200
+ +}
201
+ +
202
+ +func TestIBMIAMPolicyAssignmentCardinalityAndDefault(t *testing.T) {
203
+ + r := iamPolicyAssignmentResource(t)
204
+ +
205
+ + for _, field := range []string{"templates", "options"} {
206
+ + s, ok := r.Schema[field]
207
+ + if !ok {
208
+ + t.Fatalf("schema missing %q", field)
209
+ + }
210
+ + if s.MinItems != 1 || s.MaxItems != 1 {
211
+ + t.Fatalf("%q should accept exactly one item, got MinItems=%d MaxItems=%d", field, s.MinItems, s.MaxItems)
212
+ + }
213
+ + }
214
+ +
215
+ + acceptLanguage, ok := r.Schema["accept_language"]
216
+ + if !ok {
217
+ + t.Fatalf("schema missing accept_language")
218
+ + }
219
+ + if !acceptLanguage.Optional {
220
+ + t.Fatalf("accept_language should be optional")
221
+ + }
222
+ + if got := acceptLanguage.Default; got != "default" {
223
+ + t.Fatalf("accept_language default = %#v, want %q", got, "default")
224
+ + }
225
+ +}
226
+ +
227
+ +func TestIBMIAMPolicyAssignmentComputedMetadataSchema(t *testing.T) {
228
+ + r := iamPolicyAssignmentResource(t)
229
+ +
230
+ + for _, field := range []string{
231
+ + "account_id",
232
+ + "href",
233
+ + "created_at",
234
+ + "created_by_id",
235
+ + "last_modified_at",
236
+ + "last_modified_by_id",
237
+ + } {
238
+ + s, ok := r.Schema[field]
239
+ + if !ok {
240
+ + t.Fatalf("schema missing computed metadata field %q", field)
241
+ + }
242
+ + if !s.Computed || s.Type != schema.TypeString {
243
+ + t.Fatalf("%q should be a computed string", field)
244
+ + }
245
+ + }
246
+ +
247
+ + resources, ok := r.Schema["resources"]
248
+ + if !ok {
249
+ + t.Fatalf("schema missing resources")
250
+ + }
251
+ + if !resources.Computed || resources.Type != schema.TypeList {
252
+ + t.Fatalf("resources should be a computed list")
253
+ + }
254
+ + resourceElem, ok := resources.Elem.(*schema.Resource)
255
+ + if !ok {
256
+ + t.Fatalf("resources element should be a nested resource")
257
+ + }
258
+ + target, ok := resourceElem.Schema["target"]
259
+ + if !ok {
260
+ + t.Fatalf("resources element missing target")
261
+ + }
262
+ + if target.Type != schema.TypeMap {
263
+ + t.Fatalf("resources.target should be a map")
264
+ + }
265
+ +
266
+ + if !schemaTreeHasComputedString(resourceElem, "id") {
267
+ + t.Fatalf("resources should expose a computed policy id somewhere in the nested result schema")
268
+ + }
269
+ + if !schemaTreeHasComputedString(resourceElem, "status") {
270
+ + t.Fatalf("resources should expose a computed status somewhere in the nested result schema")
271
+ + }
272
+ + if computedCollectionCount(resourceElem) < 2 {
273
+ + t.Fatalf("resources should expose nested computed policy result details, got fewer than two computed nested collections")
274
+ + }
275
+ +}
276
+ +
277
+ +func TestIBMIAMPolicyAssignmentAccountIDIsNotHardCoded(t *testing.T) {
278
+ + fileSet := token.NewFileSet()
279
+ + files, err := filepath.Glob("*.go")
280
+ + if err != nil {
281
+ + t.Fatalf("failed to enumerate policy assignment source files: %v", err)
282
+ + }
283
+ + for _, file := range files {
284
+ + parsed, err := parser.ParseFile(fileSet, file, nil, 0)
285
+ + if err != nil {
286
+ + continue
287
+ + }
288
+ + ast.Inspect(parsed, func(n ast.Node) bool {
289
+ + call, ok := n.(*ast.CallExpr)
290
+ + if !ok || !isDataSetCall(call, "account_id") || len(call.Args) < 2 {
291
+ + return true
292
+ + }
293
+ + if _, ok := call.Args[1].(*ast.BasicLit); ok {
294
+ + t.Fatalf("account_id should be populated from assignment data, not from a literal")
295
+ + }
296
+ + return true
297
+ + })
298
+ + }
299
+ +}
300
+ +
301
+ +func schemaTreeHasComputedString(r *schema.Resource, field string) bool {
302
+ + found := false
303
+ + walkSchemaResource(r, func(name string, s *schema.Schema) {
304
+ + if name == field && s.Computed && s.Type == schema.TypeString {
305
+ + found = true
306
+ + }
307
+ + })
308
+ + return found
309
+ +}
310
+ +
311
+ +func computedCollectionCount(r *schema.Resource) int {
312
+ + count := 0
313
+ + walkSchemaResource(r, func(_ string, s *schema.Schema) {
314
+ + if s.Computed && (s.Type == schema.TypeList || s.Type == schema.TypeSet || s.Type == schema.TypeMap) {
315
+ + count++
316
+ + }
317
+ + })
318
+ + return count
319
+ +}
320
+ +
321
+ +func walkSchemaResource(r *schema.Resource, visit func(string, *schema.Schema)) {
322
+ + for name, s := range r.Schema {
323
+ + visit(name, s)
324
+ + if nested, ok := s.Elem.(*schema.Resource); ok {
325
+ + walkSchemaResource(nested, visit)
326
+ + }
327
+ + }
328
+ +}
329
+ +
330
+ +func isDataSetCall(call *ast.CallExpr, field string) bool {
331
+ + selector, ok := call.Fun.(*ast.SelectorExpr)
332
+ + if !ok || selector.Sel.Name != "Set" || len(call.Args) == 0 {
333
+ + return false
334
+ + }
335
+ + receiver, ok := selector.X.(*ast.Ident)
336
+ + if !ok || receiver.Name != "d" {
337
+ + return false
338
+ + }
339
+ + lit, ok := call.Args[0].(*ast.BasicLit)
340
+ + return ok && lit.Value == `"`+field+`"`
341
+ +}
342
+ diff --git a/ibm/service/iampolicy/resource_ibm_iam_policy_assignment_test.go b/ibm/service/iampolicy/resource_ibm_iam_policy_assignment_test.go
343
+ new file mode 100644
344
+ index 000000000..9cd43ed47
345
+ --- /dev/null
346
+ +++ b/ibm/service/iampolicy/resource_ibm_iam_policy_assignment_test.go
347
+ @@ -0,0 +1,211 @@
348
+ +
349
+ +
350
+ +
351
+ +package iampolicy_test
352
+ +
353
+ +import (
354
+ + "fmt"
355
+ + "os"
356
+ + "testing"
357
+ +
358
+ + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
359
+ + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
360
+ + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
361
+ +
362
+ + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest"
363
+ + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns"
364
+ + "github.com/IBM/platform-services-go-sdk/iampolicymanagementv1"
365
+ +)
366
+ +
367
+ +func TestAccIBMPolicyAssignmentBasic(t *testing.T) {
368
+ + var conf iampolicymanagementv1.GetPolicyAssignmentResponse
369
+ + var name string = fmt.Sprintf("TerraformTemplateTest%d", acctest.RandIntRange(10, 100))
370
+ +
371
+ + resource.Test(t, resource.TestCase{
372
+ + PreCheck: func() { acc.TestAccPreCheck(t) },
373
+ + Providers: acc.TestAccProviders,
374
+ + CheckDestroy: testAccCheckIBMPolicyAssignmentDestroy,
375
+ + Steps: []resource.TestStep{
376
+ + {
377
+ + Config: testAccCheckIBMPolicyAssignmentConfigBasic(name, os.Getenv("IBM_POLICY_ASSIGNMENT_TARGET_ACCOUNT_ID")),
378
+ + Check: resource.ComposeAggregateTestCheckFunc(
379
+ + testAccCheckIBMPolicyAssignmentExists("ibm_iam_policy_assignment.policy_assignment", conf),
380
+ + resource.TestCheckResourceAttrSet("ibm_iam_policy_assignment.policy_assignment", "account_id"),
381
+ + resource.TestCheckResourceAttrSet("ibm_iam_policy_assignment.policy_assignment", "href"),
382
+ + resource.TestCheckResourceAttrSet("ibm_iam_policy_assignment.policy_assignment", "created_at"),
383
+ + resource.TestCheckResourceAttrSet("ibm_iam_policy_assignment.policy_assignment", "created_by_id"),
384
+ + resource.TestCheckResourceAttrSet("ibm_iam_policy_assignment.policy_assignment", "last_modified_at"),
385
+ + resource.TestCheckResourceAttrSet("ibm_iam_policy_assignment.policy_assignment", "last_modified_by_id"),
386
+ + resource.TestCheckResourceAttrSet("ibm_iam_policy_assignment.policy_assignment", "resources.#"),
387
+ + resource.TestCheckResourceAttrSet("ibm_iam_policy_assignment.policy_assignment", "resources.0.target.%"),
388
+ + ),
389
+ + },
390
+ + {
391
+ + Config: testAccCheckIBMPolicyAssignmentConfigUpdate(name, os.Getenv("IBM_POLICY_ASSIGNMENT_TARGET_ACCOUNT_ID")),
392
+ + Check: resource.ComposeAggregateTestCheckFunc(
393
+ + testAccCheckIBMPolicyAssignmentExists("ibm_iam_policy_assignment.policy_assignment", conf),
394
+ + resource.TestCheckResourceAttrSet("ibm_iam_policy_assignment.policy_assignment", "account_id"),
395
+ + resource.TestCheckResourceAttrSet("ibm_iam_policy_assignment.policy_assignment", "href"),
396
+ + resource.TestCheckResourceAttrSet("ibm_iam_policy_assignment.policy_assignment", "created_at"),
397
+ + resource.TestCheckResourceAttrSet("ibm_iam_policy_assignment.policy_assignment", "created_by_id"),
398
+ + resource.TestCheckResourceAttrSet("ibm_iam_policy_assignment.policy_assignment", "last_modified_at"),
399
+ + resource.TestCheckResourceAttrSet("ibm_iam_policy_assignment.policy_assignment", "last_modified_by_id"),
400
+ + resource.TestCheckResourceAttrSet("ibm_iam_policy_assignment.policy_assignment", "resources.#"),
401
+ + resource.TestCheckResourceAttrSet("ibm_iam_policy_assignment.policy_assignment", "resources.0.target.%"),
402
+ + ),
403
+ + },
404
+ + },
405
+ + })
406
+ +}
407
+ +
408
+ +func testAccCheckIBMPolicyAssignmentConfigBasic(name string, targetId string) string {
409
+ + return fmt.Sprintf(`
410
+ + resource "ibm_iam_policy_template" "policy_s2s_template" {
411
+ + name = "%s"
412
+ + policy {
413
+ + type = "authorization"
414
+ + description = "description"
415
+ + resource {
416
+ + attributes {
417
+ + key = "serviceName"
418
+ + operator = "stringEquals"
419
+ + value = "kms"
420
+ + }
421
+ + }
422
+ + roles = ["Reader"]
423
+ + }
424
+ + committed=true
425
+ + }
426
+ + resource "ibm_iam_policy_assignment" "policy_assignment" {
427
+ + version = "1.0"
428
+ + target ={
429
+ + type = "Account"
430
+ + id = "%s"
431
+ + }
432
+ +
433
+ + options {
434
+ + root {
435
+ + requester_id = "orchestrator"
436
+ + assignment_id = "test"
437
+ + }
438
+ + }
439
+ + templates{
440
+ + id = ibm_iam_policy_template.policy_s2s_template.template_id
441
+ + version = ibm_iam_policy_template.policy_s2s_template.version
442
+ + }
443
+ + }`, name, targetId)
444
+ +}
445
+ +
446
+ +func testAccCheckIBMPolicyAssignmentConfigUpdate(name string, targetId string) string {
447
+ + return fmt.Sprintf(`
448
+ + resource "ibm_iam_policy_template" "policy_s2s_template" {
449
+ + name = "%s"
450
+ + policy {
451
+ + type = "authorization"
452
+ + description = "description"
453
+ + resource {
454
+ + attributes {
455
+ + key = "serviceName"
456
+ + operator = "stringEquals"
457
+ + value = "kms"
458
+ + }
459
+ + }
460
+ + roles = ["Reader"]
461
+ + }
462
+ + committed=true
463
+ + }
464
+ + resource "ibm_iam_policy_template_version" "template_version" {
465
+ + template_id = ibm_iam_policy_template.policy_s2s_template.template_id
466
+ + policy {
467
+ + type = "authorization"
468
+ + description = "description"
469
+ + resource {
470
+ + attributes {
471
+ + key = "serviceName"
472
+ + operator = "stringEquals"
473
+ + value = "appid"
474
+ + }
475
+ + }
476
+ + roles = ["Reader"]
477
+ + }
478
+ + committed=true
479
+ + }
480
+ +
481
+ + resource "ibm_iam_policy_assignment" "policy_assignment" {
482
+ + version = "1.0"
483
+ + target ={
484
+ + type = "Account"
485
+ + id = "%s"
486
+ + }
487
+ +
488
+ + options {
489
+ + root {
490
+ + requester_id = "orchestrator"
491
+ + assignment_id = "test"
492
+ + }
493
+ + }
494
+ + templates{
495
+ + id = ibm_iam_policy_template.policy_s2s_template.template_id
496
+ + version = ibm_iam_policy_template.policy_s2s_template.version
497
+ + }
498
+ + template_version=ibm_iam_policy_template_version.template_version.version
499
+ + }`, name, targetId)
500
+ +}
501
+ +
502
+ +func testAccCheckIBMPolicyAssignmentExists(n string, obj iampolicymanagementv1.GetPolicyAssignmentResponse) resource.TestCheckFunc {
503
+ +
504
+ + return func(s *terraform.State) error {
505
+ + rs, ok := s.RootModule().Resources[n]
506
+ + if !ok {
507
+ + return fmt.Errorf("Not found: %s", n)
508
+ + }
509
+ +
510
+ + iamPolicyManagementClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).IAMPolicyManagementV1API()
511
+ + if err != nil {
512
+ + return err
513
+ + }
514
+ +
515
+ + getPolicyAssignmentsOptions := &iampolicymanagementv1.GetPolicyAssignmentOptions{}
516
+ +
517
+ + getPolicyAssignmentsOptions.SetAssignmentID(rs.Primary.ID)
518
+ + getPolicyAssignmentsOptions.SetVersion("1.0")
519
+ +
520
+ + policyAssignmentV1, _, err := iamPolicyManagementClient.GetPolicyAssignment(getPolicyAssignmentsOptions)
521
+ + if err != nil {
522
+ + return err
523
+ + }
524
+ +
525
+ + assignmentDetails := policyAssignmentV1.(*iampolicymanagementv1.GetPolicyAssignmentResponse)
526
+ +
527
+ + obj = *assignmentDetails
528
+ + return nil
529
+ + }
530
+ +}
531
+ +
532
+ +func testAccCheckIBMPolicyAssignmentDestroy(s *terraform.State) error {
533
+ + iamPolicyManagementClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).IAMPolicyManagementV1API()
534
+ + if err != nil {
535
+ + return err
536
+ + }
537
+ + for _, rs := range s.RootModule().Resources {
538
+ + if rs.Type != "ibm_iam_policy_assignment" {
539
+ + continue
540
+ + }
541
+ +
542
+ + getPolicyAssignmentsOptions := &iampolicymanagementv1.GetPolicyAssignmentOptions{}
543
+ +
544
+ + getPolicyAssignmentsOptions.SetAssignmentID(rs.Primary.ID)
545
+ + getPolicyAssignmentsOptions.SetVersion("1.0")
546
+ +
547
+ +
548
+ + _, response, err := iamPolicyManagementClient.GetPolicyAssignment(getPolicyAssignmentsOptions)
549
+ +
550
+ + if err == nil {
551
+ + return fmt.Errorf("policy_assignment still exists: %s", rs.Primary.ID)
552
+ + } else if response.StatusCode != 404 {
553
+ + return fmt.Errorf("Error checking for policy_assignment (%s) has been destroyed: %s", rs.Primary.ID, err)
554
+ + }
555
+ + }
556
+ +
557
+ + return nil
558
+ +}
559
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
560
+ new file mode 100755
561
+ --- /dev/null
562
+ +++ b/mimo_test_command.sh
563
+ @@ -0,0 +1,21 @@
564
+ +#!/bin/bash
565
+ +set -euo pipefail
566
+ +cd /testbed
567
+ +
568
+ +
569
+ +
570
+ +go mod download
571
+ +
572
+ +case "${1:-}" in
573
+ + base)
574
+ + go test -count=1 -run '^$' ./ibm/service/iampolicy ./ibm/acctest
575
+ + ;;
576
+ + new)
577
+ + go test -count=1 -run 'TestIBMIAMPolicyAssignment' ./ibm/service/iampolicy
578
+ + go test -count=1 -run 'TestAcctestPolicyAssignment(TargetAccountEnv|TargetAccountEnvMissingNotice)$' ./ibm/acctest
579
+ + ;;
580
+ + *)
581
+ + echo "usage: $0 base|new"
582
+ + exit 2
583
+ + ;;
584
+ +esac
tasks/format-code-task-000118/tests/test.sh ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
3
+ # task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
4
+ M=/var/lib/mimo
5
+ CWD=/testbed
6
+ V=/logs/verifier
7
+ mkdir -p "$V"
8
+ BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
9
+ cd "$CWD" || exit 1
10
+ if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
11
+ # the agent's change against the base, so its own commits count too
12
+ git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
13
+ git reset -q
14
+ if ! (
15
+ while IFS= read -r tf; do
16
+ [ -z "$tf" ] && continue
17
+ if git cat-file -e $BASE:"$tf" 2>/dev/null; then
18
+ git checkout $BASE -- "$tf" 2>/dev/null || true
19
+ else
20
+ git rm -f --cached "$tf" >/dev/null 2>&1 || true
21
+ rm -f "$tf"
22
+ fi
23
+ done <<'EOF_RESET_TEST_FILES'
24
+ ibm/acctest/acctest_policy_assignment_env_test.go
25
+ ibm/service/iampolicy/resource_ibm_iam_policy_assignment_schema_test.go
26
+ ibm/service/iampolicy/resource_ibm_iam_policy_assignment_test.go
27
+ mimo_test_command.sh
28
+ EOF_RESET_TEST_FILES
29
+
30
+ ); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
31
+ if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
32
+ cat "$V/apply.log" >&2
33
+ echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
34
+ exit 1
35
+ fi
36
+ timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
37
+ RC=$?
38
+ tail -c 12000 "$V/test_output.log"
39
+ if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
40
+ echo "test command exited $RC"
tasks/format-code-task-000118/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new
tasks/format-code-task-000127/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:c880bca682f9acb39abc0c86edce758978214cb874c21a323e68f592a4e540d4
tasks/format-code-task-000127/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-000127/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-000127/tests/test.patch ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/python/jittor/test/test_misc_op.py b/python/jittor/test/test_misc_op.py
2
+ index 65663e53..1d2bee6d 100644
3
+ --- a/python/jittor/test/test_misc_op.py
4
+ +++ b/python/jittor/test/test_misc_op.py
5
+ @@ -115,7 +115,10 @@ def check(shape):
6
+ check((4,3,100,200))
7
+ check((10,3,100,200))
8
+
9
+ -
10
+ + def test_make_grid3(self):
11
+ + arr=np.random.randn(3,10,10)
12
+ + check_equal(torchvision.utils.make_grid(torch.Tensor(arr)), jt.make_grid(jt.array(arr)))
13
+ + check_equal(torchvision.utils.make_grid(torch.Tensor(arr), normalize=True), jt.make_grid(jt.array(arr), normalize=True))
14
+
15
+ def test_save_image(self):
16
+ arr = jt.array(np.random.randn(16,3,10,10))
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,6 @@
22
+ +H4sIAAAAAAAAA+3SQU+DMBQHcM58ihfCQQ8rFFZISDx4MNnFuMPuBFayVYES6Ih+eztI1JjoLlvU
23
+ ++P9xaHmP8Br+sPKgaplX7Rg4lxJaqRDTan1epz0XEbfXMo0SJ+Q8CWOHxMVO9MFhMEVP5PRam++e
24
+ +O9X/o9h7/qYaTL7VTVO0kg378804lX8k0rf8Rcxt/suEC4fC8x3ha/88/62kKfiykm713One0Pp2
25
+ +s7rx/NXD/V3Aupfjr1GqNvOPdc+txqImz7+aGqRaZWhx7bnz7a7WpW3HjIeMJ7Zo9rqNadGQ3dop
26
+ +NFeCR2WM7qfB82/XqGGb686Oy7KNLawLmWVzp3iq8l2vpH3N6P705wIAAAAAAAAAAAAAAAAAAAAA
27
+ ++FVeAaDigyIAKAAA
28
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
29
+ new file mode 100755
30
+ --- /dev/null
31
+ +++ b/mimo_test_command.sh
32
+ @@ -0,0 +1,6 @@
33
+ +#!/usr/bin/env bash
34
+ +
35
+ +set -uo pipefail
36
+ +cd /testbed || exit 1
37
+ +base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1
38
+ +exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'
tasks/format-code-task-000127/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
+ python/jittor/test/test_misc_op.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-000127/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000133/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:acf709816be05b54743e259d3b01c082aaa99c2623953f47f5fc2e292df0c0d8
tasks/format-code-task-000133/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-000133/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-000133/tests/test.patch ADDED
@@ -0,0 +1,421 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/app/common/__tests__/network.test.js b/app/common/__tests__/network.test.js
2
+ index f3bde7a5c..ac19db890 100644
3
+ --- a/app/common/__tests__/network.test.js
4
+ +++ b/app/common/__tests__/network.test.js
5
+ @@ -1,6 +1,10 @@
6
+ import * as networkUtils from '../network';
7
+ import * as db from '../database';
8
+ import nock from 'nock';
9
+ +import dns from 'dns';
10
+ +import fs from 'fs';
11
+ +import http from 'http';
12
+ +import https from 'https';
13
+ import {resolve as pathResolve, join as pathJoin} from 'path';
14
+ import {getRenderedRequest} from '../render';
15
+ import * as models from '../../models';
16
+ @@ -127,7 +131,7 @@ describe('actuallySend()', () => {
17
+ cookies
18
+ });
19
+
20
+ - mock = nock('http://[::1]:80')
21
+ + mock = nock('http://localhost')
22
+ .matchHeader('Content-Type', 'application/json')
23
+ .matchHeader('Authorization', 'Basic dXNlcjpwYXNz')
24
+ .matchHeader('Cookie', 'foo=barrrrr')
25
+ @@ -160,7 +164,7 @@ describe('actuallySend()', () => {
26
+ settings
27
+ );
28
+
29
+ - expect(mock.basePath).toBe('http://::1:80');
30
+ + expect(mock.basePath).toBe('http://localhost:80');
31
+ expect(response.error).toBe('');
32
+ expect(response.url).toBe('http://localhost/?foo%20bar=hello%26world');
33
+ expect(response.body).toBe(new Buffer('response body').toString('base64'));
34
+ @@ -174,7 +178,7 @@ describe('actuallySend()', () => {
35
+ const settings = await models.settings.create();
36
+ await models.cookieJar.create({parentId: workspace._id});
37
+
38
+ - mock = nock('http://[::1]:80')
39
+ + mock = nock('http://localhost')
40
+ .matchHeader('Content-Type', 'application/octet-stream')
41
+ .post('/', 'Hello World!')
42
+ .reply(200, 'response body')
43
+ @@ -199,7 +203,7 @@ describe('actuallySend()', () => {
44
+ settings
45
+ );
46
+
47
+ - expect(mock.basePath).toBe('http://::1:80');
48
+ + expect(mock.basePath).toBe('http://localhost:80');
49
+ expect(response.error).toBe('');
50
+ expect(response.url).toBe('http://localhost/');
51
+ expect(response.body).toBe(new Buffer('response body').toString('base64'));
52
+ @@ -214,7 +218,7 @@ describe('actuallySend()', () => {
53
+ await models.cookieJar.create({parentId: workspace._id});
54
+ const fileName = pathResolve(pathJoin(__dirname, './testfile.txt'));
55
+ let requestBody = 'n/a';
56
+ - mock = nock('http://[::1]:80')
57
+ + mock = nock('http://localhost')
58
+ .matchHeader('Content-Type', /^multipart\/form-data/)
59
+ .post('/', body => {
60
+ requestBody = body;
61
+ @@ -249,7 +253,7 @@ describe('actuallySend()', () => {
62
+ settings
63
+ );
64
+
65
+ - expect(mock.basePath).toBe('http://::1:80');
66
+ + expect(mock.basePath).toBe('http://localhost:80');
67
+ expect(response.error).toBe('');
68
+ expect(response.url).toBe('http://localhost/');
69
+ expect(response.body).toBe(new Buffer('response body').toString('base64'));
70
+ @@ -269,4 +273,272 @@ describe('actuallySend()', () => {
71
+ expect(lines[9]).toMatch(/^----------------------------\d{24}--/);
72
+ expect(lines[10]).toBe('');
73
+ });
74
+ +
75
+ + it('preserves the requested hostname for virtual-host routing', async () => {
76
+ + const originalLookup = dns.lookup;
77
+ + let server;
78
+ + const loopback = await new Promise((resolve, reject) => {
79
+ + originalLookup('127.0.0.1', (err, address, family) => err ? reject(err) : resolve({address, family}));
80
+ + });
81
+ + dns.lookup = (hostname, options, callback) => {
82
+ + const cb = typeof options === 'function' ? options : callback;
83
+ + const wantsAll = options && options.all;
84
+ + const result = {address: '127.0.0.1', family: loopback.family};
85
+ +
86
+ + if (wantsAll) {
87
+ + cb(null, [result]);
88
+ + } else {
89
+ + cb(null, result.address, result.family);
90
+ + }
91
+ + };
92
+ +
93
+ + try {
94
+ + const workspace = await models.workspace.create();
95
+ + const settings = await models.settings.create();
96
+ + await models.cookieJar.create({parentId: workspace._id});
97
+ +
98
+ + server = await new Promise(resolve => {
99
+ + const s = http.createServer((req, res) => {
100
+ + const host = req.headers.host || '';
101
+ +
102
+ + if (req.url === '/virtual-host-check' && /^alpha\.insomnia\.test:/.test(host)) {
103
+ + res.writeHead(200);
104
+ + res.end('alpha-vhost-response');
105
+ + } else if (req.url === '/virtual-host-check' && /^beta\.insomnia\.test:/.test(host)) {
106
+ + res.writeHead(200);
107
+ + res.end('beta-vhost-response');
108
+ + } else {
109
+ + res.writeHead(421);
110
+ + res.end(`wrong-vhost:${host}`);
111
+ + }
112
+ + });
113
+ +
114
+ + s.listen(0, '127.0.0.1', () => resolve(s));
115
+ + });
116
+ +
117
+ + const port = server.address().port;
118
+ +
119
+ + const alphaRequest = await models.request.create({
120
+ + parentId: workspace._id,
121
+ + method: 'GET',
122
+ + url: `http://alpha.insomnia.test:${port}/virtual-host-check`,
123
+ + });
124
+ +
125
+ + const betaRequest = await models.request.create({
126
+ + parentId: workspace._id,
127
+ + method: 'GET',
128
+ + url: `http://beta.insomnia.test:${port}/virtual-host-check`,
129
+ + });
130
+ +
131
+ + const alphaResponse = await networkUtils._actuallySend(
132
+ + await getRenderedRequest(alphaRequest),
133
+ + workspace,
134
+ + settings
135
+ + );
136
+ +
137
+ + const betaResponse = await networkUtils._actuallySend(
138
+ + await getRenderedRequest(betaRequest),
139
+ + workspace,
140
+ + settings
141
+ + );
142
+ +
143
+ + expect(alphaResponse.error).toBe('');
144
+ + expect(betaResponse.error).toBe('');
145
+ + expect(alphaResponse.body).toBe(new Buffer('alpha-vhost-response').toString('base64'));
146
+ + expect(betaResponse.body).toBe(new Buffer('beta-vhost-response').toString('base64'));
147
+ + } finally {
148
+ + dns.lookup = originalLookup;
149
+ + if (server) {
150
+ + server.close();
151
+ + }
152
+ + }
153
+ + });
154
+ +
155
+ + it('preserves the requested hostname for HTTPS virtual-host routing', async () => {
156
+ + const originalLookup = dns.lookup;
157
+ + let server;
158
+ + const loopback = await new Promise((resolve, reject) => {
159
+ + originalLookup('127.0.0.1', (err, address, family) => err ? reject(err) : resolve({address, family}));
160
+ + });
161
+ + dns.lookup = (hostname, options, callback) => {
162
+ + const cb = typeof options === 'function' ? options : callback;
163
+ + const wantsAll = options && options.all;
164
+ + const result = {address: '127.0.0.1', family: loopback.family};
165
+ +
166
+ + if (wantsAll) {
167
+ + cb(null, [result]);
168
+ + } else {
169
+ + cb(null, result.address, result.family);
170
+ + }
171
+ + };
172
+ +
173
+ + try {
174
+ + const workspace = await models.workspace.create();
175
+ + const settings = await models.settings.create({validateSSL: false});
176
+ + await models.cookieJar.create({parentId: workspace._id});
177
+ +
178
+ + const key = fs.readFileSync(pathResolve(pathJoin(
179
+ + __dirname,
180
+ + '../../../node_modules/webpack-dev-server/ssl/server.key'
181
+ + )));
182
+ + const cert = fs.readFileSync(pathResolve(pathJoin(
183
+ + __dirname,
184
+ + '../../../node_modules/webpack-dev-server/ssl/server.crt'
185
+ + )));
186
+ +
187
+ + server = await new Promise(resolve => {
188
+ + const s = https.createServer({key, cert}, (req, res) => {
189
+ + const host = req.headers.host || '';
190
+ + const servername = req.socket.servername || '';
191
+ +
192
+ + if (
193
+ + req.url === '/secure-host-check' &&
194
+ + /^tls\.insomnia\.test:/.test(host) &&
195
+ + servername === 'tls.insomnia.test'
196
+ + ) {
197
+ + res.writeHead(200);
198
+ + res.end('tls-vhost-response');
199
+ + } else {
200
+ + res.writeHead(421);
201
+ + res.end(`wrong-tls-vhost:${host}:${servername}`);
202
+ + }
203
+ + });
204
+ +
205
+ + s.listen(0, '127.0.0.1', () => resolve(s));
206
+ + });
207
+ +
208
+ + const port = server.address().port;
209
+ + const request = await models.request.create({
210
+ + parentId: workspace._id,
211
+ + method: 'GET',
212
+ + url: `https://tls.insomnia.test:${port}/secure-host-check`,
213
+ + });
214
+ +
215
+ + const response = await networkUtils._actuallySend(
216
+ + await getRenderedRequest(request),
217
+ + workspace,
218
+ + settings
219
+ + );
220
+ +
221
+ + expect(response.error).toBe('');
222
+ + expect(response.body).toBe(new Buffer('tls-vhost-response').toString('base64'));
223
+ + } finally {
224
+ + dns.lookup = originalLookup;
225
+ + if (server) {
226
+ + server.close();
227
+ + }
228
+ + }
229
+ + });
230
+ +
231
+ + it('keeps cookie jar state across redirects and writes response cookies back', async () => {
232
+ + const originalLookup = dns.lookup;
233
+ + let server;
234
+ + const loopback = await new Promise((resolve, reject) => {
235
+ + originalLookup('127.0.0.1', (err, address, family) => err ? reject(err) : resolve({address, family}));
236
+ + });
237
+ + dns.lookup = (hostname, options, callback) => {
238
+ + const cb = typeof options === 'function' ? options : callback;
239
+ + const wantsAll = options && options.all;
240
+ + const result = {address: '127.0.0.1', family: loopback.family};
241
+ +
242
+ + if (wantsAll) {
243
+ + cb(null, [result]);
244
+ + } else {
245
+ + cb(null, result.address, result.family);
246
+ + }
247
+ + };
248
+ +
249
+ + try {
250
+ + const workspace = await models.workspace.create();
251
+ + const settings = await models.settings.create();
252
+ + const nonce = `${Date.now()}${Math.floor(Math.random() * 100000)}`;
253
+ + const seedName = `seed_${nonce}`;
254
+ + const seedValue = `seed-value-${nonce}`;
255
+ + const redirectName = `redirect_${nonce}`;
256
+ + const redirectValue = `redirect-value-${nonce}`;
257
+ +
258
+ + const cookieJar = await models.cookieJar.create({
259
+ + parentId: workspace._id,
260
+ + cookies: [
261
+ + {
262
+ + key: seedName,
263
+ + value: seedValue,
264
+ + domain: 'cookie-flow.insomnia.test',
265
+ + path: '/',
266
+ + secure: false,
267
+ + httpOnly: false,
268
+ + expires: new Date('2096-10-12T04:40:49.000Z'),
269
+ + },
270
+ + ],
271
+ + });
272
+ +
273
+ + let firstHopCookie = '';
274
+ + let secondHopCookie = '';
275
+ + server = await new Promise(resolve => {
276
+ + const s = http.createServer((req, res) => {
277
+ + if (req.url === '/start') {
278
+ + firstHopCookie = req.headers.cookie || '';
279
+ + if (!firstHopCookie.includes(`${seedName}=${seedValue}`)) {
280
+ + res.writeHead(400);
281
+ + res.end('missing-seed-cookie');
282
+ + return;
283
+ + }
284
+ +
285
+ + res.writeHead(302, {
286
+ + Location: '/after-redirect',
287
+ + 'Set-Cookie': `${redirectName}=${redirectValue}; Path=/`,
288
+ + });
289
+ + res.end();
290
+ + } else if (req.url === '/after-redirect') {
291
+ + secondHopCookie = req.headers.cookie || '';
292
+ + if (
293
+ + secondHopCookie.includes(`${seedName}=${seedValue}`) &&
294
+ + secondHopCookie.includes(`${redirectName}=${redirectValue}`)
295
+ + ) {
296
+ + res.writeHead(200);
297
+ + res.end('redirected-cookie-ok');
298
+ + } else {
299
+ + res.writeHead(400);
300
+ + res.end('missing-redirect-cookie');
301
+ + }
302
+ + } else {
303
+ + res.writeHead(404);
304
+ + res.end('not-found');
305
+ + }
306
+ + });
307
+ +
308
+ + s.listen(0, '127.0.0.1', () => resolve(s));
309
+ + });
310
+ +
311
+ + const port = server.address().port;
312
+ +
313
+ + const request = await models.request.create({
314
+ + parentId: workspace._id,
315
+ + method: 'GET',
316
+ + url: `http://cookie-flow.insomnia.test:${port}/start`,
317
+ + });
318
+ +
319
+ + const response = await networkUtils._actuallySend(
320
+ + await getRenderedRequest(request),
321
+ + workspace,
322
+ + settings
323
+ + );
324
+ +
325
+ + const updatedJar = await models.cookieJar.getById(cookieJar._id);
326
+ + const storedCookie = updatedJar.cookies.find(cookie => cookie.key === redirectName);
327
+ +
328
+ + expect(firstHopCookie).toContain(`${seedName}=${seedValue}`);
329
+ + expect(secondHopCookie).toContain(`${seedName}=${seedValue}`);
330
+ + expect(secondHopCookie).toContain(`${redirectName}=${redirectValue}`);
331
+ + expect(response.error).toBe('');
332
+ + expect(response.body).toBe(new Buffer('redirected-cookie-ok').toString('base64'));
333
+ + expect(storedCookie).toBeTruthy();
334
+ + expect(storedCookie.value).toBe(redirectValue);
335
+ + } finally {
336
+ + dns.lookup = originalLookup;
337
+ + if (server) {
338
+ + server.close();
339
+ + }
340
+ + }
341
+ + });
342
+ });
343
+ diff --git a/app/models/__mocks__/uuid.js b/app/models/__mocks__/uuid.js
344
+ index 87359ac75..5a50fc8b2 100644
345
+ --- a/app/models/__mocks__/uuid.js
346
+ +++ b/app/models/__mocks__/uuid.js
347
+ @@ -24,7 +24,37 @@ const uuids = [
348
+ '884b5a86-5e6d-49ef-8bea-b5dcb7564cdc',
349
+ '2fea36e5-4e92-4da6-8088-2821f580cf20',
350
+ '1e310193-7209-430d-9ed2-f8d73ec932b5',
351
+ - '9996a7f7-ff6a-414e-9a75-2adadbde88a9'
352
+ + '9996a7f7-ff6a-414e-9a75-2adadbde88a9',
353
+ + '50b9c66c-5359-4ef1-a4cf-a4efc75c4e40',
354
+ + 'cd80dc20-25b6-45b9-8cf4-ad3616632194',
355
+ + '4f4d6cbd-72eb-4af8-bf48-61748c8f3ded',
356
+ + '2cf858b1-38ee-4066-96d3-784efbcd8749',
357
+ + '0f160c37-6da9-468d-9f6e-2237d20ce645',
358
+ + 'c02e3a38-19c1-4fce-9747-745c9aa5c6d4',
359
+ + '29fdc38d-d8c3-43a6-b3bb-ad1ac533d9fe',
360
+ + '7add3a5c-c66f-41c4-a15b-92718b16d08a',
361
+ + 'f6d132ac-276e-44fc-93a9-4f4ff9103645',
362
+ + 'c6f08e09-c598-441b-ac67-ce446b33460c',
363
+ + '0b187758-a5f8-44e0-a3ce-8d32d2e2d731',
364
+ + 'f7c23854-e202-48ac-80fc-8f2cd6e69cdf',
365
+ + '422cb833-02cf-492f-a96c-61a9d7e98c50',
366
+ + '23e61f2d-6bc5-4d53-91b4-5a50c3019100',
367
+ + '5d4c56f8-c9f6-4a3d-ae19-3654df7c24a9',
368
+ + 'd5a31c7b-9f61-47e5-bca3-65f5b98d14db',
369
+ + 'c2a9de66-3385-41bc-bd26-b3bc260841b5',
370
+ + 'be353d88-03d9-43d1-a021-f6bed08da499',
371
+ + '7c5f6382-892b-48f0-a287-2d27d4f8577b',
372
+ + '426b8c1b-7d1e-43ef-a0eb-491221a5d90d',
373
+ + '131d4bde-1a52-476c-9efc-37661346c833',
374
+ + '704c7201-e2a8-4b77-9f64-f826d8ddaf56',
375
+ + '83f1086b-a010-44b0-890f-1d2243efec90',
376
+ + 'f43218dd-6c3c-43b6-a676-ee43902f61e7',
377
+ + '01f76472-b6a0-4f71-a412-a648cf254fc7',
378
+ + '6c39b723-6a21-40e2-a608-290856d1d901',
379
+ + '1d078a0c-8780-45d0-94f3-c35229f620ab',
380
+ + '51bc2a2c-73da-4f8e-a40b-974ebd1e6d3e',
381
+ + '51e3d820-fc56-45d3-bc13-35acaad958d4',
382
+ + '52ca9bd7-f98d-49d0-b536-9d4aab57444e'
383
+ ];
384
+
385
+ function v4 () {
386
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
387
+ new file mode 100755
388
+ --- /dev/null
389
+ +++ b/mimo_test_command.sh
390
+ @@ -0,0 +1,31 @@
391
+ +#!/bin/bash
392
+ +set -uo pipefail
393
+ +cd /testbed
394
+ +
395
+ +
396
+ +dev-switch node 20 2>/dev/null || true
397
+ +
398
+ +if [ ! -d node_modules ]; then
399
+ + cp package.json /tmp/package.json.orig
400
+ + sed -i 's|"httpsnippet": "git@github.com:getinsomnia/httpsnippet.git#a3a2c0a0167fa844bf92df52a1442fa1d68a9053"|"httpsnippet": "2.0.0"|' package.json
401
+ + sed -i 's|"srp": "git@github.com:getinsomnia/srp-js.git#6ebd8c3acfbcf69645e4c6e6f8f6b55138ff22c3"|"srp": "0.2.0"|' package.json
402
+ + git config --global url."https://github.com/".insteadOf "git@github.com:" 2>/dev/null || true
403
+ + npm install --legacy-peer-deps --ignore-scripts
404
+ + cp /tmp/package.json.orig package.json
405
+ +fi
406
+ +
407
+ +
408
+ +case "${1:-}" in
409
+ + base)
410
+ + npx jest --silent --testPathPattern="app/common/__tests__/network\\.test\\.js" \
411
+ + --testNamePattern="builds a default config|builds a complex config"
412
+ + ;;
413
+ + new)
414
+ + npx jest --silent --testPathPattern="app/common/__tests__/network\\.test\\.js" \
415
+ + --testNamePattern="does something|sends a file|sends multipart form data|preserves the requested hostname for virtual-host routing|preserves the requested hostname for HTTPS virtual-host routing|keeps cookie jar state across redirects and writes response cookies back"
416
+ + ;;
417
+ + *)
418
+ + echo "usage: $0 base|new"
419
+ + exit 2
420
+ + ;;
421
+ +esac
tasks/format-code-task-000133/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
+ app/common/__tests__/network.test.js
25
+ app/models/__mocks__/uuid.js
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-000133/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new
tasks/format-code-task-000134/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:6c8119a9d8de92737e23edbe1a41cb3b23dcedd0d847458e2d8cf16a98af7610
tasks/format-code-task-000134/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-000134/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-000134/tests/test.patch ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/spec/01-unit/01-db/01-schema/06-routes_spec.lua b/spec/01-unit/01-db/01-schema/06-routes_spec.lua
2
+ index 5a693fc67..488f20f3b 100644
3
+ --- a/spec/01-unit/01-db/01-schema/06-routes_spec.lua
4
+ +++ b/spec/01-unit/01-db/01-schema/06-routes_spec.lua
5
+ @@ -6,7 +6,7 @@ local certificates = require "kong.db.schema.entities.certificates"
6
+ local Entity = require "kong.db.schema.entity"
7
+
8
+ assert(Schema.new(certificates))
9
+ -assert(Schema.new(services))
10
+ +local Services = assert(Schema.new(services))
11
+ local Routes = assert(Entity.new(routes))
12
+
13
+ for name, subschema in pairs(routes_subschemas) do
14
+ @@ -268,6 +268,133 @@ describe("routes schema", function()
15
+ end
16
+ end)
17
+
18
+ +
19
+ + it("accepts RFC 3986 reserved characters in route paths", function()
20
+ + local valid_paths = {
21
+ + "/users:list",
22
+ + "/path/with@sign",
23
+ + "/items;v=2",
24
+ + "/api/+something",
25
+ + "/hello/path$with$!&'()*+,;=stuff",
26
+ + "/accounts/42:archive",
27
+ + }
28
+ +
29
+ + for i = 1, #valid_paths do
30
+ + local route = Routes:process_auto_fields({
31
+ + protocols = { "http" },
32
+ + service = { id = a_valid_uuid },
33
+ + methods = {},
34
+ + hosts = {},
35
+ + paths = { valid_paths[i] },
36
+ + }, "insert")
37
+ +
38
+ + local ok, err = Routes:validate(route)
39
+ + assert.is_nil(err)
40
+ + assert.is_true(ok)
41
+ + end
42
+ + end)
43
+ +
44
+ + it("accepts RFC 3986 reserved characters in shared service paths", function()
45
+ + local valid_paths = {
46
+ + "/search,filter",
47
+ + "/resources/id:doSomething",
48
+ + }
49
+ +
50
+ + for i = 1, #valid_paths do
51
+ + local service = {
52
+ + host = "example.com",
53
+ + port = 80,
54
+ + protocol = "http",
55
+ + path = valid_paths[i],
56
+ + }
57
+ +
58
+ + local ok, err = Services:validate(service)
59
+ + assert.is_nil(err)
60
+ + assert.is_true(ok)
61
+ + end
62
+ + end)
63
+ +
64
+ + it("keeps regex-style route path syntax validation", function()
65
+ + local valid_regex_paths = {
66
+ + "/users/(foo)/profile",
67
+ + "/files/.+suffix",
68
+ + }
69
+ +
70
+ + for i = 1, #valid_regex_paths do
71
+ + local route = Routes:process_auto_fields({
72
+ + protocols = { "http" },
73
+ + service = { id = a_valid_uuid },
74
+ + methods = {},
75
+ + hosts = {},
76
+ + paths = { valid_regex_paths[i] },
77
+ + }, "insert")
78
+ +
79
+ + local ok, err = Routes:validate(route)
80
+ + assert.is_nil(err)
81
+ + assert.is_true(ok)
82
+ + end
83
+ +
84
+ + local invalid_regex_paths = {
85
+ + "/users/(foo/profile",
86
+ + "/files/(.+suffix",
87
+ + "/routes/[unterminated",
88
+ + "/users/(profile|settings",
89
+ + }
90
+ +
91
+ + for i = 1, #invalid_regex_paths do
92
+ + local route = Routes:process_auto_fields({
93
+ + protocols = { "http" },
94
+ + service = { id = a_valid_uuid },
95
+ + methods = {},
96
+ + hosts = {},
97
+ + paths = { invalid_regex_paths[i] },
98
+ + }, "insert")
99
+ +
100
+ + local ok, err = Routes:validate(route)
101
+ + assert.falsy(ok)
102
+ + assert.truthy(err.paths[1])
103
+ + end
104
+ + end)
105
+ +
106
+ + it("still rejects route paths with genuinely invalid characters", function()
107
+ + local invalid_paths = {
108
+ + "/users/[bad",
109
+ + }
110
+ +
111
+ + for i = 1, #invalid_paths do
112
+ + local route = Routes:process_auto_fields({
113
+ + protocols = { "http" },
114
+ + service = { id = a_valid_uuid },
115
+ + methods = {},
116
+ + hosts = {},
117
+ + paths = { invalid_paths[i] },
118
+ + }, "insert")
119
+ +
120
+ + local ok, err = Routes:validate(route)
121
+ + assert.falsy(ok)
122
+ + assert.truthy(err.paths[1])
123
+ + end
124
+ + end)
125
+ +
126
+ + it("rejects malformed percent encoding without accepting it as a route path", function()
127
+ + local invalid_paths = {
128
+ + "/percent/%",
129
+ + "/percent/%2",
130
+ + "/percent/%zz",
131
+ + }
132
+ +
133
+ + for i = 1, #invalid_paths do
134
+ + local route = {
135
+ + protocols = { "http" },
136
+ + paths = { invalid_paths[i] },
137
+ + }
138
+ +
139
+ + local ok, err = Routes:validate(route)
140
+ + assert.falsy(ok)
141
+ + assert.truthy(err.paths[1])
142
+ + end
143
+ + end)
144
+ +
145
+ it("rejects badly percent-encoded values", function()
146
+ local invalid_paths = {
147
+ "/some%2words",
148
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
149
+ new file mode 100755
150
+ --- /dev/null
151
+ +++ b/mimo_test_command.sh
152
+ @@ -0,0 +1,32 @@
153
+ +#!/bin/bash
154
+ +set -uo pipefail
155
+ +
156
+ +cd /testbed
157
+ +
158
+ +
159
+ +export PATH="/usr/local/openresty/bin:/usr/local/openresty/luajit/bin:/usr/local/bin:$PATH"
160
+ +
161
+ +run_new_tests() {
162
+ + bin/busted spec/01-unit/01-db/01-schema/06-routes_spec.lua \
163
+ + --filter="RFC 3986 reserved" &&
164
+ + bin/busted spec/01-unit/01-db/01-schema/06-routes_spec.lua \
165
+ + --filter="keeps" &&
166
+ + bin/busted spec/01-unit/01-db/01-schema/06-routes_spec.lua \
167
+ + --filter="genuinely" &&
168
+ + bin/busted spec/01-unit/01-db/01-schema/06-routes_spec.lua \
169
+ + --filter="malformed"
170
+ +}
171
+ +
172
+ +case "${1:-}" in
173
+ + base)
174
+ + bin/busted spec/01-unit/01-db/01-schema/06-routes_spec.lua \
175
+ + --filter="validates a valid route"
176
+ + ;;
177
+ + new)
178
+ + run_new_tests
179
+ + ;;
180
+ + *)
181
+ + echo "usage: $0 base|new"
182
+ + exit 2
183
+ + ;;
184
+ +esac
tasks/format-code-task-000134/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
+ spec/01-unit/01-db/01-schema/06-routes_spec.lua
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-000134/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new
tasks/format-code-task-000173/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:645e1f2394bbd71f74b1b83fe2907d5a7d0a0d556f7e63384022446adc0f72fe
tasks/format-code-task-000173/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-000173/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-000173/tests/test.patch ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/graphql-dgs-spring-webflux-autoconfigure/src/test/kotlin/com/netflix/graphql/dgs/webflux/autoconfiguration/GraphiQlCustomEndpoint.kt b/graphql-dgs-spring-webflux-autoconfigure/src/test/kotlin/com/netflix/graphql/dgs/webflux/autoconfiguration/GraphiQlCustomEndpoint.kt
2
+ index eafdeef51..259bfb73a 100644
3
+ --- a/graphql-dgs-spring-webflux-autoconfigure/src/test/kotlin/com/netflix/graphql/dgs/webflux/autoconfiguration/GraphiQlCustomEndpoint.kt
4
+ +++ b/graphql-dgs-spring-webflux-autoconfigure/src/test/kotlin/com/netflix/graphql/dgs/webflux/autoconfiguration/GraphiQlCustomEndpoint.kt
5
+ @@ -17,11 +17,13 @@
6
+ package com.netflix.graphql.dgs.webflux.autoconfiguration
7
+
8
+ import com.netflix.graphql.dgs.autoconfig.DgsAutoConfiguration
9
+ +import graphql.Assert
10
+ import org.junit.jupiter.api.Test
11
+ import org.springframework.beans.factory.annotation.Autowired
12
+ import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient
13
+ import org.springframework.boot.test.context.SpringBootTest
14
+ import org.springframework.test.web.reactive.server.WebTestClient
15
+ +import org.springframework.test.web.reactive.server.expectBody
16
+ import org.springframework.web.reactive.config.EnableWebFlux
17
+
18
+ @AutoConfigureWebTestClient
19
+ @@ -48,5 +50,7 @@ class GraphiQlCustomEndpoint {
20
+ .exchange()
21
+ .expectStatus()
22
+ .is2xxSuccessful
23
+ + .expectBody<String>()
24
+ + .consumeWith { it -> Assert.assertTrue(it.responseBody!!.contains("fetch('/graphql")) }
25
+ }
26
+ }
27
+ diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64
28
+ new file mode 100644
29
+ --- /dev/null
30
+ +++ b/mimo_build_env.tar.gz.b64
31
+ @@ -0,0 +1,15 @@
32
+ +H4sIAAAAAAAAA+2Vb2/bNhDG/Vqf4qoWdTuApOXYaZC0A4Y2K7qmzdbu3TAElEjJdCRSJSknRebv
33
+ +PpJSEqdo/qBouw3jD7AkUHePHvLIM847UbMjLldk9K2YOJ7M5+Hu+PQenrP5NJtO3G8rG02ybL69
34
+ +PYL5N3O0QWcs1QAjrZS9Ke629/9R8GX9LTf2qFBNQyXDZvH1vnFL/bemsycX9c9mW67+s+1sOoLJ
35
+ +17NwPf/z+t+/R3IhSU7NIikYhE2Qc5Yk9+H9ibDFAqyCX168hiyDR5p/6ITmDEql4bWytZCQ4Tme
36
+ +ZuD2TUutyEUt7MfHCeMrZPr8JV1Rlx0UufVaR9lOUHALX7mRK6lObyfhp63S56HPSGc0qUVOlqvG
37
+ ++Ws6LSTaQUt2jGjDtmfnyl0LLzVlNQchhQVTaNFab78Up1DpSlhUKM2B8ZZLxmXxETQ3qu6sUDJp
38
+ +jpnQgFogvtIEV0GKeCnMkoJa+PGzr4hTR0F9GIenT2H86u2r3/cPfx4ntK5brZa8sAbOEnCEAzeY
39
+ +60c8mrfKCKu04GZj2NPQFZdwBp2uYTxYaKaoVgWtx7C+PnZhbWt2CWnrrhLSDP6w0hVppmQztX/q
40
+ +r9c4uauLL3CwTtbJsGAbtQzK8CbIeU/gttNis44zPMFTeGS63FhhO8v7iBnOcPY4OTh8/tPB0bv9
41
+ +Xw+fpZ/YJf77dKlyrv3hJ0GTXCqToJwmooQ/4B6gEtIHl3IbgSgE4iXVKfy5B3bBZZjQxV7azEvD
42
+ +q8KvCzIHkN68NrdbdLO8asUN9FaQuoPh7+GmVU0Kf4FxHWNshqDggFRjd5xuNumTv4fJRrGu5l/u
43
+ +c8jvrbKrJYeHD0OnK11Lgh/8ururm5i79ml7wBQ0bG66xmWW3gU9OYbxWeuanIUH2bo3cFausQtL
44
+ +98AsaHaXaB+XennJz61dNPdS+HP2rpN+y563Yf8ywaRf0xPYdQ/t4kONWGWQ8R+o0AnPy7o7RbSz
45
+ +qlCyFFWn+a5PBIT8zUDqujmW3Ja1OMWDBHYSeMjFm7nUd1780keJ3+rn7q9YNfuStcrNxm1jJBVi
46
+ +lDeuO//Tf5ORSCQSiUQikUgkEolEIpFIJBKJRCKRSCTyr+dv1jbbkgAoAAA=
47
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
48
+ new file mode 100755
49
+ --- /dev/null
50
+ +++ b/mimo_test_command.sh
51
+ @@ -0,0 +1,6 @@
52
+ +#!/usr/bin/env bash
53
+ +
54
+ +set -uo pipefail
55
+ +cd /testbed || exit 1
56
+ +base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1
57
+ +exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'
tasks/format-code-task-000173/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
+ graphql-dgs-spring-webflux-autoconfigure/src/test/kotlin/com/netflix/graphql/dgs/webflux/autoconfiguration/GraphiQlCustomEndpoint.kt
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-000173/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000174/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:639cbf576f1313841fc5ed3017da3afa72246c6ca1e7d605f16f9e896653bb63
tasks/format-code-task-000174/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