diff --git a/tasks/format-code-task-000043/environment/Dockerfile b/tasks/format-code-task-000043/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..2cfd5ae10ec6d04e6a1e96811059497e7bdad29e --- /dev/null +++ b/tasks/format-code-task-000043/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:22dbc5e3bb2b375a9032d568dcf57e02f1fcc0391f31cdc9ae5106cb4ef46404 diff --git a/tasks/format-code-task-000043/environment/setup/files/blocklist b/tasks/format-code-task-000043/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000043/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000043/environment/setup/setup.sh b/tasks/format-code-task-000043/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000043/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000043/tests/test.patch b/tasks/format-code-task-000043/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..d4e0ba4304e72f3b1df47726d0b462e480609a97 --- /dev/null +++ b/tasks/format-code-task-000043/tests/test.patch @@ -0,0 +1,217 @@ +diff --git a/test/data/dataset/test_dataframe_upload.py b/test/data/dataset/test_dataframe_upload.py +new file mode 100644 +index 00000000..f0ce5690 +--- /dev/null ++++ b/test/data/dataset/test_dataframe_upload.py +@@ -0,0 +1,190 @@ ++# -*- coding: utf-8 -*- ++ ++ ++ ++ ++ ++ ++ ++import unittest ++import pandas as pd ++ ++from cartoframes.data import Dataset, StrategiesRegistry ++from cartoframes.data.dataset.registry.base_dataset import BaseDataset ++from cartoframes.lib import context ++ ++ ++class CapturingContext(): ++ ++ ++ def __init__(self): ++ self.copy_query = None ++ self.copy_data = None ++ self.long_running_query = None ++ ++ def upload(self, query, data): ++ self.copy_query = query ++ self.copy_data = list(data) ++ ++ def execute_query(self, query, **kwargs): ++ return {'rows': [{'current_schema': 'public'}]} ++ ++ def execute_long_running_query(self, query): ++ self.long_running_query = query ++ ++ def get_schema(self): ++ return 'public' ++ ++ ++class TestDataFrameUpload(unittest.TestCase): ++ def setUp(self): ++ self._capture = CapturingContext() ++ self._original_create_context = context.create_context ++ context.create_context = lambda credentials: self._capture ++ ++ self._original_exists = BaseDataset.exists ++ BaseDataset.exists = lambda instance: False ++ ++ def tearDown(self): ++ context.create_context = self._original_create_context ++ BaseDataset.exists = self._original_exists ++ StrategiesRegistry.instance = None ++ ++ def _upload(self, df, **kwargs): ++ kwargs.setdefault('table_name', 'fake_table') ++ kwargs.setdefault('credentials', 'fake') ++ Dataset(df).upload(**kwargs) ++ return self._capture ++ ++ ++ ++ def test_cartodb_id_and_the_geom_are_both_kept(self): ++ df = pd.DataFrame.from_dict({'cartodb_id': [1], 'the_geom': ['POINT (1 1)']}) ++ cap = self._upload(df) ++ ++ self.assertEqual( ++ cap.copy_query, ++ "COPY fake_table(cartodb_id,the_geom) FROM stdin WITH (FORMAT csv, DELIMITER '|');") ++ self.assertEqual(cap.copy_data, [b'1|SRID=4326;POINT (1 1)\n']) ++ ++ def test_create_table_has_no_dangling_comma(self): ++ df = pd.DataFrame.from_dict({'cartodb_id': [1], 'the_geom': ['POINT (1 1)']}) ++ cap = self._upload(df) ++ ++ self.assertIn( ++ 'CREATE TABLE fake_table (cartodb_id bigint, the_geom geometry(Point, 4326))', ++ cap.long_running_query) ++ self.assertNotIn('(,', cap.long_running_query) ++ ++ def test_single_geometry_column_is_renamed_to_the_geom(self): ++ df = pd.DataFrame([['POINT (1 1)']], columns=['geom']) ++ cap = self._upload(df) ++ ++ self.assertEqual( ++ cap.copy_query, ++ "COPY fake_table(the_geom) FROM stdin WITH (FORMAT csv, DELIMITER '|');") ++ self.assertEqual(cap.copy_data, [b'SRID=4326;POINT (1 1)\n']) ++ ++ def test_several_geometry_columns_prioritize_the_geom(self): ++ df = pd.DataFrame([['POINT (0 0)', 'POINT (1 1)', 'POINT (2 2)']], ++ columns=['geom', 'the_geom', 'geometry']) ++ cap = self._upload(df) ++ ++ self.assertEqual( ++ cap.copy_query, ++ "COPY fake_table(geom,the_geom,geometry) FROM stdin WITH (FORMAT csv, DELIMITER '|');") ++ self.assertEqual(cap.copy_data, [b'POINT (0 0)|SRID=4326;POINT (1 1)|POINT (2 2)\n']) ++ ++ def test_the_geom_webmercator_is_dropped(self): ++ df = pd.DataFrame([[1, 'POINT (1 1)', 'fake']], ++ columns=['cartodb_id', 'the_geom', 'the_geom_webmercator']) ++ cap = self._upload(df) ++ ++ self.assertEqual( ++ cap.copy_query, ++ "COPY fake_table(cartodb_id,the_geom) FROM stdin WITH (FORMAT csv, DELIMITER '|');") ++ self.assertEqual(cap.copy_data, [b'1|SRID=4326;POINT (1 1)\n']) ++ ++ def test_ordinary_columns_without_geometry(self): ++ df = pd.DataFrame([[1, True, 'text']], columns=['col1', 'col2', 'col3']) ++ cap = self._upload(df) ++ ++ self.assertEqual( ++ cap.copy_query, ++ "COPY fake_table(col1,col2,col3) FROM stdin WITH (FORMAT csv, DELIMITER '|');") ++ self.assertEqual(cap.copy_data, [b'1|True|text\n']) ++ ++ def test_column_names_are_normalized(self): ++ df = pd.DataFrame([[1]], columns=['My Column']) ++ cap = self._upload(df) ++ ++ self.assertEqual( ++ cap.copy_query, ++ "COPY fake_table(my_column) FROM stdin WITH (FORMAT csv, DELIMITER '|');") ++ self.assertEqual(cap.copy_data, [b'1\n']) ++ ++ def test_null_values_become_empty_fields(self): ++ df = pd.DataFrame.from_dict({'test': [None, [None, None]]}) ++ cap = self._upload(df) ++ ++ self.assertEqual( ++ cap.copy_query, ++ "COPY fake_table(test) FROM stdin WITH (FORMAT csv, DELIMITER '|');") ++ self.assertEqual(cap.copy_data, [b'\n', b'\n']) ++ ++ def test_null_geometry_becomes_empty_field(self): ++ df = pd.DataFrame.from_dict({'test': [None], 'the_geom': [None]}) ++ cap = self._upload(df) ++ ++ self.assertEqual( ++ cap.copy_query, ++ "COPY fake_table(test,the_geom) FROM stdin WITH (FORMAT csv, DELIMITER '|');") ++ self.assertEqual(cap.copy_data, [b'|\n']) ++ ++ ++ ++ def test_with_lnglat_appends_synthesized_geometry(self): ++ df = pd.DataFrame([[1, 1]], columns=['lng', 'lat']) ++ cap = self._upload(df, with_lnglat=('lng', 'lat')) ++ ++ self.assertEqual( ++ cap.copy_query, ++ "COPY fake_table(lng,lat,the_geom) FROM stdin WITH (FORMAT csv, DELIMITER '|');") ++ self.assertEqual(cap.copy_data, [b'1|1|SRID=4326;POINT (1 1)\n']) ++ ++ def test_with_lnglat_drops_existing_geometry(self): ++ df = pd.DataFrame([[1, 1, 'POINT (2 2)']], columns=['lng', 'lat', 'the_geom']) ++ cap = self._upload(df, with_lnglat=('lng', 'lat')) ++ ++ self.assertEqual( ++ cap.copy_query, ++ "COPY fake_table(lng,lat,the_geom) FROM stdin WITH (FORMAT csv, DELIMITER '|');") ++ self.assertEqual(cap.copy_data, [b'1|1|SRID=4326;POINT (1 1)\n']) ++ ++ def test_with_lnglat_synthesized_geometry_in_create_table(self): ++ df = pd.DataFrame([[1, 1]], columns=['lng', 'lat']) ++ cap = self._upload(df, with_lnglat=('lng', 'lat')) ++ ++ self.assertIn( ++ 'CREATE TABLE fake_table (lng bigint, lat bigint, the_geom geometry(Point, 4326))', ++ cap.long_running_query) ++ ++ ++ ++ def test_create_table_type_mapping(self): ++ df = pd.DataFrame.from_dict({ ++ 'a_int': pd.Series([1], dtype='int64'), ++ 'a_float': pd.Series([1.0], dtype='float64'), ++ 'a_text': pd.Series(['x'], dtype='object'), ++ 'a_bool': pd.Series([True], dtype='bool'), ++ }) ++ cap = self._upload(df) ++ ++ self.assertIn('a_int bigint', cap.long_running_query) ++ self.assertIn('a_float numeric', cap.long_running_query) ++ self.assertIn('a_text text', cap.long_running_query) ++ self.assertIn('a_bool boolean', cap.long_running_query) ++ ++ ++if __name__ == '__main__': ++ unittest.main() +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,16 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++set -euo pipefail ++HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ++cd /testbed ++ ++ ++ ++ ++python -m pytest test/utils/test_columns.py -q ++ ++ ++python -m pytest test/data/dataset/test_dataframe_upload.py -q diff --git a/tasks/format-code-task-000043/tests/test.sh b/tasks/format-code-task-000043/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..6c73a7ad990796a50c23873b27abea6087f093ee --- /dev/null +++ b/tasks/format-code-task-000043/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test/data/dataset/test_dataframe_upload.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000043/tests/test_command.sh b/tasks/format-code-task-000043/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000043/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000044/environment/Dockerfile b/tasks/format-code-task-000044/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..3f673112af6792a8ef5bd5149720cd99f71fc3d9 --- /dev/null +++ b/tasks/format-code-task-000044/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:119cc3e86df0e2ee6fe6fc7862ed26dda72bbbae0585f9a9088a41c877a9337f diff --git a/tasks/format-code-task-000044/environment/setup/files/blocklist b/tasks/format-code-task-000044/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000044/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000044/environment/setup/setup.sh b/tasks/format-code-task-000044/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000044/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000044/tests/test.patch b/tasks/format-code-task-000044/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..bf602e9ef028ad64522e9e81692919421a9d83dc --- /dev/null +++ b/tasks/format-code-task-000044/tests/test.patch @@ -0,0 +1,226 @@ +diff --git a/Specs/Core/TransformsSpec.js b/Specs/Core/TransformsSpec.js +index 7366dc552058..032503c1bdfb 100644 +--- a/Specs/Core/TransformsSpec.js ++++ b/Specs/Core/TransformsSpec.js +@@ -243,6 +243,62 @@ defineSuite([ + expect(actualTranslation).toEqual(origin); + }); + ++ it('aircraftHeadingPitchRollToFixedFrame works without a result parameter', function() { ++ var origin = new Cartesian3(1.0, 0.0, 0.0); ++ var heading = CesiumMath.toRadians(20.0); ++ var pitch = CesiumMath.toRadians(30.0); ++ var roll = CesiumMath.toRadians(40.0); ++ ++ var expectedRotation = Matrix3.fromQuaternion(Quaternion.fromHeadingPitchRoll(heading, pitch, roll)); ++ var expectedX = Matrix3.getColumn(expectedRotation, 0, new Cartesian3()); ++ var expectedY = Matrix3.getColumn(expectedRotation, 1, new Cartesian3()); ++ var expectedZ = Matrix3.getColumn(expectedRotation, 2, new Cartesian3()); ++ ++ Cartesian3.fromElements(-expectedX.z, expectedX.y, expectedX.x, expectedX); ++ Cartesian3.fromElements(-expectedY.z, expectedY.y, expectedY.x, expectedY); ++ Cartesian3.fromElements(-expectedZ.z, expectedZ.y, expectedZ.x, expectedZ); ++ ++ var returnedResult = Transforms.aircraftHeadingPitchRollToFixedFrame(origin, heading, pitch, roll, Ellipsoid.UNIT_SPHERE); ++ var actualX = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 0, new Cartesian4())); ++ var actualY = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 1, new Cartesian4())); ++ var actualZ = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 2, new Cartesian4())); ++ var actualTranslation = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 3, new Cartesian4())); ++ ++ expect(actualX).toEqual(expectedX); ++ expect(actualY).toEqual(expectedY); ++ expect(actualZ).toEqual(expectedZ); ++ expect(actualTranslation).toEqual(origin); ++ }); ++ ++ it('aircraftHeadingPitchRollToFixedFrame works with a result parameter', function() { ++ var origin = new Cartesian3(1.0, 0.0, 0.0); ++ var heading = CesiumMath.toRadians(20.0); ++ var pitch = CesiumMath.toRadians(30.0); ++ var roll = CesiumMath.toRadians(40.0); ++ ++ var expectedRotation = Matrix3.fromQuaternion(Quaternion.fromHeadingPitchRoll(heading, pitch, roll)); ++ var expectedX = Matrix3.getColumn(expectedRotation, 0, new Cartesian3()); ++ var expectedY = Matrix3.getColumn(expectedRotation, 1, new Cartesian3()); ++ var expectedZ = Matrix3.getColumn(expectedRotation, 2, new Cartesian3()); ++ ++ Cartesian3.fromElements(-expectedX.z, expectedX.y, expectedX.x, expectedX); ++ Cartesian3.fromElements(-expectedY.z, expectedY.y, expectedY.x, expectedY); ++ Cartesian3.fromElements(-expectedZ.z, expectedZ.y, expectedZ.x, expectedZ); ++ ++ var result = new Matrix4(); ++ var returnedResult = Transforms.aircraftHeadingPitchRollToFixedFrame(origin, heading, pitch, roll, Ellipsoid.UNIT_SPHERE, result); ++ var actualX = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 0, new Cartesian4())); ++ var actualY = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 1, new Cartesian4())); ++ var actualZ = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 2, new Cartesian4())); ++ var actualTranslation = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 3, new Cartesian4())); ++ ++ expect(returnedResult).toBe(result); ++ expect(actualX).toEqual(expectedX); ++ expect(actualY).toEqual(expectedY); ++ expect(actualZ).toEqual(expectedZ); ++ expect(actualTranslation).toEqual(origin); ++ }); ++ + it('headingPitchRollQuaternion works without a result parameter', function() { + var origin = new Cartesian3(1.0, 0.0, 0.0); + var heading = CesiumMath.toRadians(20.0); +@@ -273,6 +329,36 @@ defineSuite([ + expect(actual).toEqualEpsilon(expected, CesiumMath.EPSILON11); + }); + ++ it('aircraftHeadingPitchRollQuaternion works without a result parameter', function() { ++ var origin = new Cartesian3(1.0, 0.0, 0.0); ++ var heading = CesiumMath.toRadians(20.0); ++ var pitch = CesiumMath.toRadians(30.0); ++ var roll = CesiumMath.toRadians(40.0); ++ ++ var transform = Transforms.aircraftHeadingPitchRollToFixedFrame(origin, heading, pitch, roll, Ellipsoid.UNIT_SPHERE); ++ var expected = Matrix4.getRotation(transform, new Matrix3()); ++ ++ var quaternion = Transforms.aircraftHeadingPitchRollQuaternion(origin, heading, pitch, roll, Ellipsoid.UNIT_SPHERE); ++ var actual = Matrix3.fromQuaternion(quaternion); ++ expect(actual).toEqualEpsilon(expected, CesiumMath.EPSILON11); ++ }); ++ ++ it('aircraftHeadingPitchRollQuaternion works with a result parameter', function() { ++ var origin = new Cartesian3(1.0, 0.0, 0.0); ++ var heading = CesiumMath.toRadians(20.0); ++ var pitch = CesiumMath.toRadians(30.0); ++ var roll = CesiumMath.toRadians(40.0); ++ ++ var transform = Transforms.aircraftHeadingPitchRollToFixedFrame(origin, heading, pitch, roll, Ellipsoid.UNIT_SPHERE); ++ var expected = Matrix4.getRotation(transform, new Matrix3()); ++ ++ var result = new Quaternion(); ++ var quaternion = Transforms.aircraftHeadingPitchRollQuaternion(origin, heading, pitch, roll, Ellipsoid.UNIT_SPHERE, result); ++ var actual = Matrix3.fromQuaternion(quaternion); ++ expect(quaternion).toBe(result); ++ expect(actual).toEqualEpsilon(expected, CesiumMath.EPSILON11); ++ }); ++ + it('computeTemeToPseudoFixedMatrix works before noon', function() { + var time = JulianDate.fromDate(new Date('June 29, 2015 12:00:00 UTC')); + var t = Transforms.computeTemeToPseudoFixedMatrix(time); +@@ -795,6 +881,54 @@ defineSuite([ + }).toThrowDeveloperError(); + }); + ++ it('aircraftHeadingPitchRollToFixedFrame throws without an origin', function() { ++ expect(function() { ++ Transforms.aircraftHeadingPitchRollToFixedFrame(undefined, 0.0, 0.0, 0.0); ++ }).toThrowDeveloperError(); ++ }); ++ ++ it('aircraftHeadingPitchRollToFixedFrame throws without an heading', function() { ++ expect(function() { ++ Transforms.aircraftHeadingPitchRollToFixedFrame(Cartesian3.ZERO, undefined, 0.0, 0.0); ++ }).toThrowDeveloperError(); ++ }); ++ ++ it('aircraftHeadingPitchRollToFixedFrame throws without an pitch', function() { ++ expect(function() { ++ Transforms.aircraftHeadingPitchRollToFixedFrame(Cartesian3.ZERO, 0.0, undefined, 0.0); ++ }).toThrowDeveloperError(); ++ }); ++ ++ it('aircraftHeadingPitchRollToFixedFrame throws without an roll', function() { ++ expect(function() { ++ Transforms.aircraftHeadingPitchRollToFixedFrame(Cartesian3.ZERO, 0.0, 0.0, undefined); ++ }).toThrowDeveloperError(); ++ }); ++ ++ it('aircraftHeadingPitchRollQuaternion throws without an origin', function() { ++ expect(function() { ++ Transforms.aircraftHeadingPitchRollQuaternion(undefined, 0.0, 0.0, 0.0); ++ }).toThrowDeveloperError(); ++ }); ++ ++ it('aircraftHeadingPitchRollQuaternion throws without an heading', function() { ++ expect(function() { ++ Transforms.aircraftHeadingPitchRollQuaternion(Cartesian3.ZERO, undefined, 0.0, 0.0); ++ }).toThrowDeveloperError(); ++ }); ++ ++ it('aircraftHeadingPitchRollQuaternion throws without an pitch', function() { ++ expect(function() { ++ Transforms.aircraftHeadingPitchRollQuaternion(Cartesian3.ZERO, 0.0, undefined, 0.0); ++ }).toThrowDeveloperError(); ++ }); ++ ++ it('aircraftHeadingPitchRollQuaternion throws without an roll', function() { ++ expect(function() { ++ Transforms.aircraftHeadingPitchRollQuaternion(Cartesian3.ZERO, 0.0, 0.0, undefined); ++ }).toThrowDeveloperError(); ++ }); ++ + it('computeTemeToPseudoFixedMatrix throws without a date', function() { + expect(function() { + Transforms.computeTemeToPseudoFixedMatrix(undefined); +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,51 @@ ++H4sIAAAAAAAAA+0aa3PbxtGf+SvOSiYAZRIgJZqyzSpOrNiJXEfyWG4zU1HhgOCRhIQHg4cs2eF/ ++7+69cAABSe7Y6jTFzmgI3e7t7e3t8wBrmnn+bELDS/vB14IewN7jx+wXoPzLnvuPd/r9vd1+f2f4 ++oNfvD2GIPP5qEmmQJakTE/IgjqL0Jrrb8P+jYOXnz56s8+SLr4EHPBwMas6/P+jtDOT593bZ+e/u ++7O49IL0vLkkF/J+fv719niy9MCVhNKPP0jij23bLyBJKkjT23NQYtVqXoKB5QvZJTP/IvJiaxjwx ++2iM2vnLSpY7B/yUuuJh58UrH8hGJX/jRdHqt4/mIxKMEq4MoCGiYFpZniK4rMEjO6C9pnHhRCJRG ++39rZsXZQ+HkWuimOzj2fvgXp3ke/RrPMp4czMxAPbfKpRQBimmZxSOSwlWRTXCpcmL1OPuo7SXoY ++zujV8dw0LKPdtmK68h2XmvZ4bC86xLBRpHWrZduwx8R/H712Lp0TF4ROSZcEXugFji/FzSUs05pS ++Lq42K7kOXdN4gW6KCyBmnlgfYi+lr2BzJznaxjXm1ydLZwaLWGDiKTVAsLnjJ5TpCyejztDpUy98 ++JWRANZ+ejcroA8CkDj+FCvQJ2I2rkAqL+0HBEMFPlm/h1DiJstiltpDP3t62ty2kNs7EvtRUax7F ++Lx13aUotmRIllaOTw0JogFYYxaBh7yPNqUeKmAnuJPTICdQE/D+E/xU9KItLVJp4nujrnEdeaLIn ++OKDC/HZHrdEmj4DZeWII1egy/OTFBV5CM3hWQjn4+IKrWZfFmxO1luUJayztPWcrlgJW6qDBbttk ++f3+f9HRFIpRNwlplydJUu8llWBMK5vQfi6KM6lZRFOXXEkUY8K2CCLp6MVoVxvLyykuYc4CzUvbM ++PJUjK80LApQ39+gM5hRYPEcW6Mw6AytIvYBaC5q+h1+IGc9Ir8hUakRjq/NRJlvmpNkrKrYgynff ++lWX9fmOdshJ5eK3VlhuFqYj0IF5MnZmKappXZun8ie4I2iz5qMXjeBzaiwCmjUOjPSqvt7qOvcUy ++1VKMYRRVR6/S2HFTOjuoIFbrBU4KEcoe2+Pt8bb5/Nnp79tj++xPfH44ttt/jsP29vMffM+lYUIB ++b/ERoLZBupJX1y9Z1mfVBupniwCDisCABL+VJ1Glz2Tle6lpbBltyWSMz7mapZLH4Xg8DmuPpywu ++igFJ8v3SS1h6JvDrZGkE+vRcx/evwWSY5xEoE9IlJQc08bKAeeOMrOLIpUliwaItexsTDCTVGZ17 ++IdQwOMif88wB+sNhFGuslThjYySHRQGwZYBoSnKQcotRrNsjPYZv5F7uEB01U6hhLQ0PyoGfaUhj ++SMbk4GMgojocTJKnTIF/oQKfcgm5C8m9I4NS/oTljW4kyNEJZm95jaaOUwyNynQHUNkkIivqxGq8 ++lEP5om+i6CJb6VMKiHwOZHJi4kQPiHsj+Pmb2oLl03ABIhHv0aOymWtrwUQ549Q7GxXI8o3KJzi4 ++zjiU+LFh2Xiumq6QQh9jBqmHAMFXV0zh3+IKyMlwPwYTjeWoKo0olRX/v50bDkF8v3mh9YbzWRu6 ++2XRQ64Z9VlDfuBNh91opqIWBT0IE2AbUNvoyfKTACYfWoiSsdo1Nf1DVQrHG+EwuItXrxcFnclAF ++VLHsElqpOJvykAqwaBZYB0oR6s6scvx2Lndz5Eo+6oAxfGvR6j7i+imIQR7VG3uOMrhXnXXyKFo/ ++V/PunIGWOmqgJqPUgEg0n5gYdScBTr4uJ56NpHPX3gGdoZBzDGhR9FNTLasLpVdK+ZG8TvL2tDiu ++mlPW6YveuNwfrpwYFJmCKCUEqNhbhLJoKXSNYRQezgCBJWT8ji7oFdqkffp7r/vU6X78sfuvybdn ++9kKbkbB9y05TdZesq4R9duoOwngoKe9G9lsUX/B29Q7EYPwx2GGcXt9tXmkNruz3TnLxlrtDFHMU ++iirVpTfVmhLam03zvNQwz7UmNqY++OUl1QxovtmZyCPGUgSwObKEqLtiKRXfuQGI2LV1amyBxRe7 ++8Tmrp9gYFLZqqI0V7JZxtlWsnNUNjez8pB/YRk1btyGFYU0S4TuwRBFd27goKxdMlBwyYlaYNLjj ++pNCRKBfizeUWVCuoD6Vd3PCWdia5a/EJBSE0Os3TOKHBPXhzf6y42GfFRXFHMD4yysVsKasbt8Rq ++Q9uLbEU6hLcielwurF4mVFG4Mtiqq8wkm4qbTI5AUUWG2c/j+D9fvjs5PD6CcoqV+/LyEKv9jqSR ++xgBEn9Z8cC1WK+ov764Ikf0VUok4z1e/NZbLIMDJWVDSmwk9PJ+sqPsGOvFyeJbjhfCcwGDNRRxg ++kjxSYvjiIyzMtEcFFoVQrXjeHmzYXGnWaNQVcYLP0Y281tLUOWchWMHsGWG3mnjYBUHxgPjKwoiE ++sY2MmqtTPZPiPJZIhTpFviweBvyXRD61/GhhGu+yMPTCxcYlrmVZ6Dubd7uj6vnFLCtml1PvjXOV ++zPrc3C5Kc9l9MWwsWPngcg9xxn/7nUQD9wfa+78LJw6cbho7YQIuHSTdwPHCL/E+8Ob3f73+YDBU ++7//2dh8/6PWHu8N+8/7vPqBwO8ZvqWQan0yYRUwmHfHibdtmBFt57t0SIVoQWBBZ5t7CVKEfC7l/ ++xD5eWdj4bIsKsxjg5Xu9U1maaAUBMfmYnk/qVhN1UbpMnpXqPAQR1EEUy7JFgK8g4gKixJZRQOfX ++Kmu9blPCt4p8WBp1wbqiwPtIXztJAHVQzlGvecpUG/e8Jbx5zn/xpv5leGm2O+ziBP9YKhQ/upTs ++YG1yHELv7UfOjBxEMfQoytdR3I1LN71sOJ6eUze1Luh1YirDsOai3YCmksb1BUCuK1YN2bj4uLT6 ++GCLNt7aVUshRpfZjQ+e63pWQmkKr1s6FRodnebDMv/yMv+u2+ZfOiDfEf+Zf9xH/97TvP4Z7Ax7/ ++B038vw+o/P6jFOFv+s6jxZs6aM9XUbzxogLCs96HRCv5jUHun5gW2HUdC8wQkvM7CuwCP0TxBbZf ++p4YIehjohBTYouj0LFQBaTES36HCKSWCT7A5iGchiqTukmBdL3T9bEZnRLQc6xumib6qapaWA3Lh ++V3F05THxi6HLsH9yUsfQMijjzAbzgKUxoldsOdRDkT9dyYsk3s529ByGh8f73FMDI2pBsYgEzNMn ++e8OO/qLQ56zQaLRx6Cre0EuKSZ9bgPXm+OfJ4dGrY40Ib4N/w7emUis6Y5bu3jhgR0vRexdUcrCM ++o4D+Qp0ZnHdyFJ044WwaXW3QIaDKUHfFORWJf+47C779bjeMugnnaZzVlQCavNM4+pBI5dUIV9Cn ++mHAU/QiOcuml1/i6PcpQx0MMiBppAm2dT6G/E3ouvFgR6k1oagrPwoT1edlK8w5MvRP8qApEtpLl ++l4sxt33/Odzbzev/IX7/Nxju7jbx/z7gm4f21AsxtCxb7owwI5jSWav1Tf6umr+WgaLJmzv4mZdZ ++vqbqEH5PxkNwh2i3Jm1g9I6H6xmZUtfB1LLI/NUPu9ZTq49vhiBARgHETm/qU/LBg1RwBLkI5pLv ++90l/p4WZiVR8p4oyomdEWNRW1LMkQ+8hf8egz/kuhVuKENLiSYsc/PLu+NeXkxeHR/s2HrNtuQ6E ++HnuVrVY0pTS2XUZv+16YXXX7g6dWz9p7srNn7ewIVJehhgPxbytcXRGWbQirNskdyizS7XJv78aw ++qW5XhZWakPIXLkobaKCBBhpooIEGGmiggQYaaKCBBhpooIEGGmiggQYaaKCBBhpooIEGGrgz/Bs8 ++beJqAFAAAA== +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-000044/tests/test.sh b/tasks/format-code-task-000044/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..81e5bb86e4eea85ccfa56d926945c3af7b0f6736 --- /dev/null +++ b/tasks/format-code-task-000044/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +Specs/Core/TransformsSpec.js +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000044/tests/test_command.sh b/tasks/format-code-task-000044/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000044/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000088/environment/Dockerfile b/tasks/format-code-task-000088/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..4b1ae77cbe5c912114760d87559cf19ac9effbd2 --- /dev/null +++ b/tasks/format-code-task-000088/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:2853a9b39cc1171be5ad4f4b3d49fac166c4c01da1b2208f726d22447f8322c0 diff --git a/tasks/format-code-task-000088/environment/setup/files/blocklist b/tasks/format-code-task-000088/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000088/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000088/environment/setup/setup.sh b/tasks/format-code-task-000088/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000088/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000088/tests/test.patch b/tasks/format-code-task-000088/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..961d480f2c64d42a243ede7e7a77a30456644ff8 --- /dev/null +++ b/tasks/format-code-task-000088/tests/test.patch @@ -0,0 +1,123 @@ +diff --git a/controllers/exclude_processes_test.go b/controllers/exclude_processes_test.go +index d49102374..bb59b37c1 100644 +--- a/controllers/exclude_processes_test.go ++++ b/controllers/exclude_processes_test.go +@@ -830,6 +830,97 @@ var _ = Describe("exclude_processes", func() { + }) + }) + }) ++ ++ When("transaction system processes should be excluded", func() { ++ When("a stateless and a log process should be excluded", func() { ++ BeforeEach(func() { ++ var pickedStateless, pickedLog bool ++ ++ _, processGroupIDs, err := cluster.GetCurrentProcessGroupsAndProcessCounts() ++ Expect(err).NotTo(HaveOccurred()) ++ cluster.Status.ProcessGroups = append(cluster.Status.ProcessGroups, fdbv1beta2.NewProcessGroupStatus(cluster.GetNextRandomProcessGroupID(fdbv1beta2.ProcessClassLog, processGroupIDs[fdbv1beta2.ProcessClassLog]), fdbv1beta2.ProcessClassLog, nil)) ++ cluster.Status.ProcessGroups[len(cluster.Status.ProcessGroups)-1].ProcessGroupConditions = nil ++ cluster.Status.ProcessGroups = append(cluster.Status.ProcessGroups, fdbv1beta2.NewProcessGroupStatus(cluster.GetNextRandomProcessGroupID(fdbv1beta2.ProcessClassStateless, processGroupIDs[fdbv1beta2.ProcessClassStateless]), fdbv1beta2.ProcessClassStateless, nil)) ++ cluster.Status.ProcessGroups[len(cluster.Status.ProcessGroups)-1].ProcessGroupConditions = nil ++ ++ markedForRemoval := make([]fdbv1beta2.ProcessGroupID, 0, 2) ++ for _, processGroup := range cluster.Status.ProcessGroups { ++ if !processGroup.ProcessClass.IsTransaction() || processGroup.ProcessClass == fdbv1beta2.ProcessClassClusterController { ++ continue ++ } ++ ++ if pickedLog && pickedStateless { ++ break ++ } ++ ++ if !processGroup.ProcessClass.IsLogProcess() { ++ if pickedStateless { ++ continue ++ } ++ pickedStateless = true ++ } ++ ++ if processGroup.ProcessClass.IsLogProcess() { ++ if pickedLog { ++ continue ++ } ++ pickedLog = true ++ } ++ ++ processGroup.MarkForRemoval() ++ markedForRemoval = append(markedForRemoval, processGroup.ProcessGroupID) ++ } ++ ++ Expect(markedForRemoval).To(HaveLen(2)) ++ }) ++ ++ When("no processes are missing", func() { ++ It("should exclude the process", func() { ++ adminClient, err := mock.NewMockAdminClientUncast(cluster, k8sClient) ++ Expect(err).NotTo(HaveOccurred()) ++ ++ Expect(req).To(BeNil()) ++ Expect(adminClient.ExcludedAddresses).To(HaveLen(2)) ++ }) ++ }) ++ ++ When("a transaction process is missing", func() { ++ var missingProcssGroup *fdbv1beta2.ProcessGroupStatus ++ ++ BeforeEach(func() { ++ _, processGroupIDs, err := cluster.GetCurrentProcessGroupsAndProcessCounts() ++ Expect(err).NotTo(HaveOccurred()) ++ ++ missingProcssGroup = fdbv1beta2.NewProcessGroupStatus(cluster.GetNextRandomProcessGroupID(fdbv1beta2.ProcessClassLog, processGroupIDs[fdbv1beta2.ProcessClassLog]), fdbv1beta2.ProcessClassLog, nil) ++ cluster.Status.ProcessGroups = append(cluster.Status.ProcessGroups, missingProcssGroup) ++ ++ clusterReconciler.InSimulation = false ++ }) ++ ++ It("should not exclude the process", func() { ++ adminClient, err := mock.NewMockAdminClientUncast(cluster, k8sClient) ++ Expect(err).NotTo(HaveOccurred()) ++ ++ Expect(req).NotTo(BeNil()) ++ Expect(adminClient.ExcludedAddresses).To(BeEmpty()) ++ }) ++ ++ When("the transaction process is missing for more than 10 minutes", func() { ++ BeforeEach(func() { ++ missingProcssGroup.ProcessGroupConditions[0].Timestamp = time.Now().Add(-10 * time.Minute).Unix() ++ }) ++ ++ It("should exclude the process", func() { ++ adminClient, err := mock.NewMockAdminClientUncast(cluster, k8sClient) ++ Expect(err).NotTo(HaveOccurred()) ++ ++ Expect(req).To(BeNil()) ++ Expect(adminClient.ExcludedAddresses).To(HaveLen(2)) ++ }) ++ }) ++ }) ++ }) ++ }) + }) + }) + +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,5 @@ ++H4sIAAAAAAAAA+3SPU/DMBAG4Mz5FUeZ8+FAkqkDY7cO7FFimzQi8SF/VPx8TBYqJOjSCgHvs9xZ ++d5LPOudDmGbVaXMskmspo7au1xh9jmsu6kpUVds27V1SCtGIOqH6ahOdCM73liixzP67vnP1Xyr/ ++2L/XzneSl6U3KneHy91xbv+iPdl/GfvEfVNVCZWXG+Fr/3z/tzfFMJli6N0hlYrWTzBolY5M7ynl ++hWTjLc+ztq6gzAZDj7HwsN85yiQH47eCsiNlflo0h3gqF8rGyTyPnD+xDG670a9yDkp3L5aldk67 ++TfrT7wYAAAAAAAAAAAAAAAAAAAAA+AveAMBBKUoAKAAA +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-000088/tests/test.sh b/tasks/format-code-task-000088/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..2ddfb48318d2e87c0278ac055d05e841b77bde69 --- /dev/null +++ b/tasks/format-code-task-000088/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +controllers/exclude_processes_test.go +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000088/tests/test_command.sh b/tasks/format-code-task-000088/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000088/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000100/environment/Dockerfile b/tasks/format-code-task-000100/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..7ace6c213ee977ef6a47bcc09078ee403b45f57b --- /dev/null +++ b/tasks/format-code-task-000100/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:c69033924f2984abe48b7d34902ce4bdc0eca6f7ca08101779b3d655014b1ee4 diff --git a/tasks/format-code-task-000100/environment/setup/files/blocklist b/tasks/format-code-task-000100/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000100/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000100/environment/setup/setup.sh b/tasks/format-code-task-000100/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000100/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000100/tests/test.patch b/tasks/format-code-task-000100/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..894dd06704ba61b6c2bbe70cafe1e1fddb863fbe --- /dev/null +++ b/tasks/format-code-task-000100/tests/test.patch @@ -0,0 +1,89 @@ +diff --git a/tests/pint_pickle_test.py b/tests/pint_pickle_test.py +new file mode 100644 +index 0000000000..0b99eb6b6b +--- /dev/null ++++ b/tests/pint_pickle_test.py +@@ -0,0 +1,62 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++import pickle ++import unittest ++ ++import pint ++ ++import perfkitbenchmarker ++ ++ ++class TestPintPickling(unittest.TestCase): ++ ++ def testSameUnitRegistry(self): ++ q_prepickle = perfkitbenchmarker.UNIT_REGISTRY.second ++ q_pickled = pickle.dumps(q_prepickle) ++ q_postpickle = pickle.loads(q_pickled) ++ ++ self.assertEqual(q_prepickle, q_postpickle) ++ ++ def testNewUnitRegistry(self): ++ ++ ++ ++ ++ q_prepickle = perfkitbenchmarker.UNIT_REGISTRY.second ++ q_pickled = pickle.dumps(q_prepickle) ++ ++ perfkitbenchmarker.UNIT_REGISTRY = pint.UnitRegistry() ++ ++ q_postpickle = pickle.loads(q_pickled) ++ ++ with self.assertRaises(TypeError): ++ ++ ++ ++ ++ q_prepickle.to(q_postpickle) ++ ++ new_second = perfkitbenchmarker.UNIT_REGISTRY.second ++ self.assertEqual(q_postpickle, new_second) ++ ++ ++ ++ q_postpickle.to(new_second) ++ ++ ++if __name__ == '__main__': ++ unittest.main() +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,5 @@ ++H4sIAAAAAAAAA+3SPUvEMBgH8M79FA+lgw59STEpCDfcINwiOriXvgQu2CahzRXv25t2UQ70ljtE ++/f+GJCThScI/aXNQfVdJPWfBteReyfnae6f9Oma8yIuSs7Lw+xgTeRkQv9qNPjlMrh6JgtEY992+ ++c+u/VPqRv5OTq1ozDLXu0ml/uTPO5c+EOMn/ThQioPxyV/jaP8+/7WgNvpFdKN+sGR09b192myje ++PT0+ZKk9Ll+jUfo+XuajUM51T1F8sy6Q0spRchuF9uj2RlMykB/5erQ0U2aVdpVV7Wsvq2XG16Nk ++Dn/61QAAAAAAAAAAAAAAAAAAAAAAf8M7+YENmQAoAAA= +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-000100/tests/test.sh b/tasks/format-code-task-000100/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..360bb36cda0ea6e791f2f245de7d6bd8d90785c6 --- /dev/null +++ b/tasks/format-code-task-000100/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/pint_pickle_test.py +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000100/tests/test_command.sh b/tasks/format-code-task-000100/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000100/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000107/environment/Dockerfile b/tasks/format-code-task-000107/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..efe16e6c65c11ebddd3bf69a9b23d2c3e1440192 --- /dev/null +++ b/tasks/format-code-task-000107/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:17db0205ebae2dcee4fe9cd60a6fdd1ee563680579d4acce990f28e0e8920323 diff --git a/tasks/format-code-task-000107/environment/setup/files/blocklist b/tasks/format-code-task-000107/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000107/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000107/environment/setup/setup.sh b/tasks/format-code-task-000107/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000107/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000107/tests/test.patch b/tasks/format-code-task-000107/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..d0e9747a1095ee7a466e53a99a4653906413216f --- /dev/null +++ b/tasks/format-code-task-000107/tests/test.patch @@ -0,0 +1,73 @@ +diff --git a/pkg/skaffold/build/custom/custom_test.go b/pkg/skaffold/build/custom/custom_test.go +index c79d3684f..436df3008 100644 +--- a/pkg/skaffold/build/custom/custom_test.go ++++ b/pkg/skaffold/build/custom/custom_test.go +@@ -42,24 +42,24 @@ func TestRetrieveEnv(t *testing.T) { + tag: "gcr.io/image/tag:mytag", + environ: nil, + buildContext: "/some/path", +- expected: []string{"IMAGES=gcr.io/image/tag:mytag", "PUSH_IMAGE=false", "BUILD_CONTEXT=/some/path"}, ++ expected: []string{"IMAGE=gcr.io/image/tag:mytag", "IMAGES=gcr.io/image/tag:mytag", "PUSH_IMAGE=false", "BUILD_CONTEXT=/some/path"}, + }, { + description: "make sure environ is correctly applied", + tag: "gcr.io/image/tag:anothertag", + environ: []string{"PATH=/path", "HOME=/root"}, + buildContext: "/some/path", +- expected: []string{"IMAGES=gcr.io/image/tag:anothertag", "PUSH_IMAGE=false", "BUILD_CONTEXT=/some/path", "PATH=/path", "HOME=/root"}, ++ expected: []string{"IMAGE=gcr.io/image/tag:anothertag", "IMAGES=gcr.io/image/tag:anothertag", "PUSH_IMAGE=false", "BUILD_CONTEXT=/some/path", "PATH=/path", "HOME=/root"}, + }, { + description: "push image is true", + tag: "gcr.io/image/push:tag", + pushImages: true, +- expected: []string{"IMAGES=gcr.io/image/push:tag", "PUSH_IMAGE=true", "BUILD_CONTEXT="}, ++ expected: []string{"IMAGE=gcr.io/image/push:tag", "IMAGES=gcr.io/image/push:tag", "PUSH_IMAGE=true", "BUILD_CONTEXT="}, + }, { + description: "add additional env", + tag: "gcr.io/image/push:tag", + pushImages: true, + additionalEnv: []string{"KUBECONTEXT=mycluster"}, +- expected: []string{"IMAGES=gcr.io/image/push:tag", "PUSH_IMAGE=true", "BUILD_CONTEXT=", "KUBECONTEXT=mycluster"}, ++ expected: []string{"IMAGE=gcr.io/image/push:tag", "IMAGES=gcr.io/image/push:tag", "PUSH_IMAGE=true", "BUILD_CONTEXT=", "KUBECONTEXT=mycluster"}, + }, + } + for _, test := range tests { +@@ -94,7 +94,7 @@ func TestRetrieveCmd(t *testing.T) { + }, + }, + tag: "image:tag", +- expected: expectedCmd("./build.sh", "workspace", nil, []string{"IMAGES=image:tag", "PUSH_IMAGE=false", "BUILD_CONTEXT=workspace"}), ++ expected: expectedCmd("./build.sh", "workspace", nil, []string{"IMAGE=image:tag", "IMAGES=image:tag", "PUSH_IMAGE=false", "BUILD_CONTEXT=workspace"}), + }, { + description: "buildcommand with multiple args", + artifact: &latest.Artifact{ +@@ -105,7 +105,7 @@ func TestRetrieveCmd(t *testing.T) { + }, + }, + tag: "image:tag", +- expected: expectedCmd("./build.sh", "", []string{"--flag", "--anotherflag"}, []string{"IMAGES=image:tag", "PUSH_IMAGE=false", "BUILD_CONTEXT="}), ++ expected: expectedCmd("./build.sh", "", []string{"--flag", "--anotherflag"}, []string{"IMAGE=image:tag", "IMAGES=image:tag", "PUSH_IMAGE=false", "BUILD_CONTEXT="}), + }, + } + for _, test := range tests { +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 000000000..9b824fefe +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["go test ./pkg/skaffold/build/custom/... -run 'TestRetrieveEnv|TestRetrieveCmd'"] ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++go test ./pkg/skaffold/build/custom/... -run 'TestRetrieveEnv|TestRetrieveCmd' ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-000107/tests/test.sh b/tasks/format-code-task-000107/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..fa033d986daf9d5a999e2c94f267da2c5d66e13c --- /dev/null +++ b/tasks/format-code-task-000107/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +pkg/skaffold/build/custom/custom_test.go +test_commands.json +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000107/tests/test_command.sh b/tasks/format-code-task-000107/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000107/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000109/environment/Dockerfile b/tasks/format-code-task-000109/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..5b34fc67289dc18a93e046bf38478ce3d79c2249 --- /dev/null +++ b/tasks/format-code-task-000109/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:44fa53b2c677e24a2d7af58ff9af5b9d4b92a78c63d324a2542a8a1c4a82ff72 diff --git a/tasks/format-code-task-000109/environment/setup/files/blocklist b/tasks/format-code-task-000109/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000109/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000109/environment/setup/setup.sh b/tasks/format-code-task-000109/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000109/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000109/tests/test.patch b/tasks/format-code-task-000109/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..81621f9a9978ccbec6c22c2c7b15c9e9d069db34 --- /dev/null +++ b/tasks/format-code-task-000109/tests/test.patch @@ -0,0 +1,253 @@ +diff --git a/cmd/skaffold/app/cmd/dev_test.go b/cmd/skaffold/app/cmd/dev_test.go +index 6ab37b8caa3..ff5d3347bae 100644 +--- a/cmd/skaffold/app/cmd/dev_test.go ++++ b/cmd/skaffold/app/cmd/dev_test.go +@@ -22,6 +22,7 @@ import ( + "testing" + + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/config" ++ "github.com/GoogleContainerTools/skaffold/pkg/skaffold/graph" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/kubernetes/manifest" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner" + runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext/v2" +@@ -32,10 +33,11 @@ import ( + + type mockDevRunner struct { + runner.Runner +- hasBuilt bool +- hasDeployed bool +- errDev error +- calls []string ++ hasBuilt bool ++ hasDeployed bool ++ errDev error ++ calls []string ++ manifestsByConfig *manifest.ManifestListByConfig + } + + func (r *mockDevRunner) Dev(context.Context, io.Writer, []*latest.Artifact) error { +@@ -58,11 +60,16 @@ func (r *mockDevRunner) Prune(context.Context, io.Writer) error { + return nil + } + +-func (r *mockDevRunner) Cleanup(context.Context, io.Writer, bool, manifest.ManifestList) error { ++func (r *mockDevRunner) Cleanup(context.Context, io.Writer, bool, *manifest.ManifestListByConfig) error { + r.calls = append(r.calls, "Cleanup") + return nil + } + ++func (r *mockDevRunner) Render(ctx context.Context, out io.Writer, builds []graph.Artifact, offline bool) (*manifest.ManifestListByConfig, error) { ++ r.calls = append(r.calls, "Render") ++ return r.manifestsByConfig, nil ++} ++ + func TestDoDev(t *testing.T) { + tests := []struct { + description string +@@ -74,7 +81,7 @@ func TestDoDev(t *testing.T) { + description: "cleanup and then prune", + hasBuilt: true, + hasDeployed: true, +- expectedCalls: []string{"Dev", "HasDeployed", "HasBuilt", "Cleanup", "Prune"}, ++ expectedCalls: []string{"Dev", "HasDeployed", "HasBuilt", "Render", "Cleanup", "Prune"}, + }, + { + description: "hasn't deployed", +@@ -139,7 +146,11 @@ func (m *mockConfigChangeRunner) Prune(context.Context, io.Writer) error { + return nil + } + +-func (m *mockConfigChangeRunner) Cleanup(context.Context, io.Writer, bool, manifest.ManifestList) error { ++func (m *mockConfigChangeRunner) Render(ctx context.Context, out io.Writer, builds []graph.Artifact, offline bool) (*manifest.ManifestListByConfig, error) { ++ return nil, nil ++} ++ ++func (m *mockConfigChangeRunner) Cleanup(context.Context, io.Writer, bool, *manifest.ManifestListByConfig) error { + return nil + } + +diff --git a/integration/delete_test.go b/integration/delete_test.go +new file mode 100644 +index 00000000000..e37004b7b6b +--- /dev/null ++++ b/integration/delete_test.go +@@ -0,0 +1,73 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++package integration ++ ++import ( ++ "testing" ++ "time" ++ ++ "github.com/GoogleContainerTools/skaffold/integration/skaffold" ++) ++ ++func TestDelete(t *testing.T) { ++ var tests = []struct { ++ description string ++ dir string ++ args []string ++ pods []string ++ deployments []string ++ env []string ++ }{ ++ { ++ description: "getting-started", ++ dir: "testdata/getting-started", ++ pods: []string{"getting-started"}, ++ }, ++ { ++ description: "microservices", ++ dir: "examples/microservices", ++ args: []string{"--status-check=false"}, ++ deployments: []string{"leeroy-app", "leeroy-web"}, ++ }, ++ { ++ description: "multi-config-microservices", ++ dir: "examples/multi-config-microservices", ++ deployments: []string{"leeroy-app", "leeroy-web"}, ++ }, ++ { ++ description: "multiple deployers", ++ dir: "testdata/deploy-multiple", ++ pods: []string{"deploy-kubectl", "deploy-kustomize"}, ++ }, ++ } ++ ++ MarkIntegrationTest(t, CanRunWithoutGcp) ++ ++ for _, test := range tests { ++ t.Run(test.description, func(t *testing.T) { ++ ns, client := SetupNamespace(t) ++ ++ args := append(test.args, "--cache-artifacts=false") ++ skaffold.Run(args...).InDir(test.dir).InNs(ns.Name).WithEnv(test.env).RunOrFail(t) ++ ++ client.WaitForPodsReady(test.pods...) ++ client.waitForDeploymentsToStabilizeWithTimeout(time.Minute*2, test.deployments...) ++ ++ skaffold.Delete().InDir(test.dir).InNs(ns.Name).WithEnv(test.env).RunOrFail(t) ++ }) ++ } ++} +diff --git a/pkg/skaffold/deploy/cloudrun/deploy_test.go b/pkg/skaffold/deploy/cloudrun/deploy_test.go +index c0b55254c8d..382ba52925d 100644 +--- a/pkg/skaffold/deploy/cloudrun/deploy_test.go ++++ b/pkg/skaffold/deploy/cloudrun/deploy_test.go +@@ -327,9 +327,11 @@ func TestCleanup(tOuter *testing.T) { + deployer, _ := NewDeployer(&runcontext.RunContext{}, &label.DefaultLabeller{}, &latest.CloudRunDeploy{ProjectID: test.defaultProject, Region: test.region}, configName) + deployer.clientOptions = append(deployer.clientOptions, option.WithEndpoint(ts.URL), option.WithoutAuthentication()) + deployer.useGcpOptions = false ++ manifestListByConfig := manifest.NewManifestListByConfig() + manifest, _ := json.Marshal(test.toDelete) + manifests := [][]byte{manifest} +- err := deployer.Cleanup(context.Background(), os.Stderr, false, manifests) ++ manifestListByConfig.Add(configName, manifests) ++ err := deployer.Cleanup(context.Background(), os.Stderr, false, &manifestListByConfig) + if test.httpErr == 0 && err != nil { + t.Fatalf("Expected success but got err: %v", err) + } else if test.httpErr != 0 && err == nil { +diff --git a/pkg/skaffold/deploy/deploy_mux_test.go b/pkg/skaffold/deploy/deploy_mux_test.go +index f6a4212f52b..9f9fc67968d 100644 +--- a/pkg/skaffold/deploy/deploy_mux_test.go ++++ b/pkg/skaffold/deploy/deploy_mux_test.go +@@ -87,7 +87,7 @@ func (m *MockDeployer) Dependencies() ([]string, error) { + return m.dependencies, m.dependenciesErr + } + +-func (m *MockDeployer) Cleanup(context.Context, io.Writer, bool, manifest.ManifestList) error { ++func (m *MockDeployer) Cleanup(context.Context, io.Writer, bool, *manifest.ManifestListByConfig) error { + return m.cleanupErr + } + +diff --git a/pkg/skaffold/deploy/kubectl/kubectl_test.go b/pkg/skaffold/deploy/kubectl/kubectl_test.go +index b8a93544186..a9edb4d4705 100644 +--- a/pkg/skaffold/deploy/kubectl/kubectl_test.go ++++ b/pkg/skaffold/deploy/kubectl/kubectl_test.go +@@ -337,7 +337,7 @@ func TestKubectlCleanup(t *testing.T) { + true) + t.CheckNoError(errR) + +- err = k.Cleanup(context.Background(), io.Discard, test.dryRun, m.GetForConfig(configName)) ++ err = k.Cleanup(context.Background(), io.Discard, test.dryRun, m) + + t.CheckError(test.shouldErr, err) + }) +diff --git a/pkg/skaffold/render/generate/generate_test.go b/pkg/skaffold/render/generate/generate_test.go +index f15e39b2a9d..d638b6e5d4d 100644 +--- a/pkg/skaffold/render/generate/generate_test.go ++++ b/pkg/skaffold/render/generate/generate_test.go +@@ -183,7 +183,7 @@ func TestGenerate(t *testing.T) { + + func TestGenerateFromURLManifest(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { +- fmt.Fprintln(w, podYaml) ++ fmt.Fprint(w, podYaml) + })) + + defer ts.Close() +diff --git a/pkg/skaffold/runner/timings_test.go b/pkg/skaffold/runner/timings_test.go +index 7553022e1ce..43ad2e13419 100644 +--- a/pkg/skaffold/runner/timings_test.go ++++ b/pkg/skaffold/runner/timings_test.go +@@ -100,7 +100,7 @@ func (m *mockDeployer) Deploy(context.Context, io.Writer, []graph.Artifact, *man + return nil + } + +-func (m *mockDeployer) Cleanup(context.Context, io.Writer, bool, manifest.ManifestList) error { ++func (m *mockDeployer) Cleanup(context.Context, io.Writer, bool, *manifest.ManifestListByConfig) error { + if m.err { + return errors.New("Unable to cleanup") + } +diff --git a/pkg/skaffold/runner/v2/runner_test.go b/pkg/skaffold/runner/v2/runner_test.go +index 5c16cc9a4a2..07feabdce96 100644 +--- a/pkg/skaffold/runner/v2/runner_test.go ++++ b/pkg/skaffold/runner/v2/runner_test.go +@@ -143,7 +143,7 @@ func (t *TestBench) TestDependencies(context.Context, *latest.Artifact) ([]strin + return nil, nil + } + func (t *TestBench) Dependencies() ([]string, error) { return nil, nil } +-func (t *TestBench) Cleanup(ctx context.Context, out io.Writer, dryRun bool, list manifest.ManifestList) error { ++func (t *TestBench) Cleanup(ctx context.Context, out io.Writer, dryRun bool, byConfig *manifest.ManifestListByConfig) error { + return nil + } + func (t *TestBench) Prune(ctx context.Context, out io.Writer) error { return nil } +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,8 @@ ++H4sIAAAAAAAAA+3Tz2vCMBQH8J77VwR3tr+0etpBlI0xtsPwLrF5xmJMSn64DfbHL3YbrcLmBGXI ++3ufS8Ey+ffTFaO5KwWYgN3FwLok3zPP66e0/63WaZ0k26CXDfhokaTpI0oDkZ+uoxRlLNSGBVsr+ ++tO/Q7xcqauZvwdhZodZrKllklqd7x4H5p1mvmf8gz/z8+4M0C0hyuha+98/nXzBSD34OLAwNWNKF ++MLwiT04SKgTx34b7opOlJdttJuSqXpDuhnQL5aS9TkkUF2sWmxVdLJRgMa2qukC62sd0pn77RE1g ++8/a1EmCh0ySZpdL7gaW0wDW1pZI7Oftndw5VK950waAS6jUuhHLMn2+njAVQ6apjYnZ62FZAP7iX ++YxJWbg6FFe2k+4/SMe1okAx0zEGC/zrQTrv9rP0ux0m/u318Wq5Lyc0xpzdZO+ARnm+UHiu5KHk9 ++6qkuOQc99hdpTovVSLI7P1Vp/TtCKJaKdEbNFatvF6moMcCiTvjX/wuEEEIIIYQQQgghhBBCCCGE ++EEIIoUvxDiMpN/EAKAAA +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-000109/tests/test.sh b/tasks/format-code-task-000109/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..825bd93ca6d1d6af0c6ccca926ca13bb2de446ab --- /dev/null +++ b/tasks/format-code-task-000109/tests/test.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +cmd/skaffold/app/cmd/dev_test.go +integration/delete_test.go +pkg/skaffold/deploy/cloudrun/deploy_test.go +pkg/skaffold/deploy/deploy_mux_test.go +pkg/skaffold/deploy/kubectl/kubectl_test.go +pkg/skaffold/render/generate/generate_test.go +pkg/skaffold/runner/timings_test.go +pkg/skaffold/runner/v2/runner_test.go +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000109/tests/test_command.sh b/tasks/format-code-task-000109/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000109/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000131/environment/Dockerfile b/tasks/format-code-task-000131/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..302fdec2171cd2f43bb0f3a86f974c239f3af954 --- /dev/null +++ b/tasks/format-code-task-000131/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:5477d554b0339de5d9615aad38b27e8acc8607a7de0fa3419aaf6fcfb6e69d95 diff --git a/tasks/format-code-task-000131/environment/setup/files/blocklist b/tasks/format-code-task-000131/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000131/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000131/environment/setup/setup.sh b/tasks/format-code-task-000131/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000131/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000131/tests/test.patch b/tasks/format-code-task-000131/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..88db11ac6fc8c0496cd86d8bbf0d0f3d1c401a61 --- /dev/null +++ b/tasks/format-code-task-000131/tests/test.patch @@ -0,0 +1,61 @@ +diff --git a/test/services/katello/candlepin/consumer_test.rb b/test/services/katello/candlepin/consumer_test.rb +index c746b0766e7..478d13628cf 100644 +--- a/test/services/katello/candlepin/consumer_test.rb ++++ b/test/services/katello/candlepin/consumer_test.rb +@@ -57,6 +57,8 @@ def test_distribution_to_puppet_os + assert_equal 'CentOS', Candlepin::Consumer.distribution_to_puppet_os('CentOS') + assert_equal 'CentOS', Candlepin::Consumer.distribution_to_puppet_os('centosGood') + ++ assert_equal 'SLES', Candlepin::Consumer.distribution_to_puppet_os('SLES') ++ assert_equal 'SLES', Candlepin::Consumer.distribution_to_puppet_os('SUSE Linux Enterprise Server') + assert_equal nil, Candlepin::Consumer.distribution_to_puppet_os('RedHot') + end + end +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,32 @@ ++H4sIAAAAAAAAA+0Za3MTNzCf/SsWhxmbGbizHTvueEhJgDBhGhrGDp12Op1DvpNjwZ10lXQOIeS/ ++d6V7O3ZSKKTT4v2Q+Far1b4lrZxpwsLAo3zhbn0r6CAMBwP7H2H5v/3dHfQ6veGw1+t3tzrd7m5n ++ZwsG30yiCiRKEwmwJYXQN9HdNv4fBaf0v9LJVH2LKPgs/3eQrtsb9jf+vxO45v/3RNMwFJ6mSntz ++GsZUOnL6j9YwDt7t99f5f9Db3V3y/3Bnp7cFna+k443wnft/G14xziISwgrHgwkJmAkJMuGc8TPw ++BVdJRKWlwrgAxoEpERLNBG9sw+mcKZhexEQpqkDPKcySMIQXQtKIcMAwY1LwiHINhAcQS7FgAVK+ ++QzfA+ZzolgJOaUCDRkPSPxMmKbSIr9mCeiqJYyF1a92AayX3iaIVkkj4c+JGqKMZrQwsfFn5OqdT ++pHxfIWyUlhkTFipri0YkgiSkKaYBENAZKBrOnFCcnVGJGID99Dd8+rQHU3rGuMUCFGul460MfWy/ ++HE7P2y03oAuXo8FaD+wo5UEj/Vtdy0SiHX5N9JyTiGaTjdxTGti5y3PQ8HZKK1UuJbBEpZoH1ppj ++6gsZlJ4/Jh8vDnyfKiVkrn6VEnn5IbobnqLh7RpmUZTIk3b8SabnjITZeKnVkgAnGHIYSPxMXShN ++o1SGc6bnNuw04ToPDgwxeJaFohMwpSWbJiYEPS28GMOBak+oRirYMtvHNflHo0zw8eHzo4NT7+D0 ++5NXLZ97RyeTUe/5ycjo+8X4+eHUIe9Ac48JHRMMh11TGkikKx4wnH+BAi4j5cCSUbjozSenHNQxP ++JhkfZOOVbDzLxkvZeDU2SyZ6o7KszHSz32sUIlpLj2SugxGrR4SfSIlpuNdOkEUabvtehkQhDXZF ++HGUEdfIVdDPGgzYLUr6GF7LEmCg+HRYghgUFoh4RL17+evpmfDgpHN8oMHtwibQtM0e1YO9H+4kI ++EmDupghoscD+6sIVDl41rnJrIutjQQJbmKqBDVlgz6SI4Ke0EIISifRpWSPyBHNJHLshm+ZbpRsi ++p8LQtnJMqIYktsvk3LIV5gyDUfrzizyXsnGUM68tNF1YWb0y5DOsliGNi2KSej9PgQxZ9ZOI4pAR ++7tN2kuR+SOHyqvhIM7H661puFubCWptgAOZLZhJYg91oKPTTgqE2hbX8XBU330ysyX55NjbenrGz ++RKa7CWKcHEMhEPDJ/2SqjeOb3UVr6qET0JgXXsBMfDWLdc1/d8Y+aJyoXKz0Xj5FNS2HuRDvPca1 ++gFFW+S0azUeSUBfUnoiNJCoLOoBRWtNMbI244PRhio2I9uee0R8XVp7ghuD3UUT1XAQPYRRjof7D ++RmJm1YmpbEZjxtE+2qXvqK9tuTWim40TywyGOBRyp6hA8JYG+gErXh4/yAU57++bouAhjqKwaa2t ++5mMxutdekDBL99ocRK/I44JieUZJmwbC48d2giUjGHnKS7WHkZAMN0ESeqmuhXHRLkuYRrF9LA20 ++zS73ECreuMojunCVsbEJgu3LatzYSFoZMFfu9qVhe+VcRGEz48ZmcO8FC6ljTfykXeNeJlHdclom ++tBjiLATYxiTG2OP2C3XRFJNIzEASpnAfynMu3xCvsyw3SwPrLFg3y4MVqXyTO2zMVb1RR5TOWMIX ++lqpHw+1qoDFWab5GoBsL0799av7/wLX7X36Y/oprfMb9v9vtD/H+1+/vbu7/dwJr/R8nYfyVguBz ++/J/2/wb9nd2N/+8Cbva/pLFQTAvcMjP8l/SCbun/dHo7/br/e93hcLDp/9wFZGdRc/S8xfPl+b5G ++qIl6X7ZmbrjV5PwmGTt7iuB+mOBR4RSZlPjNLn93cHP+V5375V3g2/J/Z3e4lP+dQW+4yf+7gHX5 ++X/X82qTOmwHVlN7Pb/Wm45Od+Cttiax9zPLGQ0HusOWDfrlOvTxU+J0Tpj3T9UMC1bYyh3hxW3VV ++3FwgVkIl/9P2uYgiwgNHzb/eGrec/7qd7k7x/tMd9sz5f7e72f/vBLbvuVPG3SlR88Y2jBNeNCyL ++lmPZ80ubU+3XY9ge9noDeAST48MJCIU3fV/nBeQBMnpjnn9s/35OJKdKgRZAFoIF9QehqXnLaOCF ++Hx7Z7qxtZKMAKMn0AnrO0PkBFoyAnJoXDPrB8IfXB6dHe837RyevDl3HjhgdRvcNvtmgCxJC837b ++DoB5z0E5jX4PmmaF13iywQpghVMQ4IHGN6cSI9/4zdPfjl8+BSXgbXHYWfEs1noLkioRLqhVSyRZ ++Sz4TL2OzV/YjlzfZUa1TObp/mU0ZPbqyMho3mJ6rGU0fQPJ3KZckKG3CG9LY55G8NgD1Jujf6L7m ++T3mbmriBDWxgA98T/AWeY57aACgAAA== +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-000131/tests/test.sh b/tasks/format-code-task-000131/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..f57ac9624f4473134e95724fbf5d5e2e333d6c23 --- /dev/null +++ b/tasks/format-code-task-000131/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test/services/katello/candlepin/consumer_test.rb +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000131/tests/test_command.sh b/tasks/format-code-task-000131/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000131/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000136/environment/Dockerfile b/tasks/format-code-task-000136/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..e398ca7d759d95375aec7b481d0ad3e3cc1e855c --- /dev/null +++ b/tasks/format-code-task-000136/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:3ad9131f66172e4fa5bd09c87b3308185738ca59575717ec1978cd414f60736a diff --git a/tasks/format-code-task-000136/environment/setup/files/blocklist b/tasks/format-code-task-000136/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000136/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000136/environment/setup/setup.sh b/tasks/format-code-task-000136/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000136/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000136/tests/test.patch b/tasks/format-code-task-000136/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..ce41b2c3187ac453f11be9365ec56482a58c7ac1 --- /dev/null +++ b/tasks/format-code-task-000136/tests/test.patch @@ -0,0 +1,209 @@ +diff --git a/controllers/auth_config_controller_anonymous_test.go b/controllers/auth_config_controller_anonymous_test.go +new file mode 100644 +index 00000000..0920ab94 +--- /dev/null ++++ b/controllers/auth_config_controller_anonymous_test.go +@@ -0,0 +1,181 @@ ++package controllers ++ ++import ( ++ "context" ++ "testing" ++ ++ api "github.com/kuadrant/authorino/api/v1beta1" ++ "github.com/kuadrant/authorino/pkg/evaluators" ++ identity_evaluators "github.com/kuadrant/authorino/pkg/evaluators/identity" ++ mock_cache "github.com/kuadrant/authorino/pkg/cache/mocks" ++ ++ "github.com/golang/mock/gomock" ++ "gotest.tools/assert" ++ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ++ "k8s.io/apimachinery/pkg/types" ++ "sigs.k8s.io/controller-runtime/pkg/reconcile" ++) ++ ++ ++func newTestAuthConfigNoIdentity() api.AuthConfig { ++ return api.AuthConfig{ ++ TypeMeta: metav1.TypeMeta{ ++ Kind: "AuthConfig", ++ APIVersion: "authorino.kuadrant.io/v1beta1", ++ }, ++ ObjectMeta: metav1.ObjectMeta{ ++ Name: "auth-config-anon", ++ Namespace: "authorino", ++ }, ++ Spec: api.AuthConfigSpec{ ++ Hosts: []string{"echo-api-anon"}, ++ Identity: nil, ++ }, ++ } ++} ++ ++ ++func newTestAuthConfigSingleAPIKey() api.AuthConfig { ++ return api.AuthConfig{ ++ TypeMeta: metav1.TypeMeta{ ++ Kind: "AuthConfig", ++ APIVersion: "authorino.kuadrant.io/v1beta1", ++ }, ++ ObjectMeta: metav1.ObjectMeta{ ++ Name: "auth-config-apikey", ++ Namespace: "authorino", ++ }, ++ Spec: api.AuthConfigSpec{ ++ Hosts: []string{"echo-api-apikey"}, ++ Identity: []*api.Identity{ ++ { ++ Name: "my-api-key", ++ APIKey: &api.Identity_APIKey{ ++ LabelSelectors: map[string]string{"group": "friends"}, ++ }, ++ }, ++ }, ++ }, ++ } ++} ++ ++ ++ ++ ++func TestReconcileAuthConfigEmptyIdentityDefaultsAnonymous(t *testing.T) { ++ mockController := gomock.NewController(t) ++ defer mockController.Finish() ++ cacheMock := mock_cache.NewMockCache(mockController) ++ ++ authConfig := newTestAuthConfigNoIdentity() ++ authConfigName := types.NamespacedName{Name: authConfig.Name, Namespace: authConfig.Namespace} ++ client := newTestK8sClient(&authConfig) ++ reconciler := newTestAuthConfigReconciler(client, cacheMock) ++ ++ var captured evaluators.AuthConfig ++ cacheMock.EXPECT().FindKeys(authConfigName.String()).Return([]string{}) ++ cacheMock.EXPECT().FindId("echo-api-anon").Return("", false) ++ cacheMock.EXPECT().Set( ++ "authorino/auth-config-anon", ++ "echo-api-anon", ++ gomock.Any(), ++ true, ++ ).Do(func(_ string, _ string, cfg evaluators.AuthConfig, _ bool) { ++ captured = cfg ++ }).Return(nil) ++ ++ _, err := reconciler.Reconcile(context.Background(), reconcile.Request{NamespacedName: authConfigName}) ++ assert.NilError(t, err) ++ ++ ++ assert.Equal(t, 1, len(captured.IdentityConfigs), "expected one default identity config to be added") ++ ++ idCfg, ok := captured.IdentityConfigs[0].(*evaluators.IdentityConfig) ++ assert.Assert(t, ok, "expected *evaluators.IdentityConfig as the default identity entry") ++ assert.Equal(t, "anonymous", idCfg.Name) ++ assert.Assert(t, idCfg.Noop != nil, "expected the default identity config to be of Noop type") ++ ++ assert.Assert(t, idCfg.OAuth2 == nil) ++ assert.Assert(t, idCfg.OIDC == nil) ++ assert.Assert(t, idCfg.APIKey == nil) ++ assert.Assert(t, idCfg.KubernetesAuth == nil) ++ assert.Assert(t, idCfg.MTLS == nil) ++ assert.Assert(t, idCfg.HMAC == nil) ++} ++ ++ ++ ++ ++func TestReconcileAuthConfigEmptyIdentityProducesNoopEvaluator(t *testing.T) { ++ mockController := gomock.NewController(t) ++ defer mockController.Finish() ++ cacheMock := mock_cache.NewMockCache(mockController) ++ ++ authConfig := newTestAuthConfigNoIdentity() ++ authConfigName := types.NamespacedName{Name: authConfig.Name, Namespace: authConfig.Namespace} ++ client := newTestK8sClient(&authConfig) ++ reconciler := newTestAuthConfigReconciler(client, cacheMock) ++ ++ var captured evaluators.AuthConfig ++ cacheMock.EXPECT().FindKeys(authConfigName.String()).Return([]string{}) ++ cacheMock.EXPECT().FindId("echo-api-anon").Return("", false) ++ cacheMock.EXPECT().Set( ++ "authorino/auth-config-anon", ++ "echo-api-anon", ++ gomock.Any(), ++ true, ++ ).Do(func(_ string, _ string, cfg evaluators.AuthConfig, _ bool) { ++ captured = cfg ++ }).Return(nil) ++ ++ _, err := reconciler.Reconcile(context.Background(), reconcile.Request{NamespacedName: authConfigName}) ++ assert.NilError(t, err) ++ ++ assert.Equal(t, 1, len(captured.IdentityConfigs)) ++ ++ idCfg, ok := captured.IdentityConfigs[0].(*evaluators.IdentityConfig) ++ assert.Assert(t, ok) ++ ++ ++ evaluator := idCfg.GetAuthConfigEvaluator() ++ assert.Assert(t, evaluator != nil, "expected a non-nil evaluator for the anonymous identity") ++ noop, ok := evaluator.(*identity_evaluators.Noop) ++ assert.Assert(t, ok, "expected the default identity evaluator to be of *identity.Noop type") ++ assert.Assert(t, noop == idCfg.Noop, "evaluator should be the same Noop instance as IdentityConfig.Noop") ++} ++ ++ ++ ++func TestReconcileAuthConfigSingleIdentityNotOverridden(t *testing.T) { ++ mockController := gomock.NewController(t) ++ defer mockController.Finish() ++ cacheMock := mock_cache.NewMockCache(mockController) ++ ++ authConfig := newTestAuthConfigSingleAPIKey() ++ authConfigName := types.NamespacedName{Name: authConfig.Name, Namespace: authConfig.Namespace} ++ client := newTestK8sClient(&authConfig) ++ reconciler := newTestAuthConfigReconciler(client, cacheMock) ++ ++ var captured evaluators.AuthConfig ++ cacheMock.EXPECT().FindKeys(authConfigName.String()).Return([]string{}) ++ cacheMock.EXPECT().FindId("echo-api-apikey").Return("", false) ++ cacheMock.EXPECT().Set( ++ "authorino/auth-config-apikey", ++ "echo-api-apikey", ++ gomock.Any(), ++ true, ++ ).Do(func(_ string, _ string, cfg evaluators.AuthConfig, _ bool) { ++ captured = cfg ++ }).Return(nil) ++ ++ _, err := reconciler.Reconcile(context.Background(), reconcile.Request{NamespacedName: authConfigName}) ++ assert.NilError(t, err) ++ ++ ++ assert.Equal(t, 1, len(captured.IdentityConfigs), "expected exactly the user-declared identity") ++ idCfg, ok := captured.IdentityConfigs[0].(*evaluators.IdentityConfig) ++ assert.Assert(t, ok) ++ assert.Equal(t, "my-api-key", idCfg.Name) ++ assert.Assert(t, idCfg.APIKey != nil, "expected APIKey identity to be preserved") ++ assert.Assert(t, idCfg.Noop == nil, "anonymous Noop must NOT be injected when explicit identity is present") ++} +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 00000000..d618d4ac +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["go test ./controllers/ -run 'TestReconcileAuthConfigEmptyIdentityDefaultsAnonymous|TestReconcileAuthConfigEmptyIdentityProducesNoopEvaluator|TestReconcileAuthConfigSingleIdentityNotOverridden' -v"] ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++go test ./controllers/ -run 'TestReconcileAuthConfigEmptyIdentityDefaultsAnonymous|TestReconcileAuthConfigEmptyIdentityProducesNoopEvaluator|TestReconcileAuthConfigSingleIdentityNotOverridden' -v ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-000136/tests/test.sh b/tasks/format-code-task-000136/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..490942fd7fa17b15f8ad0d705f051e14ced0a05c --- /dev/null +++ b/tasks/format-code-task-000136/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +controllers/auth_config_controller_anonymous_test.go +test_commands.json +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000136/tests/test_command.sh b/tasks/format-code-task-000136/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000136/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000138/environment/Dockerfile b/tasks/format-code-task-000138/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..ca98dc33d9eddedc5a596f0d46315a7867a235b1 --- /dev/null +++ b/tasks/format-code-task-000138/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:5c57f605279e5fe67f1cef2c7cf5bd677b92d483bc56b9b26341b185c9968249 diff --git a/tasks/format-code-task-000138/environment/setup/files/blocklist b/tasks/format-code-task-000138/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000138/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000138/environment/setup/setup.sh b/tasks/format-code-task-000138/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000138/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000138/tests/test.patch b/tasks/format-code-task-000138/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..5b32027fdfe1a875160667194e713312b364c67a --- /dev/null +++ b/tasks/format-code-task-000138/tests/test.patch @@ -0,0 +1,388 @@ +diff --git a/pkg/workspace/backends_test.go b/pkg/workspace/backends_test.go +new file mode 100644 +index 0000000..b903015 +--- /dev/null ++++ b/pkg/workspace/backends_test.go +@@ -0,0 +1,353 @@ ++package workspace ++ ++import ( ++ "testing" ++ ++ "github.com/stretchr/testify/assert" ++ ++ "kusionstack.io/kusion/pkg/apis/workspace" ++) ++ ++func intPtr(i int) *int { ++ return &i ++} ++ ++ ++ ++func newOssConfig(endpoint, bucket string) *workspace.OssConfig { ++ c := &workspace.OssConfig{} ++ c.Endpoint = endpoint ++ c.Bucket = bucket ++ return c ++} ++ ++ ++func newS3Config(endpoint, bucket string) *workspace.S3Config { ++ c := &workspace.S3Config{} ++ c.Endpoint = endpoint ++ c.Bucket = bucket ++ return c ++} ++ ++func TestValidateBackendConfigs_Backends(t *testing.T) { ++ testcases := []struct { ++ name string ++ success bool ++ backendConfigs *workspace.BackendConfigs ++ }{ ++ { ++ name: "nil backend configs", ++ success: true, ++ backendConfigs: nil, ++ }, ++ { ++ name: "empty backend configs", ++ success: true, ++ backendConfigs: &workspace.BackendConfigs{}, ++ }, ++ { ++ name: "valid local backend", ++ success: true, ++ backendConfigs: &workspace.BackendConfigs{ ++ Local: &workspace.LocalFileConfig{Path: "/etc/.kusion"}, ++ }, ++ }, ++ { ++ name: "valid mysql backend full", ++ success: true, ++ backendConfigs: &workspace.BackendConfigs{ ++ Mysql: &workspace.MysqlConfig{ ++ DBName: "kusion", ++ User: "kusion", ++ Password: "do-not-store", ++ Host: "127.0.0.1", ++ Port: intPtr(3306), ++ }, ++ }, ++ }, ++ { ++ name: "valid mysql backend without port", ++ success: true, ++ backendConfigs: &workspace.BackendConfigs{ ++ Mysql: &workspace.MysqlConfig{ ++ DBName: "kusion", ++ User: "kusion", ++ Host: "127.0.0.1", ++ }, ++ }, ++ }, ++ { ++ name: "invalid mysql backend empty db name", ++ success: false, ++ backendConfigs: &workspace.BackendConfigs{ ++ Mysql: &workspace.MysqlConfig{ ++ User: "kusion", ++ Host: "127.0.0.1", ++ }, ++ }, ++ }, ++ { ++ name: "invalid mysql backend empty user", ++ success: false, ++ backendConfigs: &workspace.BackendConfigs{ ++ Mysql: &workspace.MysqlConfig{ ++ DBName: "kusion", ++ Host: "127.0.0.1", ++ }, ++ }, ++ }, ++ { ++ name: "invalid mysql backend empty host", ++ success: false, ++ backendConfigs: &workspace.BackendConfigs{ ++ Mysql: &workspace.MysqlConfig{ ++ DBName: "kusion", ++ User: "kusion", ++ }, ++ }, ++ }, ++ { ++ name: "invalid mysql backend port too small", ++ success: false, ++ backendConfigs: &workspace.BackendConfigs{ ++ Mysql: &workspace.MysqlConfig{ ++ DBName: "kusion", ++ User: "kusion", ++ Host: "127.0.0.1", ++ Port: intPtr(0), ++ }, ++ }, ++ }, ++ { ++ name: "invalid mysql backend port too large", ++ success: false, ++ backendConfigs: &workspace.BackendConfigs{ ++ Mysql: &workspace.MysqlConfig{ ++ DBName: "kusion", ++ User: "kusion", ++ Host: "127.0.0.1", ++ Port: intPtr(70000), ++ }, ++ }, ++ }, ++ { ++ name: "valid oss backend without access keys", ++ success: true, ++ backendConfigs: &workspace.BackendConfigs{ ++ Oss: newOssConfig("https://oss-cn-hangzhou.aliyuncs.com", "kusion"), ++ }, ++ }, ++ { ++ name: "invalid oss backend empty bucket", ++ success: false, ++ backendConfigs: &workspace.BackendConfigs{ ++ Oss: newOssConfig("https://oss-cn-hangzhou.aliyuncs.com", ""), ++ }, ++ }, ++ { ++ name: "invalid oss backend empty endpoint", ++ success: false, ++ backendConfigs: &workspace.BackendConfigs{ ++ Oss: newOssConfig("", "kusion"), ++ }, ++ }, ++ { ++ name: "valid s3 backend without region and keys", ++ success: true, ++ backendConfigs: &workspace.BackendConfigs{ ++ S3: newS3Config("", "kusion"), ++ }, ++ }, ++ { ++ name: "invalid s3 backend empty bucket", ++ success: false, ++ backendConfigs: &workspace.BackendConfigs{ ++ S3: newS3Config("https://s3.us-east-1.amazonaws.com", ""), ++ }, ++ }, ++ { ++ name: "invalid multiple backends local and mysql", ++ success: false, ++ backendConfigs: &workspace.BackendConfigs{ ++ Local: &workspace.LocalFileConfig{Path: "/etc/.kusion"}, ++ Mysql: &workspace.MysqlConfig{ ++ DBName: "kusion", ++ User: "kusion", ++ Host: "127.0.0.1", ++ }, ++ }, ++ }, ++ { ++ name: "invalid multiple backends oss and s3", ++ success: false, ++ backendConfigs: &workspace.BackendConfigs{ ++ Oss: newOssConfig("https://oss-cn-hangzhou.aliyuncs.com", "kusion"), ++ S3: newS3Config("", "kusion"), ++ }, ++ }, ++ } ++ ++ for _, tc := range testcases { ++ t.Run(tc.name, func(t *testing.T) { ++ err := ValidateBackendConfigs(tc.backendConfigs) ++ assert.Equal(t, tc.success, err == nil) ++ }) ++ } ++} ++ ++func TestGetBackendName_Backends(t *testing.T) { ++ testcases := []struct { ++ name string ++ expected string ++ backendConfigs *workspace.BackendConfigs ++ }{ ++ { ++ name: "nil configs default to local", ++ expected: "local", ++ backendConfigs: nil, ++ }, ++ { ++ name: "empty configs default to local", ++ expected: "local", ++ backendConfigs: &workspace.BackendConfigs{}, ++ }, ++ { ++ name: "local backend", ++ expected: "local", ++ backendConfigs: &workspace.BackendConfigs{ ++ Local: &workspace.LocalFileConfig{Path: "/etc/.kusion"}, ++ }, ++ }, ++ { ++ name: "mysql backend", ++ expected: "mysql", ++ backendConfigs: &workspace.BackendConfigs{ ++ Mysql: &workspace.MysqlConfig{DBName: "kusion", User: "kusion", Host: "127.0.0.1"}, ++ }, ++ }, ++ { ++ name: "oss backend", ++ expected: "oss", ++ backendConfigs: &workspace.BackendConfigs{ ++ Oss: newOssConfig("https://oss-cn-hangzhou.aliyuncs.com", "kusion"), ++ }, ++ }, ++ { ++ name: "s3 backend", ++ expected: "s3", ++ backendConfigs: &workspace.BackendConfigs{ ++ S3: newS3Config("", "kusion"), ++ }, ++ }, ++ } ++ ++ for _, tc := range testcases { ++ t.Run(tc.name, func(t *testing.T) { ++ assert.Equal(t, tc.expected, GetBackendName(tc.backendConfigs)) ++ }) ++ } ++} ++ ++func TestCompleteWorkspace_DefaultMysqlPort(t *testing.T) { ++ t.Run("unset port defaults to 3306", func(t *testing.T) { ++ ws := &workspace.Workspace{ ++ Name: "dev", ++ Backends: &workspace.BackendConfigs{ ++ Mysql: &workspace.MysqlConfig{DBName: "kusion", User: "kusion", Host: "127.0.0.1"}, ++ }, ++ } ++ CompleteWorkspace(ws) ++ if assert.NotNil(t, ws.Backends.Mysql.Port) { ++ assert.Equal(t, 3306, *ws.Backends.Mysql.Port) ++ } ++ }) ++ ++ t.Run("explicit port is left untouched", func(t *testing.T) { ++ ws := &workspace.Workspace{ ++ Name: "dev", ++ Backends: &workspace.BackendConfigs{ ++ Mysql: &workspace.MysqlConfig{DBName: "kusion", User: "kusion", Host: "127.0.0.1", Port: intPtr(13306)}, ++ }, ++ } ++ CompleteWorkspace(ws) ++ if assert.NotNil(t, ws.Backends.Mysql.Port) { ++ assert.Equal(t, 13306, *ws.Backends.Mysql.Port) ++ } ++ }) ++} ++ ++func TestCompleteWorkspace_EnvSecrets(t *testing.T) { ++ t.Run("mysql password from env", func(t *testing.T) { ++ t.Setenv("KUSION_BACKEND_MYSQL_PASSWORD", "secret-pwd") ++ ws := &workspace.Workspace{ ++ Backends: &workspace.BackendConfigs{ ++ Mysql: &workspace.MysqlConfig{DBName: "kusion", User: "kusion", Host: "127.0.0.1"}, ++ }, ++ } ++ CompleteWorkspace(ws) ++ assert.Equal(t, "secret-pwd", ws.Backends.Mysql.Password) ++ }) ++ ++ t.Run("empty env keeps existing mysql password", func(t *testing.T) { ++ t.Setenv("KUSION_BACKEND_MYSQL_PASSWORD", "") ++ ws := &workspace.Workspace{ ++ Backends: &workspace.BackendConfigs{ ++ Mysql: &workspace.MysqlConfig{DBName: "kusion", User: "kusion", Host: "127.0.0.1", Password: "from-config"}, ++ }, ++ } ++ CompleteWorkspace(ws) ++ assert.Equal(t, "from-config", ws.Backends.Mysql.Password) ++ }) ++ ++ t.Run("oss access keys from env", func(t *testing.T) { ++ t.Setenv("OSS_ACCESS_KEY_ID", "oss-id") ++ t.Setenv("OSS_ACCESS_KEY_SECRET", "oss-secret") ++ ws := &workspace.Workspace{ ++ Backends: &workspace.BackendConfigs{ ++ Oss: newOssConfig("https://oss-cn-hangzhou.aliyuncs.com", "kusion"), ++ }, ++ } ++ CompleteWorkspace(ws) ++ assert.Equal(t, "oss-id", ws.Backends.Oss.AccessKeyID) ++ assert.Equal(t, "oss-secret", ws.Backends.Oss.AccessKeySecret) ++ }) ++ ++ t.Run("s3 access keys and region from env", func(t *testing.T) { ++ t.Setenv("AWS_ACCESS_KEY_ID", "s3-id") ++ t.Setenv("AWS_SECRET_ACCESS_KEY", "s3-secret") ++ t.Setenv("AWS_REGION", "us-east-1") ++ t.Setenv("AWS_DEFAULT_REGION", "eu-west-1") ++ ws := &workspace.Workspace{ ++ Backends: &workspace.BackendConfigs{ ++ S3: newS3Config("", "kusion"), ++ }, ++ } ++ CompleteWorkspace(ws) ++ assert.Equal(t, "s3-id", ws.Backends.S3.AccessKeyID) ++ assert.Equal(t, "s3-secret", ws.Backends.S3.AccessKeySecret) ++ assert.Equal(t, "us-east-1", ws.Backends.S3.Region) ++ }) ++ ++ t.Run("s3 region falls back to default region", func(t *testing.T) { ++ t.Setenv("AWS_REGION", "") ++ t.Setenv("AWS_DEFAULT_REGION", "eu-west-1") ++ ws := &workspace.Workspace{ ++ Backends: &workspace.BackendConfigs{ ++ S3: newS3Config("", "kusion"), ++ }, ++ } ++ CompleteWorkspace(ws) ++ assert.Equal(t, "eu-west-1", ws.Backends.S3.Region) ++ }) ++ ++ t.Run("safe on nil and local backends", func(t *testing.T) { ++ assert.NotPanics(t, func() { ++ CompleteWorkspace(&workspace.Workspace{}) ++ CompleteWorkspace(&workspace.Workspace{ ++ Backends: &workspace.BackendConfigs{ ++ Local: &workspace.LocalFileConfig{Path: "/etc/.kusion"}, ++ }, ++ }) ++ }) ++ }) ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,24 @@ ++#!/usr/bin/env bash ++ ++ ++ ++set -euo pipefail ++HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ++cd /testbed ++ ++ ++ ++ ++ ++ ++ ++ ++export GOPROXY=off ++export GOFLAGS=-mod=mod ++cd /testbed/pkg/workspace ++ ++ ++go test -count=1 validation.go util.go operator.go validation_test.go util_test.go ++ ++ ++go test -count=1 validation.go util.go operator.go backends_test.go diff --git a/tasks/format-code-task-000138/tests/test.sh b/tasks/format-code-task-000138/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..01d4fbb3d9ee0747b3ab70df4ae03c090557e21f --- /dev/null +++ b/tasks/format-code-task-000138/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +pkg/workspace/backends_test.go +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000138/tests/test_command.sh b/tasks/format-code-task-000138/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000138/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000153/environment/Dockerfile b/tasks/format-code-task-000153/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..6223c5bc237245174744dc2ec4501bd309f66522 --- /dev/null +++ b/tasks/format-code-task-000153/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:ce3ef706010033015ad0990b69dce4cf5b9cf073014b6c36a4b18af85c481bea diff --git a/tasks/format-code-task-000153/environment/setup/files/blocklist b/tasks/format-code-task-000153/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000153/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000153/environment/setup/setup.sh b/tasks/format-code-task-000153/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000153/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000153/tests/test.patch b/tasks/format-code-task-000153/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..bc883534fdd1697c45e4bdc8ea3983332508d443 --- /dev/null +++ b/tasks/format-code-task-000153/tests/test.patch @@ -0,0 +1,156 @@ +diff --git a/tests/linter/rules/test_rule_pattern_selection.py b/tests/linter/rules/test_rule_pattern_selection.py +new file mode 100644 +index 00000000..9f7c722e +--- /dev/null ++++ b/tests/linter/rules/test_rule_pattern_selection.py +@@ -0,0 +1,124 @@ ++import re ++ ++import pytest ++ ++from robocop.linter.rules import ( ++ Rule, ++ RuleSeverity, ++ filter_rules_by_pattern, ++) ++ ++ ++def make_rule(rule_id, name, severity=RuleSeverity.WARNING, deprecated=False): ++ return Rule( ++ rule_id=rule_id, ++ name=name, ++ msg="Some description", ++ severity=severity, ++ deprecated=deprecated, ++ ) ++ ++ ++@pytest.fixture ++def rule_0101(): ++ return make_rule("0101", "some-message") ++ ++ ++@pytest.fixture ++def rules_collection(): ++ return { ++ "0101": make_rule("0101", "some-message", RuleSeverity.WARNING), ++ "0102": make_rule("0102", "other-message", RuleSeverity.ERROR), ++ "0204": make_rule("0204", "another-keyword", RuleSeverity.INFO), ++ } ++ ++ ++class TestMatchesPattern: ++ def test_exact_id_still_matches(self, rule_0101): ++ assert rule_0101.matches_pattern("0101") ++ ++ def test_exact_name_still_matches(self, rule_0101): ++ assert rule_0101.matches_pattern("some-message") ++ ++ def test_literal_non_match_returns_false(self, rule_0101): ++ assert not rule_0101.matches_pattern("0102") ++ assert not rule_0101.matches_pattern("other-message") ++ ++ def test_literal_prefix_is_not_a_match(self, rule_0101): ++ ++ assert not rule_0101.matches_pattern("01") ++ ++ def test_star_matches_everything(self, rule_0101): ++ assert rule_0101.matches_pattern("*") ++ ++ def test_star_prefix_matches_on_id(self, rule_0101): ++ assert rule_0101.matches_pattern("01*") ++ ++ def test_star_suffix_matches_on_name(self, rule_0101): ++ assert rule_0101.matches_pattern("*-message") ++ ++ def test_star_does_not_match_other_rules(self): ++ rule = make_rule("0204", "another-keyword") ++ assert not rule.matches_pattern("01*") ++ assert not rule.matches_pattern("*-message") ++ ++ def test_question_mark_single_char(self, rule_0101): ++ assert rule_0101.matches_pattern("010?") ++ assert not rule_0101.matches_pattern("01?") ++ ++ def test_character_class(self): ++ rule_a = make_rule("0101", "some-message") ++ rule_b = make_rule("0102", "other-message") ++ rule_c = make_rule("0204", "another-keyword") ++ assert rule_a.matches_pattern("010[12]") ++ assert rule_b.matches_pattern("010[12]") ++ assert not rule_c.matches_pattern("010[12]") ++ ++ def test_negated_character_class(self): ++ rule_a = make_rule("0101", "some-message") ++ rule_b = make_rule("0102", "other-message") ++ assert rule_b.matches_pattern("010[!1]") ++ assert not rule_a.matches_pattern("010[!1]") ++ ++ def test_case_insensitive_on_name(self, rule_0101): ++ assert rule_0101.matches_pattern("SOME-MESSAGE") ++ assert rule_0101.matches_pattern("Some-*") ++ ++ def test_compiled_regex_still_supported(self, rule_0101): ++ assert rule_0101.matches_pattern(re.compile("some-.*")) ++ assert rule_0101.matches_pattern(re.compile("0101")) ++ assert not rule_0101.matches_pattern(re.compile("nomatch")) ++ ++ ++class TestFilterRulesByPattern: ++ def test_filter_by_id_prefix(self, rules_collection): ++ result = filter_rules_by_pattern(rules_collection, "01*") ++ assert [rule.rule_id for rule in result] == ["0101", "0102"] ++ ++ def test_filter_by_name_suffix(self, rules_collection): ++ result = filter_rules_by_pattern(rules_collection, "*-message") ++ assert [rule.rule_id for rule in result] == ["0101", "0102"] ++ ++ def test_star_selects_all(self, rules_collection): ++ result = filter_rules_by_pattern(rules_collection, "*") ++ assert [rule.rule_id for rule in result] == ["0101", "0102", "0204"] ++ ++ def test_result_sorted_by_numeric_id(self): ++ rules = { ++ "0204": make_rule("0204", "another-keyword"), ++ "0101": make_rule("0101", "some-message"), ++ "0102": make_rule("0102", "other-message"), ++ } ++ result = filter_rules_by_pattern(rules, "*") ++ assert [rule.rule_id for rule in result] == ["0101", "0102", "0204"] ++ ++ def test_deprecated_rules_excluded(self): ++ rules = { ++ "0101": make_rule("0101", "some-message"), ++ "0102": make_rule("0102", "other-message", deprecated=True), ++ } ++ result = filter_rules_by_pattern(rules, "*") ++ assert [rule.rule_id for rule in result] == ["0101"] ++ ++ def test_no_match_returns_empty(self, rules_collection): ++ assert filter_rules_by_pattern(rules_collection, "99*") == [] +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,21 @@ ++#!/usr/bin/env bash ++ ++ ++ ++set -euo pipefail ++HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ++cd /testbed ++ ++ ++ ++PYTEST=".build_env/venv/bin/python -m pytest -p no:cacheprovider" ++ ++ ++ ++ ++ ++ ++$PYTEST tests/linter/rules/test_rule_pattern_selection.py -k "exact or literal or regex or sorted or deprecated or no_match" -q ++ ++ ++$PYTEST tests/linter/rules/test_rule_pattern_selection.py -q diff --git a/tasks/format-code-task-000153/tests/test.sh b/tasks/format-code-task-000153/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..c1dafe260447d831f4a5b172ba37761cf986ca9b --- /dev/null +++ b/tasks/format-code-task-000153/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/linter/rules/test_rule_pattern_selection.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000153/tests/test_command.sh b/tasks/format-code-task-000153/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000153/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000154/environment/Dockerfile b/tasks/format-code-task-000154/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..ba2e802726c531455b1f8f3a58b2db064c6777d8 --- /dev/null +++ b/tasks/format-code-task-000154/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:a1cca54957fb32d4c287f5ae4abe1cde0c7079030a74831f883cbd8aa9ade4a3 diff --git a/tasks/format-code-task-000154/environment/setup/files/blocklist b/tasks/format-code-task-000154/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000154/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000154/environment/setup/setup.sh b/tasks/format-code-task-000154/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000154/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000154/tests/test.patch b/tasks/format-code-task-000154/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..3f838ca0c06632f28bbef11191a5ede9e681b448 --- /dev/null +++ b/tasks/format-code-task-000154/tests/test.patch @@ -0,0 +1,167 @@ +diff --git a/tests/linter/reports/__init__.py b/tests/linter/reports/__init__.py +new file mode 100644 +index 00000000..e69de29b +diff --git a/tests/linter/reports/test_reports.py b/tests/linter/reports/test_reports.py +new file mode 100644 +index 00000000..b3dc1822 +--- /dev/null ++++ b/tests/linter/reports/test_reports.py +@@ -0,0 +1,134 @@ ++import json ++ ++import pytest ++ ++from robocop import __version__ ++from robocop.linter.exceptions import ConfigGeneralError, InvalidReportName ++from robocop.linter.reports import get_reports ++from robocop.linter.rules import Message, Rule, RuleSeverity ++ ++ ++def make_message(description="some issue", source="file.robot", line=1): ++ rule = Rule(rule_id="0801", name="dummy-rule", msg="dummy", severity=RuleSeverity.WARNING) ++ return Message( ++ rule, ++ description, ++ source=source, ++ node=None, ++ lineno=line, ++ col=1, ++ end_lineno=line, ++ end_col=2, ++ ) ++ ++ ++ ++ ++ ++def test_explicit_reports_are_returned_in_order(): ++ reports = get_reports(["json_report", "version"]) ++ assert list(reports.keys()) == ["json_report", "version"] ++ ++ ++def test_each_report_exposes_matching_name(): ++ reports = get_reports(["json_report", "version"]) ++ for name, report in reports.items(): ++ assert report.name == name ++ ++ ++def test_duplicate_names_collapse_to_single_entry(): ++ reports = get_reports(["version", "version"]) ++ assert list(reports.keys()) == ["version"] ++ ++ ++def test_all_enables_default_reports_only(): ++ names = set(get_reports(["all"]).keys()) ++ assert "version" in names ++ assert "return_status" in names ++ assert "json_report" not in names ++ assert "compare_runs" not in names ++ assert "internal_json_report" not in names ++ ++ ++def test_all_can_be_combined_with_explicit_non_default_report(): ++ names = get_reports(["all", "json_report"]) ++ assert "json_report" in names ++ assert "version" in names ++ ++ ++def test_unknown_report_raises_invalid_report_name(): ++ with pytest.raises(InvalidReportName) as err: ++ get_reports(["does_not_exist"]) ++ assert "does_not_exist" in str(err.value) ++ ++ ++def test_none_keeps_only_return_status(): ++ reports = get_reports(["None"]) ++ assert list(reports.keys()) == ["return_status"] ++ ++ ++def test_none_disables_external_reports(): ++ reports = get_reports(["json_report", "version", "None"]) ++ assert list(reports.keys()) == ["return_status"] ++ ++ ++def test_none_preserves_explicit_internal_json_report(): ++ names = set(get_reports(["None", "internal_json_report"]).keys()) ++ assert names == {"return_status", "internal_json_report"} ++ ++ ++ ++ ++ ++def test_version_report_outputs_version(): ++ report = get_reports(["version"])["version"] ++ output = report.get_report() ++ assert isinstance(output, str) ++ assert __version__ in output ++ ++ ++ ++ ++ ++def test_json_report_writes_default_file(tmp_path, monkeypatch): ++ monkeypatch.chdir(tmp_path) ++ report = get_reports(["json_report"])["json_report"] ++ first = make_message("issue one", "a.robot", line=1) ++ second = make_message("issue two", "b.robot", line=5) ++ report.add_message(first) ++ report.add_message(second) ++ ++ returned = report.get_report() ++ ++ output_file = tmp_path / "robocop.json" ++ assert output_file.is_file() ++ assert json.loads(output_file.read_text()) == [first.to_json(), second.to_json()] ++ assert isinstance(returned, str) ++ assert "robocop.json" in returned ++ ++ ++def test_json_report_empty_when_no_messages(tmp_path, monkeypatch): ++ monkeypatch.chdir(tmp_path) ++ report = get_reports(["json_report"])["json_report"] ++ report.get_report() ++ assert json.loads((tmp_path / "robocop.json").read_text()) == [] ++ ++ ++def test_json_report_configurable_destination(tmp_path): ++ report = get_reports(["json_report"])["json_report"] ++ target_dir = tmp_path / "nested" / "reports" ++ report.configure("output_dir", str(target_dir)) ++ report.configure("report_filename", "issues.json") ++ report.add_message(make_message()) ++ ++ returned = report.get_report() ++ ++ output_file = target_dir / "issues.json" ++ assert output_file.is_file() ++ assert "issues.json" in returned ++ ++ ++def test_json_report_rejects_unknown_configuration(): ++ report = get_reports(["json_report"])["json_report"] ++ with pytest.raises(ConfigGeneralError): ++ report.configure("not_a_real_param", "value") +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,19 @@ ++#!/usr/bin/env bash ++ ++ ++ ++set -euo pipefail ++HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ++cd /testbed ++ ++ ++ ++PY=/testbed/.build_env/venv/bin/python ++ ++ ++ ++ ++"$PY" -c "import robocop, robocop.linter.exceptions, robocop.linter.rules, robocop.linter.utils.misc" ++ ++ ++"$PY" -m pytest tests/linter/reports/test_reports.py -q diff --git a/tasks/format-code-task-000154/tests/test.sh b/tasks/format-code-task-000154/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..d15d00e5d63accf4e90abaa51f4b5b92e23c8434 --- /dev/null +++ b/tasks/format-code-task-000154/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/linter/reports/__init__.py +tests/linter/reports/test_reports.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000154/tests/test_command.sh b/tasks/format-code-task-000154/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000154/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000198/environment/Dockerfile b/tasks/format-code-task-000198/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..072be02fa8c39e04406ef900ca40cc46b4897f32 --- /dev/null +++ b/tasks/format-code-task-000198/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:957ae362ff0068a1abf2a238f2a464fe115233cdd001a9c41d643975fa0af895 diff --git a/tasks/format-code-task-000198/environment/setup/files/blocklist b/tasks/format-code-task-000198/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000198/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000198/environment/setup/setup.sh b/tasks/format-code-task-000198/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000198/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000198/tests/test.patch b/tasks/format-code-task-000198/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..035aaeda18e81fd8860ffd6f32806ed39a55c312 --- /dev/null +++ b/tasks/format-code-task-000198/tests/test.patch @@ -0,0 +1,217 @@ +diff --git a/src/utils/avatarImageUtils.spec.ts b/src/utils/avatarImageUtils.spec.ts +new file mode 100644 +index 00000000000..5e75049e0a5 +--- /dev/null ++++ b/src/utils/avatarImageUtils.spec.ts +@@ -0,0 +1,181 @@ ++import { ++ describe, ++ it, ++ expect, ++ vi, ++ beforeEach, ++ afterEach, ++} from 'vitest'; ++import { sanitizeAvatars } from './sanitizeAvatar'; ++import { urlToFile } from './urlToFile'; ++ ++describe('sanitizeAvatars', () => { ++ const mockCreateObjectURL = vi.fn(); ++ let consoleErrorSpy: ReturnType; ++ ++ beforeEach(() => { ++ vi.clearAllMocks(); ++ global.URL.createObjectURL = mockCreateObjectURL; ++ mockCreateObjectURL.mockReturnValue('blob:mock-url'); ++ ++ consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {}); ++ ++ Object.defineProperty(window, 'location', { ++ value: { origin: 'https://example.com' }, ++ writable: true, ++ }); ++ }); ++ ++ afterEach(() => { ++ consoleErrorSpy.mockRestore(); ++ }); ++ ++ it('creates an object URL for a valid image file', () => { ++ const mockFile = new File([''], 'test.jpg', { type: 'image/jpeg' }); ++ const result = sanitizeAvatars(mockFile, 'https://fallback.com/avatar.jpg'); ++ expect(mockCreateObjectURL).toHaveBeenCalledWith(mockFile); ++ expect(result).toBe('blob:mock-url'); ++ }); ++ ++ it('rejects non-image files and uses the fallback URL', () => { ++ const mockFile = new File([''], 'test.pdf', { type: 'application/pdf' }); ++ const fallbackUrl = 'https://fallback.com/avatar.jpg'; ++ const result = sanitizeAvatars(mockFile, fallbackUrl); ++ expect(mockCreateObjectURL).not.toHaveBeenCalled(); ++ expect(result).toBe(fallbackUrl); ++ }); ++ ++ it('uses the fallback URL when the file is null', () => { ++ const fallbackUrl = 'https://fallback.com/avatar.jpg'; ++ const result = sanitizeAvatars(null, fallbackUrl); ++ expect(mockCreateObjectURL).not.toHaveBeenCalled(); ++ expect(result).toBe(fallbackUrl); ++ }); ++ ++ it('resolves relative fallback URLs against the page origin', () => { ++ const result = sanitizeAvatars(null, '/avatar.jpg'); ++ expect(result).toBe('https://example.com/avatar.jpg'); ++ }); ++ ++ it('preserves query parameters in the fallback URL', () => { ++ const result = sanitizeAvatars( ++ null, ++ 'https://example.com/avatar.jpg?size=large&version=2', ++ ); ++ expect(result).toBe('https://example.com/avatar.jpg?size=large&version=2'); ++ }); ++ ++ it('preserves fragments in the fallback URL', () => { ++ const result = sanitizeAvatars(null, 'https://example.com/avatar.jpg#top'); ++ expect(result).toBe('https://example.com/avatar.jpg#top'); ++ }); ++ ++ it('percent-encodes non-ASCII characters in the fallback URL', () => { ++ const result = sanitizeAvatars(null, 'https://example.com/üser/avatär.jpg'); ++ expect(result).toBe('https://example.com/%C3%BCser/avat%C3%A4r.jpg'); ++ }); ++ ++ it('returns an empty string and logs an error for an empty fallback URL', () => { ++ const result = sanitizeAvatars(null, ''); ++ expect(result).toBe(''); ++ expect(consoleErrorSpy).toHaveBeenCalled(); ++ }); ++ ++ it('returns an empty string and logs an error for a missing fallback URL', () => { ++ // @ts-expect-error Testing the undefined case ++ const result = sanitizeAvatars(null, undefined); ++ expect(result).toBe(''); ++ expect(consoleErrorSpy).toHaveBeenCalled(); ++ }); ++ ++ it('does not throw on an unparseable fallback URL', () => { ++ Object.defineProperty(window, 'location', { ++ value: { origin: 'not a valid base' }, ++ writable: true, ++ }); ++ expect(() => sanitizeAvatars(null, '://bad')).not.toThrow(); ++ }); ++}); ++ ++describe('urlToFile', () => { ++ beforeEach(() => { ++ vi.clearAllMocks(); ++ }); ++ ++ it('converts a URL into a File using the final path segment as the name', async () => { ++ const testUrl = 'https://example.com/image/test-image.jpg'; ++ const mockBlob = new Blob(['test'], { type: 'image/jpeg' }); ++ ++ global.fetch = vi.fn().mockResolvedValue({ ++ blob: () => Promise.resolve(mockBlob), ++ }); ++ ++ const result = await urlToFile(testUrl); ++ ++ expect(result).toBeInstanceOf(File); ++ expect(result.name).toBe('test-image.jpg.jpeg'); ++ expect(result.type).toBe('image/jpeg'); ++ expect(fetch).toHaveBeenCalledWith(testUrl); ++ expect(fetch).toHaveBeenCalledTimes(1); ++ }); ++ ++ it('falls back to "avatar" when the URL has no final segment', async () => { ++ const testUrl = 'https://example.com/image/'; ++ const mockBlob = new Blob(['test'], { type: 'image/png' }); ++ ++ global.fetch = vi.fn().mockResolvedValue({ ++ blob: () => Promise.resolve(mockBlob), ++ }); ++ ++ const result = await urlToFile(testUrl); ++ ++ expect(result).toBeInstanceOf(File); ++ expect(result.name).toBe('avatar.png'); ++ expect(result.type).toBe('image/png'); ++ }); ++ ++ it('derives the extension from the blob MIME subtype', async () => { ++ const testUrl = 'https://example.com/document.pdf'; ++ const mockBlob = new Blob(['test'], { type: 'application/pdf' }); ++ ++ global.fetch = vi.fn().mockResolvedValue({ ++ blob: () => Promise.resolve(mockBlob), ++ }); ++ ++ const result = await urlToFile(testUrl); ++ ++ expect(result).toBeInstanceOf(File); ++ expect(result.name).toBe('document.pdf.pdf'); ++ expect(result.type).toBe('application/pdf'); ++ }); ++ ++ it('re-throws and logs when the fetch rejects', async () => { ++ const testUrl = 'https://example.com/invalid-image.jpg'; ++ const mockError = new Error('Network error'); ++ ++ global.fetch = vi.fn().mockRejectedValue(mockError); ++ const consoleErrorSpy = vi ++ .spyOn(console, 'error') ++ .mockImplementation(() => {}); ++ ++ await expect(urlToFile(testUrl)).rejects.toThrow('Network error'); ++ expect(consoleErrorSpy).toHaveBeenCalled(); ++ consoleErrorSpy.mockRestore(); ++ }); ++ ++ it('re-throws and logs when reading the blob rejects', async () => { ++ const testUrl = 'https://example.com/image.jpg'; ++ const mockError = new Error('Blob conversion failed'); ++ ++ global.fetch = vi.fn().mockResolvedValue({ ++ blob: () => Promise.reject(mockError), ++ }); ++ const consoleErrorSpy = vi ++ .spyOn(console, 'error') ++ .mockImplementation(() => {}); ++ ++ await expect(urlToFile(testUrl)).rejects.toThrow('Blob conversion failed'); ++ expect(consoleErrorSpy).toHaveBeenCalled(); ++ consoleErrorSpy.mockRestore(); ++ }); ++}); +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,25 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++set -euo pipefail ++HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ++cd /testbed ++ ++ ++ ++ ++ ++ ++ ++ ++npx vitest run --no-coverage \ ++ src/utils/convertToBase64.spec.ts \ ++ src/utils/dateFormatter.spec.ts \ ++ src/utils/getRefreshToken.spec.ts \ ++ src/utils/useLocalstorage.spec.ts ++ ++ ++npx vitest run --no-coverage \ ++ src/utils/avatarImageUtils.spec.ts diff --git a/tasks/format-code-task-000198/tests/test.sh b/tasks/format-code-task-000198/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..228c4c2a34a6fcd90e817b01d990fb605483bb6c --- /dev/null +++ b/tasks/format-code-task-000198/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +src/utils/avatarImageUtils.spec.ts +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000198/tests/test_command.sh b/tasks/format-code-task-000198/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000198/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000249/environment/Dockerfile b/tasks/format-code-task-000249/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..3e7b819abf742e4e0e6ad02848fdd40b71cf0aff --- /dev/null +++ b/tasks/format-code-task-000249/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:e17ded671e1c8df75928320eb14ddd08a6d4748531246d307033ace0d8ff0828 diff --git a/tasks/format-code-task-000249/environment/setup/files/blocklist b/tasks/format-code-task-000249/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000249/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000249/environment/setup/setup.sh b/tasks/format-code-task-000249/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000249/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000249/tests/test.patch b/tasks/format-code-task-000249/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..ee009d142a104d6b92eca93a238bb7734d4486ff --- /dev/null +++ b/tasks/format-code-task-000249/tests/test.patch @@ -0,0 +1,167 @@ +diff --git a/packages/sitecore-jss-nextjs/src/component-builder-contract.test.tsx b/packages/sitecore-jss-nextjs/src/component-builder-contract.test.tsx +new file mode 100644 +index 0000000000..ca397ed2a8 +--- /dev/null ++++ b/packages/sitecore-jss-nextjs/src/component-builder-contract.test.tsx +@@ -0,0 +1,138 @@ ++import React from 'react'; ++import { expect } from 'chai'; ++import { ComponentBuilder } from './ComponentBuilder'; ++ ++describe('ComponentBuilder (contract)', () => { ++ describe('getComponentFactory', () => { ++ it('should resolve Next.js default and SXA Default exports, and null for unknown', () => { ++ const Foo = { default: () =>
Foo
}; ++ const Bar = { default: () =>
Bar
}; ++ const Text = { Default: () =>
Text
}; ++ const components = new Map(); ++ components.set('Foo', Foo); ++ components.set('Bar', Bar); ++ components.set('Text', Text); ++ ++ const builder = new ComponentBuilder({ components }); ++ const componentFactory = builder.getComponentFactory({}); ++ ++ expect(componentFactory('Foo')).to.equal(Foo.default); ++ expect(componentFactory('Bar')).to.equal(Bar.default); ++ expect(componentFactory('Text')).to.equal(Text.Default); ++ expect(componentFactory('Unknown')).to.equal(null); ++ }); ++ ++ it('should prefer the SXA Default export over the Next.js default export', () => { ++ const Foo = { Default: () =>
SXA
, default: () =>
Next
}; ++ const components = new Map(); ++ components.set('Foo', Foo); ++ ++ const builder = new ComponentBuilder({ components }); ++ const componentFactory = builder.getComponentFactory(); ++ ++ expect(componentFactory('Foo')).to.equal(Foo.Default); ++ }); ++ ++ it('should resolve a lazy component via its element function', () => { ++ const fooComponent = () =>
Foo
; ++ const Foo = { element: () => fooComponent }; ++ const Bar = { default: () =>
Bar
}; ++ const components = new Map(); ++ components.set('Foo', Foo); ++ components.set('Bar', Bar); ++ ++ const builder = new ComponentBuilder({ components }); ++ const componentFactory = builder.getComponentFactory({}); ++ ++ expect(componentFactory('Foo')).to.equal(fooComponent); ++ expect(componentFactory('Bar')).to.equal(Bar.default); ++ }); ++ ++ it('should pass the editing flag through to a lazy component element function', () => { ++ const editingComponent = () =>
editing
; ++ const normalComponent = () =>
normal
; ++ const Foo = { ++ element: (isEditing?: boolean) => (isEditing ? editingComponent : normalComponent), ++ }; ++ const components = new Map(); ++ components.set('Foo', Foo); ++ ++ const editingFactory = new ComponentBuilder({ components }).getComponentFactory({ ++ isEditing: true, ++ }); ++ const normalFactory = new ComponentBuilder({ components }).getComponentFactory({}); ++ const defaultFactory = new ComponentBuilder({ components }).getComponentFactory(); ++ ++ expect(editingFactory('Foo')).to.equal(editingComponent); ++ expect(normalFactory('Foo')).to.equal(normalComponent); ++ expect(defaultFactory('Foo')).to.equal(normalComponent); ++ }); ++ ++ it('should resolve a custom named export when requested', () => { ++ const Foo = { default: () =>
Foo
, text: () =>
Text
}; ++ const components = new Map(); ++ components.set('Foo', Foo); ++ ++ const builder = new ComponentBuilder({ components }); ++ const componentFactory = builder.getComponentFactory({}); ++ ++ expect(componentFactory('Foo')).to.equal(Foo.default); ++ expect(componentFactory('Foo', 'text')).to.equal(Foo.text); ++ }); ++ ++ it('should treat the "Default" export name as default resolution', () => { ++ const Foo = { default: () =>
Foo
}; ++ const components = new Map(); ++ components.set('Foo', Foo); ++ ++ const builder = new ComponentBuilder({ components }); ++ const componentFactory = builder.getComponentFactory({}); ++ ++ ++ ++ expect(componentFactory('Foo', 'Default')).to.equal(Foo.default); ++ }); ++ }); ++ ++ describe('getModuleFactory', () => { ++ it('should resolve a static module and null for unknown', () => { ++ const Foo = { default: () =>
Foo
}; ++ const Bar = { default: () =>
Bar
, getStaticProps: () => undefined }; ++ const components = new Map(); ++ components.set('Foo', Foo); ++ components.set('Bar', Bar); ++ ++ const builder = new ComponentBuilder({ components }); ++ const moduleFactory = builder.getModuleFactory(); ++ ++ expect(moduleFactory('Foo')).to.equal(Foo); ++ expect(moduleFactory('Bar')).to.equal(Bar); ++ expect(moduleFactory('Unknown')).to.equal(null); ++ }); ++ ++ it('should resolve a lazy module via its module function', () => { ++ const fooModule = { default: () =>
Foo
}; ++ const Foo = { module: () => fooModule }; ++ const Bar = { default: () =>
Bar
}; ++ const components = new Map(); ++ components.set('Foo', Foo); ++ components.set('Bar', Bar); ++ ++ const builder = new ComponentBuilder({ components }); ++ const moduleFactory = builder.getModuleFactory(); ++ ++ expect(moduleFactory('Foo')).to.equal(fooModule); ++ expect(moduleFactory('Bar')).to.equal(Bar); ++ expect(moduleFactory('Unknown')).to.equal(null); ++ }); ++ ++ it('should return a callable factory function from each method', () => { ++ const components = new Map(); ++ const builder = new ComponentBuilder({ components }); ++ ++ expect(builder.getModuleFactory()).to.be.a('function'); ++ expect(builder.getComponentFactory()).to.be.a('function'); ++ expect(builder.getComponentFactory({ isEditing: true })).to.be.a('function'); ++ }); ++ }); ++}); +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,18 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++set -euo pipefail ++HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ++cd /testbed ++ ++ ++ ++cd /testbed/packages/sitecore-jss-nextjs ++ ++ ++npx mocha --require ./test/setup.js "./src/services/component-props-service.test.ts" --exit ++ ++ ++npx mocha --require ./test/setup.js "./src/component-builder-contract.test.tsx" --exit diff --git a/tasks/format-code-task-000249/tests/test.sh b/tasks/format-code-task-000249/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..dfb8ea31fe89388a1e9eff8ed06715906f2cca1a --- /dev/null +++ b/tasks/format-code-task-000249/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +packages/sitecore-jss-nextjs/src/component-builder-contract.test.tsx +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000249/tests/test_command.sh b/tasks/format-code-task-000249/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000249/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000271/environment/Dockerfile b/tasks/format-code-task-000271/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..05cca4e8095679fe5beb7ddc71178781e0cf8014 --- /dev/null +++ b/tasks/format-code-task-000271/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:ca6ebc025ee81ba81e3f5ee807dee13262ab8eadb4a87781124895ea27381a02 diff --git a/tasks/format-code-task-000271/environment/setup/files/blocklist b/tasks/format-code-task-000271/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000271/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000271/environment/setup/setup.sh b/tasks/format-code-task-000271/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000271/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000271/tests/test.patch b/tasks/format-code-task-000271/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..5172c6ca976bdb645f73bb966774f75673eec615 --- /dev/null +++ b/tasks/format-code-task-000271/tests/test.patch @@ -0,0 +1,101 @@ +diff --git a/packages/ts-interface-generator/src/test/generateMethods.test.ts b/packages/ts-interface-generator/src/test/generateMethods.test.ts +index 86f1900..a908c9b 100644 +--- a/packages/ts-interface-generator/src/test/generateMethods.test.ts ++++ b/packages/ts-interface-generator/src/test/generateMethods.test.ts +@@ -40,7 +40,7 @@ test("Generate methods for aggregation", () => { + getContent(): Control[]; + addContent(content: Control): this; + insertContent(content: Control, index: number): this; +-removeContent(content: number | string | Control): this; ++removeContent(content: number | string | Control): Control | null; + removeAllContent(): Control[]; + indexOfContent(content: Control): number; + destroyContent(): this; +@@ -89,3 +89,65 @@ unbindContent(): this;`; + + expect(interfaceText.trim()).toEqual(expected); + }); ++ ++test("Aggregation 0..n remove returns aggregation type | null (uses the actual aggregation type, not 'this' or hardcoded)", () => { ++ const requiredImports: RequiredImports = {}; ++ const knownGlobals: { ++ [key: string]: { moduleName: string; exportName?: string }; ++ } = {}; ++ const classInfo: ClassInfo = { ++ name: "MyTestClass", ++ aggregations: { ++ columns: { ++ name: "columns", ++ type: "MyItem", ++ cardinality: "0..n", ++ altTypes: null, ++ bindable: false, ++ singularName: "column", ++ methods: { ++ get: "getColumns", ++ add: "addColumn", ++ insert: "insertColumn", ++ remove: "removeColumn", ++ removeAll: "removeAllColumns", ++ indexOf: "indexOfColumn", ++ destroy: "destroyColumns", ++ }, ++ }, ++ }, ++ }; ++ ++ const methods = generateMethods( ++ classInfo, ++ requiredImports, ++ knownGlobals, ++ {}, ++ {}, ++ ); ++ ++ const interfaceText = astToString(methods).trim(); ++ ++ ++ expect(interfaceText).toContain( ++ "removeColumn(columns: number | string | MyItem): MyItem | null;", ++ ); ++ ++ expect(interfaceText).not.toMatch( ++ /removeColumn\(columns: number \| string \| MyItem\): this;/, ++ ); ++ ++ expect(interfaceText).not.toMatch( ++ /removeColumn\(columns: number \| string \| MyItem\): MyItem;/, ++ ); ++ ++ expect(interfaceText).toContain( ++ "insertColumn(columns: MyItem, index: number): this;", ++ ); ++ ++ expect(interfaceText).toContain("getColumns(): MyItem[];"); ++ expect(interfaceText).toContain("addColumn(columns: MyItem): this;"); ++ expect(interfaceText).toContain("removeAllColumns(): MyItem[];"); ++ expect(interfaceText).toContain("indexOfColumn(columns: MyItem): number;"); ++ expect(interfaceText).toContain("destroyColumns(): this;"); ++}); +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 0000000..75c722d +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["cd packages/ts-interface-generator && npx jest --testPathPattern=generateMethods"] ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++cd packages/ts-interface-generator && npx jest --testPathPattern=generateMethods ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-000271/tests/test.sh b/tasks/format-code-task-000271/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8e45899b232376806189dde56a0fa1793ce82c9e --- /dev/null +++ b/tasks/format-code-task-000271/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +packages/ts-interface-generator/src/test/generateMethods.test.ts +test_commands.json +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000271/tests/test_command.sh b/tasks/format-code-task-000271/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000271/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000276/environment/Dockerfile b/tasks/format-code-task-000276/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..820a5365d084f4237b46bd4a090912aaed2fec42 --- /dev/null +++ b/tasks/format-code-task-000276/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:1c805366349fb4b515b3df8bbd7729118039f8b5d07731a08f8c10481554f6cf diff --git a/tasks/format-code-task-000276/environment/setup/files/blocklist b/tasks/format-code-task-000276/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000276/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000276/environment/setup/setup.sh b/tasks/format-code-task-000276/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000276/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000276/tests/test.patch b/tasks/format-code-task-000276/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..862deff2841ba75a3c3fa5a5e41bfcd69e9b2f47 --- /dev/null +++ b/tasks/format-code-task-000276/tests/test.patch @@ -0,0 +1,132 @@ +diff --git a/src/linttest/basic_test.go b/src/linttest/basic_test.go +index d2d98e3fc..922ac288d 100644 +--- a/src/linttest/basic_test.go ++++ b/src/linttest/basic_test.go +@@ -755,6 +755,31 @@ func TestIssetVarVar1(t *testing.T) { + test.RunAndMatch() + } + ++func TestIssetElseif1(t *testing.T) { ++ test := linttest.NewSuite(t) ++ test.AddFile(`name(); ++ } else if ($f3 instanceof Video) { ++ return $f3->filename(); ++ } ++ return ""; ++} ++ ++function fn4($f4) { ++ if ($f4 instanceof File) { ++ return $f4->name(); ++ } elseif ($f4 instanceof Video) { ++ return $f4->filename(); ++ } ++ return ""; ++}`) ++ test.Expect = []string{ ++ `Call to undefined method {\File}->name()`, ++ `Call to undefined method {\File|\Video}->filename()`, ++ `Call to undefined method {\File}->name()`, ++ `Call to undefined method {\File|\Video}->filename()`, ++ } ++ test.RunAndMatch() ++} ++ ++func TestInstanceOfElseif1(t *testing.T) { ++ linttest.SimpleNegativeTest(t, `filename(); ++ } elseif ($f1 instanceof Video) { ++ return $f1->name(); ++ } ++ return ""; ++} ++ ++function fn2($f2) { ++ if ($f2 instanceof File) { ++ return $f2->filename(); ++ } else if ($f2 instanceof Video) { ++ return $f2->name(); ++ } ++ return ""; ++} ++`) ++} ++ + func TestInstanceOf(t *testing.T) { + test := linttest.NewSuite(t) + test.AddFile(`/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +src/linttest/basic_test.go +src/linttest/oop_test.go +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000276/tests/test_command.sh b/tasks/format-code-task-000276/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000276/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000285/environment/Dockerfile b/tasks/format-code-task-000285/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..b2b805bbc892f2d7c1ba31d8978f107617b12e9f --- /dev/null +++ b/tasks/format-code-task-000285/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:72ec3726ca06885f614c78dc57a474b8c85e9bf190a4c1a258c887884a92baa4 diff --git a/tasks/format-code-task-000285/environment/setup/files/blocklist b/tasks/format-code-task-000285/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000285/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000285/environment/setup/setup.sh b/tasks/format-code-task-000285/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000285/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000285/tests/test.patch b/tasks/format-code-task-000285/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..dac5b85b9f3e68ad9b31ea74fafeeb000dd1af82 --- /dev/null +++ b/tasks/format-code-task-000285/tests/test.patch @@ -0,0 +1,217 @@ +diff --git a/tests/test_validate.py b/tests/test_validate.py +index 9e9c893..4406677 100644 +--- a/tests/test_validate.py ++++ b/tests/test_validate.py +@@ -31,16 +31,31 @@ class NewOuter2(ConfZ): + NewOuter2.CONFIG_SOURCES = ConfZDataSource(data={'inner': {'attr1': 1}, 'attr2': 2}) + + +-def test_listeners(): ++@pytest.mark.asyncio ++async def test_listeners(): + class EmptyConfig(ConfZ): + CONFIG_SOURCES = [] + ++ called_sync = False ++ ++ @depends_on(EmptyConfig) ++ def working_fn_sync(): ++ nonlocal called_sync ++ called_sync = True ++ ++ called_async = False ++ + @depends_on(EmptyConfig) +- def working_fn(): +- pass ++ async def working_fn_async(): ++ nonlocal called_async ++ called_async = True + + validate_all_configs(include_listeners=False) +- validate_all_configs(include_listeners=True) ++ assert not called_sync ++ assert not called_async ++ await validate_all_configs(include_listeners=True) ++ assert called_sync ++ assert called_async + + @depends_on(EmptyConfig) + def broken_fn(): +@@ -48,4 +63,4 @@ def broken_fn(): + + validate_all_configs(include_listeners=False) + with pytest.raises(ValueError): +- validate_all_configs(include_listeners=True) ++ await validate_all_configs(include_listeners=True) + +diff --git a/tests/test_validate_async_listeners.py b/tests/test_validate_async_listeners.py +new file mode 100644 +index 0000000..8f1a4c3 +--- /dev/null ++++ b/tests/test_validate_async_listeners.py +@@ -0,0 +1,115 @@ ++import asyncio ++import inspect ++from contextlib import contextmanager ++from pathlib import Path ++ ++from confz import ConfZ, depends_on, validate_all_configs ++ ++ ++def _all_confz_subclasses(root=ConfZ): ++ subclasses = [] ++ for subclass in root.__subclasses__(): ++ subclasses.append(subclass) ++ subclasses.extend(_all_confz_subclasses(subclass)) ++ return subclasses ++ ++ ++@contextmanager ++def _only_active_configs(*active_classes): ++ active_classes = set(active_classes) ++ saved_sources = {} ++ for config_class in _all_confz_subclasses(): ++ if config_class not in active_classes: ++ saved_sources[config_class] = getattr(config_class, "CONFIG_SOURCES", None) ++ config_class.CONFIG_SOURCES = None ++ try: ++ yield ++ finally: ++ for config_class, source in saved_sources.items(): ++ config_class.CONFIG_SOURCES = source ++ ++ ++def _run_awaitable(awaitable): ++ async def runner(): ++ await awaitable ++ ++ asyncio.run(runner()) ++ ++ ++def test_validate_all_configs_sync_listeners_remain_sync(): ++ events = [] ++ ++ class SyncOnlyConfig(ConfZ): ++ CONFIG_SOURCES = [] ++ ++ @depends_on(SyncOnlyConfig) ++ def init_sync_client(): ++ events.append("sync") ++ return object() ++ ++ with _only_active_configs(SyncOnlyConfig): ++ result = validate_all_configs(include_listeners=True) ++ ++ assert not inspect.isawaitable(result) ++ assert events == ["sync"] ++ ++ ++def test_validate_all_configs_with_async_listener_defers_work_until_awaited(): ++ events = [] ++ ++ class MixedConfig(ConfZ): ++ CONFIG_SOURCES = [] ++ ++ @depends_on(MixedConfig) ++ def init_sync_client(): ++ events.append("sync") ++ return object() ++ ++ @depends_on(MixedConfig) ++ async def init_async_client(): ++ events.append("async") ++ return object() ++ ++ with _only_active_configs(MixedConfig): ++ result = validate_all_configs(include_listeners=True) ++ assert inspect.isawaitable(result) ++ assert events == [] ++ _run_awaitable(result) ++ ++ assert sorted(events) == ["async", "sync"] ++ ++ ++def test_validate_all_configs_awaits_each_async_listener(): ++ events = [] ++ ++ class MultiAsyncConfig(ConfZ): ++ CONFIG_SOURCES = [] ++ ++ @depends_on(MultiAsyncConfig) ++ async def init_first_client(): ++ events.append("first") ++ return object() ++ ++ @depends_on(MultiAsyncConfig) ++ async def init_second_client(): ++ events.append("second") ++ return object() ++ ++ with _only_active_configs(MultiAsyncConfig): ++ result = validate_all_configs(include_listeners=True) ++ assert inspect.isawaitable(result) ++ _run_awaitable(result) ++ ++ assert events.count("first") == 1 ++ assert events.count("second") == 1 ++ ++ ++def test_async_listener_startup_validation_is_documented(): ++ docs = Path("docs/source/usage/listeners.rst").read_text(encoding="utf-8") ++ lower_docs = docs.lower() ++ compact_docs = "".join(lower_docs.split()) ++ ++ assert "async" in lower_docs and "listener" in lower_docs ++ assert "validate_all_configs" in lower_docs ++ assert "include_listeners=true" in compact_docs ++ assert "awaitvalidate_all_configs(include_listeners=true)" in compact_docs +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,44 @@ ++#!/bin/bash ++set -uo pipefail ++cd /testbed ++ ++ ++set +u ++ ++ ++export PYENV_ROOT="$HOME/.pyenv" ++export PATH="$PYENV_ROOT/bin:$PATH" ++eval "$(pyenv init -)" ++pyenv global 3.9.7 ++ ++ ++VENV_DIR=/testbed/.build_env/.venv ++mkdir -p "$(dirname "$VENV_DIR")" ++if [ ! -f "$VENV_DIR/bin/activate" ]; then ++ rm -rf "$VENV_DIR" ++ python3 -m venv "$VENV_DIR" ++fi ++source "$VENV_DIR/bin/activate" ++set -u ++ ++ ++pip install --upgrade pip setuptools wheel -q 2>/dev/null ++pip install -e /testbed --no-deps -q 2>/dev/null ++pip install "pydantic>=1.8.2,<2" "PyYAML>=5.4.1,<6" "python-dotenv>=0.19.2,<0.20.0" pytest "pytest-asyncio>=0.16.0" -q 2>/dev/null ++ ++ ++case "${1:-}" in ++ base) ++ python -m pytest tests/test_validate.py::test_validate -v ++ ;; ++ new) ++ python -m pytest \ ++ tests/test_validate.py::test_listeners \ ++ tests/test_validate_async_listeners.py \ ++ -v ++ ;; ++ *) ++ echo "usage: $0 base|new" ++ exit 2 ++ ;; ++esac diff --git a/tasks/format-code-task-000285/tests/test.sh b/tasks/format-code-task-000285/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..6d51aa540c9af2a0bdc54055bd0554252455cacc --- /dev/null +++ b/tasks/format-code-task-000285/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/test_validate.py +tests/test_validate_async_listeners.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000285/tests/test_command.sh b/tasks/format-code-task-000285/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..e8d2f32b64045b5a5a56e0ad5667da87d8e0bc2a --- /dev/null +++ b/tasks/format-code-task-000285/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new \ No newline at end of file diff --git a/tasks/format-code-task-000303/environment/Dockerfile b/tasks/format-code-task-000303/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..c6fb5a6dc3868c12a3994818853f1f6b902d3a92 --- /dev/null +++ b/tasks/format-code-task-000303/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:0b36240913bbf2623276d6e2811d4db07cb78a285db080758d0a4f4a17218cc6 diff --git a/tasks/format-code-task-000303/environment/setup/files/blocklist b/tasks/format-code-task-000303/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000303/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000303/environment/setup/setup.sh b/tasks/format-code-task-000303/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-000303/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000303/tests/test.patch b/tasks/format-code-task-000303/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..9b167183151750681aa6f6cb7e3836b7dfc92bcc --- /dev/null +++ b/tasks/format-code-task-000303/tests/test.patch @@ -0,0 +1,211 @@ +diff --git a/usercase-test-coderl/usecase.sh b/usercase-test-coderl/usecase.sh +new file mode 100755 +--- /dev/null ++++ b/usercase-test-coderl/usecase.sh +@@ -0,0 +1,186 @@ ++#!/usr/bin/env bash ++ ++set -u ++export LANG=C.UTF-8 LC_ALL=C.UTF-8 TZ=UTC ++export PIP_DISABLE_PIP_VERSION_CHECK=1 ++export PIP_NO_INDEX=1 ++export PIP_CONFIG_FILE=/dev/null ++ ++INSTALL_LOG=$(mktemp) ++python -m pip uninstall --disable-pip-version-check -y scoary >"$INSTALL_LOG" 2>&1 || true ++if ! ( cd /workspace/repo && python -m pip install --disable-pip-version-check --no-index --no-build-isolation -e . --no-deps >"$INSTALL_LOG" 2>&1 ); then ++ echo "FAIL: build/install" >&2 ++ cat "$INSTALL_LOG" >&2 ++ rm -f "$INSTALL_LOG" ++ exit 1 ++fi ++rm -f "$INSTALL_LOG" ++hash -r ++ ++BIN=$(command -v vcf2scoary || true) ++[ -n "$BIN" ] || { echo "FAIL: vcf2scoary command is not installed" >&2; exit 1; } ++ ++TMP=$(mktemp -d); trap 'rm -rf "$TMP"' EXIT ++cd "$TMP" ++fail() { echo "FAIL: $*" >&2; exit 1; } ++ ++ ++ ++assert_csv_matches() { ++ local actual_file=$1 ++ local expected_text=$2 ++ local label=$3 ++ ACTUAL_FILE="$actual_file" EXPECTED_TEXT="$expected_text" LABEL="$label" python - <<'PY' ++import collections ++import csv ++import io ++import os ++import re ++import sys ++ ++actual_file = os.environ["ACTUAL_FILE"] ++expected_text = os.environ["EXPECTED_TEXT"] ++label = os.environ["LABEL"] ++with open(actual_file, newline="") as fh: ++ actual_text = fh.read() ++ ++quoted_line = re.compile(r'^"[^"]*"(,"[^"]*")*$') ++for lineno, line in enumerate(actual_text.splitlines(), 1): ++ if not quoted_line.fullmatch(line): ++ print(f"{label} csv line {lineno} is not fully quoted: {line}", file=sys.stderr) ++ sys.exit(1) ++ ++actual_rows = list(csv.reader(io.StringIO(actual_text))) ++expected_rows = list(csv.reader(io.StringIO(expected_text))) ++if not actual_rows: ++ print(f"{label} csv is empty", file=sys.stderr) ++ sys.exit(1) ++if actual_rows[0] != expected_rows[0]: ++ print(f"{label} csv header: {actual_rows[0]}", file=sys.stderr) ++ sys.exit(1) ++if collections.Counter(map(tuple, actual_rows[1:])) != collections.Counter(map(tuple, expected_rows[1:])): ++ print(f"{label} csv rows: {actual_rows[1:]}", file=sys.stderr) ++ sys.exit(1) ++PY ++} ++ ++cat > mixed.vcf <<'EOF' ++##fileformat=VCFv4.1 ++##FORMAT= ++##INFO= ++#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT Reference Strain_A Strain_B Strain_C ++NC_000962 4013 0 T C 9999 0 TYPE=snp GT 0:99 1:88 1:77 1:66 ++NC_000962 4705 0 T C,A 9999 0 TYPE=snp GT 0 . 1 2 ++NC_000962 5000 0 G GA 9999 0 TYPE=ins GT 0 1 0 1 ++NC_000962 5100 0 GA G 9999 0 TYPE=del GT 1 0 1 0 ++NC_000962 5200 0 A T 9999 0 TYPE=complex GT 1 1 0 0 ++EOF ++ ++cat > bad_number.vcf <<'EOF' ++##fileformat=VCFv4.1 ++##FORMAT= ++##INFO= ++#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT Reference Strain_A ++NC_000962 4013 0 T C 9999 0 TYPE=snp GT 0 1 ++EOF ++ ++EXPECTED_STDOUT='VCF version 4.1 detected ++Reached the end of the file' ++ ++EXPECTED_ALL_CSV='"#CHROM","POS","ID","REF","ALT","QUAL","FILTER","INFO","FORMAT","DUMMY","Reference","Strain_A","Strain_B","Strain_C" ++"NC_000962","4013","0","T","C","9999","0","TYPE=snp","GT","False","0","1","1","1" ++"NC_000962","4705","0","T","C","9999","0","TYPE=snp","GT","True","0","0","1","0" ++"NC_000962","4705","0","T","A","9999","0","TYPE=snp","GT","True","0","0","0","1" ++"NC_000962","5000","0","G","GA","9999","0","TYPE=ins","GT","False","0","1","0","1" ++"NC_000962","5100","0","GA","G","9999","0","TYPE=del","GT","False","1","0","1","0" ++"NC_000962","5200","0","A","T","9999","0","TYPE=complex","GT","False","1","1","0","0"' ++ ++EXPECTED_FILTERED_CSV='"#CHROM","POS","ID","REF","ALT","QUAL","FILTER","INFO","FORMAT","DUMMY","Reference","Strain_A","Strain_B","Strain_C" ++"NC_000962","4013","0","T","C","9999","0","TYPE=snp","GT","False","0","1","1","1" ++"NC_000962","4705","0","T","C","9999","0","TYPE=snp","GT","True","0","0","1","0" ++"NC_000962","4705","0","T","A","9999","0","TYPE=snp","GT","True","0","0","0","1" ++"NC_000962","5000","0","G","GA","9999","0","TYPE=ins","GT","False","0","1","0","1" ++"NC_000962","5100","0","GA","G","9999","0","TYPE=del","GT","False","1","0","1","0"' ++ ++ ++ ++ ++rm -f out err mutations_presence_absence.csv ++"$BIN" mixed.vcf >out 2>err; ec=$? ++[ "$ec" -eq 0 ] || fail "F1 exit $ec; want 0" ++[ "$(cat out)" = "$EXPECTED_STDOUT" ] || fail "F1 stdout: $(cat out)" ++[ ! -s err ] || fail "F1 unexpected stderr: $(cat err)" ++[ -f mutations_presence_absence.csv ] || fail "F1 default output file missing" ++ ++assert_csv_matches mutations_presence_absence.csv "$EXPECTED_ALL_CSV" F1 || fail "F1 csv: $(cat mutations_presence_absence.csv)" ++ ++ ++ ++ ++rm -f out err custom.csv mutations_presence_absence.csv ++"$BIN" --out custom.csv mixed.vcf >out 2>err; ec=$? ++[ "$ec" -eq 0 ] || fail "F2 exit $ec; want 0" ++[ "$(cat out)" = "$EXPECTED_STDOUT" ] || fail "F2 stdout: $(cat out)" ++[ ! -s err ] || fail "F2 unexpected stderr: $(cat err)" ++[ -f custom.csv ] || fail "F2 custom output file missing" ++[ ! -e mutations_presence_absence.csv ] || fail "F2 unexpectedly wrote default output" ++ ++assert_csv_matches custom.csv "$EXPECTED_ALL_CSV" F2 || fail "F2 csv: $(cat custom.csv)" ++ ++ ++ ++ ++rm -f out err filtered.csv ++"$BIN" --types snp,ins,del --out filtered.csv mixed.vcf >out 2>err; ec=$? ++[ "$ec" -eq 0 ] || fail "F3 exit $ec; want 0" ++[ "$(cat out)" = "$EXPECTED_STDOUT" ] || fail "F3 stdout: $(cat out)" ++[ ! -s err ] || fail "F3 unexpected stderr: $(cat err)" ++ ++assert_csv_matches filtered.csv "$EXPECTED_FILTERED_CSV" F3 || fail "F3 csv: $(cat filtered.csv)" ++ ++ ++ ++ ++printf 'existing\n' > occupied.csv ++rm -f out err ++"$BIN" --out occupied.csv mixed.vcf >out 2>err; ec=$? ++[ "$ec" -ne 0 ] || fail "F4 exit $ec; want non-zero" ++[ ! -s out ] || fail "F4 unexpected stdout: $(cat out)" ++[ "$(cat err)" = "Outfile already exists. Change name of outfile or run with --force" ] || fail "F4 stderr: $(cat err)" ++[ "$(cat occupied.csv)" = "existing" ] || fail "F4 existing file was overwritten" ++ ++ ++ ++ ++rm -f out err ++"$BIN" --force --out occupied.csv mixed.vcf >out 2>err; ec=$? ++[ "$ec" -eq 0 ] || fail "F5 exit $ec; want 0" ++[ "$(cat out)" = "$EXPECTED_STDOUT" ] || fail "F5 stdout: $(cat out)" ++[ ! -s err ] || fail "F5 unexpected stderr: $(cat err)" ++ ++assert_csv_matches occupied.csv "$EXPECTED_ALL_CSV" F5 || fail "F5 csv: $(cat occupied.csv)" ++ ++ ++ ++ ++rm -f out err missing.csv ++"$BIN" --out missing.csv no_such.vcf >out 2>err; ec=$? ++[ "$ec" -ne 0 ] || fail "F6 exit $ec; want non-zero" ++[ ! -s out ] || fail "F6 unexpected stdout: $(cat out)" ++[ "$(cat err)" = "Unable to locate input file no_such.vcf" ] || fail "F6 stderr: $(cat err)" ++[ ! -e missing.csv ] || fail "F6 wrote output for missing input" ++ ++ ++ ++ ++rm -f out err bad.csv ++"$BIN" --out bad.csv bad_number.vcf >out 2>err; ec=$? ++[ "$ec" -ne 0 ] || fail "F7 exit $ec; want non-zero" ++ ++! grep -qx 'Reached the end of the file' out || fail "F7 stdout reported successful completion: $(cat out)" ++[ "$(cat err)" = "ERROR: Expected a single allele per genotype. Scoary only works for haploid organisms." ] || fail "F7 stderr: $(cat err)" ++ ++[ ! -s bad.csv ] || fail "F7 output should be empty after metadata rejection" ++ ++echo "PASS" ++exit 0 +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,15 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++export PIP_DISABLE_PIP_VERSION_CHECK=1 ++export PIP_NO_INDEX=1 ++export PIP_CONFIG_FILE=/dev/null ++set -e ++cd /workspace/repo ++exec bash /workspace/repo/usercase-test-coderl/usecase.sh diff --git a/tasks/format-code-task-000303/tests/test.sh b/tasks/format-code-task-000303/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..d4d80bb634b14076ae561be99f395189577b7ac6 --- /dev/null +++ b/tasks/format-code-task-000303/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/usecase.sh +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000303/tests/test_command.sh b/tasks/format-code-task-000303/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-000303/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000332/environment/Dockerfile b/tasks/format-code-task-000332/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..e1ce32ef3eee0e4148678345a3cb9c2920082336 --- /dev/null +++ b/tasks/format-code-task-000332/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:bc95ee4920fa1ff9a3c1fb895837bbd4708c18f5c15f9e07d1c5f79d5934d4c6 diff --git a/tasks/format-code-task-000332/environment/setup/files/blocklist b/tasks/format-code-task-000332/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000332/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000332/environment/setup/setup.sh b/tasks/format-code-task-000332/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-000332/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000332/tests/test.patch b/tasks/format-code-task-000332/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..631e71f04b5cf5c39e2d9041ed4a370fb16075dd --- /dev/null +++ b/tasks/format-code-task-000332/tests/test.patch @@ -0,0 +1,253 @@ +diff --git a/usercase-test-coderl/test_zone_occupancy_counting.py b/usercase-test-coderl/test_zone_occupancy_counting.py +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/test_zone_occupancy_counting.py +@@ -0,0 +1,219 @@ ++ ++ ++ ++ ++ ++ ++import numpy as np ++import pytest ++ ++from peekingduck.pipeline.nodes.dabble.bbox_to_btm_midpoint import Node as BboxNode ++from peekingduck.pipeline.nodes.dabble.zone_count import Node as ZoneCountNode ++ ++ ++BBOX_CONFIG = {"input": ["bboxes", "img"], "output": ["btm_midpoint"]} ++ZONE_CONFIG = { ++ "input": ["btm_midpoint"], ++ "output": ["zones", "zone_count"], ++ "resolution": [1280, 720], ++ "zones": [ ++ [[0, 0], [640, 0], [640, 720], [0, 720]], ++ [[0.5, 0], [1, 0], [1, 1], [0.5, 1]], ++ ], ++} ++ ++ ++def test_bbox_to_bottom_midpoint_uses_image_shape_and_normalized_bbox(): ++ ++ ++ ++ img = np.zeros((400, 600, 3), dtype=np.uint8) ++ bboxes = [[0.1, 0.2, 0.3, 0.4]] ++ node = BboxNode(BBOX_CONFIG) ++ ++ assert node.run({"bboxes": bboxes, "img": img}) == {"btm_midpoint": [(120, 160)]} ++ ++ ++def test_bbox_to_bottom_midpoint_empty_input_and_no_mutation(): ++ ++ ++ ++ img = np.array( ++ [ ++ [[0, 1, 2], [3, 4, 5]], ++ [[6, 7, 8], [9, 10, 11]], ++ ], ++ dtype=np.uint8, ++ ) ++ bboxes = [] ++ node = BboxNode(BBOX_CONFIG) ++ ++ assert node.run({"bboxes": bboxes, "img": img}) == {"btm_midpoint": []} ++ assert img.tolist() == [ ++ [[0, 1, 2], [3, 4, 5]], ++ [[6, 7, 8], [9, 10, 11]], ++ ] ++ assert bboxes == [] ++ ++ ++def test_bbox_to_bottom_midpoint_does_not_mutate_nonempty_bbox_list(): ++ ++ ++ ++ img = np.array([[[12, 13, 14], [15, 16, 17]]], dtype=np.uint8) ++ bboxes = [[0.0, 0.0, 1.0, 1.0]] ++ node = BboxNode(BBOX_CONFIG) ++ ++ assert node.run({"bboxes": bboxes, "img": img}) == {"btm_midpoint": [(1, 1)]} ++ assert img.tolist() == [[[12, 13, 14], [15, 16, 17]]] ++ assert bboxes == [[0.0, 0.0, 1.0, 1.0]] ++ ++ ++def test_zone_count_resolves_fractional_zone_and_counts_each_run(): ++ ++ ++ ++ node = ZoneCountNode(ZONE_CONFIG) ++ ++ assert node.run({"btm_midpoint": [(2, 2), (3, 3), (720, 700), (650, 50)]}) == { ++ "zones": [ ++ [(0, 0), (640, 0), (640, 720), (0, 720)], ++ [(640, 0), (1280, 0), (1280, 720), (640, 720)], ++ ], ++ "zone_count": [2, 2], ++ } ++ assert node.run({"btm_midpoint": [(1, 1), (1279, 719)]}) == { ++ "zones": [ ++ [(0, 0), (640, 0), (640, 720), (0, 720)], ++ [(640, 0), (1280, 0), (1280, 720), (640, 720)], ++ ], ++ "zone_count": [1, 1], ++ } ++ ++ ++def test_zone_count_empty_points_returns_zero_counts_and_same_zones(): ++ ++ ++ ++ node = ZoneCountNode(ZONE_CONFIG) ++ ++ assert node.run({"btm_midpoint": []}) == { ++ "zones": [ ++ [(0, 0), (640, 0), (640, 720), (0, 720)], ++ [(640, 0), (1280, 0), (1280, 720), (640, 720)], ++ ], ++ "zone_count": [0, 0], ++ } ++ ++ ++def test_zone_count_mixed_coordinate_zone_is_rejected(): ++ ++ ++ ++ mixed_config = { ++ "input": ["btm_midpoint"], ++ "output": ["zones", "zone_count"], ++ "resolution": [1280, 720], ++ "zones": [[[0, 0], [1.5, 0], [1, 1], [0.5, 1]]], ++ } ++ ++ with pytest.raises(ValueError) as exc_info: ++ ZoneCountNode(mixed_config) ++ ++ ++ message = str(exc_info.value).lower() ++ assert "pixel" in message ++ assert "fraction" in message ++ assert "between 0 and 1" in message ++ ++ ++def test_zone_count_uses_configured_pixel_zone(): ++ ++ ++ ++ config = { ++ "input": ["btm_midpoint"], ++ "output": ["zones", "zone_count"], ++ "resolution": [1280, 720], ++ "zones": [[[0, 0], [100, 0], [100, 100], [0, 100]]], ++ } ++ node = ZoneCountNode(config) ++ ++ ++ assert node.run({"btm_midpoint": [(50, 50), (200, 200)]}) == { ++ "zones": [[(0, 0), (100, 0), (100, 100), (0, 100)]], ++ "zone_count": [1], ++ } ++ ++ ++def test_bbox_to_bottom_midpoint_accepts_optional_config(): ++ ++ ++ ++ img = np.zeros((400, 600, 3), dtype=np.uint8) ++ node = BboxNode() ++ ++ ++ assert node.run({"bboxes": [[0.1, 0.2, 0.3, 0.4]], "img": img}) == { ++ "btm_midpoint": [(120, 160)] ++ } ++ ++ ++def test_two_zone_count_instances_keep_their_prepared_zones_independent(): ++ ++ ++ ++ pixel_config = { ++ "input": ["btm_midpoint"], ++ "output": ["zones", "zone_count"], ++ "resolution": [1280, 720], ++ "zones": [[[0, 0], [10, 0], [10, 10], [0, 10]]], ++ } ++ fraction_config = { ++ "input": ["btm_midpoint"], ++ "output": ["zones", "zone_count"], ++ "resolution": [1280, 720], ++ "zones": [[[0.25, 0.25], [0.75, 0.25], [0.75, 0.75], [0.25, 0.75]]], ++ } ++ a = ZoneCountNode(pixel_config) ++ b = ZoneCountNode(fraction_config) ++ ++ assert a.run({"btm_midpoint": [(5, 5), (900, 500)]}) == { ++ "zones": [[(0, 0), (10, 0), (10, 10), (0, 10)]], ++ "zone_count": [1], ++ } ++ assert b.run({"btm_midpoint": [(5, 5), (900, 500)]}) == { ++ "zones": [[(320, 180), (960, 180), (960, 540), (320, 540)]], ++ "zone_count": [1], ++ } ++ ++ ++def test_repeated_construct_run_cycles_count_without_accumulating_state(): ++ ++ ++ ++ for _ in range(5): ++ node = ZoneCountNode(ZONE_CONFIG) ++ ++ assert node.run({"btm_midpoint": [(2, 2), (650, 50)]}) == { ++ "zones": [ ++ [(0, 0), (640, 0), (640, 720), (0, 720)], ++ [(640, 0), (1280, 0), (1280, 720), (640, 720)], ++ ], ++ "zone_count": [1, 1], ++ } ++ ++ assert node.run({"btm_midpoint": []}) == { ++ "zones": [ ++ [(0, 0), (640, 0), (640, 720), (0, 720)], ++ [(640, 0), (1280, 0), (1280, 720), (640, 720)], ++ ], ++ "zone_count": [0, 0], ++ } ++ assert node.run({"btm_midpoint": [(2, 2), (650, 50)]}) == { ++ "zones": [ ++ [(0, 0), (640, 0), (640, 720), (0, 720)], ++ [(640, 0), (1280, 0), (1280, 720), (640, 720)], ++ ], ++ "zone_count": [1, 1], ++ } +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,24 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++set -euo pipefail ++ ++cd /workspace/repo ++ ++ ++ ++export PYTHONPATH="/workspace/repo${PYTHONPATH:+:${PYTHONPATH}}" ++export PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 ++export PIP_NO_INDEX=1 ++export PIP_DISABLE_PIP_VERSION_CHECK=1 ++export READTHEDOCS=1 ++ ++exec python -m pytest /workspace/repo/usercase-test-coderl/test_zone_occupancy_counting.py -v --confcutdir=/workspace/repo/usercase-test-coderl diff --git a/tasks/format-code-task-000332/tests/test.sh b/tasks/format-code-task-000332/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..4038a62a90577e98b16b1b77ec53a0913706beb4 --- /dev/null +++ b/tasks/format-code-task-000332/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/test_zone_occupancy_counting.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000332/tests/test_command.sh b/tasks/format-code-task-000332/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-000332/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000335/environment/Dockerfile b/tasks/format-code-task-000335/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..113f837943320775f4f0e39d5074050491733170 --- /dev/null +++ b/tasks/format-code-task-000335/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:04130077d0645d11223a3bac0c12d9918abd6ae39c9c8eecaa5fe0cedefda9ad diff --git a/tasks/format-code-task-000335/environment/setup/files/blocklist b/tasks/format-code-task-000335/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000335/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000335/environment/setup/setup.sh b/tasks/format-code-task-000335/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000335/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000335/tests/test.patch b/tasks/format-code-task-000335/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..8d6f636b26c8e5405ab8c874458fe7fc330acb62 --- /dev/null +++ b/tasks/format-code-task-000335/tests/test.patch @@ -0,0 +1,161 @@ +diff --git a/console/widgets_test.go b/console/widgets_test.go +index e1aa949fe..afdc38364 100644 +--- a/console/widgets_test.go ++++ b/console/widgets_test.go +@@ -230,23 +230,13 @@ func TestWidgetTop(t *testing.T) { + } + + func TestWidgetGraph(t *testing.T) { +- _, h, mockConn, mockClock := NewMock(t, DefaultConfiguration()) +- +- base := time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC) +- mockClock.Set(base.Add(24 * time.Hour)) +- expected := []struct { +- Time time.Time `json:"t"` +- Gbps float64 `json:"gbps"` ++ testcases := []struct { ++ config Configuration ++ query string + }{ +- {base, 25.3}, +- {base.Add(time.Minute), 27.8}, +- {base.Add(2 * time.Minute), 26.4}, +- {base.Add(3 * time.Minute), 29.2}, +- {base.Add(4 * time.Minute), 0}, +- {base.Add(5 * time.Minute), 24.7}, +- } +- mockConn.EXPECT(). +- Select(gomock.Any(), gomock.Any(), strings.TrimSpace(` ++ { ++ config: DefaultConfiguration(), ++ query: ` + SELECT + toStartOfInterval(TimeReceived + INTERVAL 144 second, INTERVAL 432 second) - INTERVAL 144 second AS Time, + SUM(Bytes*SamplingRate*8/432)/1000/1000/1000 AS Gbps +@@ -257,23 +247,82 @@ GROUP BY Time + ORDER BY Time WITH FILL + FROM toDateTime('2009-11-10 23:00:00', 'UTC') + TO toDateTime('2009-11-11 23:00:00', 'UTC') + INTERVAL 1 second +- STEP 432`)). +- SetArg(1, expected). +- Return(nil) ++ STEP 432`, ++ }, ++ { ++ config: func() Configuration { ++ c := DefaultConfiguration() ++ c.HomepageGraphFilter = "" ++ return c ++ }(), ++ query: ` ++SELECT ++ toStartOfInterval(TimeReceived + INTERVAL 144 second, INTERVAL 432 second) - INTERVAL 144 second AS Time, ++ SUM(Bytes*SamplingRate*8/432)/1000/1000/1000 AS Gbps ++FROM flows ++WHERE TimeReceived BETWEEN toDateTime('2009-11-10 23:00:00', 'UTC') AND toDateTime('2009-11-11 23:00:00', 'UTC') + +- helpers.TestHTTPEndpoints(t, h.LocalAddr(), helpers.HTTPEndpointCases{ ++GROUP BY Time ++ORDER BY Time WITH FILL ++ FROM toDateTime('2009-11-10 23:00:00', 'UTC') ++ TO toDateTime('2009-11-11 23:00:00', 'UTC') + INTERVAL 1 second ++ STEP 432`, ++ }, + { +- URL: "/api/v0/console/widget/graph", +- JSONOutput: gin.H{ +- "data": []gin.H{ +- {"t": "2009-11-10T23:00:00Z", "gbps": 25.3}, +- {"t": "2009-11-10T23:01:00Z", "gbps": 27.8}, +- {"t": "2009-11-10T23:02:00Z", "gbps": 26.4}, +- {"t": "2009-11-10T23:03:00Z", "gbps": 29.2}, +- {"t": "2009-11-10T23:04:00Z", "gbps": 0}, +- {"t": "2009-11-10T23:05:00Z", "gbps": 24.7}, ++ config: func() Configuration { ++ c := DefaultConfiguration() ++ c.HomepageGraphFilter = "OutIfBoundary = 'external'" ++ return c ++ }(), ++ query: ` ++SELECT ++ toStartOfInterval(TimeReceived + INTERVAL 144 second, INTERVAL 432 second) - INTERVAL 144 second AS Time, ++ SUM(Bytes*SamplingRate*8/432)/1000/1000/1000 AS Gbps ++FROM flows ++WHERE TimeReceived BETWEEN toDateTime('2009-11-10 23:00:00', 'UTC') AND toDateTime('2009-11-11 23:00:00', 'UTC') ++AND OutIfBoundary = 'external' ++GROUP BY Time ++ORDER BY Time WITH FILL ++ FROM toDateTime('2009-11-10 23:00:00', 'UTC') ++ TO toDateTime('2009-11-11 23:00:00', 'UTC') + INTERVAL 1 second ++ STEP 432`, ++ }, ++ } ++ for _, tcase := range testcases { ++ _, h, mockConn, mockClock := NewMock(t, tcase.config) ++ ++ base := time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC) ++ mockClock.Set(base.Add(24 * time.Hour)) ++ expected := []struct { ++ Time time.Time `json:"t"` ++ Gbps float64 `json:"gbps"` ++ }{ ++ {base, 25.3}, ++ {base.Add(time.Minute), 27.8}, ++ {base.Add(2 * time.Minute), 26.4}, ++ {base.Add(3 * time.Minute), 29.2}, ++ {base.Add(4 * time.Minute), 0}, ++ {base.Add(5 * time.Minute), 24.7}, ++ } ++ mockConn.EXPECT(). ++ Select(gomock.Any(), gomock.Any(), strings.TrimSpace(tcase.query)). ++ SetArg(1, expected). ++ Return(nil) ++ ++ helpers.TestHTTPEndpoints(t, h.LocalAddr(), helpers.HTTPEndpointCases{ ++ { ++ URL: "/api/v0/console/widget/graph", ++ JSONOutput: gin.H{ ++ "data": []gin.H{ ++ {"t": "2009-11-10T23:00:00Z", "gbps": 25.3}, ++ {"t": "2009-11-10T23:01:00Z", "gbps": 27.8}, ++ {"t": "2009-11-10T23:02:00Z", "gbps": 26.4}, ++ {"t": "2009-11-10T23:03:00Z", "gbps": 29.2}, ++ {"t": "2009-11-10T23:04:00Z", "gbps": 0}, ++ {"t": "2009-11-10T23:05:00Z", "gbps": 24.7}, ++ }, + }, + }, +- }, +- }) ++ }) ++ } + } +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,13 @@ ++H4sIAAAAAAAAA+2UbWvbMBDH89qf4poW2kJtxWmTQtcGRlrSF4OWLjDGGEG2L7aILRlZTtN9+kl2 ++Qpx0fRi0G2P6QSzLdzr9cyedF5QsjSbI56T1XnQ0p71eNWq2x+rd73V9/7R/fNw5bXV8v9/pt6D3 ++booalIWiEqAlhVDP+b1k/0fx1vVXWKhJKLKM8sgrkrfb44X6d49P1vXvdnxd/5O+321B5+0kPM1/ ++Xv/dHRIwTgJaJE6BClx0nDCC6jAEGDnOLlzxopQIIwFKiLQAqieCw+3H8bWDi1xIVb1ftInJEYmF ++iXi2Z761zfoRcpRUIUQ4ZZwpJvgkRu7FAqZSZFCECWa0YXWMGvCIOYuCk9pOtlZrjwE86xELJxYs ++MwILcO9fdG5KHaYsnF2LstCqJZujhEyEs8LJZhGT4OarYKHxS4xfFJDaBcNEwD7ReTir7hbsSEyR ++Fri/Fvx4WfWc1HsZMWaqdemtaDijMdb7Q8xUUgaeDkPWEhvhXJ39eZekLCBL3UPB+dGduDe/4mgo ++0jLj44ccYfAbapqpCXVAJbWqKVus8gIHnxgvF/pYpA+HzSQ1XV+Xn8crajGbFiOKTeEbtPcO9DnS ++7QtGNzefD9twAe3UaGnD9w+gEuQOaJ5IJ53NhaSRIFt/ariaVtm71L4odb6Rqzptrxc5ZRvJu70a ++QU5lofeYCmkiFSJFmLJUodxInPlOlt9zFqO+ca7IFcvYD3T1BWGhm1LF+JYvqaN7OcZ1On9hqws6 ++lGgUZfoWZDQ1V5Er5BHkKQ0xEWm01KjrhJlpBY/URVRRslq3rOv5zuXNcPz19goSlaWD8/oZiOhh ++cE6WQ/VtvyFvIxBhPMKFZ5yMzLuSmzKC7tKx7k+mL+lrXY3gzsGV2j7Wky8s0vaRpHndOurIzt/u ++rxaLxWKxWCwWi8VisVgsFovFYrFYLBaLxWKx/Al+AswyBDQAKAAA +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-000335/tests/test.sh b/tasks/format-code-task-000335/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..1ba1e146d477362975a6225875ec42432e3999e9 --- /dev/null +++ b/tasks/format-code-task-000335/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +console/widgets_test.go +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000335/tests/test_command.sh b/tasks/format-code-task-000335/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000335/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000359/environment/Dockerfile b/tasks/format-code-task-000359/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..e323269d2678bbaf1d9e5f7b156ccd4bc6db6710 --- /dev/null +++ b/tasks/format-code-task-000359/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:d1ed7ef6493e85ad209592debc08384a43ad2d768d674c32e8d188ba3d4a963d diff --git a/tasks/format-code-task-000359/environment/setup/files/blocklist b/tasks/format-code-task-000359/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000359/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000359/environment/setup/setup.sh b/tasks/format-code-task-000359/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000359/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000359/tests/test.patch b/tasks/format-code-task-000359/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..55bdef5b82e56964de5d178a96779e3a2497221f --- /dev/null +++ b/tasks/format-code-task-000359/tests/test.patch @@ -0,0 +1,170 @@ +diff --git a/pkg/rulesConfig/defaultRules/rule10_jfrog_test.go b/pkg/rulesConfig/defaultRules/rule10_jfrog_test.go +new file mode 100644 +index 0000000..c0ffee1 +--- /dev/null ++++ b/pkg/rulesConfig/defaultRules/rule10_jfrog_test.go +@@ -0,0 +1,143 @@ ++package defaultRules ++ ++import ( ++ "encoding/json" ++ "testing" ++ ++ githubConnector "github.com/allero-io/allero/pkg/connectors/github" ++ gitlabConnector "github.com/allero-io/allero/pkg/connectors/gitlab" ++) ++ ++const ( ++ ownerName = "owner-under-test" ++ repoWithScanner = "repo-with-sca" ++ repoNoScanner = "repo-without-sca" ++) ++ ++func githubWithJfrogPipeline(repoName string, commands []string) map[string]*githubConnector.GithubOwner { ++ return decodeGithubOwners(`{"` + ownerName + `":{"ownerName":"` + ownerName + `","repositories":{"` + repoName + `":{"name":"` + repoName + `","github-actions-workflows":{},"jfrog-pipelines":{"pipeline":{"content":` + jfrogPipelineContent(commands) + `}}}}}}`) ++} ++ ++func gitlabWithJfrogPipeline(projectName string, commands []string) map[string]*gitlabConnector.GitlabGroup { ++ return decodeGitlabGroups(`{"` + ownerName + `":{"groupName":"` + ownerName + `","projects":{"` + projectName + `":{"name":"` + projectName + `","gitlab-ci":{},"jfrog-pipelines":{"pipeline":{"content":` + jfrogPipelineContent(commands) + `}}}}}}`) ++} ++ ++func githubWithActionsRun(repoName string, command string) map[string]*githubConnector.GithubOwner { ++ body := `{"` + ownerName + `":{"ownerName":"` + ownerName + `","repositories":{"` + repoName + `":{"name":"` + repoName + `","github-actions-workflows":{"workflow":{"content":{"jobs":{"scan":{"steps":[{"run":` + jsonString(command) + `}]}}}}},"jfrog-pipelines":{}}}}}` ++ return decodeGithubOwners(body) ++} ++ ++func githubWithoutPipelines(repoName string) map[string]*githubConnector.GithubOwner { ++ return decodeGithubOwners(`{"` + ownerName + `":{"ownerName":"` + ownerName + `","repositories":{"` + repoName + `":{"name":"` + repoName + `","github-actions-workflows":{},"jfrog-pipelines":{}}}}}`) ++} ++ ++func gitlabWithoutPipelines(projectName string) map[string]*gitlabConnector.GitlabGroup { ++ return decodeGitlabGroups(`{"` + ownerName + `":{"groupName":"` + ownerName + `","projects":{"` + projectName + `":{"name":"` + projectName + `","gitlab-ci":{},"jfrog-pipelines":{}}}}}`) ++} ++ ++func jfrogPipelineContent(commands []string) string { ++ encoded, err := json.Marshal(commands) ++ if err != nil { ++ panic(err) ++ } ++ return `{"pipelines":[{"steps":[{"execution":{"onExecute":` + string(encoded) + `}}]}]}` ++} ++ ++func jsonString(value string) string { ++ encoded, err := json.Marshal(value) ++ if err != nil { ++ panic(err) ++ } ++ return string(encoded) ++} ++ ++func decodeGithubOwners(body string) map[string]*githubConnector.GithubOwner { ++ var owners map[string]*githubConnector.GithubOwner ++ if err := json.Unmarshal([]byte(body), &owners); err != nil { ++ panic(err) ++ } ++ return owners ++} ++ ++func decodeGitlabGroups(body string) map[string]*gitlabConnector.GitlabGroup { ++ var groups map[string]*gitlabConnector.GitlabGroup ++ if err := json.Unmarshal([]byte(body), &groups); err != nil { ++ panic(err) ++ } ++ return groups ++} ++ ++func hasRepoError(errors []*SchemaError, scm, repo string) bool { ++ for _, schemaError := range errors { ++ if schemaError.ScmPlatform == scm && schemaError.RepositryName == repo { ++ return true ++ } ++ } ++ return false ++} ++ ++func requireNoRepoError(t *testing.T, errors []*SchemaError, scm, repo string) { ++ t.Helper() ++ if hasRepoError(errors, scm, repo) { ++ t.Fatalf("expected %s/%s to satisfy Rule 10, got errors: %#v", scm, repo, errors) ++ } ++} ++ ++func requireRepoError(t *testing.T, errors []*SchemaError, scm, repo string) { ++ t.Helper() ++ if !hasRepoError(errors, scm, repo) { ++ t.Fatalf("expected %s/%s to be reported by Rule 10, got errors: %#v", scm, repo, errors) ++ } ++} ++ ++func TestRule10PassesWithOnlyJfrogPipelineScanner(t *testing.T) { ++ githubData := githubWithJfrogPipeline(repoWithScanner, []string{"jf xr scan --format=json"}) ++ errors, err := EnsureScaScanner(githubData, nil) ++ if err != nil { ++ t.Fatal(err) ++ } ++ requireNoRepoError(t, errors, "github", repoWithScanner) ++} ++ ++func TestRule10PassesWithGitlabJfrogPipelineScanner(t *testing.T) { ++ gitlabData := gitlabWithJfrogPipeline(repoWithScanner, []string{"jf xr audit ."}) ++ errors, err := EnsureScaScanner(nil, gitlabData) ++ if err != nil { ++ t.Fatal(err) ++ } ++ requireNoRepoError(t, errors, "gitlab", repoWithScanner) ++} ++ ++func TestRule10RecognizesJfrogXrayCommandInGithubActions(t *testing.T) { ++ githubData := githubWithActionsRun(repoWithScanner, "jf xr scan .") ++ errors, err := EnsureScaScanner(githubData, nil) ++ if err != nil { ++ t.Fatal(err) ++ } ++ requireNoRepoError(t, errors, "github", repoWithScanner) ++} ++ ++func TestRule10DoesNotTreatUnrelatedJfrogCommandAsScanner(t *testing.T) { ++ githubData := githubWithJfrogPipeline(repoNoScanner, []string{"jfrog foo"}) ++ errors, err := EnsureScaScanner(githubData, nil) ++ if err != nil { ++ t.Fatal(err) ++ } ++ requireRepoError(t, errors, "github", repoNoScanner) ++} ++ ++func TestRule10StillFailsWithoutAnyScanner(t *testing.T) { ++ githubData := githubWithoutPipelines(repoNoScanner) ++ gitlabData := gitlabWithoutPipelines(repoNoScanner) ++ errors, err := EnsureScaScanner(githubData, nil) ++ if err != nil { ++ t.Fatal(err) ++ } ++ requireRepoError(t, errors, "github", repoNoScanner) ++ ++ errors, err = EnsureScaScanner(nil, gitlabData) ++ if err != nil { ++ t.Fatal(err) ++ } ++ requireRepoError(t, errors, "gitlab", repoNoScanner) ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,16 @@ ++#!/bin/bash ++set -uo pipefail ++cd /testbed ++ ++case "${1:-}" in ++ base) ++ go test ./pkg/rulesConfig/ -v -run TestDefaultRulesValidation ++ ;; ++ new) ++ go test ./pkg/rulesConfig/defaultRules/ -v -run 'TestRule10(PassesWithOnlyJfrogPipelineScanner|PassesWithGitlabJfrogPipelineScanner|RecognizesJfrogXrayCommandInGithubActions|DoesNotTreatUnrelatedJfrogCommandAsScanner|StillFailsWithoutAnyScanner)$' ++ ;; ++ *) ++ echo "usage: $0 base|new" ++ exit 2 ++ ;; ++esac diff --git a/tasks/format-code-task-000359/tests/test.sh b/tasks/format-code-task-000359/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..728ee45ad0870e180f892eaa0245c895c2cf51e2 --- /dev/null +++ b/tasks/format-code-task-000359/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +pkg/rulesConfig/defaultRules/rule10_jfrog_test.go +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000359/tests/test_command.sh b/tasks/format-code-task-000359/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..e8d2f32b64045b5a5a56e0ad5667da87d8e0bc2a --- /dev/null +++ b/tasks/format-code-task-000359/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new \ No newline at end of file diff --git a/tasks/format-code-task-000361/environment/Dockerfile b/tasks/format-code-task-000361/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..7f9e4d19bec2f300a162ad1e052339faa500c654 --- /dev/null +++ b/tasks/format-code-task-000361/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:bf796b35bfa89d718a97cf04ebdb0fe3d219ea12fa06581167f1efed4ac36444 diff --git a/tasks/format-code-task-000361/environment/setup/files/blocklist b/tasks/format-code-task-000361/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000361/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000361/environment/setup/setup.sh b/tasks/format-code-task-000361/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-000361/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000361/tests/test.patch b/tasks/format-code-task-000361/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..f0583025d7b01dd0a8ecebbc9a5f4db883de03b0 --- /dev/null +++ b/tasks/format-code-task-000361/tests/test.patch @@ -0,0 +1,249 @@ +diff --git a/usercase-test-coderl/fixtures/notes/00000001.md b/usercase-test-coderl/fixtures/notes/00000001.md +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/fixtures/notes/00000001.md +@@ -0,0 +1,4 @@ ++# alpha note ++ ++See [Beta](00000002.md). ++Also see [Gamma](00000003.md). +diff --git a/usercase-test-coderl/fixtures/notes/00000002.md b/usercase-test-coderl/fixtures/notes/00000002.md +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/fixtures/notes/00000002.md +@@ -0,0 +1,3 @@ ++# beta note ++ ++Links to [Gamma](00000003.md) and [Missing](00000009.md). +diff --git a/usercase-test-coderl/fixtures/notes/00000003.md b/usercase-test-coderl/fixtures/notes/00000003.md +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/fixtures/notes/00000003.md +@@ -0,0 +1,3 @@ ++# gamma note ++ ++No outgoing here. +diff --git a/usercase-test-coderl/fixtures/notes/notanote.md b/usercase-test-coderl/fixtures/notes/notanote.md +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/fixtures/notes/notanote.md +@@ -0,0 +1,3 @@ ++# ignored title ++ ++[Beta](00000002.md). +diff --git a/usercase-test-coderl/usecase.sh b/usercase-test-coderl/usecase.sh +new file mode 100755 +--- /dev/null ++++ b/usercase-test-coderl/usecase.sh +@@ -0,0 +1,188 @@ ++#!/usr/bin/env bash ++ ++set -u ++export LANG=C.UTF-8 LC_ALL=C.UTF-8 TZ=UTC ++ ++export GOMODCACHE="${GOMODCACHE:-/root/go/pkg/mod}" ++export GOPROXY=off ++export GOSUMDB=off ++export GOTOOLCHAIN=local ++export GOFLAGS="-mod=readonly" ++ ++TMPROOT=$(mktemp -d) ++trap 'rm -rf "$TMPROOT"' EXIT ++ ++fail() { echo "FAIL: $*" >&2; exit 1; } ++ ++( cd /workspace/repo && go build -o "$TMPROOT/notesium" . ) \ ++ || fail "build" ++BIN="$TMPROOT/notesium" ++ ++FIXTURES=/workspace/repo/usercase-test-coderl/fixtures/notes ++NOTES="$TMPROOT/notes" ++mkdir -p "$NOTES" ++cp "$FIXTURES"/*.md "$NOTES"/ ++export NOTESIUM_DIR="$NOTES" ++ ++cd "$TMPROOT" || fail "cd tmp" ++ ++run_notesium() { ++ "$BIN" "$@" >out 2>err ++ ec=$? ++} ++ ++expect_stdout() { ++ label=$1 ++ expected=$2 ++ printf "%b" "$expected" >want ++ cmp -s out want || fail "$label stdout mismatch: got $(sed -n l out | tr '\n' ' ')" ++} ++ ++expect_stdout_lines_any_order() { ++ label=$1 ++ expected=$2 ++ printf "%b" "$expected" | sort >want ++ sort out >got ++ cmp -s got want || fail "$label stdout lines mismatch: got $(sed -n l out | tr '\n' ' ')" ++} ++ ++expect_empty_stderr() { ++ label=$1 ++ [ ! -s err ] || fail "$label unexpected stderr: $(cat err)" ++} ++ ++expect_empty_stdout() { ++ label=$1 ++ [ ! -s out ] || fail "$label unexpected stdout: $(cat out)" ++} ++ ++ ++ ++ ++run_notesium links ++[ "$ec" -eq 0 ] || fail "F1 exit $ec; want 0" ++expect_stdout F1 "00000001.md:3: alpha note \342\206\222 beta note ++00000001.md:4: alpha note \342\206\222 gamma note ++00000002.md:3: beta note \342\206\222 gamma note ++00000002.md:3: beta note \342\206\222 00000009.md ++" ++expect_empty_stderr F1 ++ ++ ++ ++ ++run_notesium links 00000001.md ++[ "$ec" -eq 0 ] || fail "F2 exit $ec; want 0" ++expect_stdout F2 "00000002.md:1: outgoing beta note ++00000003.md:1: outgoing gamma note ++" ++expect_empty_stderr F2 ++ ++ ++ ++ ++run_notesium links --filename=00000001.md ++[ "$ec" -eq 0 ] || fail "F3 exit $ec; want 0" ++expect_stdout F3 "00000002.md:1: outgoing beta note ++00000003.md:1: outgoing gamma note ++" ++expect_empty_stderr F3 ++ ++ ++ ++ ++run_notesium links --outgoing 00000002.md ++[ "$ec" -eq 0 ] || fail "F4 exit $ec; want 0" ++expect_stdout F4 "00000003.md:1: gamma note ++" ++expect_empty_stderr F4 ++ ++ ++ ++ ++run_notesium links --incoming 00000002.md ++[ "$ec" -eq 0 ] || fail "F5 exit $ec; want 0" ++expect_stdout F5 "00000001.md:3: alpha note ++" ++expect_empty_stderr F5 ++ ++ ++ ++ ++run_notesium links --incoming --outgoing 00000002.md ++[ "$ec" -eq 0 ] || fail "F6 exit $ec; want 0" ++ ++expect_stdout_lines_any_order F6 "00000003.md:1: outgoing gamma note ++00000001.md:3: incoming alpha note ++" ++expect_empty_stderr F6 ++ ++ ++ ++ ++run_notesium links --dangling ++[ "$ec" -eq 0 ] || fail "F7 exit $ec; want 0" ++expect_stdout F7 "00000002.md:3: beta note \342\206\222 00000009.md ++" ++expect_empty_stderr F7 ++ ++ ++ ++ ++run_notesium links --color ++[ "$ec" -eq 0 ] || fail "F8 exit $ec; want 0" ++expect_stdout F8 "00000001.md:3: \033[0;36malpha note\033[0m \342\206\222 beta note ++00000001.md:4: \033[0;36malpha note\033[0m \342\206\222 gamma note ++00000002.md:3: \033[0;36mbeta note\033[0m \342\206\222 gamma note ++00000002.md:3: \033[0;36mbeta note\033[0m \342\206\222 00000009.md ++" ++expect_empty_stderr F8 ++ ++ ++ ++ ++run_notesium links --color 00000002.md ++[ "$ec" -eq 0 ] || fail "F9 exit $ec; want 0" ++expect_stdout F9 "00000003.md:1: \033[0;36moutgoing\033[0m gamma note ++00000001.md:3: \033[0;36mincoming\033[0m alpha note ++" ++expect_empty_stderr F9 ++ ++ ++ ++ ++run_notesium links --outgoing ++[ "$ec" -ne 0 ] || fail "F10 exit $ec; want nonzero" ++expect_empty_stdout F10 ++grep -q "filename is required" err || fail "F10 stderr missing filename is required: $(cat err)" ++ ++ ++ ++ ++run_notesium links --incoming ++[ "$ec" -ne 0 ] || fail "F11 exit $ec; want nonzero" ++expect_empty_stdout F11 ++grep -q "filename is required" err || fail "F11 stderr missing filename is required: $(cat err)" ++ ++ ++ ++ ++run_notesium links --dangling 00000001.md ++[ "$ec" -ne 0 ] || fail "F12 exit $ec; want nonzero" ++expect_empty_stdout F12 ++grep -q "filename not supported" err || fail "F12 stderr missing filename not supported: $(cat err)" ++ ++ ++ ++ ++run_notesium help ++ ++cat out err >help_output ++grep -Eq "links[[:space:]]+\\[filename\\]" help_output || fail "F13 help missing links [filename]" ++grep -Eq "(^|[[:space:]])--color([[:space:]]|$)" help_output || fail "F13 help missing --color" ++grep -Eq "(^|[[:space:]])--outgoing([[:space:]]|$)" help_output || fail "F13 help missing --outgoing" ++grep -Eq "(^|[[:space:]])--incoming([[:space:]]|$)" help_output || fail "F13 help missing --incoming" ++grep -Eq "(^|[[:space:]])--dangling([[:space:]]|$)" help_output || fail "F13 help missing --dangling" ++ ++echo "PASS" ++exit 0 +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,18 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++ ++export GOMODCACHE="${GOMODCACHE:-/root/go/pkg/mod}" ++export GOPROXY=off ++export GOSUMDB=off ++export GOTOOLCHAIN=local ++export GOFLAGS="-mod=readonly" ++set -e ++cd /workspace/repo ++exec bash /workspace/repo/usercase-test-coderl/usecase.sh diff --git a/tasks/format-code-task-000361/tests/test.sh b/tasks/format-code-task-000361/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..3106dc1f265e56d98b5a114e29a83901b05cdb38 --- /dev/null +++ b/tasks/format-code-task-000361/tests/test.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/fixtures/notes/00000001.md +usercase-test-coderl/fixtures/notes/00000002.md +usercase-test-coderl/fixtures/notes/00000003.md +usercase-test-coderl/fixtures/notes/notanote.md +usercase-test-coderl/usecase.sh +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000361/tests/test_command.sh b/tasks/format-code-task-000361/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-000361/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000366/environment/Dockerfile b/tasks/format-code-task-000366/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..80e2f787180498a2d159a63c13d05cf504ea946e --- /dev/null +++ b/tasks/format-code-task-000366/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:b421a7db46910a29f24875a7375f3b885ac1545b93a537cebbaf12d67828b0da diff --git a/tasks/format-code-task-000366/environment/setup/files/blocklist b/tasks/format-code-task-000366/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000366/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000366/environment/setup/setup.sh b/tasks/format-code-task-000366/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000366/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000366/tests/test.patch b/tasks/format-code-task-000366/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..7d54c5b4ae23268c8e7462cb5dc18206d596e875 --- /dev/null +++ b/tasks/format-code-task-000366/tests/test.patch @@ -0,0 +1,249 @@ +diff --git a/tests/trading/trading_client/test_order_management_routes.py b/tests/trading/trading_client/test_order_management_routes.py +new file mode 100644 +index 0000000..49b0387 +--- /dev/null ++++ b/tests/trading/trading_client/test_order_management_routes.py +@@ -0,0 +1,215 @@ ++from typing import List ++ ++import pytest ++ ++from alpaca.common.enums import BaseURL, OrderSide, OrderStatus ++from alpaca.common.models.trading import Order ++from alpaca.trading.client import TradingClient ++from alpaca.trading.models import ( ++ CancelOrderResponse, ++ GetOrderByIdRequest, ++ GetOrdersRequest, ++ ReplaceOrderRequest, ++) ++ ++ ++@pytest.fixture ++def trading_client(): ++ return TradingClient("key-id", "secret-key") ++ ++ ++ORDER_JSON = """ ++{ ++ "id": "61e69015-8549-4bfd-b9c3-01e75843f47d", ++ "client_order_id": "some-non-uuid-client-id", ++ "created_at": "2021-03-16T18:38:01.942282Z", ++ "updated_at": "2021-03-16T18:38:01.942282Z", ++ "submitted_at": "2021-03-16T18:38:01.937734Z", ++ "filled_at": null, ++ "expired_at": null, ++ "canceled_at": null, ++ "failed_at": null, ++ "replaced_at": null, ++ "replaced_by": null, ++ "replaces": null, ++ "asset_id": "904837e3-3b76-47ec-b432-046db621571b", ++ "symbol": "AAPL", ++ "asset_class": "us_equity", ++ "notional": null, ++ "qty": 1, ++ "filled_qty": "0", ++ "filled_avg_price": null, ++ "order_class": "simple", ++ "order_type": "market", ++ "type": "market", ++ "side": "buy", ++ "time_in_force": "day", ++ "limit_price": null, ++ "stop_price": null, ++ "status": "accepted", ++ "extended_hours": false, ++ "legs": null, ++ "trail_percent": null, ++ "trail_price": null, ++ "hwm": null, ++ "commission": 1.25 ++} ++""" ++ ++ ++def _order_list_json(): ++ return f"[{ORDER_JSON}]" ++ ++ ++def test_get_orders_returns_order_list(reqmock, trading_client: TradingClient): ++ reqmock.get( ++ f"{BaseURL.TRADING_PAPER}/v2/orders", ++ text=_order_list_json(), ++ ) ++ ++ response = trading_client.get_orders() ++ ++ assert isinstance(response, list) ++ assert len(response) == 1 ++ assert isinstance(response[0], Order) ++ ++ assert response[0].client_order_id == "some-non-uuid-client-id" ++ ++ ++def test_get_orders_no_filter_sends_no_params(reqmock, trading_client: TradingClient): ++ reqmock.get( ++ f"{BaseURL.TRADING_PAPER}/v2/orders", ++ text=_order_list_json(), ++ ) ++ ++ trading_client.get_orders() ++ ++ assert reqmock.last_request.qs == {} ++ ++ ++def test_get_orders_serializes_symbols_as_csv(reqmock, trading_client: TradingClient): ++ reqmock.get( ++ f"{BaseURL.TRADING_PAPER}/v2/orders", ++ text=_order_list_json(), ++ ) ++ ++ filter = GetOrdersRequest( ++ status=OrderStatus.NEW, ++ side=OrderSide.BUY, ++ symbols=["SPY", "AAPL"], ++ ) ++ ++ trading_client.get_orders(filter) ++ ++ qs = reqmock.last_request.qs ++ ++ ++ assert qs["symbols"] == ["spy,aapl"] ++ assert qs["status"] == ["new"] ++ assert qs["side"] == ["buy"] ++ ++ ++def test_get_orders_omits_unset_fields(reqmock, trading_client: TradingClient): ++ reqmock.get( ++ f"{BaseURL.TRADING_PAPER}/v2/orders", ++ text=_order_list_json(), ++ ) ++ ++ trading_client.get_orders(GetOrdersRequest(status=OrderStatus.NEW)) ++ ++ qs = reqmock.last_request.qs ++ assert qs["status"] == ["new"] ++ assert "symbols" not in qs ++ assert "limit" not in qs ++ ++ ++def test_get_order_by_id(reqmock, trading_client: TradingClient): ++ order_id = "61e69015-8549-4bfd-b9c3-01e75843f47d" ++ ++ reqmock.get( ++ f"{BaseURL.TRADING_PAPER}/v2/orders/{order_id}", ++ text=ORDER_JSON, ++ ) ++ ++ order = trading_client.get_order_by_id( ++ order_id, filter=GetOrderByIdRequest(nested=False) ++ ) ++ ++ assert isinstance(order, Order) ++ assert str(order.id) == order_id ++ ++ ++def test_get_order_by_id_accepts_uuid_instance( ++ reqmock, trading_client: TradingClient ++): ++ from uuid import UUID ++ ++ order_id = "61e69015-8549-4bfd-b9c3-01e75843f47d" ++ ++ reqmock.get( ++ f"{BaseURL.TRADING_PAPER}/v2/orders/{order_id}", ++ text=ORDER_JSON, ++ ) ++ ++ order = trading_client.get_order_by_id(UUID(order_id)) ++ ++ assert isinstance(order, Order) ++ ++ ++def test_get_order_by_id_rejects_non_uuid(reqmock, trading_client: TradingClient): ++ with pytest.raises(ValueError): ++ trading_client.get_order_by_id("not-a-real-uuid") ++ ++ ++def test_replace_order(reqmock, trading_client: TradingClient): ++ order_id = "61e69015-8549-4bfd-b9c3-01e75843f47d" ++ ++ reqmock.patch( ++ f"{BaseURL.TRADING_PAPER}/v2/orders/{order_id}", ++ text=ORDER_JSON, ++ ) ++ ++ order = trading_client.replace_order( ++ order_id, ReplaceOrderRequest(qty=10, limit_price=100) ++ ) ++ ++ assert isinstance(order, Order) ++ assert reqmock.last_request.method == "PATCH" ++ body = reqmock.last_request.json() ++ assert body["qty"] == 10 ++ assert body["limit_price"] == 100 ++ ++ assert "stop_price" not in body ++ assert "trail" not in body ++ ++ ++def test_replace_order_rejects_non_uuid(reqmock, trading_client: TradingClient): ++ with pytest.raises(ValueError): ++ trading_client.replace_order("not-a-real-uuid") ++ ++ ++def test_cancel_orders(reqmock, trading_client: TradingClient): ++ reqmock.delete( ++ f"{BaseURL.TRADING_PAPER}/v2/orders", ++ text=""" ++ [ ++ { ++ "id": "61e69015-8549-4bfd-b9c3-01e75843f47d", ++ "status": 200 ++ }, ++ { ++ "id": "904837e3-3b76-47ec-b432-046db621571b", ++ "status": 500 ++ } ++ ] ++ """, ++ ) ++ ++ response = trading_client.cancel_orders() ++ ++ assert isinstance(response, list) ++ assert len(response) == 2 ++ assert all(isinstance(item, CancelOrderResponse) for item in response) ++ assert response[0].status == 200 ++ assert str(response[0].id) == "61e69015-8549-4bfd-b9c3-01e75843f47d" ++ assert response[1].status == 500 +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,23 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++set -euo pipefail ++HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ++cd /testbed ++ ++ ++ ++PYTEST=.build_env/.venv/bin/pytest ++ ++ ++"$PYTEST" \ ++ tests/trading/test_trading_models.py \ ++ tests/trading/trading_client/test_order_routes.py \ ++ -q ++ ++ ++"$PYTEST" \ ++ tests/trading/trading_client/test_order_management_routes.py \ ++ -q diff --git a/tasks/format-code-task-000366/tests/test.sh b/tasks/format-code-task-000366/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..c0c1e2ce976ebf77e7f367043c04f5733458a8df --- /dev/null +++ b/tasks/format-code-task-000366/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/trading/trading_client/test_order_management_routes.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000366/tests/test_command.sh b/tasks/format-code-task-000366/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000366/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000392/environment/Dockerfile b/tasks/format-code-task-000392/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..e7f6f102c815793df5e7e482c681476aa457c567 --- /dev/null +++ b/tasks/format-code-task-000392/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:13a2e0145e46d9a12b4705062ee0a71bf664609ce1832209a59ef1c530741252 diff --git a/tasks/format-code-task-000392/environment/setup/files/blocklist b/tasks/format-code-task-000392/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000392/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000392/environment/setup/setup.sh b/tasks/format-code-task-000392/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000392/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000392/tests/test.patch b/tasks/format-code-task-000392/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..68e2fbb963954931facd2ac1b1472802ccf1ec8b --- /dev/null +++ b/tasks/format-code-task-000392/tests/test.patch @@ -0,0 +1,79 @@ +diff --git a/awx/main/tests/unit/test_tasks.py b/awx/main/tests/unit/test_tasks.py +index f94c70c7395f..0a530bef516e 100644 +--- a/awx/main/tests/unit/test_tasks.py ++++ b/awx/main/tests/unit/test_tasks.py +@@ -246,6 +246,53 @@ def test_openstack_client_config_generation_with_project_domain_name(mocker, sou + } + + ++@pytest.mark.parametrize("source,expected", [ ++ (None, True), (False, False), (True, True) ++]) ++def test_openstack_client_config_generation_with_project_region_name(mocker, source, expected, private_data_dir): ++ update = tasks.RunInventoryUpdate() ++ credential_type = CredentialType.defaults['openstack']() ++ inputs = { ++ 'host': 'https://keystone.openstack.example.org', ++ 'username': 'demo', ++ 'password': 'secrete', ++ 'project': 'demo-project', ++ 'domain': 'my-demo-domain', ++ 'project_domain_name': 'project-domain', ++ 'project_region_name': 'region-name', ++ } ++ if source is not None: ++ inputs['verify_ssl'] = source ++ credential = Credential(pk=1, credential_type=credential_type, inputs=inputs) ++ ++ inventory_update = mocker.Mock(**{ ++ 'source': 'openstack', ++ 'source_vars_dict': {}, ++ 'get_cloud_credential': mocker.Mock(return_value=credential), ++ 'get_extra_credentials': lambda x: [], ++ 'ansible_virtualenv_path': '/venv/foo' ++ }) ++ cloud_config = update.build_private_data(inventory_update, private_data_dir) ++ cloud_credential = yaml.safe_load( ++ cloud_config.get('credentials')[credential] ++ ) ++ assert cloud_credential['clouds'] == { ++ 'devstack': { ++ 'auth': { ++ 'auth_url': 'https://keystone.openstack.example.org', ++ 'password': 'secrete', ++ 'project_name': 'demo-project', ++ 'username': 'demo', ++ 'domain_name': 'my-demo-domain', ++ 'project_domain_name': 'project-domain', ++ }, ++ 'verify': expected, ++ 'private': True, ++ 'region_name': 'region-name', ++ } ++ } ++ ++ + @pytest.mark.parametrize("source,expected", [ + (False, False), (True, True) + ]) +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,5 @@ ++H4sIAAAAAAAAA+3S326DIBQGcK59ivMCilgZj9OgktRsgpGjm29fapOtadL1ps2y7ftd8EcPAfJR ++NHP/1u2dX6R4ljIxWm99ct1vY6UrVVW71BhRKqXNiyD9tBNdmCPbiUhMIfB3dff+/1LFV/7sIu/b ++MAzWd0U8PG6Pe/mruv7Mf/uuam2MoPJxR7jtn+ffdrQF37gui2GeWkcyjCzt+0e+nF5F03tpW+4X ++yy4bVz4ET/lAaZRWUSqTg00lp1mUs+/5/I7YxtdYjCvlS/bTdwQAAAAAAAAAAAAAAAAAAAAA+KuO ++bjL2FQAoAAA= +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-000392/tests/test.sh b/tasks/format-code-task-000392/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..43d7bdfc8467e704dbade478d46eda4d92bed6f2 --- /dev/null +++ b/tasks/format-code-task-000392/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +awx/main/tests/unit/test_tasks.py +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000392/tests/test_command.sh b/tasks/format-code-task-000392/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000392/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000395/environment/Dockerfile b/tasks/format-code-task-000395/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..2edb1d407c2e56622837d7a18f96697737207ae6 --- /dev/null +++ b/tasks/format-code-task-000395/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:046212cf0eb2f32988e0bfb3fe09e83c2c35eac8ae2d8d641ad67496e4058e89 diff --git a/tasks/format-code-task-000395/environment/setup/files/blocklist b/tasks/format-code-task-000395/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000395/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000395/environment/setup/setup.sh b/tasks/format-code-task-000395/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-000395/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000395/tests/test.patch b/tasks/format-code-task-000395/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..e252c11feb422ed765e20af98bdd7888b56041d4 --- /dev/null +++ b/tasks/format-code-task-000395/tests/test.patch @@ -0,0 +1,429 @@ +diff --git a/usercase-test-coderl/usecase.sh b/usercase-test-coderl/usecase.sh +new file mode 100755 +--- /dev/null ++++ b/usercase-test-coderl/usecase.sh +@@ -0,0 +1,407 @@ ++#!/usr/bin/env bash ++ ++set -u ++export LANG=C.UTF-8 LC_ALL=C.UTF-8 TZ=UTC ++ ++fail() { echo "FAIL: $*" >&2; exit 1; } ++ ++PYTHON_BIN=$(command -v python3 || true) ++[ -n "$PYTHON_BIN" ] || fail "python3 is required for this Python CLI acceptance test" ++ ++SCRIPT=/workspace/repo/wxPython/RunScript.py ++SETUP_SCRIPT=/workspace/repo/wxPython/setup.py ++[ -f "$SCRIPT" ] || fail "RunScript.py is missing from wxPython resources" ++[ -f "$SETUP_SCRIPT" ] || fail "setup.py is missing" ++ ++ROOT_TMP=/tmp/dsymtools-fixture-coderl ++rm -rf "$ROOT_TMP" ++mkdir -p "$ROOT_TMP" ++ ++APP_PARENT=/Applications ++APP_ROOT=/Applications/DSYMTools.app ++DB_DIR=$APP_ROOT/Contents/Resources ++DB_PATH=$DB_DIR/dsym.db ++HAD_APP_PARENT=0 ++HAD_APP_ROOT=0 ++ ++[ -e "$APP_PARENT" ] && HAD_APP_PARENT=1 ++if [ -e "$APP_ROOT" ]; then ++ HAD_APP_ROOT=1 ++ mv "$APP_ROOT" "$ROOT_TMP/original-DSYMTools.app" || fail "backup existing DSYMTools.app" ++fi ++ ++cleanup() { ++ rm -rf "$APP_ROOT" ++ if [ "$HAD_APP_ROOT" -eq 1 ]; then ++ mkdir -p "$APP_PARENT" ++ mv "$ROOT_TMP/original-DSYMTools.app" "$APP_ROOT" 2>/dev/null || true ++ fi ++ if [ "$HAD_APP_PARENT" -eq 0 ]; then ++ rmdir "$APP_PARENT" 2>/dev/null || true ++ fi ++ rm -rf "$ROOT_TMP" ++} ++trap cleanup EXIT ++ ++mkdir -p "$DB_DIR" || fail "create DSYMTools resource directory" ++ ++RUNNER=$ROOT_TMP/run_python_file.py ++cat >"$RUNNER" <<'PY' ++import os ++import re ++import sys ++ ++path = sys.argv[1] ++sys.argv = [path] + sys.argv[2:] ++with open(path, "r", encoding="utf-8") as handle: ++ source = handle.read() ++ ++try: ++ code = compile(source, path, "exec") ++except SyntaxError: ++ converted = [] ++ for line in source.splitlines(True): ++ match = re.match(r"^(\s*)print\s+(.+?)(\r?\n)?$", line) ++ if match and not match.group(2).lstrip().startswith(">>"): ++ converted.append("%sprint(%s)%s" % (match.group(1), match.group(2), match.group(3) or "")) ++ else: ++ converted.append(line) ++ code = compile("".join(converted), path, "exec") ++ ++globals_dict = {"__name__": "__main__", "__file__": path, "__builtins__": __builtins__} ++exec(code, globals_dict, globals_dict) ++PY ++ ++SETUP_PROBE=$ROOT_TMP/probe_setup.py ++cat >"$SETUP_PROBE" <<'PY' ++import builtins ++import json ++import os ++import re ++import sys ++import types ++ ++path = sys.argv[1] ++with open(path, "r", encoding="utf-8") as handle: ++ source = handle.read() ++ ++try: ++ code = compile(source, path, "exec") ++except SyntaxError: ++ converted = [] ++ for line in source.splitlines(True): ++ match = re.match(r"^(\s*)print\s+(.+?)(\r?\n)?$", line) ++ if match and not match.group(2).lstrip().startswith(">>"): ++ converted.append("%sprint(%s)%s" % (match.group(1), match.group(2), match.group(3) or "")) ++ else: ++ converted.append(line) ++ code = compile("".join(converted), path, "exec") ++ ++builtins.reload = lambda module: module ++sys.setdefaultencoding = lambda encoding: None ++captured = {} ++ ++def setup(**kwargs): ++ captured.update(kwargs) ++ ++fake_setuptools = types.ModuleType("setuptools") ++fake_setuptools.setup = setup ++sys.modules["setuptools"] = fake_setuptools ++ ++cwd = os.getcwd() ++os.chdir(os.path.dirname(path) or ".") ++try: ++ exec(code, {"__name__": "__main__", "__file__": path, "__builtins__": builtins.__dict__}, {}) ++finally: ++ os.chdir(cwd) ++ ++print(json.dumps({ ++ "app": captured.get("app"), ++ "data_files": captured.get("data_files"), ++ "name": captured.get("name"), ++ "options": captured.get("options"), ++ "setup_requires": captured.get("setup_requires"), ++}, ensure_ascii=False, sort_keys=True)) ++PY ++ ++reset_registry() { ++ rm -f "$DB_PATH" ++ mkdir -p "$DB_DIR" || fail "create db dir" ++} ++ ++registry_count() { ++ "$PYTHON_BIN" - "$DB_PATH" <<'PY' ++import os ++import sqlite3 ++import sys ++ ++db = sys.argv[1] ++if not os.path.exists(db): ++ print(0) ++ raise SystemExit ++con = sqlite3.connect(db) ++try: ++ cur = con.execute("select count(*) from archives") ++ print(cur.fetchone()[0]) ++except sqlite3.Error: ++ print(0) ++finally: ++ con.close() ++PY ++} ++ ++registry_rows() { ++ "$PYTHON_BIN" - "$DB_PATH" <<'PY' ++import os ++import sqlite3 ++import sys ++ ++db = sys.argv[1] ++if not os.path.exists(db): ++ raise SystemExit ++con = sqlite3.connect(db) ++try: ++ for (path,) in con.execute("select file_path from archives order by file_path"): ++ print(path) ++finally: ++ con.close() ++PY ++} ++ ++registry_table_info() { ++ "$PYTHON_BIN" - "$DB_PATH" <<'PY' ++import os ++import sqlite3 ++import sys ++ ++db = sys.argv[1] ++if not os.path.exists(db): ++ raise SystemExit ++con = sqlite3.connect(db) ++try: ++ for row in con.execute("pragma table_info(archives)"): ++ print("|".join("" if value is None else str(value) for value in row)) ++finally: ++ con.close() ++PY ++} ++ ++registry_unique_index_count() { ++ "$PYTHON_BIN" - "$DB_PATH" <<'PY' ++import os ++import sqlite3 ++import sys ++ ++db = sys.argv[1] ++if not os.path.exists(db): ++ print(0) ++ raise SystemExit ++con = sqlite3.connect(db) ++try: ++ print(sum(1 for row in con.execute("pragma index_list(archives)") if row[2])) ++finally: ++ con.close() ++PY ++} ++ ++assert_file_exact() { ++ local actual=$1 ++ local expected=$2 ++ cmp -s "$actual" "$expected" || { ++ echo "expected:" >&2 ++ sed -n l "$expected" >&2 ++ echo "actual:" >&2 ++ sed -n l "$actual" >&2 ++ fail "$3" ++ } ++} ++ ++run_candidate() { ++ env -i LANG=C.UTF-8 LC_ALL=C.UTF-8 TZ=UTC "$@" ++} ++ ++ ++ ++ ++reset_registry ++F1_SRC=$ROOT_TMP/f1-debug-src ++F1_PROJECT=$ROOT_TMP/f1-debug-project ++mkdir -p "$F1_SRC/MyDebug.app.dSYM/Contents/Resources/DWARF" "$F1_PROJECT/dSYM" ++printf 'debug-symbols\n' >"$F1_SRC/MyDebug.app.dSYM/Contents/Resources/DWARF/MyDebug" ++run_candidate \ ++ EFFECTIVE_PLATFORM_NAME=-iphoneos \ ++ DWARF_DSYM_FOLDER_PATH="$F1_SRC" \ ++ BUILD_STYLE=Debug \ ++ DWARF_DSYM_FILE_NAME=MyDebug.app.dSYM \ ++ EXECUTABLE_NAME=MyDebug \ ++ PROJECT_DIR="$F1_PROJECT" \ ++ "$PYTHON_BIN" "$RUNNER" "$SCRIPT" >"$ROOT_TMP/f1.out" 2>"$ROOT_TMP/f1.err"; ec=$? ++printf '%s\n%s\n%s\n' "-iphoneos" "$F1_SRC" "跳过debug模式" >"$ROOT_TMP/f1.expected" ++[ "$ec" -eq 0 ] || fail "F1 exit $ec; want 0" ++ ++[ "$(sed -n '1p' "$ROOT_TMP/f1.out")" = "-iphoneos" ] || fail "F1 first stdout line mismatch" ++[ "$(sed -n '2p' "$ROOT_TMP/f1.out")" = "$F1_SRC" ] || fail "F1 second stdout line mismatch" ++grep -Fxq "跳过debug模式" "$ROOT_TMP/f1.out" || fail "F1 stdout should include debug skip message" ++ ++[ -d "$F1_SRC/MyDebug.app.dSYM" ] || fail "F1 source dSYM was moved" ++[ -z "$(find "$F1_PROJECT/dSYM" -mindepth 1 -maxdepth 1 -print -quit)" ] || fail "F1 destination dSYM should not be created" ++[ "$(registry_count)" = "0" ] || fail "F1 registry should remain empty" ++ ++ ++ ++ ++reset_registry ++F2_SRC=$ROOT_TMP/f2-simulator-src ++F2_PROJECT=$ROOT_TMP/f2-simulator-project ++mkdir -p "$F2_SRC/Sim.app.dSYM/Contents/Resources/DWARF" "$F2_PROJECT/dSYM" ++printf 'sim-symbols\n' >"$F2_SRC/Sim.app.dSYM/Contents/Resources/DWARF/Sim" ++run_candidate \ ++ EFFECTIVE_PLATFORM_NAME=-iphonesimulator \ ++ DWARF_DSYM_FOLDER_PATH="$F2_SRC" \ ++ BUILD_STYLE=Release \ ++ DWARF_DSYM_FILE_NAME=Sim.app.dSYM \ ++ EXECUTABLE_NAME=Sim \ ++ PROJECT_DIR="$F2_PROJECT" \ ++ "$PYTHON_BIN" "$RUNNER" "$SCRIPT" >"$ROOT_TMP/f2.out" 2>"$ROOT_TMP/f2.err"; ec=$? ++printf '%s\n%s\n%s\n' "-iphonesimulator" "$F2_SRC" "跳过模拟器编译情况" >"$ROOT_TMP/f2.expected" ++[ "$ec" -eq 0 ] || fail "F2 exit $ec; want 0" ++ ++[ "$(sed -n '1p' "$ROOT_TMP/f2.out")" = "-iphonesimulator" ] || fail "F2 first stdout line mismatch" ++[ "$(sed -n '2p' "$ROOT_TMP/f2.out")" = "$F2_SRC" ] || fail "F2 second stdout line mismatch" ++grep -Fxq "跳过模拟器编译情况" "$ROOT_TMP/f2.out" || fail "F2 stdout should include simulator skip message" ++ ++[ -d "$F2_SRC/Sim.app.dSYM" ] || fail "F2 source dSYM was moved" ++[ -z "$(find "$F2_PROJECT/dSYM" -mindepth 1 -maxdepth 1 -print -quit)" ] || fail "F2 destination dSYM should not be created" ++[ "$(registry_count)" = "0" ] || fail "F2 registry should remain empty" ++ ++ ++ ++ ++reset_registry ++F3_SRC=$ROOT_TMP/f3-release-src ++F3_PROJECT=$ROOT_TMP/f3-release-project ++mkdir -p "$F3_SRC/Crashy.app.dSYM/Contents/Resources/DWARF" "$F3_PROJECT/dSYM" ++printf 'symbol-payload\n' >"$F3_SRC/Crashy.app.dSYM/Contents/Resources/DWARF/Crashy" ++F3_BEFORE=$(date +%Y%m%d%H%M%S) ++run_candidate \ ++ EFFECTIVE_PLATFORM_NAME=-iphoneos \ ++ DWARF_DSYM_FOLDER_PATH="$F3_SRC" \ ++ BUILD_STYLE=Release \ ++ DWARF_DSYM_FILE_NAME=Crashy.app.dSYM \ ++ EXECUTABLE_NAME=Crashy \ ++ PROJECT_DIR="$F3_PROJECT" \ ++ "$PYTHON_BIN" "$RUNNER" "$SCRIPT" >"$ROOT_TMP/f3.out" 2>"$ROOT_TMP/f3.err"; ec=$? ++F3_AFTER=$(date +%Y%m%d%H%M%S) ++[ "$ec" -eq 0 ] || fail "F3 exit $ec; want 0; stderr=$(cat "$ROOT_TMP/f3.err")" ++ ++[ "$(sed -n '1p' "$ROOT_TMP/f3.out")" = "-iphoneos" ] || fail "F3 first stdout line mismatch" ++[ "$(sed -n '2p' "$ROOT_TMP/f3.out")" = "$F3_SRC" ] || fail "F3 second stdout line mismatch" ++ ++F3_LINE3=$(grep -F "moving $F3_SRC/Crashy.app.dSYM to $F3_PROJECT/dSYM/Crashy." "$ROOT_TMP/f3.out" | head -n 1) ++F3_PREFIX="moving $F3_SRC/Crashy.app.dSYM to $F3_PROJECT/dSYM/Crashy." ++case "$F3_LINE3" in ++ "$F3_PREFIX"*.app.dSYM) ;; ++ *) fail "F3 moving line mismatch: $F3_LINE3" ;; ++esac ++F3_DEST=${F3_LINE3#moving $F3_SRC/Crashy.app.dSYM to } ++F3_TS=${F3_DEST#"$F3_PROJECT/dSYM/Crashy."} ++F3_TS=${F3_TS%.app.dSYM} ++[[ "$F3_TS" =~ ^[0-9]{14}$ ]] || fail "F3 timestamp is not YYYYmmddHHMMSS: $F3_TS" ++[ "$F3_TS" -ge "$F3_BEFORE" ] && [ "$F3_TS" -le "$F3_AFTER" ] || fail "F3 timestamp $F3_TS outside run window $F3_BEFORE..$F3_AFTER" ++[ ! -e "$F3_SRC/Crashy.app.dSYM" ] || fail "F3 source dSYM still exists after move" ++[ -d "$F3_DEST" ] || fail "F3 destination dSYM missing: $F3_DEST" ++[ "$(cat "$F3_DEST/Contents/Resources/DWARF/Crashy")" = "symbol-payload" ] || fail "F3 moved payload mismatch" ++[ "$(registry_rows)" = "$F3_DEST" ] || fail "F3 registry row mismatch: $(registry_rows)" ++[ "$(registry_table_info)" = "0|file_path|varchar(10)|0||0" ] || fail "F3 registry schema mismatch: $(registry_table_info)" ++[ "$(registry_unique_index_count)" = "1" ] || fail "F3 registry should have one unique index" ++ ++ ++ ++ ++reset_registry ++F4_SRC=$ROOT_TMP/f4-missing-env-src ++F4_PROJECT=$ROOT_TMP/f4-missing-env-project ++mkdir -p "$F4_SRC" "$F4_PROJECT/dSYM" ++run_candidate \ ++ EFFECTIVE_PLATFORM_NAME=-iphoneos \ ++ DWARF_DSYM_FOLDER_PATH="$F4_SRC" \ ++ BUILD_STYLE=Release \ ++ EXECUTABLE_NAME=NoEnv \ ++ PROJECT_DIR="$F4_PROJECT" \ ++ "$PYTHON_BIN" "$RUNNER" "$SCRIPT" >"$ROOT_TMP/f4.out" 2>"$ROOT_TMP/f4.err"; ec=$? ++printf '%s\n%s\n' "-iphoneos" "$F4_SRC" >"$ROOT_TMP/f4.expected" ++[ "$ec" -ne 0 ] || fail "F4 exit should be non-zero" ++ ++[ "$(sed -n '1p' "$ROOT_TMP/f4.out")" = "-iphoneos" ] || fail "F4 first stdout line mismatch" ++[ "$(sed -n '2p' "$ROOT_TMP/f4.out")" = "$F4_SRC" ] || fail "F4 second stdout line mismatch" ++[ "$(registry_count)" = "0" ] || fail "F4 registry should remain empty" ++[ -z "$(find "$F4_PROJECT/dSYM" -mindepth 1 -maxdepth 1 -print -quit)" ] || fail "F4 should not create destination dSYM" ++ ++ ++ ++ ++reset_registry ++F5_SRC=$ROOT_TMP/f5-missing-source-src ++F5_PROJECT=$ROOT_TMP/f5-missing-source-project ++mkdir -p "$F5_SRC" "$F5_PROJECT/dSYM" ++F5_BEFORE=$(date +%Y%m%d%H%M%S) ++run_candidate \ ++ EFFECTIVE_PLATFORM_NAME=-iphoneos \ ++ DWARF_DSYM_FOLDER_PATH="$F5_SRC" \ ++ BUILD_STYLE=Release \ ++ DWARF_DSYM_FILE_NAME=Missing.app.dSYM \ ++ EXECUTABLE_NAME=Missing \ ++ PROJECT_DIR="$F5_PROJECT" \ ++ "$PYTHON_BIN" "$RUNNER" "$SCRIPT" >"$ROOT_TMP/f5.out" 2>"$ROOT_TMP/f5.err"; ec=$? ++F5_AFTER=$(date +%Y%m%d%H%M%S) ++[ "$ec" -ne 0 ] || fail "F5 exit should be non-zero" ++[ "$(sed -n '1p' "$ROOT_TMP/f5.out")" = "-iphoneos" ] || fail "F5 first stdout line mismatch" ++[ "$(sed -n '2p' "$ROOT_TMP/f5.out")" = "$F5_SRC" ] || fail "F5 second stdout line mismatch" ++ ++F5_LINE3=$(grep -F "moving $F5_SRC/Missing.app.dSYM to $F5_PROJECT/dSYM/Missing." "$ROOT_TMP/f5.out" | head -n 1) ++F5_PREFIX="moving $F5_SRC/Missing.app.dSYM to $F5_PROJECT/dSYM/Missing." ++case "$F5_LINE3" in ++ "$F5_PREFIX"*.app.dSYM) ;; ++ *) fail "F5 moving line mismatch: $F5_LINE3" ;; ++esac ++F5_DEST=${F5_LINE3#moving $F5_SRC/Missing.app.dSYM to } ++F5_TS=${F5_DEST#"$F5_PROJECT/dSYM/Missing."} ++F5_TS=${F5_TS%.app.dSYM} ++[[ "$F5_TS" =~ ^[0-9]{14}$ ]] || fail "F5 timestamp is not YYYYmmddHHMMSS: $F5_TS" ++[ "$F5_TS" -ge "$F5_BEFORE" ] && [ "$F5_TS" -le "$F5_AFTER" ] || fail "F5 timestamp $F5_TS outside run window $F5_BEFORE..$F5_AFTER" ++ ++[ ! -e "$F5_DEST" ] || fail "F5 destination should not exist after failed move" ++[ "$(registry_count)" = "0" ] || fail "F5 registry should remain empty" ++ ++ ++ ++ ++"$PYTHON_BIN" "$SETUP_PROBE" "$SETUP_SCRIPT" >"$ROOT_TMP/f6.out" 2>"$ROOT_TMP/f6.err"; ec=$? ++[ "$ec" -eq 0 ] || fail "F6 setup probe exit $ec; stderr=$(cat "$ROOT_TMP/f6.err")" ++ ++"$PYTHON_BIN" - "$ROOT_TMP/f6.out" <<'PY' || fail "F6 setup.py does not include RunScript.py in py2app resources" ++import json ++import sys ++ ++with open(sys.argv[1], "r", encoding="utf-8") as handle: ++ captured = json.load(handle) ++data_files = captured.get("data_files") or [] ++options = captured.get("options") or {} ++ ++def contains_runscript(value): ++ if isinstance(value, str): ++ return value == "RunScript.py" or value.endswith("/RunScript.py") ++ if isinstance(value, dict): ++ return any(contains_runscript(item) for item in value.values()) ++ if isinstance(value, (list, tuple)): ++ return any(contains_runscript(item) for item in value) ++ return False ++ ++# ++py2app_options = options.get("py2app") if isinstance(options, dict) else {} ++if not (contains_runscript(data_files) or contains_runscript(py2app_options)): ++ raise SystemExit(1) ++PY ++ ++echo "PASS" ++exit 0 +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,12 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++exec bash /workspace/repo/usercase-test-coderl/usecase.sh diff --git a/tasks/format-code-task-000395/tests/test.sh b/tasks/format-code-task-000395/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..d4d80bb634b14076ae561be99f395189577b7ac6 --- /dev/null +++ b/tasks/format-code-task-000395/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/usecase.sh +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000395/tests/test_command.sh b/tasks/format-code-task-000395/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-000395/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000418/environment/Dockerfile b/tasks/format-code-task-000418/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..099a83064d478824e95eee7db972d8067004e86b --- /dev/null +++ b/tasks/format-code-task-000418/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:df6da86374e3f9cf19e78ffb02f8a03c585fa4683232234e2ea69966495f5e72 diff --git a/tasks/format-code-task-000418/environment/setup/files/blocklist b/tasks/format-code-task-000418/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000418/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000418/environment/setup/setup.sh b/tasks/format-code-task-000418/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000418/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000418/tests/test.patch b/tasks/format-code-task-000418/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..6707b6d31138a0d009d7c41bbfd3923fd5cc1972 --- /dev/null +++ b/tasks/format-code-task-000418/tests/test.patch @@ -0,0 +1,117 @@ +diff --git a/providers/hashicorp/tests/unit/hashicorp/_internal_client/test_vault_client.py b/providers/hashicorp/tests/unit/hashicorp/_internal_client/test_vault_client.py +index 434b441e8964e..977f4da657d60 100644 +--- a/providers/hashicorp/tests/unit/hashicorp/_internal_client/test_vault_client.py ++++ b/providers/hashicorp/tests/unit/hashicorp/_internal_client/test_vault_client.py +@@ -153,6 +153,30 @@ def test_aws_iam_different_auth_mount_point(self, mock_hvac): + client.is_authenticated.assert_called_with() + assert vault_client.kv_engine_version == 2 + ++ @mock.patch("airflow.providers.hashicorp._internal_client.vault_client.hvac") ++ def test_aws_iam_different_region(self, mock_hvac): ++ mock_client = mock.MagicMock() ++ mock_hvac.Client.return_value = mock_client ++ vault_client = _VaultClient( ++ auth_type="aws_iam", ++ role_id="role", ++ url="http://localhost:8180", ++ key_id="user", ++ secret_id="pass", ++ session=None, ++ region="us-east-2", ++ ) ++ client = vault_client.client ++ mock_hvac.Client.assert_called_with(url="http://localhost:8180", session=None) ++ client.auth.aws.iam_login.assert_called_with( ++ access_key="user", ++ secret_key="pass", ++ role="role", ++ region="us-east-2", ++ ) ++ client.is_authenticated.assert_called_with() ++ assert vault_client.kv_engine_version == 2 ++ + @mock.patch("airflow.providers.hashicorp._internal_client.vault_client.hvac") + def test_azure(self, mock_hvac): + mock_client = mock.MagicMock() +diff --git a/providers/hashicorp/tests/unit/hashicorp/hooks/test_vault.py b/providers/hashicorp/tests/unit/hashicorp/hooks/test_vault.py +index f835382b1200a..fd0862329e7ef 100644 +--- a/providers/hashicorp/tests/unit/hashicorp/hooks/test_vault.py ++++ b/providers/hashicorp/tests/unit/hashicorp/hooks/test_vault.py +@@ -306,6 +306,7 @@ def test_aws_iam_init_params(self, mock_hvac, mock_get_connection): + "auth_type": "aws_iam", + "role_id": "role", + "session": None, ++ "region": "us-east-2", + } + + test_hook = VaultHook(**kwargs) +@@ -313,9 +314,7 @@ def test_aws_iam_init_params(self, mock_hvac, mock_get_connection): + test_client = test_hook.get_conn() + mock_hvac.Client.assert_called_with(url="http://localhost:8180", session=None) + test_client.auth.aws.iam_login.assert_called_with( +- access_key="user", +- secret_key="pass", +- role="role", ++ access_key="user", secret_key="pass", role="role", region="us-east-2" + ) + test_client.is_authenticated.assert_called_with() + assert test_hook.vault_client.kv_engine_version == 2 +@@ -328,7 +327,7 @@ def test_aws_iam_dejson(self, mock_hvac, mock_get_connection): + mock_connection = self.get_mock_connection() + mock_get_connection.return_value = mock_connection + +- connection_dict = {"auth_type": "aws_iam", "role_id": "role"} ++ connection_dict = {"auth_type": "aws_iam", "role_id": "role", "region": "us-east-2"} + + mock_connection.extra_dejson.get.side_effect = connection_dict.get + kwargs = { +@@ -344,21 +343,21 @@ def test_aws_iam_dejson(self, mock_hvac, mock_get_connection): + access_key="user", + secret_key="pass", + role="role", ++ region="us-east-2", + ) + + @mock.patch("airflow.providers.hashicorp._internal_client.vault_client.hvac") + @mock.patch.dict( + "os.environ", +- AIRFLOW_CONN_VAULT_CONN_ID="https://login:pass@vault.example.com?auth_type=aws_iam&role_id=role", ++ AIRFLOW_CONN_VAULT_CONN_ID="https://login:pass@vault.example.com?auth_type=aws_iam&role_id=role" ++ "®ion=us-east-2", + ) + def test_aws_uri(self, mock_hvac): + test_hook = VaultHook(vault_conn_id="vault_conn_id", session=None) + test_client = test_hook.get_conn() + mock_hvac.Client.assert_called_with(url="https://vault.example.com", session=None) + test_client.auth.aws.iam_login.assert_called_with( +- access_key="login", +- secret_key="pass", +- role="role", ++ access_key="login", secret_key="pass", role="role", region="us-east-2" + ) + test_client.is_authenticated.assert_called_with() + assert test_hook.vault_client.kv_engine_version == 2 +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,8 @@ ++H4sIAAAAAAAAA+3TW2/TMBQA4Dz7V5yVh20SzaUsrQTqQxhFm9StGpuEEEKWEzvEamIH2wnbvycJ ++66iK2BDahBDne/Elx8dHtuOnjSw5FaoNvKcSdmZxPLSd3XboR/EknMxmLyZx5IVRNA1jD+Inq2hL ++Yx0zAJ7R2t0X99D3f5T/4/6dsI5muqqY4r4tHm+PB+4/CsPpzv0fTaOpB+HjlfBr//n9P9sLUqmC ++lNmCZByGR5AKTqxuTCbuxoHf9k+kD2WZky1zgojrWhsHyem7t8vVe3qyOlvMA1fVAZMmL/VX2q/d ++jaJvkqvkdXK5oPTyYkmT5fHJ4uwDPV6dn89H9kspnXgZdHbzbAY+T0dE5vAR9mCcw31x8OkVuEIo ++Ap36xhVawTiDbnk1lKQt0dav2FpwaezB/k+59p+DuJbdT6HX8yvTiEOSG13BZofGydL2+9zma+rP ++hnHBU3LXOzgkI5JLstm96uvoMkNtdCu5MDYoupOXmTb1cNQ2aJR0W5NUKieMYiXNSimU+/6Xtqwp ++3e2MX9/8frpC67XdytEvHrfkb79ChBBCCCGEEEIIIYQQQgghhBBCCCH0p74BkoTxvAAoAAA= +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-000418/tests/test.sh b/tasks/format-code-task-000418/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..9ca90481499e6116ca9d98cce10a54e5431fa446 --- /dev/null +++ b/tasks/format-code-task-000418/tests/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +providers/hashicorp/tests/unit/hashicorp/_internal_client/test_vault_client.py +providers/hashicorp/tests/unit/hashicorp/hooks/test_vault.py +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000418/tests/test_command.sh b/tasks/format-code-task-000418/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000418/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000420/environment/Dockerfile b/tasks/format-code-task-000420/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..908149af275017e8f74f27fb9a7ab2efb5f2ee2c --- /dev/null +++ b/tasks/format-code-task-000420/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:b6aa396275b7aae15c7861d89d772c1ccfd5e62378480b4b49081d490e0a4136 diff --git a/tasks/format-code-task-000420/environment/setup/files/blocklist b/tasks/format-code-task-000420/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000420/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000420/environment/setup/setup.sh b/tasks/format-code-task-000420/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000420/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000420/tests/test.patch b/tasks/format-code-task-000420/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..33113cb92604d68e674871682b414d240a115dfc --- /dev/null +++ b/tasks/format-code-task-000420/tests/test.patch @@ -0,0 +1,182 @@ +diff --git a/lang/py/test/test_io.py b/lang/py/test/test_io.py +index 1e79d3e8931..df8b1809859 100644 +--- a/lang/py/test/test_io.py ++++ b/lang/py/test/test_io.py +@@ -14,6 +14,9 @@ + # See the License for the specific language governing permissions and + # limitations under the License. + import unittest ++ ++from decimal import Decimal ++ + try: + from cStringIO import StringIO + except ImportError: +@@ -35,6 +38,12 @@ + ('"float"', 1234.0), + ('"double"', 1234.0), + ('{"type": "fixed", "name": "Test", "size": 1}', 'B'), ++ ('{"type": "fixed", "logicalType": "decimal", "name": "Test", "size": 8, "precision": 5, "scale": 4}', ++ Decimal('3.1415')), ++ ('{"type": "fixed", "logicalType": "decimal", "name": "Test", "size": 8, "precision": 5, "scale": 4}', ++ Decimal('-3.1415')), ++ ('{"type": "bytes", "logicalType": "decimal", "precision": 5, "scale": 4}', Decimal('3.1415')), ++ ('{"type": "bytes", "logicalType": "decimal", "precision": 5, "scale": 4}', Decimal('-3.1415')), + ('{"type": "enum", "name": "Test", "symbols": ["A", "B"]}', 'B'), + ('{"type": "array", "items": "long"}', [1, 3, 2]), + ('{"type": "map", "values": "long"}', {'a': 1, 'b': 3, 'c': 2}), +@@ -199,6 +208,9 @@ def test_round_trip(self): + round_trip_datum = read_datum(writer, writers_schema) + + print 'Round Trip Datum: %s' % round_trip_datum ++ if isinstance(round_trip_datum, Decimal): ++ round_trip_datum = round_trip_datum.to_eng_string() ++ datum = str(datum) + if datum == round_trip_datum: correct += 1 + self.assertEquals(correct, len(SCHEMAS_TO_VALIDATE)) + +diff --git a/lang/py/test/test_schema.py b/lang/py/test/test_schema.py +index 00e2a05de81..e556ae25061 100644 +--- a/lang/py/test/test_schema.py ++++ b/lang/py/test/test_schema.py +@@ -17,6 +17,9 @@ + Test the schema parsing logic. + """ + import unittest ++ ++from avro.schema import SchemaParseException, AvroException ++ + import set_avro_test_path + + from avro import schema +@@ -295,6 +298,21 @@ def make_primitive_examples(): + """, True) + ] + ++DECIMAL_LOGICAL_TYPE = [ ++ ExampleSchema("""{ ++ "type": "fixed", ++ "logicalType": "decimal", ++ "name": "TestDecimal", ++ "precision": 4, ++ "size": 10, ++ "scale": 2}""", True), ++ ExampleSchema("""{ ++ "type": "bytes", ++ "logicalType": "decimal", ++ "precision": 4, ++ "scale": 2}""", True) ++] ++ + EXAMPLES = PRIMITIVE_EXAMPLES + EXAMPLES += FIXED_EXAMPLES + EXAMPLES += ENUM_EXAMPLES +@@ -303,6 +321,7 @@ def make_primitive_examples(): + EXAMPLES += UNION_EXAMPLES + EXAMPLES += RECORD_EXAMPLES + EXAMPLES += DOC_EXAMPLES ++EXAMPLES += DECIMAL_LOGICAL_TYPE + + VALID_EXAMPLES = [e for e in EXAMPLES if e.valid] + +@@ -491,5 +510,78 @@ def test_exception_is_not_swallowed_on_parse_error(self): + + self.assertTrue(caught_exception, 'Exception was not caught') + ++ def test_decimal_invalid_schema(self): ++ invalid_schemas = [ ++ ExampleSchema("""{ ++ "type": "bytes", ++ "logicalType": "decimal", ++ "precision": 2, ++ "scale": -2}""", True), ++ ++ ExampleSchema("""{ ++ "type": "bytes", ++ "logicalType": "decimal", ++ "precision": -2, ++ "scale": 2}""", True), ++ ++ ExampleSchema("""{ ++ "type": "bytes", ++ "logicalType": "decimal", ++ "precision": 2, ++ "scale": 3}""", True), ++ ++ ExampleSchema("""{ ++ "type": "fixed", ++ "logicalType": "decimal", ++ "name": "TestDecimal", ++ "precision": -10, ++ "scale": 2, ++ "size": 5}""", True), ++ ++ ++ ExampleSchema("""{ ++ "type": "fixed", ++ "logicalType": "decimal", ++ "name": "TestDecimal", ++ "precision": 2, ++ "scale": 3, ++ "size": 2}""", True) ++ ] ++ ++ for invalid_schema in invalid_schemas: ++ self.assertRaises(SchemaParseException, schema.parse, invalid_schema.schema_string) ++ ++ fixed_invalid_schema_size = ExampleSchema("""{ ++ "type": "fixed", ++ "logicalType": "decimal", ++ "name": "TestDecimal", ++ "precision": 2, ++ "scale": 2, ++ "size": -2}""", True) ++ self.assertRaises(AvroException, schema.parse, fixed_invalid_schema_size.schema_string) ++ ++ def test_decimal_valid_type(self): ++ fixed_decimal_schema = ExampleSchema("""{ ++ "type": "fixed", ++ "logicalType": "decimal", ++ "name": "TestDecimal", ++ "precision": 4, ++ "scale": 2, ++ "size": 2}""", True) ++ ++ bytes_decimal_schema = ExampleSchema("""{ ++ "type": "bytes", ++ "logicalType": "decimal", ++ "precision": 4}""", True) ++ ++ fixed_decimal = schema.parse(fixed_decimal_schema.schema_string) ++ self.assertEqual(4, fixed_decimal.get_prop('precision')) ++ self.assertEqual(2, fixed_decimal.get_prop('scale')) ++ self.assertEqual(2, fixed_decimal.get_prop('size')) ++ ++ bytes_decimal = schema.parse(bytes_decimal_schema.schema_string) ++ self.assertEqual(4, bytes_decimal.get_prop('precision')) ++ self.assertEqual(0, bytes_decimal.get_prop('scale')) ++ + if __name__ == '__main__': + unittest.main() +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,6 @@ ++H4sIAAAAAAAAA+3Sz2uDMBQHcM/+FQ+RsR38Ea11DDbYYdDL2A67l6ihCmpEo6ywP37Rsq2Mdr1Y ++xtj3c3kmL8kLvrhJX5TZWtSDZ5yLr8VRNEXte5y+WRSwIIh8FiwMn7EoDg2KznajPX2neEtktFKq ++n9adyv9R7lf/lejUOpVVxevM7fL5apzqfxizz/77bKn7v1gy3yB/visc98/7n2Y0NT4RmWmK10a2 ++ip7vX1a3lr16enzw3GY7vo2kqG/scd4yxcBLsuzLKUFFXShynIar/OpwTk/vhptSJjoduLHLrk1z ++r7JX8nrjNVu9UOWypk6ovtGV9Qm6O6Xec3fB6I0UL0pywoN7p/HHAU5FvS4+TpEz0PSyC7mLXZqL ++ipu//eMBAAAAAAAAAAAAAAAAAAAAAGbwDiSDku0AKAAA +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-000420/tests/test.sh b/tasks/format-code-task-000420/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..2152495f546c41995ff0b43e0b731fb515cc97aa --- /dev/null +++ b/tasks/format-code-task-000420/tests/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +lang/py/test/test_io.py +lang/py/test/test_schema.py +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000420/tests/test_command.sh b/tasks/format-code-task-000420/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000420/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000427/environment/Dockerfile b/tasks/format-code-task-000427/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..045b88639f5ae6ebc7ee8b4df60f2e1d8e7afc5a --- /dev/null +++ b/tasks/format-code-task-000427/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:6219ee480cdd0dc87d2eeeb62f96733d66a1d909428abac77a74f25ca6824252 diff --git a/tasks/format-code-task-000427/environment/setup/files/blocklist b/tasks/format-code-task-000427/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000427/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000427/environment/setup/setup.sh b/tasks/format-code-task-000427/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000427/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000427/tests/test.patch b/tasks/format-code-task-000427/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..4871ca5979bb42fa588f6140f7ea79f1223a9298 --- /dev/null +++ b/tasks/format-code-task-000427/tests/test.patch @@ -0,0 +1,86 @@ +diff --git a/internal/model_test.go b/internal/model_test.go +index a505f3ec..a653fa4b 100644 +--- a/internal/model_test.go ++++ b/internal/model_test.go +@@ -419,7 +419,7 @@ func TestConsumeMessageDirectlyResult_MarshalJSON(t *testing.T) { + } + + func TestRestOffsetBody_MarshalJSON(t *testing.T) { +- Convey("test ResetOffset Body Decode", t, func() { ++ Convey("test ResetOffset Body Decode gson json schema", t, func() { + body := "{\"offsetTable\":[[{\"topic\":\"zx_tst\",\"brokerName\":\"tjwqtst-common-rocketmq-raft0\",\"queueId\":5},23354233],[{\"topic\":\"zx_tst\",\"brokerName\":\"tjwqtst-common-rocketmq-raft0\",\"queueId\":4},23354245],[{\"topic\":\"zx_tst\",\"brokerName\":\"tjwqtst-common-rocketmq-raft0\",\"queueId\":7},23354203],[{\"topic\":\"zx_tst\",\"brokerName\":\"tjwqtst-common-rocketmq-raft0\",\"queueId\":6},23354312],[{\"topic\":\"zx_tst\",\"brokerName\":\"tjwqtst-common-rocketmq-raft0\",\"queueId\":1},23373517],[{\"topic\":\"zx_tst\",\"brokerName\":\"tjwqtst-common-rocketmq-raft0\",\"queueId\":0},23373350],[{\"topic\":\"zx_tst\",\"brokerName\":\"tjwqtst-common-rocketmq-raft0\",\"queueId\":3},23373424],[{\"topic\":\"zx_tst\",\"brokerName\":\"tjwqtst-common-rocketmq-raft0\",\"queueId\":2},23373382]]}" + resetOffsetBody := new(ResetOffsetBody) + resetOffsetBody.Decode([]byte(body)) +@@ -433,4 +433,52 @@ func TestRestOffsetBody_MarshalJSON(t *testing.T) { + } + So(offsetTable[messageQueue], ShouldEqual, 23354233) + }) ++ ++ Convey("test ResetOffset Body Decode fast json schema", t, func() { ++ body := "{\"offsetTable\":{{\"brokerName\":\"RaftNode00\",\"queueId\":0,\"topic\":\"topicB\"}:11110,{\"brokerName\":\"RaftNode00\",\"queueId\":1,\"topic\":\"topicB\"}:0,{\"brokerName\":\"RaftNode00\",\"queueId\":2,\"topic\":\"topicB\"}:0,{\"brokerName\":\"RaftNode00\",\"queueId\":3,\"topic\":\"topicB\"}:0}}" ++ resetOffsetBody := new(ResetOffsetBody) ++ resetOffsetBody.Decode([]byte(body)) ++ offsetTable := resetOffsetBody.OffsetTable ++ So(offsetTable, ShouldNotBeNil) ++ So(len(offsetTable), ShouldEqual, 4) ++ messageQueue := primitive.MessageQueue{ ++ Topic: "topicB", ++ BrokerName: "RaftNode00", ++ QueueId: 0, ++ } ++ So(offsetTable[messageQueue], ShouldEqual, 11110) ++ }) ++ ++ Convey("test ResetOffset Body Decode fast json schema with one item", t, func() { ++ body := "{\"offsetTable\":{{\"brokerName\":\"RaftNode00\",\"queueId\":0,\"topic\":\"topicB\"}:11110}}" ++ resetOffsetBody := new(ResetOffsetBody) ++ resetOffsetBody.Decode([]byte(body)) ++ offsetTable := resetOffsetBody.OffsetTable ++ So(offsetTable, ShouldNotBeNil) ++ So(len(offsetTable), ShouldEqual, 1) ++ messageQueue := primitive.MessageQueue{ ++ Topic: "topicB", ++ BrokerName: "RaftNode00", ++ QueueId: 0, ++ } ++ So(offsetTable[messageQueue], ShouldEqual, 11110) ++ }) ++ ++ Convey("test ResetOffset Body Decode empty fast json ", t, func() { ++ body := "{\"offsetTable\":{}}" ++ resetOffsetBody := new(ResetOffsetBody) ++ resetOffsetBody.Decode([]byte(body)) ++ offsetTable := resetOffsetBody.OffsetTable ++ So(offsetTable, ShouldNotBeNil) ++ So(len(offsetTable), ShouldEqual, 0) ++ }) ++ ++ Convey("test ResetOffset Body Decode empty gson json ", t, func() { ++ body := "{\"offsetTable\":[]}" ++ resetOffsetBody := new(ResetOffsetBody) ++ resetOffsetBody.Decode([]byte(body)) ++ offsetTable := resetOffsetBody.OffsetTable ++ So(offsetTable, ShouldNotBeNil) ++ So(len(offsetTable), ShouldEqual, 0) ++ }) + } +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,4 @@ ++H4sIAAAAAAAAA+3Rz6oCIRQGcNc9xXmBZnQYx33LoIJu+8HS/sCkoE5w3z7vbLoE1aaI6PuBnIMK ++HvmKdX/oTGvdqWSvwjMl5VCz6zr0Qla8UkLJumJciIY3jOTLJvqnj0kHIha8T/fuPTr/UMUl/2Rj ++ajf+eNTOFHH/vDce5S+4uuQv6px/3QjFiD9vhNu+PP+NoSH4tTWjnae/lory4JINTncljUPvaJV3 ++l3ktttto08Sb33amQ9zrbvqzmNP4NHr3NwAAAAAAAAAAAAAAAAAAAAAAvtIZC/Ye7gAoAAA= +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-000427/tests/test.sh b/tasks/format-code-task-000427/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..5eee4648d869ed34d194cbf306a24db0b0eb50ef --- /dev/null +++ b/tasks/format-code-task-000427/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +internal/model_test.go +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000427/tests/test_command.sh b/tasks/format-code-task-000427/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000427/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000506/environment/Dockerfile b/tasks/format-code-task-000506/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..292ed60fd7e4ff93e4567d221680e132ebc62e0a --- /dev/null +++ b/tasks/format-code-task-000506/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:a4cb9ea41f24d96c3ed98c412115e8f4c58b792a584cf110a80a41cc7c81721f diff --git a/tasks/format-code-task-000506/environment/setup/files/blocklist b/tasks/format-code-task-000506/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000506/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000506/environment/setup/setup.sh b/tasks/format-code-task-000506/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000506/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000506/tests/test.patch b/tasks/format-code-task-000506/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..c9320f78aedfb2b605e9d07656e09f7c41d0db8d --- /dev/null +++ b/tasks/format-code-task-000506/tests/test.patch @@ -0,0 +1,334 @@ +diff --git a/internal/test/integration/s3/s3manager/integration_test.go b/internal/test/integration/s3/s3manager/integration_test.go +index d52489d480e..0952cb19e13 100644 +--- a/internal/test/integration/s3/s3manager/integration_test.go ++++ b/internal/test/integration/s3/s3manager/integration_test.go +@@ -83,13 +83,13 @@ func validate(t *testing.T, key string, md5value string) { + } + + func TestUploadConcurrently(t *testing.T) { +- svc := s3.New(nil) + key := "12mb-1" +- out, err := s3manager.Upload(svc, &s3manager.UploadInput{ ++ mgr := s3manager.NewUploader(nil) ++ out, err := mgr.Upload(&s3manager.UploadInput{ + Bucket: bucketName, + Key: &key, + Body: bytes.NewReader(integBuf12MB), +- }, nil) ++ }) + + assert.NoError(t, err) + assert.NotEqual(t, "", out.UploadID) +@@ -113,12 +113,14 @@ func TestUploadFailCleanup(t *testing.T) { + }) + + key := "12mb-leave" +- _, err := s3manager.Upload(svc, &s3manager.UploadInput{ ++ mgr := s3manager.NewUploader(&s3manager.UploadOptions{ ++ S3: svc, ++ LeavePartsOnError: false, ++ }) ++ _, err := mgr.Upload(&s3manager.UploadInput{ + Bucket: bucketName, + Key: &key, + Body: bytes.NewReader(integBuf12MB), +- }, &s3manager.UploadOptions{ +- LeavePartsOnError: false, + }) + assert.Error(t, err) + uploadID := "" +diff --git a/service/s3/s3manager/upload_test.go b/service/s3/s3manager/upload_test.go +index 55dd3d3582d..686def69c51 100644 +--- a/service/s3/s3manager/upload_test.go ++++ b/service/s3/s3manager/upload_test.go +@@ -71,13 +71,14 @@ func buflen(i interface{}) int { + + func TestUploadOrderMulti(t *testing.T) { + s, ops, args := loggingSvc() +- resp, err := s3manager.Upload(s, &s3manager.UploadInput{ ++ mgr := s3manager.NewUploader(&s3manager.UploadOptions{S3: s}) ++ resp, err := mgr.Upload(&s3manager.UploadInput{ + Bucket: aws.String("Bucket"), + Key: aws.String("Key"), + Body: bytes.NewReader(buf12MB), + ServerSideEncryption: aws.String("AES256"), + ContentType: aws.String("content/type"), +- }, nil) ++ }) + + assert.NoError(t, err) + assert.Equal(t, []string{"CreateMultipartUpload", "UploadPart", "UploadPart", "UploadPart", "CompleteMultipartUpload"}, *ops) +@@ -107,11 +108,16 @@ func TestUploadOrderMulti(t *testing.T) { + + func TestUploadOrderMultiDifferentPartSize(t *testing.T) { + s, ops, args := loggingSvc() +- _, err := s3manager.Upload(s, &s3manager.UploadInput{ ++ mgr := s3manager.NewUploader(&s3manager.UploadOptions{ ++ S3: s, ++ PartSize: 1024 * 1024 * 7, ++ Concurrency: 1, ++ }) ++ _, err := mgr.Upload(&s3manager.UploadInput{ + Bucket: aws.String("Bucket"), + Key: aws.String("Key"), + Body: bytes.NewReader(buf12MB), +- }, &s3manager.UploadOptions{PartSize: 1024 * 1024 * 7, Concurrency: 1}) ++ }) + + assert.NoError(t, err) + assert.Equal(t, []string{"CreateMultipartUpload", "UploadPart", "UploadPart", "CompleteMultipartUpload"}, *ops) +@@ -126,12 +132,13 @@ func TestUploadIncreasePartSize(t *testing.T) { + defer func() { s3manager.MaxUploadParts = 1000 }() + + s, ops, args := loggingSvc() +- opts := &s3manager.UploadOptions{Concurrency: 1} +- _, err := s3manager.Upload(s, &s3manager.UploadInput{ ++ opts := &s3manager.UploadOptions{S3: s, Concurrency: 1} ++ mgr := s3manager.NewUploader(opts) ++ _, err := mgr.Upload(&s3manager.UploadInput{ + Bucket: aws.String("Bucket"), + Key: aws.String("Key"), + Body: bytes.NewReader(buf12MB), +- }, opts) ++ }) + + assert.NoError(t, err) + assert.Equal(t, int64(0), opts.PartSize) // don't modify orig options +@@ -143,13 +150,13 @@ func TestUploadIncreasePartSize(t *testing.T) { + } + + func TestUploadFailIfPartSizeTooSmall(t *testing.T) { +- s := s3.New(nil) + opts := &s3manager.UploadOptions{PartSize: 5} +- resp, err := s3manager.Upload(s, &s3manager.UploadInput{ ++ mgr := s3manager.NewUploader(opts) ++ resp, err := mgr.Upload(&s3manager.UploadInput{ + Bucket: aws.String("Bucket"), + Key: aws.String("Key"), + Body: bytes.NewReader(buf12MB), +- }, opts) ++ }) + + assert.Nil(t, resp) + assert.NotNil(t, err) +@@ -161,13 +168,14 @@ func TestUploadFailIfPartSizeTooSmall(t *testing.T) { + + func TestUploadOrderSingle(t *testing.T) { + s, ops, args := loggingSvc() +- resp, err := s3manager.Upload(s, &s3manager.UploadInput{ ++ mgr := s3manager.NewUploader(&s3manager.UploadOptions{S3: s}) ++ resp, err := mgr.Upload(&s3manager.UploadInput{ + Bucket: aws.String("Bucket"), + Key: aws.String("Key"), + Body: bytes.NewReader(buf2MB), + ServerSideEncryption: aws.String("AES256"), + ContentType: aws.String("content/type"), +- }, nil) ++ }) + + assert.NoError(t, err) + assert.Equal(t, []string{"PutObject"}, *ops) +@@ -182,11 +190,12 @@ func TestUploadOrderSingleFailure(t *testing.T) { + s.Handlers.Send.PushBack(func(r *aws.Request) { + r.HTTPResponse.StatusCode = 400 + }) +- resp, err := s3manager.Upload(s, &s3manager.UploadInput{ ++ mgr := s3manager.NewUploader(&s3manager.UploadOptions{S3: s}) ++ resp, err := mgr.Upload(&s3manager.UploadInput{ + Bucket: aws.String("Bucket"), + Key: aws.String("Key"), + Body: bytes.NewReader(buf2MB), +- }, nil) ++ }) + + assert.Error(t, err) + assert.Equal(t, []string{"PutObject"}, *ops) +@@ -195,11 +204,12 @@ func TestUploadOrderSingleFailure(t *testing.T) { + + func TestUploadOrderZero(t *testing.T) { + s, ops, args := loggingSvc() +- resp, err := s3manager.Upload(s, &s3manager.UploadInput{ ++ mgr := s3manager.NewUploader(&s3manager.UploadOptions{S3: s}) ++ resp, err := mgr.Upload(&s3manager.UploadInput{ + Bucket: aws.String("Bucket"), + Key: aws.String("Key"), + Body: bytes.NewReader(make([]byte, 0)), +- }, nil) ++ }) + + assert.NoError(t, err) + assert.Equal(t, []string{"PutObject"}, *ops) +@@ -218,11 +228,13 @@ func TestUploadOrderMultiFailure(t *testing.T) { + } + } + }) +- _, err := s3manager.Upload(s, &s3manager.UploadInput{ ++ ++ mgr := s3manager.NewUploader(&s3manager.UploadOptions{S3: s, Concurrency: 1}) ++ _, err := mgr.Upload(&s3manager.UploadInput{ + Bucket: aws.String("Bucket"), + Key: aws.String("Key"), + Body: bytes.NewReader(buf12MB), +- }, &s3manager.UploadOptions{Concurrency: 1}) ++ }) + + assert.Error(t, err) + assert.Equal(t, []string{"CreateMultipartUpload", "UploadPart", "UploadPart", "AbortMultipartUpload"}, *ops) +@@ -236,11 +248,13 @@ func TestUploadOrderMultiFailureOnComplete(t *testing.T) { + r.HTTPResponse.StatusCode = 400 + } + }) +- _, err := s3manager.Upload(s, &s3manager.UploadInput{ ++ ++ mgr := s3manager.NewUploader(&s3manager.UploadOptions{S3: s}) ++ _, err := mgr.Upload(&s3manager.UploadInput{ + Bucket: aws.String("Bucket"), + Key: aws.String("Key"), + Body: bytes.NewReader(buf12MB), +- }, nil) ++ }) + + assert.Error(t, err) + assert.Equal(t, []string{"CreateMultipartUpload", "UploadPart", "UploadPart", +@@ -255,11 +269,13 @@ func TestUploadOrderMultiFailureOnCreate(t *testing.T) { + r.HTTPResponse.StatusCode = 400 + } + }) +- _, err := s3manager.Upload(s, &s3manager.UploadInput{ ++ ++ mgr := s3manager.NewUploader(&s3manager.UploadOptions{S3: s}) ++ _, err := mgr.Upload(&s3manager.UploadInput{ + Bucket: aws.String("Bucket"), + Key: aws.String("Key"), + Body: bytes.NewReader(make([]byte, 1024*1024*12)), +- }, nil) ++ }) + + assert.Error(t, err) + assert.Equal(t, []string{"CreateMultipartUpload"}, *ops) +@@ -275,11 +291,17 @@ func TestUploadOrderMultiFailureLeaveParts(t *testing.T) { + } + } + }) +- _, err := s3manager.Upload(s, &s3manager.UploadInput{ ++ ++ mgr := s3manager.NewUploader(&s3manager.UploadOptions{ ++ S3: s, ++ Concurrency: 1, ++ LeavePartsOnError: true, ++ }) ++ _, err := mgr.Upload(&s3manager.UploadInput{ + Bucket: aws.String("Bucket"), + Key: aws.String("Key"), + Body: bytes.NewReader(make([]byte, 1024*1024*12)), +- }, &s3manager.UploadOptions{Concurrency: 1, LeavePartsOnError: true}) ++ }) + + assert.Error(t, err) + assert.Equal(t, []string{"CreateMultipartUpload", "UploadPart", "UploadPart"}, *ops) +@@ -300,11 +322,12 @@ func (f failreader) Read(b []byte) (int, error) { + func TestUploadOrderReadFail1(t *testing.T) { + failreaderCount = 0 + s, ops, _ := loggingSvc() +- _, err := s3manager.Upload(s, &s3manager.UploadInput{ ++ mgr := s3manager.NewUploader(&s3manager.UploadOptions{S3: s}) ++ _, err := mgr.Upload(&s3manager.UploadInput{ + Bucket: aws.String("Bucket"), + Key: aws.String("Key"), + Body: failreader{1}, +- }, nil) ++ }) + + assert.Equal(t, "ReadRequestBody", err.(awserr.Error).Code()) + assert.EqualError(t, err.(awserr.Error).OrigErr(), "random failure") +@@ -314,11 +337,12 @@ func TestUploadOrderReadFail1(t *testing.T) { + func TestUploadOrderReadFail2(t *testing.T) { + failreaderCount = 0 + s, ops, _ := loggingSvc() +- _, err := s3manager.Upload(s, &s3manager.UploadInput{ ++ mgr := s3manager.NewUploader(&s3manager.UploadOptions{S3: s}) ++ _, err := mgr.Upload(&s3manager.UploadInput{ + Bucket: aws.String("Bucket"), + Key: aws.String("Key"), + Body: failreader{2}, +- }, nil) ++ }) + + assert.Equal(t, "ReadRequestBody", err.(awserr.Error).Code()) + assert.EqualError(t, err.(awserr.Error).OrigErr(), "random failure") +@@ -350,11 +374,12 @@ func (s sizedReader) Read(p []byte) (n int, err error) { + + func TestUploadOrderMultiBufferedReader(t *testing.T) { + s, ops, args := loggingSvc() +- _, err := s3manager.Upload(s, &s3manager.UploadInput{ ++ mgr := s3manager.NewUploader(&s3manager.UploadOptions{S3: s}) ++ _, err := mgr.Upload(&s3manager.UploadInput{ + Bucket: aws.String("Bucket"), + Key: aws.String("Key"), + Body: sizedReader{&sizedReaderImpl{size: 1024 * 1024 * 12}}, +- }, nil) ++ }) + + assert.NoError(t, err) + assert.Equal(t, []string{"CreateMultipartUpload", "UploadPart", "UploadPart", "UploadPart", "CompleteMultipartUpload"}, *ops) +@@ -373,11 +398,12 @@ func TestUploadOrderMultiBufferedReaderExceedTotalParts(t *testing.T) { + s3manager.MaxUploadParts = 2 + defer func() { s3manager.MaxUploadParts = 1000 }() + s, ops, _ := loggingSvc() +- resp, err := s3manager.Upload(s, &s3manager.UploadInput{ ++ mgr := s3manager.NewUploader(&s3manager.UploadOptions{S3: s, Concurrency: 1}) ++ resp, err := mgr.Upload(&s3manager.UploadInput{ + Bucket: aws.String("Bucket"), + Key: aws.String("Key"), + Body: sizedReader{&sizedReaderImpl{size: 1024 * 1024 * 12}}, +- }, &s3manager.UploadOptions{Concurrency: 1}) ++ }) + + assert.Error(t, err) + assert.Nil(t, resp) +@@ -390,11 +416,12 @@ func TestUploadOrderMultiBufferedReaderExceedTotalParts(t *testing.T) { + + func TestUploadOrderSingleBufferedReader(t *testing.T) { + s, ops, _ := loggingSvc() +- resp, err := s3manager.Upload(s, &s3manager.UploadInput{ ++ mgr := s3manager.NewUploader(&s3manager.UploadOptions{S3: s}) ++ resp, err := mgr.Upload(&s3manager.UploadInput{ + Bucket: aws.String("Bucket"), + Key: aws.String("Key"), + Body: sizedReader{&sizedReaderImpl{size: 1024 * 1024 * 2}}, +- }, nil) ++ }) + + assert.NoError(t, err) + assert.Equal(t, []string{"PutObject"}, *ops) +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,15 @@ ++H4sIAAAAAAAAA+2V+2sTQRDH8/P9FYOCD/DucolpQahQfFRQibT1ASJlszu5W3LZjfu4GvCPd3Zt ++NJakodAi4n4IXHI7O4/v7GSLiZetOEPVlb3bok/sj0bxSVx+xu/VaNAfjPpVf2/Y61fVaH/Yg9Gt ++ZbSGt44ZgJ7R2l1lt2v9H6X43X+H1p1xPZ8zJQrb3FyMHf0f9vf3fve/Irvq8V416EH/5lLYzn/e ++fy4gNn6CIsvuwgk68As4Gr87PH0FdjlvpZrBVBtwDQI7ty2bWFgw14C3KGCypAVpQbcCTp6/zuYz ++IQ3kCyiDXmWtS2t4WUvX+ElBZ6u8cJG1CnI7/RV7l3145lbM8lqHNF8o6w2CwAUqgYpLtMDoBeuY ++JPMWdyfSMV83TPWzz5BvD7+yoqVcKglf4Pt3eMB3b4B794BeA2+1QshzSpU0q6BxbmGflFfEKMK2 ++wdNSYFcq37YPQ0hnPGa7i7LOoOONubqolVUUX06Xu6ta7bhGVZeDXL8svZjVhVSbarlYKpds3hbd ++cFsBF2bXyJpaEHz+dBz2rCKQC3K/9is6bJDPtHdArzaXdheOvYqz4xVtCFrYOE4WTSc5lnZIH/rH ++ZTUaqkB3aCxNYKuZOAvWRa0fkpej8dvDT++Ox89ODiqgeTP41UtDc+M0HXotBTAwjCNwrYR0Uiug ++uk/Jwfvoa2wEmmNk4iUNyIAcnjdoojX3xqBycK7NLMSesyUsjOZoaaSoQk/zP0FKGWMZc0Z+a22o ++aqnCBDrkzpLDsGgoAEwpAg1nkV1xnjZM9R8VHo2rqno7fv7+zYsDPZ1SwCgd5B3kXHvlyKYoN2lY ++Bu3xG2ldBfU/oAkHPCQnlcPasKhNdEaJLGRL/xwr2dcs1rU/3bT5ogE2ur6/tnwf4o0KjtVAFym0 ++skM4/HgCnNpFQkvW2kfk1Wo4x1UOeTxJQFmTE+oMeWUKjFdKqppeF9lWRSjOH5mTQJBr+HUYSaew ++ahRr4yiWa7bblUPeaLhzSNvpdqzx58mFaZSrC5pKFMWd7G/fXolEIpFIJBKJRCKRSCQSiUQikUgk ++EolEIpFY8QMPM2umACgAAA== +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-000506/tests/test.sh b/tasks/format-code-task-000506/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..75456f1d354e5d515d67fd897d85434eebd6b254 --- /dev/null +++ b/tasks/format-code-task-000506/tests/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +internal/test/integration/s3/s3manager/integration_test.go +service/s3/s3manager/upload_test.go +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000506/tests/test_command.sh b/tasks/format-code-task-000506/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000506/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000508/environment/Dockerfile b/tasks/format-code-task-000508/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..94f9f8a240018d5d25f9134c0257eaff5f9f6db9 --- /dev/null +++ b/tasks/format-code-task-000508/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:5f36c050850e54f023d53a926dc1c3285037c0a45485f59dce94a4b48c0caf95 diff --git a/tasks/format-code-task-000508/environment/setup/files/blocklist b/tasks/format-code-task-000508/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000508/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000508/environment/setup/setup.sh b/tasks/format-code-task-000508/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000508/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000508/tests/test.patch b/tasks/format-code-task-000508/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..f0dcd96c4df590b3a26197464c99170677f80c18 --- /dev/null +++ b/tasks/format-code-task-000508/tests/test.patch @@ -0,0 +1,78 @@ +diff --git a/internal/pkg/cli/pipeline_init_test.go b/internal/pkg/cli/pipeline_init_test.go +index a1629e5ea9a..5c5f6474522 100644 +--- a/internal/pkg/cli/pipeline_init_test.go ++++ b/internal/pkg/cli/pipeline_init_test.go +@@ -245,7 +245,7 @@ func TestInitPipelineOpts_Ask(t *testing.T) { + + expectedRepoURL: codecommitSSHURL, + expectedRepoName: codecommitAnotherRepoName, +- expectedRepoBranch: "master", ++ expectedRepoBranch: "main", + expectedCodeCommitRegion: codecommitRegion, + expectedEnvironments: []string{"test", "prod"}, + expectedError: nil, +diff --git a/internal/pkg/deploy/cloudformation/cc_pipeline_integration_test.go b/internal/pkg/deploy/cloudformation/cc_pipeline_integration_test.go +index 2d18ea13b90..a10e8b1cbc2 100644 +--- a/internal/pkg/deploy/cloudformation/cc_pipeline_integration_test.go ++++ b/internal/pkg/deploy/cloudformation/cc_pipeline_integration_test.go +@@ -208,7 +208,7 @@ func TestCCPipelineCreation(t *testing.T) { + Name: pipelineStackName, + Source: &deploy.CodeCommitSource{ + ProviderName: manifest.CodeCommitProviderName, +- Branch: "master", ++ Branch: "main", + RepositoryURL: "https://us-west-2.console.aws.amazon.com/codesuite/codecommit/repositories/repo-name/browse", + }, + Build: deploy.PipelineBuildFromManifest(nil), +diff --git a/internal/pkg/deploy/cloudformation/stack/cc_pipeline_integration_test.go b/internal/pkg/deploy/cloudformation/stack/cc_pipeline_integration_test.go +index fb1fbd63fd3..9408a2f7856 100644 +--- a/internal/pkg/deploy/cloudformation/stack/cc_pipeline_integration_test.go ++++ b/internal/pkg/deploy/cloudformation/stack/cc_pipeline_integration_test.go +@@ -26,7 +26,7 @@ func TestCC_Pipeline_Template(t *testing.T) { + Source: &deploy.CodeCommitSource{ + ProviderName: manifest.CodeCommitProviderName, + RepositoryURL: "https://us-west-2.console.aws.amazon.com/codesuite/codecommit/repositories/aws-sample/browse", +- Branch: "master", ++ Branch: "main", + }, + Build: deploy.PipelineBuildFromManifest(nil), + Stages: []deploy.PipelineStage{ +diff --git a/internal/pkg/manifest/pipeline_test.go b/internal/pkg/manifest/pipeline_test.go +index 267cd0177bd..fdb4cf1b87d 100644 +--- a/internal/pkg/manifest/pipeline_test.go ++++ b/internal/pkg/manifest/pipeline_test.go +@@ -19,7 +19,7 @@ import ( + + const ( + defaultGHBranch = "main" +- defaultCCBranch = "master" ++ defaultCCBranch = "main" + ) + + func TestNewProvider(t *testing.T) { +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,10 @@ ++H4sIAAAAAAAAA+2UwY7aMBCGOfMUU5BWrSpikm5AatVDy6mHbVfV7jlyEhMsHDuyHVokHr6OgcCm ++7NKVWFVV5+OQ4Mz8nvk9SZDWXOQJkyvSeynGjmkc+6uje/X3YRyF7jeNxpPeOAzj6bQH8YtVdERt ++LNUAPa2UfSru3PN/lOBw/pYZm2SqLKnMA7O43B5nzj8aR3F7/i7Qnf/1JJz0YHy5Eh7nPz//4SuS ++cklSahb9LAc/BCnL+/0hfK8lVDRb6gisAla6ZbCsrAR1QfBaMpa7lbnS4CzMlsClZYWmlisJjcyb ++RvCQcHUFpDGRFMpvuZN2y51979wthO+9npZUkGpZkExwUvGKCS5ZwiW3SZMRFKpfKL8bjFYwylQt ++7ccQAvJbMoy062fQiH9x6bc7rW+VNcknsxzAZgPsJ3c7tzVEnRpyVgm1dmqqzl3bpW+VZFlyVFhr ++QVvfEO6Na1+ojIoHFtHiA9gFgzMCMOeCATeuukzUznKnmK6BWwOEwFv//kJHGNLaeu3GZFr4dGO5 ++EKDZnGkmM5YHJ50buWwDg261g66lp704Mnk221s802yr0Rr77o+M9VN11t7LN7Hd90Eryb6X5G43 ++z6fm5brTlvuQ8rl7cBjcZ8xsm3xUyFf241arFc+Z3uz/76RvduF+vbuY3FBtFlR85pLqtQ+5l+V2 ++bR973NDf/ighCIIgCIIgCIIgCIIgCIIgCIIgCIIgCPIsfgHLMNP4ACgAAA== +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-000508/tests/test.sh b/tasks/format-code-task-000508/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..97f6185c8911d6c7245f7dc838a49bb0f1cffa92 --- /dev/null +++ b/tasks/format-code-task-000508/tests/test.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +internal/pkg/cli/pipeline_init_test.go +internal/pkg/deploy/cloudformation/cc_pipeline_integration_test.go +internal/pkg/deploy/cloudformation/stack/cc_pipeline_integration_test.go +internal/pkg/manifest/pipeline_test.go +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000508/tests/test_command.sh b/tasks/format-code-task-000508/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000508/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000530/environment/Dockerfile b/tasks/format-code-task-000530/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..5f426ac7a6cfc923d7ccd13d000cc486a0cde4fa --- /dev/null +++ b/tasks/format-code-task-000530/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:6d094ed832b5a283276072dfa03e2aa59040f2c338b41848cd9f8f76790a3cf2 diff --git a/tasks/format-code-task-000530/environment/setup/files/blocklist b/tasks/format-code-task-000530/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000530/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000530/environment/setup/setup.sh b/tasks/format-code-task-000530/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000530/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000530/tests/test.patch b/tasks/format-code-task-000530/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..ab02a51b9fc957d262af47a0b55cf7ff5c2ddf3a --- /dev/null +++ b/tasks/format-code-task-000530/tests/test.patch @@ -0,0 +1,99 @@ +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 0000000..f2a5b63 +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["PYTHONPATH=./src python -m pytest tests/basilisp/core_test.py -k \"sort_none_returns_empty_seq or sort_of_seq_on_empty_vector_returns_empty_seq or sort_of_empty_map_returns_empty_seq or sort_of_empty_vector_returns_empty_seq or sort_non_empty_preserved or sort_by_none_returns_empty_seq or sort_by_of_seq_on_empty_vector_returns_empty_seq or sort_by_of_empty_map_returns_empty_seq or sort_by_of_empty_vector_returns_empty_seq or sort_by_non_empty_preserved\""] ++} +diff --git a/tests/basilisp/core_test.py b/tests/basilisp/core_test.py +index 1432407..f658326 100644 +--- a/tests/basilisp/core_test.py ++++ b/tests/basilisp/core_test.py +@@ -471,6 +471,72 @@ def test_sort(): + assert llist.l(1, 2, 3, 4, 5) == core.sort(vec.v(5, 3, 1, 2, 4)) + + ++_EMPTY_LIST = llist.PersistentList.empty() ++ ++ ++def test_sort_none_returns_empty_seq(): ++ ++ result = core.sort(None) ++ assert result is not None ++ assert _EMPTY_LIST == result ++ ++ ++def test_sort_of_seq_on_empty_vector_returns_empty_seq(): ++ ++ ++ empty_seq = core.seq(vec.PersistentVector.empty()) ++ assert empty_seq is None ++ result = core.sort(empty_seq) ++ assert _EMPTY_LIST == result ++ ++ ++def test_sort_of_empty_map_returns_empty_seq(): ++ ++ result = core.sort(lmap.PersistentMap.empty()) ++ assert _EMPTY_LIST == result ++ ++ ++def test_sort_of_empty_vector_returns_empty_seq(): ++ ++ result = core.sort(vec.PersistentVector.empty()) ++ assert _EMPTY_LIST == result ++ ++ ++def test_sort_non_empty_preserved(): ++ ++ assert llist.l(1, 2, 3, 4, 5) == core.sort(vec.v(5, 3, 1, 2, 4)) ++ ++ ++def test_sort_by_none_returns_empty_seq(): ++ result = core.sort_by(lambda x: x, None) ++ assert result is not None ++ assert _EMPTY_LIST == result ++ ++ ++def test_sort_by_of_seq_on_empty_vector_returns_empty_seq(): ++ empty_seq = core.seq(vec.PersistentVector.empty()) ++ assert empty_seq is None ++ result = core.sort_by(lambda x: x, empty_seq) ++ assert _EMPTY_LIST == result ++ ++ ++def test_sort_by_of_empty_map_returns_empty_seq(): ++ result = core.sort_by(lambda x: x, lmap.PersistentMap.empty()) ++ assert _EMPTY_LIST == result ++ ++ ++def test_sort_by_of_empty_vector_returns_empty_seq(): ++ result = core.sort_by(lambda x: x, vec.PersistentVector.empty()) ++ assert _EMPTY_LIST == result ++ ++ ++def test_sort_by_non_empty_preserved(): ++ ++ assert llist.l(1, 2, 3, 4, 5) == core.sort_by( ++ lambda x: x, vec.v(5, 3, 1, 2, 4) ++ ) ++ ++ + class TestIsAny: + def test_any_always_true(self, lisp_value): + assert True is core.any__Q__(lisp_value) +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++PYTHONPATH=./src python -m pytest -rA tests/basilisp/core_test.py::test_sort_none_returns_empty_seq tests/basilisp/core_test.py::test_sort_of_seq_on_empty_vector_returns_empty_seq tests/basilisp/core_test.py::test_sort_of_empty_map_returns_empty_seq tests/basilisp/core_test.py::test_sort_of_empty_vector_returns_empty_seq tests/basilisp/core_test.py::test_sort_non_empty_preserved tests/basilisp/core_test.py::test_sort_by_none_returns_empty_seq tests/basilisp/core_test.py::test_sort_by_of_seq_on_empty_vector_returns_empty_seq tests/basilisp/core_test.py::test_sort_by_of_empty_map_returns_empty_seq tests/basilisp/core_test.py::test_sort_by_of_empty_vector_returns_empty_seq tests/basilisp/core_test.py::test_sort_by_non_empty_preserved ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-000530/tests/test.sh b/tasks/format-code-task-000530/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..e13bd674dd44230fea2a6228a419497cafcc4abf --- /dev/null +++ b/tasks/format-code-task-000530/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test_commands.json +tests/basilisp/core_test.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000530/tests/test_command.sh b/tasks/format-code-task-000530/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000530/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000537/environment/Dockerfile b/tasks/format-code-task-000537/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..6559fea97fadb078e5f987d1b9003f0e4e84932c --- /dev/null +++ b/tasks/format-code-task-000537/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:2978381e7b6e75b4a01059da25ac7814f67c2794c56edcda2660367b82758cb7 diff --git a/tasks/format-code-task-000537/environment/setup/files/blocklist b/tasks/format-code-task-000537/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000537/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000537/environment/setup/setup.sh b/tasks/format-code-task-000537/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-000537/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000537/tests/test.patch b/tasks/format-code-task-000537/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..e2f9d81004af79e4763e5518306543e139a9a280 --- /dev/null +++ b/tasks/format-code-task-000537/tests/test.patch @@ -0,0 +1,225 @@ +diff --git a/usercase-test-coderl/usecase.sh b/usercase-test-coderl/usecase.sh +new file mode 100755 +--- /dev/null ++++ b/usercase-test-coderl/usecase.sh +@@ -0,0 +1,203 @@ ++#!/usr/bin/env bash ++ ++set -u ++export LANG=C.UTF-8 LC_ALL=C.UTF-8 TZ=UTC ++ ++fail() { echo "FAIL: $*" >&2; exit 1; } ++ ++BIN=/workspace/repo/bin/ntsynt_merge_collinear.py ++[ -x "$BIN" ] || fail "ntsynt_merge_collinear.py is not an executable command" ++python3 -m py_compile "$BIN" || fail "python syntax check" ++ ++TMP=$(mktemp -d) ++trap 'rm -rf "$TMP"' EXIT ++cd "$TMP" || fail "cd tmp" ++ ++assert_file_eq() { ++ local actual=$1 ++ local expected=$2 ++ local label=$3 ++ if ! cmp -s "$actual" "$expected"; then ++ echo "FAIL: $label" >&2 ++ echo "Expected:" >&2 ++ sed -n '1,120p' "$expected" >&2 ++ echo "Actual:" >&2 ++ sed -n '1,120p' "$actual" >&2 ++ exit 1 ++ fi ++} ++ ++assert_tsv_rows_eq() { ++ local actual=$1 ++ local expected=$2 ++ local label=$3 ++ local actual_sorted expected_sorted ++ actual_sorted=$(mktemp) ++ expected_sorted=$(mktemp) ++ sort "$actual" >"$actual_sorted" ++ sort "$expected" >"$expected_sorted" ++ if ! cmp -s "$actual_sorted" "$expected_sorted"; then ++ echo "FAIL: $label" >&2 ++ echo "Expected rows:" >&2 ++ sed -n '1,120p' "$expected_sorted" >&2 ++ echo "Actual rows:" >&2 ++ sed -n '1,120p' "$actual_sorted" >&2 ++ rm -f "$actual_sorted" "$expected_sorted" ++ exit 1 ++ fi ++ rm -f "$actual_sorted" "$expected_sorted" ++} ++ ++ ++ ++ ++cat > f1.tsv <<'EOF' ++0 asmA chr1 100 200 + 7 None ++0 asmB chr7 500 600 + 7 None ++1 asmA chr1 220 300 + 4 None ++1 asmB chr7 625 705 + 4 None ++EOF ++"$BIN" --tsv f1.tsv --indel 10 --merge 100 >out 2>err; ec=$? ++cat >expected <<'EOF' ++0 asmA chr1 100 300 + 0 None ++0 asmB chr7 500 705 + 0 None ++EOF ++[ "$ec" -eq 0 ] || fail "F1 exit $ec; want 0" ++assert_file_eq out expected "F1 stdout" ++[ ! -s err ] || fail "F1 unexpected stderr: $(cat err)" ++ ++ ++ ++ ++cat > f2.tsv <<'EOF' ++0 asmA chr1 100 200 + 99 old_reason ++0 asmB chr7 500 600 + 88 old_reason ++1 asmA chr1 200 280 + 77 old_reason ++1 asmB chr7 50600 50700 + 66 old_reason ++EOF ++"$BIN" --tsv f2.tsv >out 2>err; ec=$? ++cat >expected <<'EOF' ++0 asmA chr1 100 280 + 0 None ++0 asmB chr7 500 50700 + 0 None ++EOF ++[ "$ec" -eq 0 ] || fail "F2 exit $ec; want 0" ++ ++assert_tsv_rows_eq out expected "F2 stdout" ++[ ! -s err ] || fail "F2 unexpected stderr: $(cat err)" ++ ++ ++ ++ ++cat > f3.tsv <<'EOF' ++0 asmA chr1 500 600 - 5 None ++0 asmB chr7 1000 1100 - 5 None ++1 asmA chr1 700 480 - 3 None ++1 asmB chr7 1200 980 - 3 None ++EOF ++"$BIN" --tsv f3.tsv --indel 10 --merge 100 >out 2>err; ec=$? ++cat >expected <<'EOF' ++0 asmA chr1 700 600 - 0 None ++0 asmB chr7 1200 1100 - 0 None ++EOF ++[ "$ec" -eq 0 ] || fail "F3 exit $ec; want 0" ++ ++assert_tsv_rows_eq out expected "F3 stdout" ++[ ! -s err ] || fail "F3 unexpected stderr: $(cat err)" ++ ++ ++ ++ ++cat > f4.tsv <<'EOF' ++9 asmB chr2 100 180 + 1 stale ++9 asmA chrZ 1000 1100 + 1 stale ++2 asmB chr1 400 450 + 1 stale ++2 asmA chrA 10 60 + 1 stale ++5 asmB chr1 100 150 + 1 stale ++5 asmA chrM 700 760 + 1 stale ++EOF ++"$BIN" --tsv f4.tsv --indel 0 --merge 1 >out 2>err; ec=$? ++cat >expected <<'EOF' ++0 asmB chr1 100 150 + 0 None ++0 asmA chrM 700 760 + 0 None ++1 asmB chr1 400 450 + 0 id_change ++1 asmA chrA 10 60 + 0 id_change ++2 asmB chr2 100 180 + 0 id_change ++2 asmA chrZ 1000 1100 + 0 id_change ++EOF ++[ "$ec" -eq 0 ] || fail "F4 exit $ec; want 0" ++ ++assert_tsv_rows_eq out expected "F4 stdout" ++[ ! -s err ] || fail "F4 unexpected stderr: $(cat err)" ++ ++ ++ ++ ++cat > f5.tsv <<'EOF' ++0 asmA c1 100 150 + 1 old ++0 asmB d1 100 150 + 1 old ++1 asmA c2 140 190 - 1 old ++1 asmB d1 170 220 - 1 old ++2 asmA c2 200 250 + 1 old ++2 asmB d1 240 290 + 1 old ++3 asmA c2 240 300 + 1 old ++3 asmB d1 300 350 + 1 old ++4 asmA c2 320 370 + 1 old ++4 asmB d1 500 550 + 1 old ++5 asmA c2 430 480 + 1 old ++5 asmB d1 610 660 + 1 old ++EOF ++"$BIN" --tsv f5.tsv --indel 10 --merge 60 >out 2>err; ec=$? ++cat >expected <<'EOF' ++0 asmA c1 100 150 + 0 None ++0 asmB d1 100 150 + 0 None ++1 asmA c2 140 190 - 0 id_change ++1 asmB d1 170 220 - 0 id_change ++2 asmA c2 200 250 + 0 ori_change ++2 asmB d1 240 290 + 0 ori_change ++3 asmA c2 240 300 + 0 inconsistent_order ++3 asmB d1 300 350 + 0 inconsistent_order ++4 asmA c2 320 370 + 0 indel ++4 asmB d1 500 550 + 0 indel ++5 asmA c2 430 480 + 0 merge ++5 asmB d1 610 660 + 0 merge ++EOF ++[ "$ec" -eq 0 ] || fail "F5 exit $ec; want 0" ++ ++assert_tsv_rows_eq out expected "F5 stdout" ++[ ! -s err ] || fail "F5 unexpected stderr: $(cat err)" ++ ++ ++ ++ ++printf '0\tasmA\tchr1\t100\t200\n' > f6.tsv ++"$BIN" --tsv f6.tsv >out 2>err; ec=$? ++[ "$ec" -ne 0 ] || fail "F6 exit $ec; want non-zero" ++[ ! -s out ] || fail "F6 unexpected stdout: $(cat out)" ++ ++grep -Eiq '(6|six)' err || fail "F6 stderr missing minimum count: $(cat err)" ++grep -Eiq 'col(umn)?s?' err || fail "F6 stderr missing column-count context: $(cat err)" ++ ++ ++ ++ ++"$BIN" >out 2>err; ec=$? ++[ "$ec" -eq 2 ] || fail "F7 exit $ec; want 2" ++[ ! -s out ] || fail "F7 unexpected stdout: $(cat out)" ++ ++grep -q '^usage:' err || fail "F7 stderr missing usage: $(cat err)" ++grep -q -- '--tsv' err || fail "F7 stderr missing --tsv error: $(cat err)" ++ ++ ++ ++ ++"$BIN" --help >out 2>err; ec=$? ++[ "$ec" -eq 0 ] || fail "F8 exit $ec; want 0" ++ ++grep -q '^usage:' out || fail "F8 stdout missing usage" ++grep -q -- '--tsv' out || fail "F8 stdout missing --tsv" ++grep -q -- '--indel' out || fail "F8 stdout missing --indel" ++grep -q -- '--merge' out || fail "F8 stdout missing --merge" ++[ ! -s err ] || fail "F8 unexpected stderr: $(cat err)" ++ ++echo "PASS" ++exit 0 +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,12 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++exec bash /workspace/repo/usercase-test-coderl/usecase.sh diff --git a/tasks/format-code-task-000537/tests/test.sh b/tasks/format-code-task-000537/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..d4d80bb634b14076ae561be99f395189577b7ac6 --- /dev/null +++ b/tasks/format-code-task-000537/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/usecase.sh +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000537/tests/test_command.sh b/tasks/format-code-task-000537/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-000537/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000552/environment/Dockerfile b/tasks/format-code-task-000552/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..77fc55fddb2017618cae34f805f08b5e88eb7a99 --- /dev/null +++ b/tasks/format-code-task-000552/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:2cab3c04b27282f16546f6975771299770b3a9685c7056cb6969f93e1c42ce4b diff --git a/tasks/format-code-task-000552/environment/setup/files/blocklist b/tasks/format-code-task-000552/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000552/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000552/environment/setup/setup.sh b/tasks/format-code-task-000552/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-000552/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000552/tests/test.patch b/tasks/format-code-task-000552/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..3847d36e542fb4f23b34c3de4a415722bd4ae69a --- /dev/null +++ b/tasks/format-code-task-000552/tests/test.patch @@ -0,0 +1,426 @@ +diff --git a/usercase-test-coderl/test_corporate_filings_session.py b/usercase-test-coderl/test_corporate_filings_session.py +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/test_corporate_filings_session.py +@@ -0,0 +1,398 @@ ++import json ++import threading ++from datetime import datetime, timedelta ++from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer ++from urllib.parse import parse_qs, urlparse ++ ++import pytest ++ ++from nse import NSE ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++RESPONSES = { ++ "/corporates-corporateActions": [{"symbol": "HDFCBANK"}], ++ "/corporate-announcements": [{"symbol": "INFY", "subject": "Board"}], ++ "/corporate-board-meetings": [{"symbol": "TCS", "purpose": "Results"}], ++ "/annual-reports": {"data": [{"fileName": "HDFC-2025.pdf"}]}, ++ "/corporate-share-holdings-master": [ ++ {"symbol": "RELIANCE", "date": "30-Jun-2025"} ++ ], ++ "/public-past-issues": [{"symbol": "IPOCO"}], ++ "/circulars": {"data": []}, ++} ++ ++ ++class RecordingNSEServer: ++ def __init__(self): ++ self.logs = [] ++ owner = self ++ ++ class Handler(BaseHTTPRequestHandler): ++ protocol_version = "HTTP/1.1" ++ ++ def log_message(self, *_): ++ return ++ ++ def do_GET(self): ++ parsed = urlparse(self.path) ++ body = json.dumps(RESPONSES[parsed.path]).encode("utf-8") ++ owner.logs.append( ++ { ++ "path": parsed.path, ++ "query": dict(parse_qs(parsed.query)), ++ "cookie": self.headers.get("Cookie", ""), ++ } ++ ) ++ self.send_response(200) ++ self.send_header("Content-Type", "application/json") ++ self.send_header("Set-Cookie", "nse-stage=observed; Path=/") ++ self.send_header("Connection", "close") ++ self.send_header("Content-Length", str(len(body))) ++ self.end_headers() ++ self.wfile.write(body) ++ ++ self._server = ThreadingHTTPServer(("127.0.0.1", 0), Handler) ++ self.base_url = f"http://127.0.0.1:{self._server.server_port}" ++ self._thread = threading.Thread(target=self._server.serve_forever, daemon=True) ++ ++ def __enter__(self): ++ self._thread.start() ++ return self ++ ++ def __exit__(self, *_): ++ self._server.shutdown() ++ self._server.server_close() ++ ++ ++@pytest.fixture ++def nse_server(): ++ with RecordingNSEServer() as server: ++ yield server ++ ++ ++def make_client(tmp_path, nse_server, name="client"): ++ client = NSE(tmp_path / name, server=False) ++ client.base_url = nse_server.base_url ++ return client ++ ++ ++def parsed_query_date(log, key): ++ value = log["query"].get(key) ++ assert value is not None ++ assert len(value) == 1 ++ return datetime.strptime(value[0], "%d-%m-%Y").date() ++ ++ ++def test_actions_announcements_boardmeetings_session_params_and_cookie_state( ++ tmp_path, nse_server ++): ++ ++ ++ ++ ++ client = make_client(tmp_path, nse_server) ++ ++ actions = client.actions( ++ symbol="HDFCBANK", ++ from_date=datetime(2025, 1, 2), ++ to_date=datetime(2025, 1, 31), ++ ) ++ assert actions == [{"symbol": "HDFCBANK"}] ++ assert nse_server.logs[0] == { ++ "path": "/corporates-corporateActions", ++ "query": { ++ "index": ["equities"], ++ "symbol": ["HDFCBANK"], ++ "from_date": ["02-01-2025"], ++ "to_date": ["31-01-2025"], ++ }, ++ "cookie": "", ++ } ++ ++ announcements = client.announcements( ++ index="sme", ++ symbol="INFY", ++ fno=True, ++ from_date=datetime(2025, 2, 1), ++ to_date=datetime(2025, 2, 5), ++ ) ++ assert announcements == [{"symbol": "INFY", "subject": "Board"}] ++ assert nse_server.logs[1] == { ++ "path": "/corporate-announcements", ++ "query": { ++ "index": ["sme"], ++ "symbol": ["INFY"], ++ "fo_sec": ["True"], ++ "from_date": ["01-02-2025"], ++ "to_date": ["05-02-2025"], ++ }, ++ "cookie": "nse-stage=observed", ++ } ++ ++ meetings = client.boardMeetings( ++ index="sme", ++ symbol="TCS", ++ fno=True, ++ from_date=datetime(2025, 3, 4), ++ to_date=datetime(2025, 3, 6), ++ ) ++ assert meetings == [{"symbol": "TCS", "purpose": "Results"}] ++ assert nse_server.logs[2] == { ++ "path": "/corporate-board-meetings", ++ "query": { ++ "index": ["sme"], ++ "symbol": ["TCS"], ++ "fo_sec": ["True"], ++ "from_date": ["04-03-2025"], ++ "to_date": ["06-03-2025"], ++ }, ++ "cookie": "nse-stage=observed", ++ } ++ ++ client.__exit__(None, None, None) ++ ++ ++def test_default_and_single_date_omission_for_corporate_queries(tmp_path, nse_server): ++ ++ ++ ++ ++ client = make_client(tmp_path, nse_server) ++ ++ actions = client.actions() ++ assert actions == [{"symbol": "HDFCBANK"}] ++ assert nse_server.logs[0] == { ++ "path": "/corporates-corporateActions", ++ "query": {"index": ["equities"]}, ++ "cookie": "", ++ } ++ ++ announcements = client.announcements(from_date=datetime(2025, 2, 1)) ++ assert announcements == [{"symbol": "INFY", "subject": "Board"}] ++ assert nse_server.logs[1] == { ++ "path": "/corporate-announcements", ++ "query": {"index": ["equities"]}, ++ "cookie": "nse-stage=observed", ++ } ++ ++ meetings = client.boardMeetings(to_date=datetime(2025, 3, 6)) ++ assert meetings == [{"symbol": "TCS", "purpose": "Results"}] ++ assert nse_server.logs[2] == { ++ "path": "/corporate-board-meetings", ++ "query": {"index": ["equities"]}, ++ "cookie": "nse-stage=observed", ++ } ++ ++ client.__exit__(None, None, None) ++ ++ ++def test_invalid_corporate_date_order_raises_value_error(tmp_path, nse_server): ++ ++ ++ ++ ++ client = make_client(tmp_path, nse_server) ++ ++ for call in (client.actions, client.announcements, client.boardMeetings): ++ with pytest.raises(ValueError) as error: ++ call(from_date=datetime(2025, 6, 2), to_date=datetime(2025, 6, 1)) ++ assert str(error.value) == "'from_date' cannot be greater than 'to_date'" ++ ++ assert nse_server.logs == [] ++ client.__exit__(None, None, None) ++ ++ ++def test_annual_reports_and_shareholding_params_and_return_shapes(tmp_path, nse_server): ++ ++ ++ ++ ++ client = make_client(tmp_path, nse_server) ++ ++ annual_reports = client.annual_reports("HDFCBANK", segment="sme") ++ assert annual_reports == {"data": [{"fileName": "HDFC-2025.pdf"}]} ++ assert nse_server.logs[0] == { ++ "path": "/annual-reports", ++ "query": {"index": ["sme"], "symbol": ["HDFCBANK"]}, ++ "cookie": "", ++ } ++ ++ shareholding = client.shareholding("reliance", index="sme") ++ assert shareholding == [{"symbol": "RELIANCE", "date": "30-Jun-2025"}] ++ assert nse_server.logs[1] == { ++ "path": "/corporate-share-holdings-master", ++ "query": {"index": ["sme"], "symbol": ["RELIANCE"]}, ++ "cookie": "nse-stage=observed", ++ } ++ ++ client.__exit__(None, None, None) ++ ++ ++def test_list_past_ipo_explicit_default_and_invalid_windows(tmp_path, nse_server): ++ ++ ++ ++ ++ client = make_client(tmp_path, nse_server) ++ ++ explicit = client.listPastIPO( ++ from_date=datetime(2025, 4, 1), to_date=datetime(2025, 4, 30) ++ ) ++ assert explicit == [{"symbol": "IPOCO"}] ++ assert nse_server.logs[0] == { ++ "path": "/public-past-issues", ++ "query": {"from_date": ["01-04-2025"], "to_date": ["30-04-2025"]}, ++ "cookie": "", ++ } ++ ++ before_default = datetime.now().date() ++ defaulted = client.listPastIPO() ++ after_default = datetime.now().date() ++ assert defaulted == [{"symbol": "IPOCO"}] ++ ++ assert nse_server.logs[1]["path"] == "/public-past-issues" ++ assert nse_server.logs[1]["cookie"] == "nse-stage=observed" ++ assert set(nse_server.logs[1]["query"]) == {"from_date", "to_date"} ++ default_to_date = parsed_query_date(nse_server.logs[1], "to_date") ++ default_from_date = parsed_query_date(nse_server.logs[1], "from_date") ++ assert before_default <= default_to_date <= after_default ++ assert default_from_date == default_to_date - timedelta(days=90) ++ ++ with pytest.raises(ValueError) as error: ++ client.listPastIPO( ++ from_date=datetime(2025, 5, 2), to_date=datetime(2025, 5, 1) ++ ) ++ assert str(error.value) == "Argument `to_date` cannot be less than `from_date`" ++ assert len(nse_server.logs) == 2 ++ ++ client.__exit__(None, None, None) ++ ++ ++def test_circulars_explicit_default_filters_and_invalid_windows(tmp_path, nse_server): ++ ++ ++ ++ ++ client = make_client(tmp_path, nse_server) ++ ++ explicit = client.circulars( ++ subject="holidays", ++ dept_code="cc", ++ from_date=datetime(2025, 5, 1), ++ to_date=datetime(2025, 5, 8), ++ ) ++ assert explicit == {"data": []} ++ assert nse_server.logs[0] == { ++ "path": "/circulars", ++ "query": { ++ "from_date": ["01-05-2025"], ++ "to_date": ["08-05-2025"], ++ "sub": ["holidays"], ++ "dept": ["CC"], ++ }, ++ "cookie": "", ++ } ++ ++ before_default = datetime.now().date() ++ defaulted = client.circulars() ++ after_default = datetime.now().date() ++ assert defaulted == {"data": []} ++ ++ assert nse_server.logs[1]["path"] == "/circulars" ++ assert nse_server.logs[1]["cookie"] == "nse-stage=observed" ++ assert set(nse_server.logs[1]["query"]) == {"from_date", "to_date"} ++ default_to_date = parsed_query_date(nse_server.logs[1], "to_date") ++ default_from_date = parsed_query_date(nse_server.logs[1], "from_date") ++ assert before_default <= default_to_date <= after_default ++ assert default_from_date == default_to_date - timedelta(days=7) ++ ++ with pytest.raises(ValueError) as error: ++ client.circulars(from_date=datetime(2025, 7, 2), to_date=datetime(2025, 7, 1)) ++ assert str(error.value) == "Argument `to_date` cannot be less than `from_date`" ++ assert len(nse_server.logs) == 2 ++ ++ client.__exit__(None, None, None) ++ ++ ++def test_context_cleanup_is_idempotent(tmp_path, nse_server): ++ ++ ++ ++ ++ client = make_client(tmp_path, nse_server) ++ assert len(list(tmp_path.rglob("nse_cookies_requests.json"))) == 1 ++ ++ client.__exit__(None, None, None) ++ assert len(list(tmp_path.rglob("nse_cookies_requests.json"))) == 0 ++ ++ client.__exit__(None, None, None) ++ assert len(list(tmp_path.rglob("nse_cookies_requests.json"))) == 0 ++ ++ ++def test_two_instances_keep_session_cookies_independent(tmp_path, nse_server): ++ ++ ++ ++ ++ first = make_client(tmp_path, nse_server, "first") ++ second = make_client(tmp_path, nse_server, "second") ++ ++ first_actions = first.actions() ++ assert first_actions == [{"symbol": "HDFCBANK"}] ++ assert nse_server.logs[0] == { ++ "path": "/corporates-corporateActions", ++ "query": {"index": ["equities"]}, ++ "cookie": "", ++ } ++ ++ second_announcements = second.announcements() ++ assert second_announcements == [{"symbol": "INFY", "subject": "Board"}] ++ assert nse_server.logs[1] == { ++ "path": "/corporate-announcements", ++ "query": {"index": ["equities"]}, ++ "cookie": "", ++ } ++ ++ first_meetings = first.boardMeetings() ++ assert first_meetings == [{"symbol": "TCS", "purpose": "Results"}] ++ assert nse_server.logs[2] == { ++ "path": "/corporate-board-meetings", ++ "query": {"index": ["equities"]}, ++ "cookie": "nse-stage=observed", ++ } ++ ++ first.__exit__(None, None, None) ++ second.__exit__(None, None, None) ++ ++ ++def test_repeated_context_cycles_do_not_leave_cookie_files(tmp_path, nse_server): ++ ++ ++ ++ ++ for i in range(100): ++ client = make_client(tmp_path, nse_server, f"cycle-{i}") ++ result = client.actions() ++ assert result == [{"symbol": "HDFCBANK"}] ++ client.__exit__(None, None, None) ++ ++ assert len(nse_server.logs) == 100 ++ assert nse_server.logs[0] == { ++ "path": "/corporates-corporateActions", ++ "query": {"index": ["equities"]}, ++ "cookie": "", ++ } ++ assert nse_server.logs[99] == { ++ "path": "/corporates-corporateActions", ++ "query": {"index": ["equities"]}, ++ "cookie": "", ++ } ++ assert len(list(tmp_path.rglob("nse_cookies_requests.json"))) == 0 +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,18 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++set -euo pipefail ++cd /workspace/repo ++ ++export PYTHONPATH="/workspace/repo/src${PYTHONPATH:+:${PYTHONPATH}}" ++export PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 ++ ++exec python -m pytest /workspace/repo/usercase-test-coderl/test_corporate_filings_session.py -v diff --git a/tasks/format-code-task-000552/tests/test.sh b/tasks/format-code-task-000552/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..92e609fb1d67d705f64e95877948cdf7b59f0d45 --- /dev/null +++ b/tasks/format-code-task-000552/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/test_corporate_filings_session.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000552/tests/test_command.sh b/tasks/format-code-task-000552/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-000552/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000555/environment/Dockerfile b/tasks/format-code-task-000555/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..771a1509f489764213eb2816f878220208a908b5 --- /dev/null +++ b/tasks/format-code-task-000555/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:3e644731d44c223a69d4d8edbfe5b3d346058b308428b3b8d0d030514da46878 diff --git a/tasks/format-code-task-000555/environment/setup/files/blocklist b/tasks/format-code-task-000555/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000555/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000555/environment/setup/setup.sh b/tasks/format-code-task-000555/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-000555/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000555/tests/test.patch b/tasks/format-code-task-000555/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..ebf6a1c5cd50b32c5afe833bcb0b83ce54c7cea9 --- /dev/null +++ b/tasks/format-code-task-000555/tests/test.patch @@ -0,0 +1,2259 @@ +diff --git a/usercase-test-coderl/go.mod b/usercase-test-coderl/go.mod +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/go.mod +@@ -0,0 +1,147 @@ ++module usercase_test_coderl ++ ++go 1.21.6 ++ ++require ( ++ cosmossdk.io/log v1.3.1 ++ cosmossdk.io/store v1.1.0 ++ github.com/berachain/polaris/cosmos v0.0.0 ++ github.com/berachain/polaris/eth v0.1.6-alpha ++ github.com/cometbft/cometbft v0.38.8-0.20240527104925-a38dbb2eef72 ++ github.com/cosmos/cosmos-db v1.0.2 ++ github.com/cosmos/cosmos-sdk v0.50.7-0.20240528102556-d180df817efc ++ github.com/ethereum/go-ethereum v1.13.10 ++) ++ ++require ( ++ cosmossdk.io/api v0.7.5 // indirect ++ cosmossdk.io/collections v0.4.0 // indirect ++ cosmossdk.io/core v0.11.0 // indirect ++ cosmossdk.io/depinject v1.0.0-alpha.4 // indirect ++ cosmossdk.io/errors v1.0.1 // indirect ++ cosmossdk.io/math v1.3.0 // indirect ++ cosmossdk.io/x/tx v0.13.3 // indirect ++ github.com/DataDog/zstd v1.5.5 // indirect ++ github.com/Microsoft/go-winio v0.6.1 // indirect ++ github.com/VictoriaMetrics/fastcache v1.12.1 // indirect ++ github.com/beorn7/perks v1.0.1 // indirect ++ github.com/berachain/polaris/lib v0.0.4-alpha // indirect ++ github.com/bits-and-blooms/bitset v1.11.0 // indirect ++ github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect ++ github.com/cespare/xxhash v1.1.0 // indirect ++ github.com/cespare/xxhash/v2 v2.3.0 // indirect ++ github.com/cockroachdb/errors v1.11.1 // indirect ++ github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect ++ github.com/cockroachdb/pebble v1.1.0 // indirect ++ github.com/cockroachdb/redact v1.1.5 // indirect ++ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect ++ github.com/cometbft/cometbft-db v0.9.1 // indirect ++ github.com/consensys/bavard v0.1.13 // indirect ++ github.com/consensys/gnark-crypto v0.12.1 // indirect ++ github.com/cosmos/btcutil v1.0.5 // indirect ++ github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect ++ github.com/cosmos/gogoproto v1.4.12 // indirect ++ github.com/cosmos/iavl v1.1.2 // indirect ++ github.com/cosmos/ics23/go v0.10.0 // indirect ++ github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 // indirect ++ github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect ++ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect ++ github.com/deckarep/golang-set/v2 v2.3.1 // indirect ++ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect ++ github.com/dgraph-io/badger/v2 v2.2007.4 // indirect ++ github.com/dgraph-io/ristretto v0.1.1 // indirect ++ github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect ++ github.com/dustin/go-humanize v1.0.1 // indirect ++ github.com/emicklei/dot v1.6.1 // indirect ++ github.com/ethereum/c-kzg-4844 v0.4.0 // indirect ++ github.com/fsnotify/fsnotify v1.7.0 // indirect ++ github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect ++ github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect ++ github.com/getsentry/sentry-go v0.27.0 // indirect ++ github.com/go-kit/kit v0.12.0 // indirect ++ github.com/go-kit/log v0.2.1 // indirect ++ github.com/go-logfmt/logfmt v0.6.0 // indirect ++ github.com/go-ole/go-ole v1.3.0 // indirect ++ github.com/gofrs/flock v0.8.1 // indirect ++ github.com/gogo/protobuf v1.3.2 // indirect ++ github.com/golang/glog v1.2.0 // indirect ++ github.com/golang/protobuf v1.5.4 // indirect ++ github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect ++ github.com/google/btree v1.1.2 // indirect ++ github.com/google/go-cmp v0.6.0 // indirect ++ github.com/google/uuid v1.6.0 // indirect ++ github.com/gorilla/websocket v1.5.1 // indirect ++ github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect ++ github.com/hashicorp/go-immutable-radix v1.3.1 // indirect ++ github.com/hashicorp/go-metrics v0.5.3 // indirect ++ github.com/hashicorp/golang-lru v1.0.2 // indirect ++ github.com/holiman/bloomfilter/v2 v2.0.3 // indirect ++ github.com/holiman/uint256 v1.2.4 // indirect ++ github.com/huin/goupnp v1.3.0 // indirect ++ github.com/iancoleman/strcase v0.3.0 // indirect ++ github.com/inconshreveable/mousetrap v1.1.0 // indirect ++ github.com/jackpal/go-nat-pmp v1.0.2 // indirect ++ github.com/jmhodges/levigo v1.0.0 // indirect ++ github.com/klauspost/compress v1.17.7 // indirect ++ github.com/kr/pretty v0.3.1 // indirect ++ github.com/kr/text v0.2.0 // indirect ++ github.com/libp2p/go-buffer-pool v0.1.0 // indirect ++ github.com/linxGnu/grocksdb v1.8.14 // indirect ++ github.com/mattn/go-colorable v0.1.13 // indirect ++ github.com/mattn/go-isatty v0.0.20 // indirect ++ github.com/mattn/go-runewidth v0.0.15 // indirect ++ github.com/mmcloughlin/addchain v0.4.0 // indirect ++ github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect ++ github.com/olekukonko/tablewriter v0.0.5 // indirect ++ github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 // indirect ++ github.com/pkg/errors v0.9.1 // indirect ++ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect ++ github.com/prometheus/client_golang v1.19.0 // indirect ++ github.com/prometheus/client_model v0.6.1 // indirect ++ github.com/prometheus/common v0.52.2 // indirect ++ github.com/prometheus/procfs v0.13.0 // indirect ++ github.com/rivo/uniseg v0.4.4 // indirect ++ github.com/rogpeppe/go-internal v1.12.0 // indirect ++ github.com/rs/zerolog v1.32.0 // indirect ++ github.com/sasha-s/go-deadlock v0.3.1 // indirect ++ github.com/shirou/gopsutil v3.21.11+incompatible // indirect ++ github.com/spf13/cast v1.6.0 // indirect ++ github.com/spf13/cobra v1.8.0 // indirect ++ github.com/spf13/pflag v1.0.5 // indirect ++ github.com/status-im/keycard-go v0.2.0 // indirect ++ github.com/stretchr/testify v1.9.0 // indirect ++ github.com/supranational/blst v0.3.11 // indirect ++ github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect ++ github.com/tendermint/go-amino v0.16.0 // indirect ++ github.com/tidwall/btree v1.7.0 // indirect ++ github.com/tklauser/go-sysconf v0.3.12 // indirect ++ github.com/tklauser/numcpus v0.6.1 // indirect ++ github.com/tyler-smith/go-bip39 v1.1.0 // indirect ++ github.com/yusufpapurcu/wmi v1.2.3 // indirect ++ go.etcd.io/bbolt v1.3.8 // indirect ++ golang.org/x/crypto v0.22.0 // indirect ++ golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect ++ golang.org/x/mod v0.17.0 // indirect ++ golang.org/x/net v0.24.0 // indirect ++ golang.org/x/sync v0.7.0 // indirect ++ golang.org/x/sys v0.19.0 // indirect ++ golang.org/x/text v0.14.0 // indirect ++ golang.org/x/tools v0.20.0 // indirect ++ google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect ++ google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect ++ google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect ++ google.golang.org/grpc v1.63.2 // indirect ++ google.golang.org/protobuf v1.33.0 // indirect ++ gopkg.in/yaml.v3 v3.0.1 // indirect ++ rsc.io/tmplfunc v0.0.3 // indirect ++ sigs.k8s.io/yaml v1.4.0 // indirect ++) ++ ++replace ( ++ github.com/berachain/polaris/contracts => ../contracts ++ github.com/berachain/polaris/cosmos => ../cosmos ++ github.com/berachain/polaris/eth => ../eth ++ github.com/berachain/polaris/lib => ../lib ++ github.com/ethereum/go-ethereum => github.com/berachain/polaris-geth v1.13.10-2-polar ++ github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 ++) +diff --git a/usercase-test-coderl/go.sum b/usercase-test-coderl/go.sum +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/go.sum +@@ -0,0 +1,1655 @@ ++4d63.com/gocheckcompilerdirectives v1.2.1 h1:AHcMYuw56NPjq/2y615IGg2kYkBdTvOaojYCBcRE7MA= ++4d63.com/gocheckcompilerdirectives v1.2.1/go.mod h1:yjDJSxmDTtIHHCqX0ufRYZDL6vQtMG7tJdKVeWwsqvs= ++4d63.com/gochecknoglobals v0.2.1 h1:1eiorGsgHOFOuoOiJDy2psSrQbRdIHrlge0IJIkUgDc= ++4d63.com/gochecknoglobals v0.2.1/go.mod h1:KRE8wtJB3CXCsb1xy421JfTHIIbmT3U5ruxw2Qu8fSU= ++cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= ++cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= ++cloud.google.com/go v0.112.0 h1:tpFCD7hpHFlQ8yPwT3x+QeXqc2T6+n6T+hmABHfDUSM= ++cloud.google.com/go v0.112.0/go.mod h1:3jEEVwZ/MHU4djK5t5RHuKOA/GbLddgTdVubX1qnPD4= ++cloud.google.com/go/accessapproval v1.7.5 h1:uzmAMSgYcnlHa9X9YSQZ4Q1wlfl4NNkZyQgho1Z6p04= ++cloud.google.com/go/accessapproval v1.7.5/go.mod h1:g88i1ok5dvQ9XJsxpUInWWvUBrIZhyPDPbk4T01OoJ0= ++cloud.google.com/go/accesscontextmanager v1.8.5 h1:2GLNaNu9KRJhJBFTIVRoPwk6xE5mUDgD47abBq4Zp/I= ++cloud.google.com/go/accesscontextmanager v1.8.5/go.mod h1:TInEhcZ7V9jptGNqN3EzZ5XMhT6ijWxTGjzyETwmL0Q= ++cloud.google.com/go/aiplatform v1.60.0 h1:0cSrii1ZeLr16MbBoocyy5KVnrSdiQ3KN/vtrTe7RqE= ++cloud.google.com/go/aiplatform v1.60.0/go.mod h1:eTlGuHOahHprZw3Hio5VKmtThIOak5/qy6pzdsqcQnM= ++cloud.google.com/go/analytics v0.23.0 h1:Q+y94XH84jM8SK8O7qiY/PJRexb6n7dRbQ6PiUa4YGM= ++cloud.google.com/go/analytics v0.23.0/go.mod h1:YPd7Bvik3WS95KBok2gPXDqQPHy08TsCQG6CdUCb+u0= ++cloud.google.com/go/apigateway v1.6.5 h1:sPXnpk+6TneKIrjCjcpX5YGsAKy3PTdpIchoj8/74OE= ++cloud.google.com/go/apigateway v1.6.5/go.mod h1:6wCwvYRckRQogyDDltpANi3zsCDl6kWi0b4Je+w2UiI= ++cloud.google.com/go/apigeeconnect v1.6.5 h1:CrfIKv9Go3fh/QfQgisU3MeP90Ww7l/sVGmr3TpECo8= ++cloud.google.com/go/apigeeconnect v1.6.5/go.mod h1:MEKm3AiT7s11PqTfKE3KZluZA9O91FNysvd3E6SJ6Ow= ++cloud.google.com/go/apigeeregistry v0.8.3 h1:C+QU2K+DzDjk4g074ouwHQGkoff1h5OMQp6sblCVreQ= ++cloud.google.com/go/apigeeregistry v0.8.3/go.mod h1:aInOWnqF4yMQx8kTjDqHNXjZGh/mxeNlAf52YqtASUs= ++cloud.google.com/go/appengine v1.8.5 h1:l2SviT44zWQiOv8bPoMBzW0vOcMO22iO0s+nVtVhdts= ++cloud.google.com/go/appengine v1.8.5/go.mod h1:uHBgNoGLTS5di7BvU25NFDuKa82v0qQLjyMJLuPQrVo= ++cloud.google.com/go/area120 v0.8.5 h1:vTs08KPLN/iMzTbxpu5ciL06KcsrVPMjz4IwcQyZ4uY= ++cloud.google.com/go/area120 v0.8.5/go.mod h1:BcoFCbDLZjsfe4EkCnEq1LKvHSK0Ew/zk5UFu6GMyA0= ++cloud.google.com/go/artifactregistry v1.14.7 h1:W9sVlyb1VRcUf83w7aM3yMsnp4HS4PoyGqYQNG0O5lI= ++cloud.google.com/go/artifactregistry v1.14.7/go.mod h1:0AUKhzWQzfmeTvT4SjfI4zjot72EMfrkvL9g9aRjnnM= ++cloud.google.com/go/asset v1.17.2 h1:xgFnBP3luSbUcC9RWJvb3Zkt+y/wW6PKwPHr3ssnIP8= ++cloud.google.com/go/asset v1.17.2/go.mod h1:SVbzde67ehddSoKf5uebOD1sYw8Ab/jD/9EIeWg99q4= ++cloud.google.com/go/assuredworkloads v1.11.5 h1:gCrN3IyvqY3cP0wh2h43d99CgH3G+WYs9CeuFVKChR8= ++cloud.google.com/go/assuredworkloads v1.11.5/go.mod h1:FKJ3g3ZvkL2D7qtqIGnDufFkHxwIpNM9vtmhvt+6wqk= ++cloud.google.com/go/automl v1.13.5 h1:ijiJy9sYWh75WrqImXsfWc1e3HR3iO+ef9fvW03Ig/4= ++cloud.google.com/go/automl v1.13.5/go.mod h1:MDw3vLem3yh+SvmSgeYUmUKqyls6NzSumDm9OJ3xJ1Y= ++cloud.google.com/go/baremetalsolution v1.2.4 h1:LFydisRmS7hQk9P/YhekwuZGqb45TW4QavcrMToWo5A= ++cloud.google.com/go/baremetalsolution v1.2.4/go.mod h1:BHCmxgpevw9IEryE99HbYEfxXkAEA3hkMJbYYsHtIuY= ++cloud.google.com/go/batch v1.8.0 h1:2HK4JerwVaIcCh/lJiHwh6+uswPthiMMWhiSWLELayk= ++cloud.google.com/go/batch v1.8.0/go.mod h1:k8V7f6VE2Suc0zUM4WtoibNrA6D3dqBpB+++e3vSGYc= ++cloud.google.com/go/beyondcorp v1.0.4 h1:qs0J0O9Ol2h1yA0AU+r7l3hOCPzs2MjE1d6d/kaHIKo= ++cloud.google.com/go/beyondcorp v1.0.4/go.mod h1:Gx8/Rk2MxrvWfn4WIhHIG1NV7IBfg14pTKv1+EArVcc= ++cloud.google.com/go/bigquery v1.59.1 h1:CpT+/njKuKT3CEmswm6IbhNu9u35zt5dO4yPDLW+nG4= ++cloud.google.com/go/bigquery v1.59.1/go.mod h1:VP1UJYgevyTwsV7desjzNzDND5p6hZB+Z8gZJN1GQUc= ++cloud.google.com/go/billing v1.18.2 h1:oWUEQvuC4JvtnqLZ35zgzdbuHt4Itbftvzbe6aEyFdE= ++cloud.google.com/go/billing v1.18.2/go.mod h1:PPIwVsOOQ7xzbADCwNe8nvK776QpfrOAUkvKjCUcpSE= ++cloud.google.com/go/binaryauthorization v1.8.1 h1:1jcyh2uIUwSZkJ/JmL8kd5SUkL/Krbv8zmYLEbAz6kY= ++cloud.google.com/go/binaryauthorization v1.8.1/go.mod h1:1HVRyBerREA/nhI7yLang4Zn7vfNVA3okoAR9qYQJAQ= ++cloud.google.com/go/certificatemanager v1.7.5 h1:UMBr/twXvH3jcT5J5/YjRxf2tvwTYIfrpemTebe0txc= ++cloud.google.com/go/certificatemanager v1.7.5/go.mod h1:uX+v7kWqy0Y3NG/ZhNvffh0kuqkKZIXdvlZRO7z0VtM= ++cloud.google.com/go/channel v1.17.5 h1:/omiBnyFjm4S1ETHoOmJbL7LH7Ljcei4rYG6Sj3hc80= ++cloud.google.com/go/channel v1.17.5/go.mod h1:FlpaOSINDAXgEext0KMaBq/vwpLMkkPAw9b2mApQeHc= ++cloud.google.com/go/cloudbuild v1.15.1 h1:ZB6oOmJo+MTov9n629fiCrO9YZPOg25FZvQ7gIHu5ng= ++cloud.google.com/go/cloudbuild v1.15.1/go.mod h1:gIofXZSu+XD2Uy+qkOrGKEx45zd7s28u/k8f99qKals= ++cloud.google.com/go/clouddms v1.7.4 h1:Sr0Zo5EAcPQiCBgHWICg3VGkcdS/LLP1d9SR7qQBM/s= ++cloud.google.com/go/clouddms v1.7.4/go.mod h1:RdrVqoFG9RWI5AvZ81SxJ/xvxPdtcRhFotwdE79DieY= ++cloud.google.com/go/cloudtasks v1.12.6 h1:EUt1hIZ9bLv8Iz9yWaCrqgMnIU+Tdh0yXM1MMVGhjfE= ++cloud.google.com/go/cloudtasks v1.12.6/go.mod h1:b7c7fe4+TJsFZfDyzO51F7cjq7HLUlRi/KZQLQjDsaY= ++cloud.google.com/go/compute v1.24.0 h1:phWcR2eWzRJaL/kOiJwfFsPs4BaKq1j6vnpZrc1YlVg= ++cloud.google.com/go/compute v1.24.0/go.mod h1:kw1/T+h/+tK2LJK0wiPPx1intgdAM3j/g3hFDlscY40= ++cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= ++cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= ++cloud.google.com/go/contactcenterinsights v1.13.0 h1:6Vs/YnDG5STGjlWMEjN/xtmft7MrOTOnOZYUZtGTx0w= ++cloud.google.com/go/contactcenterinsights v1.13.0/go.mod h1:ieq5d5EtHsu8vhe2y3amtZ+BE+AQwX5qAy7cpo0POsI= ++cloud.google.com/go/container v1.31.0 h1:MAaNH7VRNPWEhvqOypq2j+7ONJKrKzon4v9nS3nLZe0= ++cloud.google.com/go/container v1.31.0/go.mod h1:7yABn5s3Iv3lmw7oMmyGbeV6tQj86njcTijkkGuvdZA= ++cloud.google.com/go/containeranalysis v0.11.4 h1:doJ0M1ljS4hS0D2UbHywlHGwB7sQLNrt9vFk9Zyi7vY= ++cloud.google.com/go/containeranalysis v0.11.4/go.mod h1:cVZT7rXYBS9NG1rhQbWL9pWbXCKHWJPYraE8/FTSYPE= ++cloud.google.com/go/datacatalog v1.19.3 h1:A0vKYCQdxQuV4Pi0LL9p39Vwvg4jH5yYveMv50gU5Tw= ++cloud.google.com/go/datacatalog v1.19.3/go.mod h1:ra8V3UAsciBpJKQ+z9Whkxzxv7jmQg1hfODr3N3YPJ4= ++cloud.google.com/go/dataflow v0.9.5 h1:RYHtcPhmE664+F0Je46p+NvFbG8z//KCXp+uEqB4jZU= ++cloud.google.com/go/dataflow v0.9.5/go.mod h1:udl6oi8pfUHnL0z6UN9Lf9chGqzDMVqcYTcZ1aPnCZQ= ++cloud.google.com/go/dataform v0.9.2 h1:5e4eqGrd0iDTCg4Q+VlAao5j2naKAA7xRurNtwmUknU= ++cloud.google.com/go/dataform v0.9.2/go.mod h1:S8cQUwPNWXo7m/g3DhWHsLBoufRNn9EgFrMgne2j7cI= ++cloud.google.com/go/datafusion v1.7.5 h1:HQ/BUOP8OIGJxuztpYvNvlb+/U+/Bfs9SO8tQbh61fk= ++cloud.google.com/go/datafusion v1.7.5/go.mod h1:bYH53Oa5UiqahfbNK9YuYKteeD4RbQSNMx7JF7peGHc= ++cloud.google.com/go/datalabeling v0.8.5 h1:GpIFRdm0qIZNsxqURFJwHt0ZBJZ0nF/mUVEigR7PH/8= ++cloud.google.com/go/datalabeling v0.8.5/go.mod h1:IABB2lxQnkdUbMnQaOl2prCOfms20mcPxDBm36lps+s= ++cloud.google.com/go/dataplex v1.14.2 h1:fxIfdU8fxzR3clhOoNI7XFppvAmndxDu1AMH+qX9WKQ= ++cloud.google.com/go/dataplex v1.14.2/go.mod h1:0oGOSFlEKef1cQeAHXy4GZPB/Ife0fz/PxBf+ZymA2U= ++cloud.google.com/go/dataproc/v2 v2.4.0 h1:/u81Fd+BvCLp+xjctI1DiWVJn6cn9/s3Akc8xPH02yk= ++cloud.google.com/go/dataproc/v2 v2.4.0/go.mod h1:3B1Ht2aRB8VZIteGxQS/iNSJGzt9+CA0WGnDVMEm7Z4= ++cloud.google.com/go/dataqna v0.8.5 h1:9ybXs3nr9BzxSGC04SsvtuXaHY0qmJSLIpIAbZo9GqQ= ++cloud.google.com/go/dataqna v0.8.5/go.mod h1:vgihg1mz6n7pb5q2YJF7KlXve6tCglInd6XO0JGOlWM= ++cloud.google.com/go/datastore v1.15.0 h1:0P9WcsQeTWjuD1H14JIY7XQscIPQ4Laje8ti96IC5vg= ++cloud.google.com/go/datastore v1.15.0/go.mod h1:GAeStMBIt9bPS7jMJA85kgkpsMkvseWWXiaHya9Jes8= ++cloud.google.com/go/datastream v1.10.4 h1:o1QDKMo/hk0FN7vhoUQURREuA0rgKmnYapB+1M+7Qz4= ++cloud.google.com/go/datastream v1.10.4/go.mod h1:7kRxPdxZxhPg3MFeCSulmAJnil8NJGGvSNdn4p1sRZo= ++cloud.google.com/go/deploy v1.17.1 h1:m27Ojwj03gvpJqCbodLYiVmE9x4/LrHGGMjzc0LBfM4= ++cloud.google.com/go/deploy v1.17.1/go.mod h1:SXQyfsXrk0fBmgBHRzBjQbZhMfKZ3hMQBw5ym7MN/50= ++cloud.google.com/go/dialogflow v1.49.0 h1:KqG0oxGE71qo0lRVyAoeBozefCvsMfcDzDjoLYSY0F4= ++cloud.google.com/go/dialogflow v1.49.0/go.mod h1:dhVrXKETtdPlpPhE7+2/k4Z8FRNUp6kMV3EW3oz/fe0= ++cloud.google.com/go/dlp v1.11.2 h1:lTipOuJaSjlYnnotPMbEhKURLC6GzCMDDzVbJAEbmYM= ++cloud.google.com/go/dlp v1.11.2/go.mod h1:9Czi+8Y/FegpWzgSfkRlyz+jwW6Te9Rv26P3UfU/h/w= ++cloud.google.com/go/documentai v1.25.0 h1:lI62GMEEPO6vXJI9hj+G9WjOvnR0hEjvjokrnex4cxA= ++cloud.google.com/go/documentai v1.25.0/go.mod h1:ftLnzw5VcXkLItp6pw1mFic91tMRyfv6hHEY5br4KzY= ++cloud.google.com/go/domains v0.9.5 h1:Mml/R6s3vQQvFPpi/9oX3O5dRirgjyJ8cksK8N19Y7g= ++cloud.google.com/go/domains v0.9.5/go.mod h1:dBzlxgepazdFhvG7u23XMhmMKBjrkoUNaw0A8AQB55Y= ++cloud.google.com/go/edgecontainer v1.1.5 h1:tBY32km78ScpK2aOP84JoW/+wtpx5WluyPUSEE3270U= ++cloud.google.com/go/edgecontainer v1.1.5/go.mod h1:rgcjrba3DEDEQAidT4yuzaKWTbkTI5zAMu3yy6ZWS0M= ++cloud.google.com/go/errorreporting v0.3.0 h1:kj1XEWMu8P0qlLhm3FwcaFsUvXChV/OraZwA70trRR0= ++cloud.google.com/go/errorreporting v0.3.0/go.mod h1:xsP2yaAp+OAW4OIm60An2bbLpqIhKXdWR/tawvl7QzU= ++cloud.google.com/go/essentialcontacts v1.6.6 h1:13eHn5qBnsawxI7mIrv4jRIEmQ1xg0Ztqw5ZGqtUNfA= ++cloud.google.com/go/essentialcontacts v1.6.6/go.mod h1:XbqHJGaiH0v2UvtuucfOzFXN+rpL/aU5BCZLn4DYl1Q= ++cloud.google.com/go/eventarc v1.13.4 h1:ORkd6/UV5FIdA8KZQDLNZYKS7BBOrj0p01DXPmT4tE4= ++cloud.google.com/go/eventarc v1.13.4/go.mod h1:zV5sFVoAa9orc/52Q+OuYUG9xL2IIZTbbuTHC6JSY8s= ++cloud.google.com/go/filestore v1.8.1 h1:X5G4y/vrUo1B8Nsz93qSWTMAcM8LXbGUldq33OdcdCw= ++cloud.google.com/go/filestore v1.8.1/go.mod h1:MbN9KcaM47DRTIuLfQhJEsjaocVebNtNQhSLhKCF5GM= ++cloud.google.com/go/firestore v1.14.0 h1:8aLcKnMPoldYU3YHgu4t2exrKhLQkqaXAGqT0ljrFVw= ++cloud.google.com/go/firestore v1.14.0/go.mod h1:96MVaHLsEhbvkBEdZgfN+AS/GIkco1LRpH9Xp9YZfzQ= ++cloud.google.com/go/functions v1.16.0 h1:IWVylmK5F6hJ3R5zaRW7jI5PrWhCvtBVU4axQLmXSo4= ++cloud.google.com/go/functions v1.16.0/go.mod h1:nbNpfAG7SG7Duw/o1iZ6ohvL7mc6MapWQVpqtM29n8k= ++cloud.google.com/go/gkebackup v1.3.5 h1:iuE8KNtTsPOc79qeWoNS8zOWoXPD9SAdOmwgxtlCmh8= ++cloud.google.com/go/gkebackup v1.3.5/go.mod h1:KJ77KkNN7Wm1LdMopOelV6OodM01pMuK2/5Zt1t4Tvc= ++cloud.google.com/go/gkeconnect v0.8.5 h1:17d+ZSSXKqG/RwZCq3oFMIWLPI8Zw3b8+a9/BEVlwH0= ++cloud.google.com/go/gkeconnect v0.8.5/go.mod h1:LC/rS7+CuJ5fgIbXv8tCD/mdfnlAadTaUufgOkmijuk= ++cloud.google.com/go/gkehub v0.14.5 h1:RboLNFzf9wEMSo7DrKVBlf+YhK/A/jrLN454L5Tz99Q= ++cloud.google.com/go/gkehub v0.14.5/go.mod h1:6bzqxM+a+vEH/h8W8ec4OJl4r36laxTs3A/fMNHJ0wA= ++cloud.google.com/go/gkemulticloud v1.1.1 h1:rsSZAGLhyjyE/bE2ToT5fqo1qSW7S+Ubsc9jFOcbhSI= ++cloud.google.com/go/gkemulticloud v1.1.1/go.mod h1:C+a4vcHlWeEIf45IB5FFR5XGjTeYhF83+AYIpTy4i2Q= ++cloud.google.com/go/gsuiteaddons v1.6.5 h1:CZEbaBwmbYdhFw21Fwbo+C35HMe36fTE0FBSR4KSfWg= ++cloud.google.com/go/gsuiteaddons v1.6.5/go.mod h1:Lo4P2IvO8uZ9W+RaC6s1JVxo42vgy+TX5a6hfBZ0ubs= ++cloud.google.com/go/iam v1.1.6 h1:bEa06k05IO4f4uJonbB5iAgKTPpABy1ayxaIZV/GHVc= ++cloud.google.com/go/iam v1.1.6/go.mod h1:O0zxdPeGBoFdWW3HWmBxJsk0pfvNM/p/qa82rWOGTwI= ++cloud.google.com/go/iap v1.9.4 h1:94zirc2r4t6KzhAMW0R6Dme005eTP6yf7g6vN4IhRrA= ++cloud.google.com/go/iap v1.9.4/go.mod h1:vO4mSq0xNf/Pu6E5paORLASBwEmphXEjgCFg7aeNu1w= ++cloud.google.com/go/ids v1.4.5 h1:xd4U7pgl3GHV+MABnv1BF4/Vy/zBF7CYC8XngkOLzag= ++cloud.google.com/go/ids v1.4.5/go.mod h1:p0ZnyzjMWxww6d2DvMGnFwCsSxDJM666Iir1bK1UuBo= ++cloud.google.com/go/iot v1.7.5 h1:munTeBlbqI33iuTYgXy7S8lW2TCgi5l1hA4roSIY+EE= ++cloud.google.com/go/iot v1.7.5/go.mod h1:nq3/sqTz3HGaWJi1xNiX7F41ThOzpud67vwk0YsSsqs= ++cloud.google.com/go/kms v1.15.7 h1:7caV9K3yIxvlQPAcaFffhlT7d1qpxjB1wHBtjWa13SM= ++cloud.google.com/go/kms v1.15.7/go.mod h1:ub54lbsa6tDkUwnu4W7Yt1aAIFLnspgh0kPGToDukeI= ++cloud.google.com/go/language v1.12.3 h1:iaJZg6K4j/2PvZZVcjeO/btcWWIllVRBhuTFjGO4LXs= ++cloud.google.com/go/language v1.12.3/go.mod h1:evFX9wECX6mksEva8RbRnr/4wi/vKGYnAJrTRXU8+f8= ++cloud.google.com/go/lifesciences v0.9.5 h1:gXvN70m2p+4zgJFzaz6gMKaxTuF9WJ0USYoMLWAOm8g= ++cloud.google.com/go/lifesciences v0.9.5/go.mod h1:OdBm0n7C0Osh5yZB7j9BXyrMnTRGBJIZonUMxo5CzPw= ++cloud.google.com/go/logging v1.9.0 h1:iEIOXFO9EmSiTjDmfpbRjOxECO7R8C7b8IXUGOj7xZw= ++cloud.google.com/go/logging v1.9.0/go.mod h1:1Io0vnZv4onoUnsVUQY3HZ3Igb1nBchky0A0y7BBBhE= ++cloud.google.com/go/longrunning v0.5.5 h1:GOE6pZFdSrTb4KAiKnXsJBtlE6mEyaW44oKyMILWnOg= ++cloud.google.com/go/longrunning v0.5.5/go.mod h1:WV2LAxD8/rg5Z1cNW6FJ/ZpX4E4VnDnoTk0yawPBB7s= ++cloud.google.com/go/managedidentities v1.6.5 h1:+bpih1piZVLxla/XBqeSUzJBp8gv9plGHIMAI7DLpDM= ++cloud.google.com/go/managedidentities v1.6.5/go.mod h1:fkFI2PwwyRQbjLxlm5bQ8SjtObFMW3ChBGNqaMcgZjI= ++cloud.google.com/go/maps v1.6.4 h1:EVCZAiDvog9So46460BGbCasPhi613exoaQbpilMVlk= ++cloud.google.com/go/maps v1.6.4/go.mod h1:rhjqRy8NWmDJ53saCfsXQ0LKwBHfi6OSh5wkq6BaMhI= ++cloud.google.com/go/mediatranslation v0.8.5 h1:c76KdIXljQHSCb/Cy47S8H4s05A4zbK3pAFGzwcczZo= ++cloud.google.com/go/mediatranslation v0.8.5/go.mod h1:y7kTHYIPCIfgyLbKncgqouXJtLsU+26hZhHEEy80fSs= ++cloud.google.com/go/memcache v1.10.5 h1:yeDv5qxRedFosvpMSEswrqUsJM5OdWvssPHFliNFTc4= ++cloud.google.com/go/memcache v1.10.5/go.mod h1:/FcblbNd0FdMsx4natdj+2GWzTq+cjZvMa1I+9QsuMA= ++cloud.google.com/go/metastore v1.13.4 h1:dR7vqWXlK6IYR8Wbu9mdFfwlVjodIBhd1JRrpZftTEg= ++cloud.google.com/go/metastore v1.13.4/go.mod h1:FMv9bvPInEfX9Ac1cVcRXp8EBBQnBcqH6gz3KvJ9BAE= ++cloud.google.com/go/monitoring v1.18.0 h1:NfkDLQDG2UR3WYZVQE8kwSbUIEyIqJUPl+aOQdFH1T4= ++cloud.google.com/go/monitoring v1.18.0/go.mod h1:c92vVBCeq/OB4Ioyo+NbN2U7tlg5ZH41PZcdvfc+Lcg= ++cloud.google.com/go/networkconnectivity v1.14.4 h1:GBfXFhLyPspnaBE3nI/BRjdhW8vcbpT9QjE/4kDCDdc= ++cloud.google.com/go/networkconnectivity v1.14.4/go.mod h1:PU12q++/IMnDJAB+3r+tJtuCXCfwfN+C6Niyj6ji1Po= ++cloud.google.com/go/networkmanagement v1.9.4 h1:aLV5GcosBNmd6M8+a0ekB0XlLRexv4fvnJJrYnqeBcg= ++cloud.google.com/go/networkmanagement v1.9.4/go.mod h1:daWJAl0KTFytFL7ar33I6R/oNBH8eEOX/rBNHrC/8TA= ++cloud.google.com/go/networksecurity v0.9.5 h1:+caSxBTj0E8OYVh/5wElFdjEMO1S/rZtE1152Cepchc= ++cloud.google.com/go/networksecurity v0.9.5/go.mod h1:KNkjH/RsylSGyyZ8wXpue8xpCEK+bTtvof8SBfIhMG8= ++cloud.google.com/go/notebooks v1.11.3 h1:FH48boYmrWVQ6k0Mx/WrnNafXncT5iSYxA8CNyWTgy0= ++cloud.google.com/go/notebooks v1.11.3/go.mod h1:0wQyI2dQC3AZyQqWnRsp+yA+kY4gC7ZIVP4Qg3AQcgo= ++cloud.google.com/go/optimization v1.6.3 h1:63NZaWyN+5rZEKHPX4ACpw3BjgyeuY8+rCehiCMaGPY= ++cloud.google.com/go/optimization v1.6.3/go.mod h1:8ve3svp3W6NFcAEFr4SfJxrldzhUl4VMUJmhrqVKtYA= ++cloud.google.com/go/orchestration v1.8.5 h1:YHgWMlrPttIVGItgGfuvO2KM7x+y9ivN/Yk92pMm1a4= ++cloud.google.com/go/orchestration v1.8.5/go.mod h1:C1J7HesE96Ba8/hZ71ISTV2UAat0bwN+pi85ky38Yq8= ++cloud.google.com/go/orgpolicy v1.12.1 h1:2JbXigqBJVp8Dx5dONUttFqewu4fP0p3pgOdIZAhpYU= ++cloud.google.com/go/orgpolicy v1.12.1/go.mod h1:aibX78RDl5pcK3jA8ysDQCFkVxLj3aOQqrbBaUL2V5I= ++cloud.google.com/go/osconfig v1.12.5 h1:Mo5jGAxOMKH/PmDY7fgY19yFcVbvwREb5D5zMPQjFfo= ++cloud.google.com/go/osconfig v1.12.5/go.mod h1:D9QFdxzfjgw3h/+ZaAb5NypM8bhOMqBzgmbhzWViiW8= ++cloud.google.com/go/oslogin v1.13.1 h1:1K4nOT5VEZNt7XkhaTXupBYos5HjzvJMfhvyD2wWdFs= ++cloud.google.com/go/oslogin v1.13.1/go.mod h1:vS8Sr/jR7QvPWpCjNqy6LYZr5Zs1e8ZGW/KPn9gmhws= ++cloud.google.com/go/phishingprotection v0.8.5 h1:DH3WFLzEoJdW/6xgsmoDqOwT1xddFi7gKu0QGZQhpGU= ++cloud.google.com/go/phishingprotection v0.8.5/go.mod h1:g1smd68F7mF1hgQPuYn3z8HDbNre8L6Z0b7XMYFmX7I= ++cloud.google.com/go/policytroubleshooter v1.10.3 h1:c0WOzC6hz964QWNBkyKfna8A2jOIx1zzZa43Gx/P09o= ++cloud.google.com/go/policytroubleshooter v1.10.3/go.mod h1:+ZqG3agHT7WPb4EBIRqUv4OyIwRTZvsVDHZ8GlZaoxk= ++cloud.google.com/go/privatecatalog v0.9.5 h1:UZ0assTnATXSggoxUIh61RjTQ4P9zCMk/kEMbn0nMYA= ++cloud.google.com/go/privatecatalog v0.9.5/go.mod h1:fVWeBOVe7uj2n3kWRGlUQqR/pOd450J9yZoOECcQqJk= ++cloud.google.com/go/pubsub v1.36.1 h1:dfEPuGCHGbWUhaMCTHUFjfroILEkx55iUmKBZTP5f+Y= ++cloud.google.com/go/pubsub v1.36.1/go.mod h1:iYjCa9EzWOoBiTdd4ps7QoMtMln5NwaZQpK1hbRfBDE= ++cloud.google.com/go/pubsublite v1.8.1 h1:pX+idpWMIH30/K7c0epN6V703xpIcMXWRjKJsz0tYGY= ++cloud.google.com/go/pubsublite v1.8.1/go.mod h1:fOLdU4f5xldK4RGJrBMm+J7zMWNj/k4PxwEZXy39QS0= ++cloud.google.com/go/recaptchaenterprise/v2 v2.9.2 h1:U3Wfq12X9cVMuTpsWDSURnXF0Z9hSPTHj+xsnXDRLsw= ++cloud.google.com/go/recaptchaenterprise/v2 v2.9.2/go.mod h1:trwwGkfhCmp05Ll5MSJPXY7yvnO0p4v3orGANAFHAuU= ++cloud.google.com/go/recommendationengine v0.8.5 h1:ineqLswaCSBY0csYv5/wuXJMBlxATK6Xc5jJkpiTEdM= ++cloud.google.com/go/recommendationengine v0.8.5/go.mod h1:A38rIXHGFvoPvmy6pZLozr0g59NRNREz4cx7F58HAsQ= ++cloud.google.com/go/recommender v1.12.1 h1:LVLYS3r3u0MSCxQSDUtLSkporEGi9OAE6hGvayrZNPs= ++cloud.google.com/go/recommender v1.12.1/go.mod h1:gf95SInWNND5aPas3yjwl0I572dtudMhMIG4ni8nr+0= ++cloud.google.com/go/redis v1.14.2 h1:QF0maEdVv0Fj/2roU8sX3NpiDBzP9ICYTO+5F32gQNo= ++cloud.google.com/go/redis v1.14.2/go.mod h1:g0Lu7RRRz46ENdFKQ2EcQZBAJ2PtJHJLuiiRuEXwyQw= ++cloud.google.com/go/resourcemanager v1.9.5 h1:AZWr1vWVDKGwfLsVhcN+vcwOz3xqqYxtmMa0aABCMms= ++cloud.google.com/go/resourcemanager v1.9.5/go.mod h1:hep6KjelHA+ToEjOfO3garMKi/CLYwTqeAw7YiEI9x8= ++cloud.google.com/go/resourcesettings v1.6.5 h1:BTr5MVykJwClASci/7Og4Qfx70aQ4n3epsNLj94ZYgw= ++cloud.google.com/go/resourcesettings v1.6.5/go.mod h1:WBOIWZraXZOGAgoR4ukNj0o0HiSMO62H9RpFi9WjP9I= ++cloud.google.com/go/retail v1.16.0 h1:Fn1GuAua1c6crCGqfJ1qMxG1Xh10Tg/x5EUODEHMqkw= ++cloud.google.com/go/retail v1.16.0/go.mod h1:LW7tllVveZo4ReWt68VnldZFWJRzsh9np+01J9dYWzE= ++cloud.google.com/go/run v1.3.4 h1:m9WDA7DzTpczhZggwYlZcBWgCRb+kgSIisWn1sbw2rQ= ++cloud.google.com/go/run v1.3.4/go.mod h1:FGieuZvQ3tj1e9GnzXqrMABSuir38AJg5xhiYq+SF3o= ++cloud.google.com/go/scheduler v1.10.6 h1:5U8iXLoQ03qOB+ZXlAecU7fiE33+u3QiM9nh4cd0eTE= ++cloud.google.com/go/scheduler v1.10.6/go.mod h1:pe2pNCtJ+R01E06XCDOJs1XvAMbv28ZsQEbqknxGOuE= ++cloud.google.com/go/secretmanager v1.11.5 h1:82fpF5vBBvu9XW4qj0FU2C6qVMtj1RM/XHwKXUEAfYY= ++cloud.google.com/go/secretmanager v1.11.5/go.mod h1:eAGv+DaCHkeVyQi0BeXgAHOU0RdrMeZIASKc+S7VqH4= ++cloud.google.com/go/security v1.15.5 h1:wTKJQ10j8EYgvE8Y+KhovxDRVDk2iv/OsxZ6GrLP3kE= ++cloud.google.com/go/security v1.15.5/go.mod h1:KS6X2eG3ynWjqcIX976fuToN5juVkF6Ra6c7MPnldtc= ++cloud.google.com/go/securitycenter v1.24.4 h1:/5jjkZ+uGe8hZ7pvd7pO30VW/a+pT2MrrdgOqjyucKQ= ++cloud.google.com/go/securitycenter v1.24.4/go.mod h1:PSccin+o1EMYKcFQzz9HMMnZ2r9+7jbc+LvPjXhpwcU= ++cloud.google.com/go/servicedirectory v1.11.4 h1:da7HFI1229kyzIyuVEzHXip0cw0d+E0s8mjQby0WN+k= ++cloud.google.com/go/servicedirectory v1.11.4/go.mod h1:Bz2T9t+/Ehg6x+Y7Ycq5xiShYLD96NfEsWNHyitj1qM= ++cloud.google.com/go/shell v1.7.5 h1:3Fq2hzO0ZSyaqBboJrFkwwf/qMufDtqwwA6ep8EZxEI= ++cloud.google.com/go/shell v1.7.5/go.mod h1:hL2++7F47/IfpfTO53KYf1EC+F56k3ThfNEXd4zcuiE= ++cloud.google.com/go/spanner v1.57.0 h1:fJq+ZfQUDHE+cy1li0bJA8+sy2oiSGhuGqN5nqVaZdU= ++cloud.google.com/go/spanner v1.57.0/go.mod h1:aXQ5QDdhPRIqVhYmnkAdwPYvj/DRN0FguclhEWw+jOo= ++cloud.google.com/go/speech v1.21.1 h1:nuFc+Kj5B8de75nN4FdPyUbI2SiBoHZG6BLurXL56Q0= ++cloud.google.com/go/speech v1.21.1/go.mod h1:E5GHZXYQlkqWQwY5xRSLHw2ci5NMQNG52FfMU1aZrIA= ++cloud.google.com/go/storagetransfer v1.10.4 h1:dy4fL3wO0VABvzM05ycMUPFHxTPbJz9Em8ikAJVqSbI= ++cloud.google.com/go/storagetransfer v1.10.4/go.mod h1:vef30rZKu5HSEf/x1tK3WfWrL0XVoUQN/EPDRGPzjZs= ++cloud.google.com/go/talent v1.6.6 h1:JssV0CE3FNujuSWn7SkosOzg7qrMxVnt6txOfGcMSa4= ++cloud.google.com/go/talent v1.6.6/go.mod h1:y/WQDKrhVz12WagoarpAIyKKMeKGKHWPoReZ0g8tseQ= ++cloud.google.com/go/texttospeech v1.7.5 h1:dxY2Q5mHCbrGa3oPR2O3PCicdnvKa1JmwGQK36EFLOw= ++cloud.google.com/go/texttospeech v1.7.5/go.mod h1:tzpCuNWPwrNJnEa4Pu5taALuZL4QRRLcb+K9pbhXT6M= ++cloud.google.com/go/tpu v1.6.5 h1:C8YyYda8WtNdBoCgFwwBzZd+S6+EScHOxM/z1h0NNp8= ++cloud.google.com/go/tpu v1.6.5/go.mod h1:P9DFOEBIBhuEcZhXi+wPoVy/cji+0ICFi4TtTkMHSSs= ++cloud.google.com/go/trace v1.10.5 h1:0pr4lIKJ5XZFYD9GtxXEWr0KkVeigc3wlGpZco0X1oA= ++cloud.google.com/go/trace v1.10.5/go.mod h1:9hjCV1nGBCtXbAE4YK7OqJ8pmPYSxPA0I67JwRd5s3M= ++cloud.google.com/go/translate v1.10.1 h1:upovZ0wRMdzZvXnu+RPam41B0mRJ+coRXFP2cYFJ7ew= ++cloud.google.com/go/translate v1.10.1/go.mod h1:adGZcQNom/3ogU65N9UXHOnnSvjPwA/jKQUMnsYXOyk= ++cloud.google.com/go/video v1.20.4 h1:TXwotxkShP1OqgKsbd+b8N5hrIHavSyLGvYnLGCZ7xc= ++cloud.google.com/go/video v1.20.4/go.mod h1:LyUVjyW+Bwj7dh3UJnUGZfyqjEto9DnrvTe1f/+QrW0= ++cloud.google.com/go/videointelligence v1.11.5 h1:mYaWH8uhUCXLJCN3gdXswKzRa2+lK0zN6/KsIubm6pE= ++cloud.google.com/go/videointelligence v1.11.5/go.mod h1:/PkeQjpRponmOerPeJxNPuxvi12HlW7Em0lJO14FC3I= ++cloud.google.com/go/vision/v2 v2.8.0 h1:W52z1b6LdGI66MVhE70g/NFty9zCYYcjdKuycqmlhtg= ++cloud.google.com/go/vision/v2 v2.8.0/go.mod h1:ocqDiA2j97pvgogdyhoxiQp2ZkDCyr0HWpicywGGRhU= ++cloud.google.com/go/vmmigration v1.7.5 h1:5v9RT2vWyuw3pK2ox0HQpkoftO7Q7/8591dTxxQc79g= ++cloud.google.com/go/vmmigration v1.7.5/go.mod h1:pkvO6huVnVWzkFioxSghZxIGcsstDvYiVCxQ9ZH3eYI= ++cloud.google.com/go/vmwareengine v1.1.1 h1:EGdDi9QbqThfZq3ILcDK5g+m9jTevc34AY5tACx5v7k= ++cloud.google.com/go/vmwareengine v1.1.1/go.mod h1:nMpdsIVkUrSaX8UvmnBhzVzG7PPvNYc5BszcvIVudYs= ++cloud.google.com/go/vpcaccess v1.7.5 h1:XyL6hTLtEM/eE4F1GEge8xUN9ZCkiVWn44K/YA7z1rQ= ++cloud.google.com/go/vpcaccess v1.7.5/go.mod h1:slc5ZRvvjP78c2dnL7m4l4R9GwL3wDLcpIWz6P/ziig= ++cloud.google.com/go/webrisk v1.9.5 h1:251MvGuC8wisNN7+jqu9DDDZAi38KiMXxOpA/EWy4dE= ++cloud.google.com/go/webrisk v1.9.5/go.mod h1:aako0Fzep1Q714cPEM5E+mtYX8/jsfegAuS8aivxy3U= ++cloud.google.com/go/websecurityscanner v1.6.5 h1:YqWZrZYabG88TZt7364XWRJGhxmxhony2ZUyZEYMF2k= ++cloud.google.com/go/websecurityscanner v1.6.5/go.mod h1:QR+DWaxAz2pWooylsBF854/Ijvuoa3FCyS1zBa1rAVQ= ++cloud.google.com/go/workflows v1.12.4 h1:uHNmUiatTbPQ4H1pabwfzpfEYD4BBnqDHqMm2IesOh4= ++cloud.google.com/go/workflows v1.12.4/go.mod h1:yQ7HUqOkdJK4duVtMeBCAOPiN1ZF1E9pAMX51vpwB/w= ++cosmossdk.io/api v0.7.5 h1:eMPTReoNmGUm8DeiQL9DyM8sYDjEhWzL1+nLbI9DqtQ= ++cosmossdk.io/api v0.7.5/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= ++cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= ++cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= ++cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= ++cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= ++cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= ++cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= ++cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= ++cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= ++cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= ++cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= ++cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= ++cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= ++cosmossdk.io/store v1.1.0 h1:LnKwgYMc9BInn9PhpTFEQVbL9UK475G2H911CGGnWHk= ++cosmossdk.io/store v1.1.0/go.mod h1:oZfW/4Fc/zYqu3JmQcQdUJ3fqu5vnYTn3LZFFy8P8ng= ++cosmossdk.io/x/evidence v0.0.0-20231103111158-e83a20081ced h1:y2eG5dV8cVPPw88+ZtoFqaGaibTwRdN3uGGOO3QPWQk= ++cosmossdk.io/x/evidence v0.0.0-20231103111158-e83a20081ced/go.mod h1:vV+KovxKlqcn42hKzj1LgplTdEZVC3cuXaoIqJz5+ZU= ++cosmossdk.io/x/tx v0.13.3 h1:Ha4mNaHmxBc6RMun9aKuqul8yHiL78EKJQ8g23Zf73g= ++cosmossdk.io/x/tx v0.13.3/go.mod h1:I8xaHv0rhUdIvIdptKIqzYy27+n2+zBVaxO6fscFhys= ++dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= ++dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= ++filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= ++filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= ++github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= ++github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= ++github.com/99designs/keyring v1.2.1 h1:tYLp1ULvO7i3fI5vE21ReQuj99QFSs7lGm0xWyJo87o= ++github.com/99designs/keyring v1.2.1/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= ++github.com/Abirdcfly/dupword v0.0.11 h1:z6v8rMETchZXUIuHxYNmlUAuKuB21PeaSymTed16wgU= ++github.com/Abirdcfly/dupword v0.0.11/go.mod h1:wH8mVGuf3CP5fsBTkfWwwwKTjDnVVCxtU8d8rgeVYXA= ++github.com/Antonboom/errname v0.1.9 h1:BZDX4r3l4TBZxZ2o2LNrlGxSHran4d1u4veZdoORTT4= ++github.com/Antonboom/errname v0.1.9/go.mod h1:nLTcJzevREuAsgTbG85UsuiWpMpAqbKD1HNZ29OzE58= ++github.com/Antonboom/nilnil v0.1.3 h1:6RTbx3d2mcEu3Zwq9TowQpQMVpP75zugwOtqY1RTtcE= ++github.com/Antonboom/nilnil v0.1.3/go.mod h1:iOov/7gRcXkeEU+EMGpBu2ORih3iyVEiWjeste1SJm8= ++github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 h1:8q4SaHjFsClSvuVne0ID/5Ka8u3fcIHyqkLjcFpNRHQ= ++github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= ++github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= ++github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= ++github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.2.0 h1:gggzg0SUMs6SQbEw+3LoSsYf9YMjkupeAnHMX8O9mmY= ++github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.2.0/go.mod h1:+6KLcKIVgxoBDMqMO/Nvy7bZ9a0nbU3I1DtFQK3YvB4= ++github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= ++github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= ++github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= ++github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= ++github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= ++github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 h1:sR+/8Yb4slttB4vD+b9btVEnWgL3Q00OBTzVT8B9C0c= ++github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno= ++github.com/CloudyKit/jet/v6 v6.2.0 h1:EpcZ6SR9n28BUGtNJSvlBqf90IpjeFr36Tizxhn/oME= ++github.com/CloudyKit/jet/v6 v6.2.0/go.mod h1:d3ypHeIRNo2+XyqnGA8s+aphtcVpjP5hPwP/Lzo7Ro4= ++github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= ++github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= ++github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= ++github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= ++github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= ++github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= ++github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 h1:+r1rSv4gvYn0wmRjC8X7IAzX8QezqtFV9m0MUHFJgts= ++github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0/go.mod h1:b3g59n2Y+T5xmcxJL+UEG2f8cQploZm1mR/v6BW0mU0= ++github.com/HdrHistogram/hdrhistogram-go v1.1.2 h1:5IcZpTvzydCQeHzK4Ef/D5rrSqwxob0t8PQPMybUNFM= ++github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= ++github.com/Joker/jade v1.1.3 h1:Qbeh12Vq6BxURXT1qZBRHsDxeURB8ztcL6f3EXSGeHk= ++github.com/Joker/jade v1.1.3/go.mod h1:T+2WLyt7VH6Lp0TRxQrUYEs64nRc83wkMQrfeIQKduM= ++github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible h1:1G1pk05UrOh0NlF1oeaaix1x8XzrfjIDK47TY0Zehcw= ++github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= ++github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= ++github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= ++github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g= ++github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= ++github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= ++github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= ++github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= ++github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= ++github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= ++github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= ++github.com/OpenPeeDeeP/depguard v1.1.1 h1:TSUznLjvp/4IUP+OQ0t/4jF4QUyxIcVX8YnghZdunyA= ++github.com/OpenPeeDeeP/depguard v1.1.1/go.mod h1:JtAMzWkmFEzDPyAd+W0NHl1lvpQKTvT9jnRVsohBKpc= ++github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 h1:kkhsdkhsCvIsutKu5zLMgWtgh9YxGCNAw8Ad8hjwfYg= ++github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= ++github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06 h1:KkH3I3sJuOLP3TjA/dfr4NAY8bghDwnXiU7cTKxQqo0= ++github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06/go.mod h1:7erjKLwalezA0k99cWs5L11HWOAPNjdUZ6RxH1BXbbM= ++github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= ++github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= ++github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= ++github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= ++github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= ++github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= ++github.com/aclements/go-moremath v0.0.0-20210112150236-f10218a38794 h1:xlwdaKcTNVW4PtpQb8aKA4Pjy0CdJHEqvFbAnvR5m2g= ++github.com/aclements/go-moremath v0.0.0-20210112150236-f10218a38794/go.mod h1:7e+I0LQFUI9AXWxOfsQROs9xPhoJtbsyWcjJqDd4KPY= ++github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= ++github.com/adlio/schema v1.3.3/go.mod h1:1EsRssiv9/Ce2CMzq5DoL7RiMshhuigQxrR4DMV9fHg= ++github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 h1:rFw4nCn9iMW+Vajsk51NtYIcwSTkXr+JGrMd36kTDJw= ++github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= ++github.com/alecthomas/kingpin/v2 v2.4.0 h1:f48lwail6p8zpO1bC4TxtqACaGqHYA22qkHjHpqDjYY= ++github.com/alecthomas/kingpin/v2 v2.4.0/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE= ++github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= ++github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= ++github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= ++github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= ++github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= ++github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc= ++github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= ++github.com/alexkohler/prealloc v1.0.0 h1:Hbq0/3fJPQhNkN0dR95AVrr6R7tou91y0uHG5pOcUuw= ++github.com/alexkohler/prealloc v1.0.0/go.mod h1:VetnK3dIgFBBKmg0YnD9F9x6Icjd+9cvfHR56wJVlKE= ++github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQRnw= ++github.com/alingse/asasalint v0.0.11/go.mod h1:nCaoMhw7a9kSJObvQyVzNTPBDbNpdocqrSP7t/cW5+I= ++github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= ++github.com/allegro/bigcache v1.2.1 h1:hg1sY1raCwic3Vnsvje6TT7/pnZba83LeFck5NrFKSc= ++github.com/allegro/bigcache v1.2.1/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= ++github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= ++github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= ++github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= ++github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= ++github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7Dml6nw9rQ= ++github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP2+08jFMw88y4klk= ++github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6 h1:G1bPvciwNyF7IUmKXNt9Ak3m6u9DE1rF+RmtIkBpVdA= ++github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= ++github.com/armon/go-metrics v0.3.9 h1:O2sNqxBdvq8Eq5xmzljcYzAORli6RWCvEym4cJf9m18= ++github.com/armon/go-metrics v0.3.9/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= ++github.com/ashanbrown/forbidigo v1.5.1 h1:WXhzLjOlnuDYPYQo/eFlcFMi8X/kLfvWLYu6CSoebis= ++github.com/ashanbrown/forbidigo v1.5.1/go.mod h1:Y8j9jy9ZYAEHXdu723cUlraTqbzjKF1MUyfOKL+AjcU= ++github.com/ashanbrown/makezero v1.1.1 h1:iCQ87C0V0vSyO+M9E/FZYbu65auqH0lnsOkf5FcB28s= ++github.com/ashanbrown/makezero v1.1.1/go.mod h1:i1bJLCRSCHOcOa9Y6MyF2FTfMZMFdHvxKHxgO5Z1axI= ++github.com/aws/aws-sdk-go v1.40.45 h1:QN1nsY27ssD/JmW4s83qmSb+uL6DG4GmCDzjmJB4xUI= ++github.com/aws/aws-sdk-go v1.40.45/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= ++github.com/aws/aws-sdk-go-v2 v1.21.2 h1:+LXZ0sgo8quN9UOKXXzAWRT3FWd4NxeXWOZom9pE7GA= ++github.com/aws/aws-sdk-go-v2 v1.21.2/go.mod h1:ErQhvNuEMhJjweavOYhxVkn2RUx7kQXVATHrjKtxIpM= ++github.com/aws/aws-sdk-go-v2/config v1.18.45 h1:Aka9bI7n8ysuwPeFdm77nfbyHCAKQ3z9ghB3S/38zes= ++github.com/aws/aws-sdk-go-v2/config v1.18.45/go.mod h1:ZwDUgFnQgsazQTnWfeLWk5GjeqTQTL8lMkoE1UXzxdE= ++github.com/aws/aws-sdk-go-v2/credentials v1.13.43 h1:LU8vo40zBlo3R7bAvBVy/ku4nxGEyZe9N8MqAeFTzF8= ++github.com/aws/aws-sdk-go-v2/credentials v1.13.43/go.mod h1:zWJBz1Yf1ZtX5NGax9ZdNjhhI4rgjfgsyk6vTY1yfVg= ++github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.13 h1:PIktER+hwIG286DqXyvVENjgLTAwGgoeriLDD5C+YlQ= ++github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.13/go.mod h1:f/Ib/qYjhV2/qdsf79H3QP/eRE4AkVyEf6sk7XfZ1tg= ++github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.43 h1:nFBQlGtkbPzp/NjZLuFxRqmT91rLJkgvsEQs68h962Y= ++github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.43/go.mod h1:auo+PiyLl0n1l8A0e8RIeR8tOzYPfZZH/JNlrJ8igTQ= ++github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.37 h1:JRVhO25+r3ar2mKGP7E0LDl8K9/G36gjlqca5iQbaqc= ++github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.37/go.mod h1:Qe+2KtKml+FEsQF/DHmDV+xjtche/hwoF75EG4UlHW8= ++github.com/aws/aws-sdk-go-v2/internal/ini v1.3.45 h1:hze8YsjSh8Wl1rYa1CJpRmXP21BvOBuc76YhW0HsuQ4= ++github.com/aws/aws-sdk-go-v2/internal/ini v1.3.45/go.mod h1:lD5M20o09/LCuQ2mE62Mb/iSdSlCNuj6H5ci7tW7OsE= ++github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.8.1 h1:w/fPGB0t5rWwA43mux4e9ozFSH5zF1moQemlA131PWc= ++github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.8.1/go.mod h1:CM+19rL1+4dFWnOQKwDc7H1KwXTz+h61oUSHyhV0b3o= ++github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.37 h1:WWZA/I2K4ptBS1kg0kV1JbBtG/umed0vwHRrmcr9z7k= ++github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.37/go.mod h1:vBmDnwWXWxNPFRMmG2m/3MKOe+xEcMDo1tanpaWCcck= ++github.com/aws/aws-sdk-go-v2/service/route53 v1.30.2 h1:/RPQNjh1sDIezpXaFIkZb7MlXnSyAqjVdAwcJuGYTqg= ++github.com/aws/aws-sdk-go-v2/service/route53 v1.30.2/go.mod h1:TQZBt/WaQy+zTHoW++rnl8JBrmZ0VO6EUbVua1+foCA= ++github.com/aws/aws-sdk-go-v2/service/sso v1.15.2 h1:JuPGc7IkOP4AaqcZSIcyqLpFSqBWK32rM9+a1g6u73k= ++github.com/aws/aws-sdk-go-v2/service/sso v1.15.2/go.mod h1:gsL4keucRCgW+xA85ALBpRFfdSLH4kHOVSnLMSuBECo= ++github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.3 h1:HFiiRkf1SdaAmV3/BHOFZ9DjFynPHj8G/UIO1lQS+fk= ++github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.3/go.mod h1:a7bHA82fyUXOm+ZSWKU6PIoBxrjSprdLoM8xPYvzYVg= ++github.com/aws/aws-sdk-go-v2/service/sts v1.23.2 h1:0BkLfgeDjfZnZ+MhB3ONb01u9pwFYTCZVhlsSSBvlbU= ++github.com/aws/aws-sdk-go-v2/service/sts v1.23.2/go.mod h1:Eows6e1uQEsc4ZaHANmsPRzAKcVDrcmjjWiih2+HUUQ= ++github.com/aws/smithy-go v1.15.0 h1:PS/durmlzvAFpQHDs4wi4sNNP9ExsqZh6IlfdHXgKK8= ++github.com/aws/smithy-go v1.15.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= ++github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= ++github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= ++github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= ++github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= ++github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= ++github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= ++github.com/berachain/polaris-geth v1.13.10-2-polar h1:W1dahX0MvEzRv5kRww0FpN0j8M9qhSiftUaWFsUSGi8= ++github.com/berachain/polaris-geth v1.13.10-2-polar/go.mod h1:sc48XYQxCzH3fG9BcrXCOOgQk2JfZzNAmIKnceogzsA= ++github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= ++github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= ++github.com/bits-and-blooms/bitset v1.11.0 h1:RMyy2mBBShArUAhfVRZJ2xyBO58KCBCtZFShw3umo6k= ++github.com/bits-and-blooms/bitset v1.11.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= ++github.com/bkielbasa/cyclop v1.2.0 h1:7Jmnh0yL2DjKfw28p86YTd/B4lRGcNuu12sKE35sM7A= ++github.com/bkielbasa/cyclop v1.2.0/go.mod h1:qOI0yy6A7dYC4Zgsa72Ppm9kONl0RoIlPbzot9mhmeI= ++github.com/blizzy78/varnamelen v0.8.0 h1:oqSblyuQvFsW1hbBHh1zfwrKe3kcSj0rnXkKzsQ089M= ++github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k= ++github.com/bombsimon/wsl/v3 v3.4.0 h1:RkSxjT3tmlptwfgEgTgU+KYKLI35p/tviNXNXiL2aNU= ++github.com/bombsimon/wsl/v3 v3.4.0/go.mod h1:KkIB+TXkqy6MvK9BDZVbZxKNYsE1/oLRJbIFtf14qqo= ++github.com/breml/bidichk v0.2.4 h1:i3yedFWWQ7YzjdZJHnPo9d/xURinSq3OM+gyM43K4/8= ++github.com/breml/bidichk v0.2.4/go.mod h1:7Zk0kRFt1LIZxtQdl9W9JwGAcLTTkOs+tN7wuEYGJ3s= ++github.com/breml/errchkjson v0.3.1 h1:hlIeXuspTyt8Y/UmP5qy1JocGNR00KQHgfaNtRAjoxQ= ++github.com/breml/errchkjson v0.3.1/go.mod h1:XroxrzKjdiutFyW3nWhw34VGg7kiMsDQox73yWCGI2U= ++github.com/btcsuite/btcd v0.23.2 h1:/YOgUp25sdCnP5ho6Hl3s0E438zlX+Kak7E6TgBgoT0= ++github.com/btcsuite/btcd v0.23.2/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY= ++github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= ++github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= ++github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= ++github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= ++github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= ++github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= ++github.com/bufbuild/buf v1.15.1 h1:v7sK2uMEsGX4Z2hvu+xiMheH3C3AKBGfxPBgdUZYDQ8= ++github.com/bufbuild/buf v1.15.1/go.mod h1:TQeGKam1QMfHy/xsSnnMpxN3JK5HBb6aNvZj4m52gkE= ++github.com/bufbuild/connect-go v1.5.2 h1:G4EZd5gF1U1ZhhbVJXplbuUnfKpBZ5j5izqIwu2g2W8= ++github.com/bufbuild/connect-go v1.5.2/go.mod h1:GmMJYR6orFqD0Y6ZgX8pwQ8j9baizDrIQMm1/a6LnHk= ++github.com/bufbuild/protocompile v0.6.1-0.20231108163138-146b831231f7 h1:1pUks8VaLdprN9wrxAgshb06b08IzdYp0B7JgoDeUfw= ++github.com/bufbuild/protocompile v0.6.1-0.20231108163138-146b831231f7/go.mod h1:9N39DyRmxAF5+5AjqXQKV6hyWDI0EeoX4TRMix2ZnPE= ++github.com/butuzov/ireturn v0.1.1 h1:QvrO2QF2+/Cx1WA/vETCIYBKtRjc30vesdoPUNo1EbY= ++github.com/butuzov/ireturn v0.1.1/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc= ++github.com/bytedance/sonic v1.10.0 h1:qtNZduETEIWJVIyDl01BeNxur2rW9OwTQ/yBqFRkKEk= ++github.com/bytedance/sonic v1.10.0/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4= ++github.com/casbin/casbin/v2 v2.37.0 h1:/poEwPSovi4bTOcP752/CsTQiRz2xycyVKFG7GUhbDw= ++github.com/casbin/casbin/v2 v2.37.0/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= ++github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= ++github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= ++github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= ++github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= ++github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= ++github.com/census-instrumentation/opencensus-proto v0.4.1 h1:iKLQ0xPNFxR/2hzXZMrBo8f1j86j5WHzznCCQxV/b8g= ++github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= ++github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= ++github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= ++github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= ++github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= ++github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= ++github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= ++github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= ++github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= ++github.com/charithe/durationcheck v0.0.10 h1:wgw73BiocdBDQPik+zcEoBG/ob8uyBHf2iyoHGPf5w4= ++github.com/charithe/durationcheck v0.0.10/go.mod h1:bCWXb7gYRysD1CU3C+u4ceO49LoGOY1C1L6uouGNreQ= ++github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8 h1:W9o46d2kbNL06lq7UNDPV0zYLzkrde/bjIqO02eoll0= ++github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8/go.mod h1:gakxgyXaaPkxvLw1XQxNGK4I37ys9iBRzNUx/B7pUCo= ++github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d h1:77cEq6EriyTZ0g/qfRdp61a3Uu/AWrgIq2s0ClJV1g0= ++github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d/go.mod h1:8EPpVsBuRksnlj1mLy4AWzRNQYxauNi62uWcE3to6eA= ++github.com/chenzhuoyu/iasm v0.9.0 h1:9fhXjVzq5hUy2gkhhgHl95zG2cEAhw9OSGs8toWWAwo= ++github.com/chenzhuoyu/iasm v0.9.0/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog= ++github.com/chigopher/pathlib v0.12.0 h1:1GM7fN/IwXXmOHbd1jkMqHD2wUhYqUvafgxTwmLT/q8= ++github.com/chigopher/pathlib v0.12.0/go.mod h1:EJ5UtJ/sK8Nt6q3VWN+EwZLZ3g0afJiG8NegYiQQ/gQ= ++github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI= ++github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= ++github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible h1:C29Ae4G5GtYyYMm1aztcyj/J5ckgJm2zwdDajFbx1NY= ++github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= ++github.com/circonus-labs/circonusllhist v0.1.3 h1:TJH+oke8D16535+jHExHj4nQvzlZrj7ug5D7I/orNUA= ++github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= ++github.com/clbanning/mxj v1.8.4 h1:HuhwZtbyvyOw+3Z1AowPkU87JkJUSv751ELWaiTpj8I= ++github.com/clbanning/mxj v1.8.4/go.mod h1:BVjHeAH+rl9rs6f+QIpeRl0tfu10SXn1pUSa5PVGJng= ++github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= ++github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= ++github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= ++github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= ++github.com/cloudflare/cloudflare-go v0.79.0 h1:ErwCYDjFCYppDJlDJ/5WhsSmzegAUe2+K9qgFyQDg3M= ++github.com/cloudflare/cloudflare-go v0.79.0/go.mod h1:gkHQf9xEubaQPEuerBuoinR9P8bf8a05Lq0X6WKy1Oc= ++github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f h1:WBZRG4aNOuI15bLRrCgN8fCq8E5Xuty6jGbmSNEvSsU= ++github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= ++github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa h1:jQCWAUqqlij9Pgj2i/PB79y4KOPYVyFYdROxgaCwdTQ= ++github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa/go.mod h1:x/1Gn8zydmfq8dk6e9PdstVsDgu9RuyIIJqAaF//0IM= ++github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= ++github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= ++github.com/cockroachdb/datadriven v1.0.3-0.20230801171734-e384cf455877 h1:1MLK4YpFtIEo3ZtMA5C795Wtv5VuUnrXX7mQG+aHg6o= ++github.com/cockroachdb/datadriven v1.0.3-0.20230801171734-e384cf455877/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= ++github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= ++github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= ++github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= ++github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= ++github.com/cockroachdb/pebble v1.1.0 h1:pcFh8CdCIt2kmEpK0OIatq67Ln9uGDYY3d5XnE0LJG4= ++github.com/cockroachdb/pebble v1.1.0/go.mod h1:sEHm5NOXxyiAoKWhoFxT8xMgd/f3RA6qUqQ1BXKrh2E= ++github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= ++github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= ++github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 h1:IKgmqgMQlVJIZj19CdocBeSfSaiCbEBZGKODaixqtHM= ++github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2/go.mod h1:8BT+cPK6xvFOcRlk0R8eg+OTkcqI6baNH4xAkpiYVvQ= ++github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= ++github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= ++github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 h1:sDMmm+q/3+BukdIpxwO365v/Rbspp2Nt5XntgQRXq8Q= ++github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= ++github.com/cometbft/cometbft v0.38.8-0.20240527104925-a38dbb2eef72 h1:OaN2kWUlW2eVpHSpId3O7pImusrS/nm1lssO6dHBAq8= ++github.com/cometbft/cometbft v0.38.8-0.20240527104925-a38dbb2eef72/go.mod h1:xOoGZrtUT+A5izWfHSJgl0gYZUE7lu7Z2XIS1vWG/QQ= ++github.com/cometbft/cometbft-db v0.9.1 h1:MIhVX5ja5bXNHF8EYrThkG9F7r9kSfv8BX4LWaxWJ4M= ++github.com/cometbft/cometbft-db v0.9.1/go.mod h1:iliyWaoV0mRwBJoizElCwwRA9Tf7jZJOURcRZF9m60U= ++github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= ++github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= ++github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M= ++github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= ++github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= ++github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= ++github.com/coreos/etcd v3.3.10+incompatible h1:jFneRYjIvLMLhDLCzuTuU4rSJUjRplcJQ7pD7MnhC04= ++github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= ++github.com/coreos/go-etcd v2.0.0+incompatible h1:bXhRBIXoTm9BYHS3gE0TtQuyNZyeEMux2sDi4oo5YOo= ++github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= ++github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= ++github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= ++github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= ++github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= ++github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= ++github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= ++github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= ++github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= ++github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= ++github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= ++github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= ++github.com/cosmos/cosmos-sdk v0.50.7-0.20240528102556-d180df817efc h1:Cv6UMVCKGaKzG7j6bKP3gDA4FOXoJbF1JVQXPXtMzQ4= ++github.com/cosmos/cosmos-sdk v0.50.7-0.20240528102556-d180df817efc/go.mod h1:84xDDJEHttRT7NDGwBaUOLVOMN0JNE9x7NbsYIxXs1s= ++github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= ++github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= ++github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= ++github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= ++github.com/cosmos/gogoproto v1.4.12 h1:vB6Lbe/rtnYGjQuFxkPiPYiCybqFT8QvLipDZP8JpFE= ++github.com/cosmos/gogoproto v1.4.12/go.mod h1:LnZob1bXRdUoqMMtwYlcR3wjiElmlC+FkjaZRv1/eLY= ++github.com/cosmos/iavl v1.1.2 h1:zL9FK7C4L/P4IF1Dm5fIwz0WXCnn7Bp1M2FxH0ayM7Y= ++github.com/cosmos/iavl v1.1.2/go.mod h1:jLeUvm6bGT1YutCaL2fIar/8vGUE8cPZvh/gXEWDaDM= ++github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= ++github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= ++github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= ++github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= ++github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= ++github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= ++github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= ++github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= ++github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 h1:d28BXYi+wUpz1KBmiF9bWrjEMacUEREV6MBi2ODnrfQ= ++github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs= ++github.com/crate-crypto/go-kzg-4844 v0.7.0 h1:C0vgZRk4q4EZ/JgPfzuSoxdCq3C3mOZMBShovmncxvA= ++github.com/crate-crypto/go-kzg-4844 v0.7.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= ++github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w= ++github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= ++github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo= ++github.com/curioswitch/go-reassign v0.2.0/go.mod h1:x6OpXuWvgfQaMGks2BZybTngWjT84hqJfKoO8Tt/Roc= ++github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= ++github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= ++github.com/daixiang0/gci v0.10.1 h1:eheNA3ljF6SxnPD/vE4lCBusVHmV3Rs3dkKvFrJ7MR0= ++github.com/daixiang0/gci v0.10.1/go.mod h1:xtHP9N7AHdNvtRNfcx9gwTDfw7FRJx4bZUsiEfiNNAI= ++github.com/danieljoos/wincred v1.2.0 h1:ozqKHaLK0W/ii4KVbbvluM91W2H3Sh0BncbUNPS7jLE= ++github.com/danieljoos/wincred v1.2.0/go.mod h1:FzQLLMKBFdvu+osBrnFODiv32YGwCfx0SkRa/eYHgec= ++github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= ++github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= ++github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= ++github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= ++github.com/deckarep/golang-set/v2 v2.3.1 h1:vjmkvJt/IV27WXPyYQpAh4bRyWJc5Y435D17XQ9QU5A= ++github.com/deckarep/golang-set/v2 v2.3.1/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= ++github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= ++github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= ++github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= ++github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= ++github.com/deepmap/oapi-codegen v1.13.4 h1:lRRQ8JAXaz5/4oidKFyk3fFZFQsbv0BzRtvDKDnvIfM= ++github.com/deepmap/oapi-codegen v1.13.4/go.mod h1:/h5nFQbTAMz4S/WtBz8sBfamlGByYKDr21O2uoNgCYI= ++github.com/denis-tingaikin/go-header v0.4.3 h1:tEaZKAlqql6SKCY++utLmkPLd6K8IBM20Ha7UVm+mtU= ++github.com/denis-tingaikin/go-header v0.4.3/go.mod h1:0wOCWuN71D5qIgE2nz9KrKmuYBAC2Mra5RassOIQ2/c= ++github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= ++github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= ++github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o= ++github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN/Uz0X0VPruTIhk= ++github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= ++github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= ++github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= ++github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= ++github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= ++github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= ++github.com/dlclark/regexp2 v1.7.0 h1:7lJfhqlPssTb1WQx4yvTHN0uElPEv52sbaECrAQxjAo= ++github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= ++github.com/docker/cli v23.0.1+incompatible h1:LRyWITpGzl2C9e9uGxzisptnxAn1zfZKXy13Ul2Q5oM= ++github.com/docker/cli v23.0.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= ++github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= ++github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= ++github.com/docker/docker v23.0.1+incompatible h1:vjgvJZxprTTE1A37nm+CLNAdwu6xZekyoiVlUZEINcY= ++github.com/docker/docker v23.0.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= ++github.com/docker/docker-credential-helpers v0.7.0 h1:xtCHsjxogADNZcdv1pKUHXryefjlVRqWqIhk/uXJp0A= ++github.com/docker/docker-credential-helpers v0.7.0/go.mod h1:rETQfLdHNT3foU5kuNkFR1R1V12OJRRO5lzt2D1b5X0= ++github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= ++github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= ++github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= ++github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= ++github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 h1:qwcF+vdFrvPSEUDSX5RVoRccG8a5DhOdWdQ4zN62zzo= ++github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4= ++github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= ++github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= ++github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= ++github.com/dvsekhvalnov/jose2go v1.6.0 h1:Y9gnSnP4qEI0+/uQkHvFXeD2PLPJeXEL+ySMEA2EjTY= ++github.com/dvsekhvalnov/jose2go v1.6.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= ++github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= ++github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= ++github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385 h1:clC1lXBpe2kTj2VHdaIu9ajZQe4kcEY9j0NsnDDBZ3o= ++github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= ++github.com/emicklei/dot v1.6.1 h1:ujpDlBkkwgWUY+qPId5IwapRW/xEoligRSYjioR6DFI= ++github.com/emicklei/dot v1.6.1/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= ++github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= ++github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= ++github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= ++github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= ++github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= ++github.com/envoyproxy/go-control-plane v0.12.0 h1:4X+VP1GHd1Mhj6IB5mMeGbLCleqxjletLK6K0rbxyZI= ++github.com/envoyproxy/go-control-plane v0.12.0/go.mod h1:ZBTaoJ23lqITozF0M6G4/IragXCQKCnYbmlmtHvwRG0= ++github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= ++github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= ++github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= ++github.com/esimonov/ifshort v1.0.4 h1:6SID4yGWfRae/M7hkVDVVyppy8q/v9OuxNdmjLQStBA= ++github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= ++github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY= ++github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= ++github.com/ettle/strcase v0.1.1 h1:htFueZyVeE1XNnMEfbqp5r67qAN/4r6ya1ysq8Q+Zcw= ++github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA9o9VY= ++github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= ++github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= ++github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= ++github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= ++github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= ++github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= ++github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= ++github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= ++github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= ++github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= ++github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= ++github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= ++github.com/felixge/fgprof v0.9.3 h1:VvyZxILNuCiUCSXtPtYmmtGvb65nqXh2QFWc0Wpf2/g= ++github.com/felixge/fgprof v0.9.3/go.mod h1:RdbpDgzqYVh/T9fPELJyV7EYJuHB55UTEULNun8eiPw= ++github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= ++github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= ++github.com/firefart/nonamedreturns v1.0.4 h1:abzI1p7mAEPYuR4A+VLKn4eNDOycjYo2phmY9sfv40Y= ++github.com/firefart/nonamedreturns v1.0.4/go.mod h1:TDhe/tjI1BXo48CmYbUduTV7BdIga8MAO/xbKdcVsGI= ++github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e h1:bBLctRc7kr01YGvaDfgLbTwjFNW5jdp5y5rj8XXBHfY= ++github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e/go.mod h1:AzA8Lj6YtixmJWL+wkKoBGsLWy9gFrAzi4g+5bCKwpY= ++github.com/fjl/memsize v0.0.1 h1:+zhkb+dhUgx0/e+M8sF0QqiouvMQUiKR+QYvdxIOKcQ= ++github.com/fjl/memsize v0.0.1/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= ++github.com/flosch/pongo2/v4 v4.0.2 h1:gv+5Pe3vaSVmiJvh/BZa82b7/00YUGm0PIyVVLop0Hw= ++github.com/flosch/pongo2/v4 v4.0.2/go.mod h1:B5ObFANs/36VwxxlgKpdchIJHMvHB562PW+BWPhwZD8= ++github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= ++github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= ++github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8 h1:a9ENSRDFBUPkJ5lCgVZh26+ZbGyoVJG7yb5SSzF5H54= ++github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= ++github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= ++github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= ++github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= ++github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= ++github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= ++github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= ++github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= ++github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= ++github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= ++github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= ++github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61 h1:IZqZOB2fydHte3kUgxrzK5E1fW7RQGeDwE8F/ZZnUYc= ++github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61/go.mod h1:Q0X6pkwTILDlzrGEckF6HKjXe48EgsY/l7K7vhY4MW8= ++github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 h1:f6D9Hr8xV8uYKlyuj8XIruxlh9WjVjdh1gIicAS7ays= ++github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= ++github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 h1:BAIP2GihuqhwdILrV+7GJel5lyPV3u1+PgzrWLc0TkE= ++github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46/go.mod h1:QNpY22eby74jVhqH4WhDLDwxc/vqsern6pW+u2kbkpc= ++github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= ++github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= ++github.com/ghemawat/stream v0.0.0-20171120220530-696b145b53b9 h1:r5GgOLGbza2wVHRzK7aAj6lWZjfbAwiu/RDCVOKjRyM= ++github.com/ghemawat/stream v0.0.0-20171120220530-696b145b53b9/go.mod h1:106OIgooyS7OzLDOpUGgm9fA3bQENb/cFSyyBmMoJDs= ++github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= ++github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= ++github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= ++github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= ++github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg= ++github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU= ++github.com/go-chi/chi/v5 v5.0.8 h1:lD+NLqFcAi1ovnVZpsnObHGW4xb4J8lNmoYVfECH1Y0= ++github.com/go-chi/chi/v5 v5.0.8/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= ++github.com/go-critic/go-critic v0.7.0 h1:tqbKzB8pqi0NsRZ+1pyU4aweAF7A7QN0Pi4Q02+rYnQ= ++github.com/go-critic/go-critic v0.7.0/go.mod h1:moYzd7GdVXE2C2hYTwd7h0CPcqlUeclsyBRwMa38v64= ++github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= ++github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= ++github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= ++github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= ++github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= ++github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow= ++github.com/go-git/go-git/v5 v5.11.0 h1:XIZc1p+8YzypNr34itUfSvYJcv+eYdTnTvOZ2vD3cA4= ++github.com/go-git/go-git/v5 v5.11.0/go.mod h1:6GFcX2P3NM7FPBfpePbpLd21XxsgdAt+lKqXmCUiUCY= ++github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= ++github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= ++github.com/go-kit/kit v0.12.0 h1:e4o3o3IsBfAKQh5Qbbiqyfu97Ku7jrO/JbohvztANh4= ++github.com/go-kit/kit v0.12.0/go.mod h1:lHd+EkCZPIwYItmGDDRdhinkzX2A1sj+M9biaEaizzs= ++github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= ++github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= ++github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= ++github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= ++github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= ++github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= ++github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= ++github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= ++github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= ++github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= ++github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab h1:xveKWz2iaueeTaUgdetzel+U7exyigDYBryyVfV/rZk= ++github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= ++github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= ++github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= ++github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= ++github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= ++github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= ++github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= ++github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= ++github.com/go-playground/validator/v10 v10.15.1 h1:BSe8uhN+xQ4r5guV/ywQI4gO59C2raYcGffYWZEjZzM= ++github.com/go-playground/validator/v10 v10.15.1/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= ++github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU= ++github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= ++github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= ++github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= ++github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= ++github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= ++github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= ++github.com/go-toolsmith/astcast v1.1.0 h1:+JN9xZV1A+Re+95pgnMgDboWNVnIMMQXwfBwLRPgSC8= ++github.com/go-toolsmith/astcast v1.1.0/go.mod h1:qdcuFWeGGS2xX5bLM/c3U9lewg7+Zu4mr+xPwZIB4ZU= ++github.com/go-toolsmith/astcopy v1.1.0 h1:YGwBN0WM+ekI/6SS6+52zLDEf8Yvp3n2seZITCUBt5s= ++github.com/go-toolsmith/astcopy v1.1.0/go.mod h1:hXM6gan18VA1T/daUEHCFcYiW8Ai1tIwIzHY6srfEAw= ++github.com/go-toolsmith/astequal v1.1.0 h1:kHKm1AWqClYn15R0K1KKE4RG614D46n+nqUQ06E1dTw= ++github.com/go-toolsmith/astequal v1.1.0/go.mod h1:sedf7VIdCL22LD8qIvv7Nn9MuWJruQA/ysswh64lffQ= ++github.com/go-toolsmith/astfmt v1.1.0 h1:iJVPDPp6/7AaeLJEruMsBUlOYCmvg0MoCfJprsOmcco= ++github.com/go-toolsmith/astfmt v1.1.0/go.mod h1:OrcLlRwu0CuiIBp/8b5PYF9ktGVZUjlNMV634mhwuQ4= ++github.com/go-toolsmith/astp v1.1.0 h1:dXPuCl6u2llURjdPLLDxJeZInAeZ0/eZwFJmqZMnpQA= ++github.com/go-toolsmith/astp v1.1.0/go.mod h1:0T1xFGz9hicKs8Z5MfAqSUitoUYS30pDMsRVIDHs8CA= ++github.com/go-toolsmith/strparse v1.1.0 h1:GAioeZUK9TGxnLS+qfdqNbA4z0SSm5zVNtCQiyP2Bvw= ++github.com/go-toolsmith/strparse v1.1.0/go.mod h1:7ksGy58fsaQkGQlY8WVoBFNyEPMGuJin1rfoPS4lBSQ= ++github.com/go-toolsmith/typep v1.1.0 h1:fIRYDyF+JywLfqzyhdiHzRop/GQDxxNhLGQ6gFUNHus= ++github.com/go-toolsmith/typep v1.1.0/go.mod h1:fVIw+7zjdsMxDA3ITWnH1yOiw1rnTQKCsF/sk2H/qig= ++github.com/go-xmlfmt/xmlfmt v1.1.2 h1:Nea7b4icn8s57fTx1M5AI4qQT5HEM3rVUO8MuE6g80U= ++github.com/go-xmlfmt/xmlfmt v1.1.2/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= ++github.com/go-zookeeper/zk v1.0.2 h1:4mx0EYENAdX/B/rbunjlt5+4RTA/a9SMHBRuSKdGxPM= ++github.com/go-zookeeper/zk v1.0.2/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw= ++github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= ++github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= ++github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= ++github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= ++github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= ++github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= ++github.com/godbus/dbus/v5 v5.0.4 h1:9349emZab16e7zQvpmsbtjc18ykshndd8y2PG3sgJbA= ++github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= ++github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= ++github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= ++github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= ++github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= ++github.com/gofrs/uuid/v5 v5.0.0 h1:p544++a97kEL+svbcFbCQVM9KFu0Yo25UoISXGNNH9M= ++github.com/gofrs/uuid/v5 v5.0.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= ++github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= ++github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= ++github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= ++github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= ++github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= ++github.com/gogo/status v1.1.0 h1:+eIkrewn5q6b30y+g/BJINVVdi2xH7je5MPJ3ZPK3JA= ++github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM= ++github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= ++github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= ++github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= ++github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= ++github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= ++github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= ++github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= ++github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= ++github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= ++github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= ++github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= ++github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= ++github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= ++github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= ++github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= ++github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= ++github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= ++github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= ++github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= ++github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= ++github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= ++github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= ++github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= ++github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= ++github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= ++github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= ++github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= ++github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 h1:23T5iq8rbUYlhpt5DB4XJkc6BU31uODLD1o1gKvZmD0= ++github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= ++github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM= ++github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= ++github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe h1:6RGUuS7EGotKx6J5HIP8ZtyMdiDscjMLfRBSPuzVVeo= ++github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ= ++github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 h1:amWTbTGqOZ71ruzrdA+Nx5WA3tV1N0goTspwmKCQvBY= ++github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2/go.mod h1:9wOXstvyDRshQ9LggQuzBCGysxs3b6Uo/1MvYCR2NMs= ++github.com/golangci/golangci-lint v1.52.0 h1:T7w3tuF1goz64qGV+ML4MgysSl/yUfA3UZJK92oE48A= ++github.com/golangci/golangci-lint v1.52.0/go.mod h1:wlTh+d/oVlgZC2yCe6nlxrxNAnuhEQC0Zdygoh72Uak= ++github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= ++github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= ++github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= ++github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca/go.mod h1:tvlJhZqDe4LMs4ZHD0oMUlt9G2LWuDGoisJTBzLMV9o= ++github.com/golangci/misspell v0.4.0 h1:KtVB/hTK4bbL/S6bs64rYyk8adjmh1BygbBiaAiX+a0= ++github.com/golangci/misspell v0.4.0/go.mod h1:W6O/bwV6lGDxUCChm2ykw9NQdd5bYd1Xkjo88UcWyJc= ++github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6 h1:DIPQnGy2Gv2FSA4B/hh8Q7xx3B7AIDk3DAMeHclH1vQ= ++github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6/go.mod h1:0AKcRCkMoKvUvlf89F6O7H2LYdhr1zBh736mBItOdRs= ++github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 h1:zwtduBRr5SSWhqsYNgcuWO2kFlpdOZbP0+yRjmvPGys= ++github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= ++github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= ++github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= ++github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= ++github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= ++github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= ++github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= ++github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= ++github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= ++github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= ++github.com/google/go-containerregistry v0.13.0 h1:y1C7Z3e149OJbOPDBxLYR8ITPz8dTKqQwjErKVHJC8k= ++github.com/google/go-containerregistry v0.13.0/go.mod h1:J9FQ+eSS4a1aC2GNZxvNpbWhgp0487v+cgiilB4FqDo= ++github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= ++github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= ++github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= ++github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= ++github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= ++github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= ++github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= ++github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= ++github.com/google/pprof v0.0.0-20231101202521-4ca4178f5c7a h1:fEBsGL/sjAuJrgah5XqmmYsTLzJp/TO9Lhy39gkverk= ++github.com/google/pprof v0.0.0-20231101202521-4ca4178f5c7a/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= ++github.com/google/subcommands v1.2.0 h1:vWQspBTo2nEqTUFita5/KeEWlUL8kQObDFbub/EN9oE= ++github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= ++github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= ++github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= ++github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= ++github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28 h1:9alfqbrhuD+9fLZ4iaAVwhlp5PEhmnBt7yvK2Oy5C1U= ++github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= ++github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY= ++github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c= ++github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= ++github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= ++github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= ++github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= ++github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= ++github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= ++github.com/gostaticanalysis/analysisutil v0.7.1 h1:ZMCjoue3DtDWQ5WyU16YbjbQEQ3VuzwxALrpYd+HeKk= ++github.com/gostaticanalysis/analysisutil v0.7.1/go.mod h1:v21E3hY37WKMGSnbsw2S/ojApNWb6C1//mXO48CXbVc= ++github.com/gostaticanalysis/comment v1.4.2 h1:hlnx5+S2fY9Zo9ePo4AhgYsYHbM2+eAv8m/s1JiCd6Q= ++github.com/gostaticanalysis/comment v1.4.2/go.mod h1:KLUTGDv6HOCotCH8h2erHKmpci2ZoR8VPu34YA2uzdM= ++github.com/gostaticanalysis/forcetypeassert v0.1.0 h1:6eUflI3DiGusXGK6X7cCcIgVCpZ2CiZ1Q7jl6ZxNV70= ++github.com/gostaticanalysis/forcetypeassert v0.1.0/go.mod h1:qZEedyP/sY1lTGV1uJ3VhWZ2mqag3IkWsDHVbplHXak= ++github.com/gostaticanalysis/nilerr v0.1.1 h1:ThE+hJP0fEp4zWLkWHWcRyI2Od0p7DlgYG3Uqrmrcpk= ++github.com/gostaticanalysis/nilerr v0.1.1/go.mod h1:wZYb6YI5YAxxq0i1+VJbY0s2YONW0HU0GPE3+5PWN4A= ++github.com/gotestyourself/gotestyourself v2.2.0+incompatible h1:AQwinXlbQR2HvPjQZOmDhRqsv5mZf+Jb1RnSLxcqZcI= ++github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY= ++github.com/graph-gophers/graphql-go v1.5.0 h1:fDqblo50TEpD0LY7RXk/LFVYEVqo3+tXMNMPSVXA1yc= ++github.com/graph-gophers/graphql-go v1.5.0/go.mod h1:YtmJZDLbF1YYNrlNAuiO5zAStUWc3XZT07iGsVqe1Os= ++github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= ++github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= ++github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= ++github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= ++github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= ++github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= ++github.com/guptarohit/asciigraph v0.5.5 h1:ccFnUF8xYIOUPPY3tmdvRyHqmn1MYI9iv1pLKX+/ZkQ= ++github.com/guptarohit/asciigraph v0.5.5/go.mod h1:dYl5wwK4gNsnFf9Zp+l06rFiDZ5YtXM6x7SRWZ3KGag= ++github.com/hashicorp/consul/api v1.10.1 h1:MwZJp86nlnL+6+W1Zly4JUuVn9YHhMggBirMpHGD7kw= ++github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= ++github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= ++github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= ++github.com/hashicorp/go-bexpr v0.1.12 h1:XrdVhmwu+9iYxIUWxsGVG7NQwrhzJZ0vR6nbN5bLgrA= ++github.com/hashicorp/go-bexpr v0.1.12/go.mod h1:ACktpcSySkFNpcxWSClFrut7wicd9WzisnvHuw+g9K8= ++github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= ++github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= ++github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= ++github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= ++github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= ++github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= ++github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= ++github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= ++github.com/hashicorp/go-metrics v0.5.3 h1:M5uADWMOGCTUNU1YuC4hfknOeHNaX54LDm4oYSucoNE= ++github.com/hashicorp/go-metrics v0.5.3/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE= ++github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= ++github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= ++github.com/hashicorp/go-plugin v1.5.2 h1:aWv8eimFqWlsEiMrYZdPYl+FdHaBJSN4AWwGWfT1G2Y= ++github.com/hashicorp/go-plugin v1.5.2/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= ++github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= ++github.com/hashicorp/go-retryablehttp v0.7.4 h1:ZQgVdpTdAL7WpMIwLzCfbalOcSUdkDZnpUv3/+BxzFA= ++github.com/hashicorp/go-retryablehttp v0.7.4/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= ++github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= ++github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= ++github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= ++github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= ++github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= ++github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= ++github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= ++github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= ++github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= ++github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= ++github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= ++github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= ++github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= ++github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= ++github.com/hashicorp/serf v0.9.5 h1:EBWvyu9tcRszt3Bxp3KNssBMP1KuHWyO51lz9+786iM= ++github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= ++github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= ++github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= ++github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7HsjsjeEZ6auqU= ++github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= ++github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= ++github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= ++github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7 h1:3JQNjnMRil1yD0IfZKHF9GxxWKDJGj8I0IqOUol//sw= ++github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc= ++github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= ++github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= ++github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU= ++github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= ++github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= ++github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= ++github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw= ++github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= ++github.com/hudl/fargo v1.4.0 h1:ZDDILMbB37UlAVLlWcJ2Iz1XuahZZTDZfdCKeclfq2s= ++github.com/hudl/fargo v1.4.0/go.mod h1:9Ai6uvFy5fQNq6VPKtg+Ceq1+eTY4nKUlR2JElEOcDo= ++github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= ++github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= ++github.com/hydrogen18/memlistener v1.0.0 h1:JR7eDj8HD6eXrc5fWLbSUnfcQFL06PYvCc0DKQnWfaU= ++github.com/hydrogen18/memlistener v1.0.0/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= ++github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= ++github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= ++github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= ++github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8= ++github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= ++github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= ++github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= ++github.com/influxdata/influxdb-client-go/v2 v2.12.3 h1:28nRlNMRIV4QbtIUvxhWqaxn0IpXeMSkY/uJa/O/vC4= ++github.com/influxdata/influxdb-client-go/v2 v2.12.3/go.mod h1:IrrLUbCjjfkmRuaCiGQg4m2GbkaeJDcuWoxiWdQEbA0= ++github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c h1:qSHzRbhzK8RdXOsAdfDgO49TtqC1oZ+acxPrkfTxcCs= ++github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= ++github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097 h1:vilfsDSy7TDxedi9gyBkMvAirat/oRcL0lFdJBf6tdM= ++github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= ++github.com/informalsystems/tm-load-test v1.3.0 h1:FGjKy7vBw6mXNakt+wmNWKggQZRsKkEYpaFk/zR64VA= ++github.com/informalsystems/tm-load-test v1.3.0/go.mod h1:OQ5AQ9TbT5hKWBNIwsMjn6Bf4O0U4b1kRc+0qZlQJKw= ++github.com/iris-contrib/schema v0.0.6 h1:CPSBLyx2e91H2yJzPuhGuifVRnZBBJ3pCOMbOvPZaTw= ++github.com/iris-contrib/schema v0.0.6/go.mod h1:iYszG0IOsuIsfzjymw1kMzTL8YQcCWlm65f3wX8J5iA= ++github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= ++github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= ++github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= ++github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= ++github.com/jdxcode/netrc v0.0.0-20221124155335-4616370d1a84 h1:2uT3aivO7NVpUPGcQX7RbHijHMyWix/yCnIrCWc+5co= ++github.com/jdxcode/netrc v0.0.0-20221124155335-4616370d1a84/go.mod h1:Zi/ZFkEqFHTm7qkjyNJjaWH4LQA9LQhGJyF0lTYGpxw= ++github.com/jedisct1/go-minisign v0.0.0-20230811132847-661be99b8267 h1:TMtDYDHKYY15rFihtRfck/bfFqNfvcabqvXAFQfAUpY= ++github.com/jedisct1/go-minisign v0.0.0-20230811132847-661be99b8267/go.mod h1:h1nSAbGFqGVzn6Jyl1R/iCcBUHN4g+gW1u9CoBTrb9E= ++github.com/jgautheron/goconst v1.5.1 h1:HxVbL1MhydKs8R8n/HE5NPvzfaYmQJA3o879lE4+WcM= ++github.com/jgautheron/goconst v1.5.1/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= ++github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= ++github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= ++github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjzq7gFzUs= ++github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= ++github.com/jinzhu/copier v0.3.5 h1:GlvfUwHk62RokgqVNvYsku0TATCF7bAHVwEXoBh3iJg= ++github.com/jinzhu/copier v0.3.5/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= ++github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af h1:KA9BjwUk7KlCh6S9EAGWBt1oExIUv9WyNCiRz5amv48= ++github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= ++github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= ++github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= ++github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= ++github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= ++github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= ++github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= ++github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA= ++github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= ++github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= ++github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= ++github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= ++github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= ++github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= ++github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U= ++github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= ++github.com/julz/importas v0.1.0 h1:F78HnrsjY3cR7j0etXy5+TU1Zuy7Xt08X/1aJnH5xXY= ++github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= ++github.com/junk1tm/musttag v0.5.0 h1:bV1DTdi38Hi4pG4OVWa7Kap0hi0o7EczuK6wQt9zPOM= ++github.com/junk1tm/musttag v0.5.0/go.mod h1:PcR7BA+oREQYvHwgjIDmw3exJeds5JzRcvEJTfjrA0M= ++github.com/karalabe/usb v0.0.2 h1:M6QQBNxF+CQ8OFvxrT90BA0qBOXymndZnk5q235mFc4= ++github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= ++github.com/kataras/blocks v0.0.7 h1:cF3RDY/vxnSRezc7vLFlQFTYXG/yAr1o7WImJuZbzC4= ++github.com/kataras/blocks v0.0.7/go.mod h1:UJIU97CluDo0f+zEjbnbkeMRlvYORtmc1304EeyXf4I= ++github.com/kataras/golog v0.1.8 h1:isP8th4PJH2SrbkciKnylaND9xoTtfxv++NB+DF0l9g= ++github.com/kataras/golog v0.1.8/go.mod h1:rGPAin4hYROfk1qT9wZP6VY2rsb4zzc37QpdPjdkqVw= ++github.com/kataras/iris/v12 v12.2.0 h1:WzDY5nGuW/LgVaFS5BtTkW3crdSKJ/FEgWnxPnIVVLI= ++github.com/kataras/iris/v12 v12.2.0/go.mod h1:BLzBpEunc41GbE68OUaQlqX4jzi791mx5HU04uPb90Y= ++github.com/kataras/pio v0.0.11 h1:kqreJ5KOEXGMwHAWHDwIl+mjfNCPhAwZPa8gK7MKlyw= ++github.com/kataras/pio v0.0.11/go.mod h1:38hH6SWH6m4DKSYmRhlrCJ5WItwWgCVrTNU62XZyUvI= ++github.com/kataras/sitemap v0.0.6 h1:w71CRMMKYMJh6LR2wTgnk5hSgjVNB9KL60n5e2KHvLY= ++github.com/kataras/sitemap v0.0.6/go.mod h1:dW4dOCNs896OR1HmG+dMLdT7JjDk7mYBzoIRwuj5jA4= ++github.com/kataras/tunnel v0.0.4 h1:sCAqWuJV7nPzGrlb0os3j49lk2JhILT0rID38NHNLpA= ++github.com/kataras/tunnel v0.0.4/go.mod h1:9FkU4LaeifdMWqZu7o20ojmW4B7hdhv2CMLwfnHGpYw= ++github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= ++github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= ++github.com/kilic/bls12-381 v0.1.0 h1:encrdjqKMEvabVQ7qYOKu1OvhqpK4s47wDYtNiPtlp4= ++github.com/kilic/bls12-381 v0.1.0/go.mod h1:vDTTHJONJ6G+P2R74EhnyotQDTliQDnFEwhdmfzw1ig= ++github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= ++github.com/kisielk/errcheck v1.6.3 h1:dEKh+GLHcWm2oN34nMvDzn1sqI0i0WxPvrgiJA5JuM8= ++github.com/kisielk/errcheck v1.6.3/go.mod h1:nXw/i/MfnvRHqXa7XXmQMUB0oNFGuBrNI8d8NLy0LPw= ++github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= ++github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= ++github.com/kkHAIKE/contextcheck v1.1.4 h1:B6zAaLhOEEcjvUgIYEqystmnFk1Oemn8bvJhbt0GMb8= ++github.com/kkHAIKE/contextcheck v1.1.4/go.mod h1:1+i/gWqokIa+dm31mqGLZhZJ7Uh44DJGZVmr6QRBNJg= ++github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= ++github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= ++github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= ++github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= ++github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= ++github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE= ++github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= ++github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= ++github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= ++github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= ++github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= ++github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= ++github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= ++github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= ++github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw= ++github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= ++github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= ++github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= ++github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= ++github.com/kulti/thelper v0.6.3 h1:ElhKf+AlItIu+xGnI990no4cE2+XaSu1ULymV2Yulxs= ++github.com/kulti/thelper v0.6.3/go.mod h1:DsqKShOvP40epevkFrvIwkCMNYxMeTNjdWL4dqWHZ6I= ++github.com/kunwardeep/paralleltest v1.0.6 h1:FCKYMF1OF2+RveWlABsdnmsvJrei5aoyZoaGS+Ugg8g= ++github.com/kunwardeep/paralleltest v1.0.6/go.mod h1:Y0Y0XISdZM5IKm3TREQMZ6iteqn1YuwCsJO/0kL9Zes= ++github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= ++github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= ++github.com/kyoh86/exportloopref v0.1.11 h1:1Z0bcmTypkL3Q4k+IDHMWTcnCliEZcaPiIe0/ymEyhQ= ++github.com/kyoh86/exportloopref v0.1.11/go.mod h1:qkV4UF1zGl6EkF1ox8L5t9SwyeBAZ3qLMd6up458uqA= ++github.com/labstack/echo/v4 v4.11.1 h1:dEpLU2FLg4UVmvCGPuk/APjlH6GDpbEPti61srUUUs4= ++github.com/labstack/echo/v4 v4.11.1/go.mod h1:YuYRTSM3CHs2ybfrL8Px48bO6BAnYIN4l8wSTMP6BDQ= ++github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8= ++github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= ++github.com/ldez/gomoddirectives v0.2.3 h1:y7MBaisZVDYmKvt9/l1mjNCiSA1BVn34U0ObUcJwlhA= ++github.com/ldez/gomoddirectives v0.2.3/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdBr6g8G04uz6d0= ++github.com/ldez/tagliatelle v0.4.0 h1:sylp7d9kh6AdXN2DpVGHBRb5guTVAgOxqNGhbqc4b1c= ++github.com/ldez/tagliatelle v0.4.0/go.mod h1:mNtTfrHy2haaBAw+VT7IBV6VXBThS7TCreYWbBcJ87I= ++github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= ++github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= ++github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= ++github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= ++github.com/leonklingele/grouper v1.1.1 h1:suWXRU57D4/Enn6pXR0QVqqWWrnJ9Osrz+5rjt8ivzU= ++github.com/leonklingele/grouper v1.1.1/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= ++github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= ++github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= ++github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= ++github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= ++github.com/linxGnu/grocksdb v1.8.14 h1:HTgyYalNwBSG/1qCQUIott44wU5b2Y9Kr3z7SK5OfGQ= ++github.com/linxGnu/grocksdb v1.8.14/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= ++github.com/lufeee/execinquery v1.2.1 h1:hf0Ems4SHcUGBxpGN7Jz78z1ppVkP/837ZlETPCEtOM= ++github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= ++github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= ++github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= ++github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= ++github.com/mailgun/raymond/v2 v2.0.48 h1:5dmlB680ZkFG2RN/0lvTAghrSxIESeu9/2aeDqACtjw= ++github.com/mailgun/raymond/v2 v2.0.48/go.mod h1:lsgvL50kgt1ylcFJYZiULi5fjPBkkhNfj4KA0W54Z18= ++github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= ++github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= ++github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= ++github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= ++github.com/maratori/testableexamples v1.0.0 h1:dU5alXRrD8WKSjOUnmJZuzdxWOEQ57+7s93SLMxb2vI= ++github.com/maratori/testableexamples v1.0.0/go.mod h1:4rhjL1n20TUTT4vdh3RDqSizKLyXp7K2u6HgraZCGzE= ++github.com/maratori/testpackage v1.1.1 h1:S58XVV5AD7HADMmD0fNnziNHqKvSdDuEKdPD1rNTU04= ++github.com/maratori/testpackage v1.1.1/go.mod h1:s4gRK/ym6AMrqpOa/kEbQTV4Q4jb7WeLZzVhVVVOQMc= ++github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 h1:gWg6ZQ4JhDfJPqlo2srm/LN17lpybq15AryXIRcWYLE= ++github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= ++github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= ++github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= ++github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= ++github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= ++github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= ++github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= ++github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= ++github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= ++github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= ++github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= ++github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= ++github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= ++github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwgOdMUQePUo= ++github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= ++github.com/mgechev/revive v1.3.1 h1:OlQkcH40IB2cGuprTPcjB0iIUddgVZgGmDX3IAMR8D4= ++github.com/mgechev/revive v1.3.1/go.mod h1:YlD6TTWl2B8A103R9KWJSPVI9DrEf+oqr15q21Ld+5I= ++github.com/microcosm-cc/bluemonday v1.0.23 h1:SMZe2IGa0NuHvnVNAZ+6B38gsTbi5e4sViiWJyDDqFY= ++github.com/microcosm-cc/bluemonday v1.0.23/go.mod h1:mN70sk7UkkF8TUr2IGBpNN0jAgStuPzlK76QuruE/z4= ++github.com/miekg/dns v1.1.43 h1:JKfpVSCB84vrAmHzyrsxB5NAr5kLoMXZArPSw7Qlgyg= ++github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4= ++github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= ++github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= ++github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= ++github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= ++github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= ++github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= ++github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= ++github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= ++github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= ++github.com/mitchellh/pointerstructure v1.2.1 h1:ZhBBeX8tSlRpu/FFhXH4RC4OJzFlqsQhoHZAz4x7TIw= ++github.com/mitchellh/pointerstructure v1.2.1/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= ++github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= ++github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= ++github.com/mmcloughlin/profile v0.1.1 h1:jhDmAqPyebOsVDOCICJoINoLb/AnLBaUw58nFzxWS2w= ++github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= ++github.com/moby/term v0.0.0-20221205130635-1aeaba878587 h1:HfkjXDfhgVaN5rmueG8cL8KKeFNecRCXFhaJ2qZ5SKA= ++github.com/moby/term v0.0.0-20221205130635-1aeaba878587/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= ++github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= ++github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= ++github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= ++github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= ++github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= ++github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= ++github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= ++github.com/moricho/tparallel v0.3.0 h1:8dDx3S3e+jA+xiQXC7O3dvfRTe/J+FYlTDDW01Y7z/Q= ++github.com/moricho/tparallel v0.3.0/go.mod h1:leENX2cUv7Sv2qDgdi0D0fCftN8fRC67Bcn8pqzeYNI= ++github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= ++github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= ++github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= ++github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= ++github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= ++github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= ++github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= ++github.com/nakabonne/nestif v0.3.1 h1:wm28nZjhQY5HyYPx+weN3Q65k6ilSBxDb8v5S81B81U= ++github.com/nakabonne/nestif v0.3.1/go.mod h1:9EtoZochLn5iUprVDmDjqGKPofoUEBL8U4Ngq6aY7OE= ++github.com/naoina/go-stringutil v0.1.0 h1:rCUeRUHjBjGTSHl0VC00jUPLz8/F9dDzYI70Hzifhks= ++github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= ++github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416 h1:shk/vn9oCoOTmwcouEdwIeOtOGA/ELRUw/GwvxwfT+0= ++github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= ++github.com/nats-io/jwt/v2 v2.0.3 h1:i/O6cmIsjpcQyWDYNcq2JyZ3/VTF8SJ4JWluI5OhpvI= ++github.com/nats-io/jwt/v2 v2.0.3/go.mod h1:VRP+deawSXyhNjXmxPCHskrR6Mq50BqpEI5SEcNiGlY= ++github.com/nats-io/nats-server/v2 v2.5.0 h1:wsnVaaXH9VRSg+A2MVg5Q727/CqxnmPLGFQ3YZYKTQg= ++github.com/nats-io/nats-server/v2 v2.5.0/go.mod h1:Kj86UtrXAL6LwYRA6H4RqzkHhK0Vcv2ZnKD5WbQ1t3g= ++github.com/nats-io/nats.go v1.12.1 h1:+0ndxwUPz3CmQ2vjbXdkC1fo3FdiOQDim4gl3Mge8Qo= ++github.com/nats-io/nats.go v1.12.1/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w= ++github.com/nats-io/nkeys v0.3.0 h1:cgM5tL53EvYRU+2YLXIK0G2mJtK12Ft9oeooSZMA2G8= ++github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4= ++github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= ++github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= ++github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 h1:4kuARK6Y6FxaNu/BnU2OAaLF86eTVhP2hjTB6iMvItA= ++github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354/go.mod h1:KSVJerMDfblTH7p5MZaTt+8zaT2iEk3AkVb9PQdZuE8= ++github.com/nishanths/exhaustive v0.9.5 h1:TzssWan6orBiLYVqewCG8faud9qlFntJE30ACpzmGME= ++github.com/nishanths/exhaustive v0.9.5/go.mod h1:IbwrGdVMizvDcIxPYGVdQn5BqWJaOwpCvg4RGb8r/TA= ++github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= ++github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= ++github.com/nunnatsa/ginkgolinter v0.9.0 h1:Sm0zX5QfjJzkeCjEp+t6d3Ha0jwvoDjleP9XCsrEzOA= ++github.com/nunnatsa/ginkgolinter v0.9.0/go.mod h1:FHaMLURXP7qImeH6bvxWJUpyH+2tuqe5j4rW1gxJRmI= ++github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= ++github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= ++github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= ++github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a h1:dlRvE5fWabOchtH7znfiFCcOvmIYgOeAS5ifBXBlh9Q= ++github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a/go.mod h1:hVoHR2EVESiICEMbg137etN/Lx+lSrHPTD39Z/uE+2s= ++github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= ++github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= ++github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= ++github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= ++github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= ++github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= ++github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= ++github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= ++github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= ++github.com/onsi/ginkgo/v2 v2.14.0 h1:vSmGj2Z5YPb9JwCWT6z6ihcUvDhuXLc3sJiqd3jMKAY= ++github.com/onsi/ginkgo/v2 v2.14.0/go.mod h1:JkUdW7JkN0V6rFvsHcJ478egV3XH9NxpD27Hal/PhZw= ++github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= ++github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= ++github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= ++github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= ++github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 h1:lDH9UUVJtmYCjyT0CI4q8xvlXPxeZ0gYCVvWbmPlp88= ++github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= ++github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= ++github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= ++github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= ++github.com/opencontainers/image-spec v1.1.0-rc5/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= ++github.com/opencontainers/runc v1.1.5 h1:L44KXEpKmfWDcS02aeGm8QNTFXTo2D+8MYGDIJ/GDEs= ++github.com/opencontainers/runc v1.1.5/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= ++github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= ++github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= ++github.com/openzipkin/zipkin-go v0.2.5 h1:UwtQQx2pyPIgWYHRg+epgdx1/HnBQTgN3/oIYEJTQzU= ++github.com/openzipkin/zipkin-go v0.2.5/go.mod h1:KpXfKdgRDnnhsxw4pNIH9Md5lyFqKUa4YDFlwRYAMyE= ++github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= ++github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= ++github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= ++github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= ++github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= ++github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= ++github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= ++github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= ++github.com/performancecopilot/speed/v4 v4.0.0 h1:VxEDCmdkfbQYDlcr/GC9YoN9PQ6p8ulk9xVsepYy9ZY= ++github.com/performancecopilot/speed/v4 v4.0.0/go.mod h1:qxrSyuDGrTOWfV+uKRFhfxw6h/4HXRGUiZiufxo49BM= ++github.com/peterh/liner v1.2.2 h1:aJ4AOodmL+JxOZZEL2u9iJf8omNRpqHc/EbrK+3mAXw= ++github.com/peterh/liner v1.2.2/go.mod h1:xFwJyiKIXJZUKItq5dGHZSTBRAuG/CpeNpWLyiNRNwI= ++github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= ++github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 h1:jik8PHtAIsPlCRJjJzl4udgEf7hawInF9texMeO2jrU= ++github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= ++github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= ++github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= ++github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= ++github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= ++github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= ++github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= ++github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A= ++github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= ++github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= ++github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= ++github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= ++github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= ++github.com/pkg/profile v1.7.0 h1:hnbDkaNWPCLMO9wGLdBFTIZvzDrDfBM2072E1S9gJkA= ++github.com/pkg/profile v1.7.0/go.mod h1:8Uer0jas47ZQMJ7VD+OHknK4YDY07LPUC6dEvqDjvNo= ++github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= ++github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= ++github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= ++github.com/polyfloyd/go-errorlint v1.4.5 h1:70YWmMy4FgRHehGNOUask3HtSFSOLKgmDn7ryNe7LqI= ++github.com/polyfloyd/go-errorlint v1.4.5/go.mod h1:sIZEbFoDOCnTYYZoVkjc4hTnM459tuWA9H/EkdXwsKk= ++github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= ++github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= ++github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= ++github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU= ++github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k= ++github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= ++github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= ++github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= ++github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= ++github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= ++github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= ++github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= ++github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= ++github.com/prometheus/common v0.52.2 h1:LW8Vk7BccEdONfrJBDffQGRtpSzi5CQaRZGtboOO2ck= ++github.com/prometheus/common v0.52.2/go.mod h1:lrWtQx+iDfn2mbH5GUzlH9TSHyfZpHkSiG1W7y3sF2Q= ++github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= ++github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= ++github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= ++github.com/prometheus/procfs v0.13.0 h1:GqzLlQyfsPbaEHaQkO7tbDlriv/4o5Hudv6OXHGKX7o= ++github.com/prometheus/procfs v0.13.0/go.mod h1:cd4PFCR54QLnGKPaKGA6l+cfuNXtht43ZKY6tow0Y1g= ++github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7 h1:cZC+usqsYgHtlBaGulVnZ1hfKAi8iWtujBnRLQE698c= ++github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7/go.mod h1:IToEjHuttnUzwZI5KBSM/LOOW3qLbbrHOEfp3SbECGY= ++github.com/quasilyte/go-ruleguard v0.4.0 h1:DyM6r+TKL+xbKB4Nm7Afd1IQh9kEUKQs2pboWGKtvQo= ++github.com/quasilyte/go-ruleguard v0.4.0/go.mod h1:Eu76Z/R8IXtViWUIHkE3p8gdH3/PKk1eh3YGfaEof10= ++github.com/quasilyte/gogrep v0.5.0 h1:eTKODPXbI8ffJMN+W2aE0+oL0z/nh8/5eNdiO34SOAo= ++github.com/quasilyte/gogrep v0.5.0/go.mod h1:Cm9lpz9NZjEoL1tgZ2OgeUKPIxL1meE7eo60Z6Sk+Ng= ++github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 h1:TCg2WBOl980XxGFEZSS6KlBGIV0diGdySzxATTWoqaU= ++github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= ++github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 h1:M8mH9eK4OUR4lu7Gd+PU1fV2/qnDNfzT635KRSObncs= ++github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ= ++github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= ++github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= ++github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= ++github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= ++github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= ++github.com/rogpeppe/fastuuid v1.2.0 h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s= ++github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= ++github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= ++github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= ++github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= ++github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo= ++github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= ++github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc= ++github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= ++github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0= ++github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= ++github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= ++github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= ++github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= ++github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= ++github.com/ryancurrah/gomodguard v1.3.0 h1:q15RT/pd6UggBXVBuLps8BXRvl5GPBcwVA7BJHMLuTw= ++github.com/ryancurrah/gomodguard v1.3.0/go.mod h1:ggBxb3luypPEzqVtq33ee7YSN35V28XeGnid8dnni50= ++github.com/ryanrolds/sqlclosecheck v0.4.0 h1:i8SX60Rppc1wRuyQjMciLqIzV3xnoHB7/tXbr6RGYNI= ++github.com/ryanrolds/sqlclosecheck v0.4.0/go.mod h1:TBRRjzL31JONc9i4XMinicuo+s+E8yKZ5FN8X3G6CKQ= ++github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= ++github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= ++github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= ++github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= ++github.com/sanposhiho/wastedassign/v2 v2.0.7 h1:J+6nrY4VW+gC9xFzUc+XjPD3g3wF3je/NsJFwFK7Uxc= ++github.com/sanposhiho/wastedassign/v2 v2.0.7/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI= ++github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= ++github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= ++github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tMEOsumirXcOJqAw= ++github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= ++github.com/sashamelentyev/usestdlibvars v1.23.0 h1:01h+/2Kd+NblNItNeux0veSL5cBF1jbEOPrEhDzGYq0= ++github.com/sashamelentyev/usestdlibvars v1.23.0/go.mod h1:YPwr/Y1LATzHI93CqoPUN/2BzGQ/6N/cl/KwgR0B/aU= ++github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= ++github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= ++github.com/schollz/closestmatch v2.1.0+incompatible h1:Uel2GXEpJqOWBrlyI+oY9LTiyyjYS17cCYRqP13/SHk= ++github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g= ++github.com/securego/gosec/v2 v2.15.0 h1:v4Ym7FF58/jlykYmmhZ7mTm7FQvN/setNm++0fgIAtw= ++github.com/securego/gosec/v2 v2.15.0/go.mod h1:VOjTrZOkUtSDt2QLSJmQBMWnvwiQPEjg0l+5juIqGk8= ++github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= ++github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= ++github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= ++github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs= ++github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= ++github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= ++github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= ++github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= ++github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= ++github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= ++github.com/sivchari/containedctx v1.0.2 h1:0hLQKpgC53OVF1VT7CeoFHk9YKstur1XOgfYIc1yrHI= ++github.com/sivchari/containedctx v1.0.2/go.mod h1:PwZOeqm4/DLoJOqMSIJs3aKqXRX4YO+uXww087KZ7Bw= ++github.com/sivchari/nosnakecase v1.7.0 h1:7QkpWIRMe8x25gckkFd2A5Pi6Ymo0qgr4JrhGt95do8= ++github.com/sivchari/nosnakecase v1.7.0/go.mod h1:CwDzrzPea40/GB6uynrNLiorAlgFRvRbFSgJx2Gs+QY= ++github.com/sivchari/tenv v1.7.1 h1:PSpuD4bu6fSmtWMxSGWcvqUUgIn7k3yOJhOIzVWn8Ak= ++github.com/sivchari/tenv v1.7.1/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= ++github.com/skeema/knownhosts v1.2.1 h1:SHWdIUa82uGZz+F+47k8SY4QhhI291cXCpopT1lK2AQ= ++github.com/skeema/knownhosts v1.2.1/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo= ++github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa h1:YJfZp12Z3AFhSBeXOlv4BO55RMwPn2NoQeDsrdWnBtY= ++github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= ++github.com/sonatard/noctx v0.0.2 h1:L7Dz4De2zDQhW8S0t+KUjY0MAQJd6SgVwhzNIc4ok00= ++github.com/sonatard/noctx v0.0.2/go.mod h1:kzFz+CzWSjQ2OzIm46uJZoXuBpa2+0y3T36U18dWqIo= ++github.com/sony/gobreaker v0.4.1 h1:oMnRNZXX5j85zso6xCPRNPtmAycat+WcoKbklScLDgQ= ++github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= ++github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= ++github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= ++github.com/sourcegraph/go-diff v0.7.0 h1:9uLlrd5T46OXs5qpp8L/MTltk0zikUGi0sNNyCpA8G0= ++github.com/sourcegraph/go-diff v0.7.0/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= ++github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= ++github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= ++github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= ++github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= ++github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= ++github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= ++github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= ++github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= ++github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= ++github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= ++github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= ++github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= ++github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= ++github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= ++github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= ++github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= ++github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= ++github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= ++github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= ++github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= ++github.com/ssgreg/nlreturn/v2 v2.2.1 h1:X4XDI7jstt3ySqGU86YGAURbxw3oTDPK9sPEi6YEwQ0= ++github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= ++github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= ++github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= ++github.com/stbenjam/no-sprintf-host-port v0.1.1 h1:tYugd/yrm1O0dV+ThCbaKZh195Dfm07ysF0U6JQXczc= ++github.com/stbenjam/no-sprintf-host-port v0.1.1/go.mod h1:TLhvtIvONRzdmkFiio4O8LHsN9N74I+PhRquPsxpL0I= ++github.com/streadway/amqp v1.0.0 h1:kuuDrUJFZL1QYL9hUNuCxNObNzB0bV/ZG5jV3RWAQgo= ++github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= ++github.com/streadway/handy v0.0.0-20200128134331-0f66f006fb2e h1:mOtuXaRAbVZsxAHVdPR3IjfmN8T1h2iczJLynhLybf8= ++github.com/streadway/handy v0.0.0-20200128134331-0f66f006fb2e/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= ++github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= ++github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= ++github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= ++github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= ++github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= ++github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= ++github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= ++github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= ++github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= ++github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= ++github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= ++github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4= ++github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= ++github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= ++github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= ++github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c h1:+aPplBwWcHBo6q9xrfWdMrT9o4kltkmmvpemgIjep/8= ++github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c/go.mod h1:SbErYREK7xXdsRiigaQiQkI9McGRzYMvlKYaP3Nimdk= ++github.com/tdakkota/asciicheck v0.2.0 h1:o8jvnUANo0qXtnslk2d3nMKTFNlOnJjRrNcj0j9qkHM= ++github.com/tdakkota/asciicheck v0.2.0/go.mod h1:Qb7Y9EgjCLJGup51gDHFzbI08/gbGhL/UVhYIPWG2rg= ++github.com/tdewolff/minify/v2 v2.12.4 h1:kejsHQMM17n6/gwdw53qsi6lg0TGddZADVyQOz1KMdE= ++github.com/tdewolff/minify/v2 v2.12.4/go.mod h1:h+SRvSIX3kwgwTFOpSckvSxgax3uy8kZTSF1Ojrr3bk= ++github.com/tdewolff/parse/v2 v2.6.4 h1:KCkDvNUMof10e3QExio9OPZJT8SbdKojLBumw8YZycQ= ++github.com/tdewolff/parse/v2 v2.6.4/go.mod h1:woz0cgbLwFdtbjJu8PIKxhW05KplTFQkOdX78o+Jgrs= ++github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= ++github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= ++github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= ++github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= ++github.com/tetafro/godot v1.4.11 h1:BVoBIqAf/2QdbFmSwAWnaIqDivZdOV0ZRwEm6jivLKw= ++github.com/tetafro/godot v1.4.11/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaEohUpn8= ++github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= ++github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= ++github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e h1:MV6KaVu/hzByHP0UvJ4HcMGE/8a6A4Rggc/0wx2AvJo= ++github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e/go.mod h1:27bSVNWSBOHm+qRp1T9qzaIpsWEP6TbUnei/43HK+PQ= ++github.com/timonwong/loggercheck v0.9.4 h1:HKKhqrjcVj8sxL7K77beXh0adEm6DLjV/QOGeMXEVi4= ++github.com/timonwong/loggercheck v0.9.4/go.mod h1:caz4zlPcgvpEkXgVnAJGowHAMW2NwHaNlpS8xDbVhTg= ++github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= ++github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= ++github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= ++github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= ++github.com/tomarrell/wrapcheck/v2 v2.8.1 h1:HxSqDSN0sAt0yJYsrcYVoEeyM4aI9yAm3KQpIXDJRhQ= ++github.com/tomarrell/wrapcheck/v2 v2.8.1/go.mod h1:/n2Q3NZ4XFT50ho6Hbxg+RV1uyo2Uow/Vdm9NQcl5SE= ++github.com/tommy-muehle/go-mnd/v2 v2.5.1 h1:NowYhSdyE/1zwK9QCLeRb6USWdoif80Ie+v+yU8u1Zw= ++github.com/tommy-muehle/go-mnd/v2 v2.5.1/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= ++github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 h1:G3dpKMzFDjgEh2q1Z7zUUtKa8ViPtH+ocF0bE0g00O8= ++github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= ++github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= ++github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= ++github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= ++github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= ++github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= ++github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= ++github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= ++github.com/ultraware/funlen v0.0.3 h1:5ylVWm8wsNwH5aWo9438pwvsK0QiqVuUrt9bn7S/iLA= ++github.com/ultraware/funlen v0.0.3/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= ++github.com/ultraware/whitespace v0.0.5 h1:hh+/cpIcopyMYbZNVov9iSxvJU3OYQg78Sfaqzi/CzI= ++github.com/ultraware/whitespace v0.0.5/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= ++github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= ++github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= ++github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc= ++github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= ++github.com/uudashr/gocognit v1.0.6 h1:2Cgi6MweCsdB6kpcVQp7EW4U23iBFQWfTXiWlyp842Y= ++github.com/uudashr/gocognit v1.0.6/go.mod h1:nAIUuVBnYU7pcninia3BHOvQkpQCeO76Uscky5BOwcY= ++github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= ++github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= ++github.com/valyala/fasthttp v1.40.0 h1:CRq/00MfruPGFLTQKY8b+8SfdK60TxNztjRMnH0t1Yc= ++github.com/valyala/fasthttp v1.40.0/go.mod h1:t/G+3rLek+CyY9bnIE+YlMRddxVAAGjhxndDB4i4C0I= ++github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= ++github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= ++github.com/vektra/mockery/v2 v2.23.1 h1:N59FENM2d/gWE6Ns5JPuf9a7jqQWeheGefZqvuvb1dM= ++github.com/vektra/mockery/v2 v2.23.1/go.mod h1:Zh3Kv1ckKs6FokhlVLcCu6UTyzfS3M8mpROz1lBNp+w= ++github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU= ++github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= ++github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= ++github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= ++github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= ++github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= ++github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc= ++github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU= ++github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77 h1:ESFSdwYZvkeru3RtdrYueztKhOBCSAAzS4Gf+k0tEow= ++github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= ++github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= ++github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= ++github.com/yagipy/maintidx v1.0.0 h1:h5NvIsCz+nRDapQ0exNv4aJ0yXSI0420omVANTv3GJM= ++github.com/yagipy/maintidx v1.0.0/go.mod h1:0qNf/I/CCZXSMhsRsrEPDZ+DkekpKLXAJfsTACwgXLk= ++github.com/yeya24/promlinter v0.2.0 h1:xFKDQ82orCU5jQujdaD8stOHiv8UN68BSdn2a8u8Y3o= ++github.com/yeya24/promlinter v0.2.0/go.mod h1:u54lkmBOZrpEbQQ6gox2zWKKLKu2SGe+2KOiextY+IA= ++github.com/yosssi/ace v0.0.5 h1:tUkIP/BLdKqrlrPwcmH0shwEEhTRHoGnc1wFIWmaBUA= ++github.com/yosssi/ace v0.0.5/go.mod h1:ALfIzm2vT7t5ZE7uoIZqF3TQ7SAOyupFZnkrF5id+K0= ++github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= ++github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= ++github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE= ++github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= ++github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= ++github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= ++github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= ++github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= ++github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= ++github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= ++gitlab.com/bosi/decorder v0.2.3 h1:gX4/RgK16ijY8V+BRQHAySfQAb354T7/xQpDB2n10P0= ++gitlab.com/bosi/decorder v0.2.3/go.mod h1:9K1RB5+VPNQYtXtTDAzd2OEftsZb1oV0IrJrzChSdGE= ++go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= ++go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= ++go.etcd.io/etcd/api/v3 v3.5.0 h1:GsV3S+OfZEOCNXdtNkBSR7kgLobAa/SO6tCxRa0GAYw= ++go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= ++go.etcd.io/etcd/client/pkg/v3 v3.5.0 h1:2aQv6F436YnN7I4VbI8PPYrBhu+SmrTaADcf8Mi/6PU= ++go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= ++go.etcd.io/etcd/client/v2 v2.305.0 h1:ftQ0nOOHMcbMS3KIaDQ0g5Qcd6bhaBrQT6b89DfwLTs= ++go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= ++go.etcd.io/etcd/client/v3 v3.5.0 h1:62Eh0XOro+rDwkrypAGDfgmNh5Joq+z+W9HZdlXMzek= ++go.etcd.io/etcd/client/v3 v3.5.0/go.mod h1:AIKXXVX/DQXtfTEqBryiLTUXwON+GuvO6Z7lLS/oTh0= ++go.etcd.io/gofail v0.1.0 h1:XItAMIhOojXFQMgrxjnd2EIIHun/d5qL0Pf7FzVTkFg= ++go.etcd.io/gofail v0.1.0/go.mod h1:VZBCXYGZhHAinaBiiqYvuDynvahNsAyLFwB3kEHKz1M= ++go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= ++go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= ++go.opentelemetry.io/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM= ++go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU= ++go.opentelemetry.io/otel/sdk v1.14.0 h1:PDCppFRDq8A1jL9v6KMI6dYesaq+DFcDZvjsoGvxGzY= ++go.opentelemetry.io/otel/sdk v1.14.0/go.mod h1:bwIC5TjrNG6QDCHNWvW4HLHtUQ4I+VQDsnjhvyZCALM= ++go.opentelemetry.io/otel/trace v1.14.0 h1:wp2Mmvj41tDsyAJXiWDWpfNsOiIyd38fy85pyKcFq/M= ++go.opentelemetry.io/otel/trace v1.14.0/go.mod h1:8avnQLK+CG77yNLUae4ea2JDQ6iT+gozhnZjy/rw9G8= ++go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= ++go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= ++go.uber.org/automaxprocs v1.5.2 h1:2LxUOGiR3O6tw8ui5sZa2LAaHnsviZdVOUZw4fvbnME= ++go.uber.org/automaxprocs v1.5.2/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= ++go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= ++go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= ++go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= ++go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= ++golang.org/x/arch v0.4.0 h1:A8WCeEWhLwPBKNbFi5Wv5UTCBx5zzubnXDlMOFAzFMc= ++golang.org/x/arch v0.4.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= ++golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= ++golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= ++golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= ++golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= ++golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= ++golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= ++golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= ++golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= ++golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 h1:985EYyeCOxTpcgOTJpflJUwOeEz0CQOdPt73OzpE9F8= ++golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= ++golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 h1:jWGQJV4niP+CCmFW9ekjA9Zx8vYORzOUH2/Nl5WPuLQ= ++golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= ++golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= ++golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= ++golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0= ++golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= ++golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= ++golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= ++golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= ++golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= ++golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= ++golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= ++golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= ++golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= ++golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= ++golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= ++golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= ++golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= ++golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= ++golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= ++golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= ++golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= ++golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= ++golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= ++golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= ++golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= ++golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= ++golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= ++golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= ++golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI= ++golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8= ++golang.org/x/perf v0.0.0-20230113213139-801c7ef9e5c5 h1:ObuXPmIgI4ZMyQLIz48cJYgSyWdjUXc2SZAdyJMwEAU= ++golang.org/x/perf v0.0.0-20230113213139-801c7ef9e5c5/go.mod h1:UBKtEnL8aqnd+0JHqZ+2qoMDwtuy6cYhhKNoHLBiTQc= ++golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= ++golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= ++golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= ++golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= ++golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= ++golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= ++golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= ++golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= ++golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= ++golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= ++golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= ++golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= ++golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= ++golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= ++golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= ++golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= ++golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= ++golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= ++golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= ++golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= ++golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= ++golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= ++golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= ++golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= ++golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= ++golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= ++golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= ++golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= ++golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= ++golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= ++golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= ++golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= ++golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= ++golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= ++golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= ++golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= ++golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= ++golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= ++golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2 h1:IRJeR9r1pYWsHKTRe/IInb7lYvbBVIqOgsX/u0mbOWY= ++golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= ++golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= ++golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= ++golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= ++golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= ++golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= ++golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= ++golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= ++golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= ++golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= ++golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= ++golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= ++golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= ++golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= ++golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= ++golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= ++golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= ++golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= ++golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= ++golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= ++golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= ++golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= ++golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= ++golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= ++golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= ++gonum.org/v1/gonum v0.12.0 h1:xKuo6hzt+gMav00meVPUlXwSdoEJP46BR+wdxQEFK2o= ++gonum.org/v1/gonum v0.12.0/go.mod h1:73TDxJfAAHeA8Mk9mf8NlIppyhQNo5GLTcYeqgo2lvY= ++google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= ++google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= ++google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= ++google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= ++google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= ++google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= ++google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= ++google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= ++google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= ++google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= ++google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de h1:jFNzHPIeuzhdRwVhbZdiym9q0ory/xY3sA+v2wPg8I0= ++google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:5iCWqnniDlqZHrd3neWVTOwvh/v6s3232omMecelax8= ++google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda h1:LI5DOvAxUPMv/50agcLLoo+AdWc1irS9Rzz4vPuD1V4= ++google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= ++google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= ++google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= ++google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= ++google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= ++google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= ++google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= ++google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= ++google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= ++google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= ++google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= ++google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= ++google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= ++google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= ++google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= ++google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= ++gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= ++gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= ++gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= ++gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= ++gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= ++gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= ++gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= ++gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= ++gopkg.in/gcfg.v1 v1.2.3 h1:m8OOJ4ccYHnx2f4gQwpno8nAX5OGOh7RLaaz0pj3Ogs= ++gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= ++gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= ++gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= ++gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= ++gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= ++gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= ++gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= ++gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= ++gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= ++gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= ++gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= ++gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= ++gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= ++gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= ++gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= ++gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= ++gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= ++gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= ++gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= ++gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= ++gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= ++gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= ++gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= ++honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= ++honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= ++honnef.co/go/tools v0.4.3 h1:o/n5/K5gXqk8Gozvs2cnL0F2S1/g1vcGCAx2vETjITw= ++honnef.co/go/tools v0.4.3/go.mod h1:36ZgoUOrqOk1GxwHhyryEkq8FQWkUO2xGuSMhUCcdvA= ++mvdan.cc/gofumpt v0.4.0 h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM= ++mvdan.cc/gofumpt v0.4.0/go.mod h1:PljLOHDeZqgS8opHRKLzp2It2VBuSdteAgqUfzMTxlQ= ++mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= ++mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= ++mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphDJbHOQO1DFFFTeBo= ++mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= ++mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d h1:3rvTIIM22r9pvXk+q3swxUQAQOxksVMGK7sml4nG57w= ++mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d/go.mod h1:IeHQjmn6TOD+e4Z3RFiZMMsLVL+A96Nvptar8Fj71is= ++nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= ++nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= ++pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= ++pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= ++rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= ++rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= ++sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= ++sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= +diff --git a/usercase-test-coderl/historical_plugin_test.go b/usercase-test-coderl/historical_plugin_test.go +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/historical_plugin_test.go +@@ -0,0 +1,413 @@ ++package usercase_test_coderl ++ ++import ( ++ "errors" ++ "math/big" ++ "testing" ++ ++ "cosmossdk.io/log" ++ "cosmossdk.io/store/metrics" ++ "cosmossdk.io/store/rootmulti" ++ storetypes "cosmossdk.io/store/types" ++ historical "github.com/berachain/polaris/cosmos/x/evm/plugins/historical" ++ "github.com/berachain/polaris/eth/core" ++ polarparams "github.com/berachain/polaris/eth/params" ++ cometproto "github.com/cometbft/cometbft/proto/tendermint/types" ++ dbm "github.com/cosmos/cosmos-db" ++ sdk "github.com/cosmos/cosmos-sdk/types" ++ "github.com/ethereum/go-ethereum/common" ++ ethtypes "github.com/ethereum/go-ethereum/core/types" ++ "github.com/ethereum/go-ethereum/trie" ++) ++ ++type session struct { ++ ctx sdk.Context ++ key storetypes.StoreKey ++ p historical.Plugin ++} ++ ++func newSession(t *testing.T, height int64) session { ++ t.Helper() ++ ++ key := storetypes.NewKVStoreKey("historical_acceptance_evm") ++ db := dbm.NewMemDB() ++ logger := log.NewNopLogger() ++ ms := rootmulti.NewStore(db, logger, metrics.NewNoOpMetrics()) ++ ms.MountStoreWithDB(key, storetypes.StoreTypeIAVL, db) ++ if err := ms.LoadLatestVersion(); err != nil { ++ t.Fatalf("load multistore: %v", err) ++ } ++ ++ ctx := sdk.NewContext(ms, cometproto.Header{}, false, logger).WithBlockHeight(height) ++ p := historical.NewPlugin(polarparams.DefaultChainConfig, nil, nil, key) ++ return session{ctx: ctx, key: key, p: p} ++} ++ ++func initGenesis(t *testing.T, s session) *ethtypes.Block { ++ t.Helper() ++ ++ genesis := core.DefaultGenesis ++ genesis.Config = polarparams.DefaultChainConfig ++ if err := s.p.InitGenesis(s.ctx, genesis); err != nil { ++ t.Fatalf("init genesis: %v", err) ++ } ++ return genesis.ToBlock() ++} ++ ++func prepareAtHeight(s session, height int64) session { ++ s.ctx = s.ctx.WithBlockHeight(height) ++ s.p.Prepare(sdk.WrapSDKContext(s.ctx)) ++ return s ++} ++ ++func blockOneFixture() (*ethtypes.Block, *ethtypes.Transaction, ethtypes.Receipts) { ++ tx := ethtypes.NewTransaction( ++ 0, common.Address{0x1}, big.NewInt(1), 1000, big.NewInt(1), []byte{0x12}, ++ ) ++ receipts := ethtypes.Receipts{{ ++ Type: 2, ++ Status: 1, ++ CumulativeGasUsed: 500, ++ ContractAddress: common.Address{0x1}, ++ GasUsed: 500, ++ BlockNumber: big.NewInt(1), ++ }} ++ block := ethtypes.NewBlock( ++ ðtypes.Header{Number: big.NewInt(1), GasLimit: 1000}, ++ ethtypes.Transactions{tx}, ++ nil, ++ receipts, ++ trie.NewStackTrie(nil), ++ ) ++ return block, tx, receipts ++} ++ ++func emptyBlockFixture(number uint64) *ethtypes.Block { ++ return ethtypes.NewBlock( ++ ðtypes.Header{Number: new(big.Int).SetUint64(number), GasLimit: 1000}, ++ nil, ++ nil, ++ nil, ++ trie.NewStackTrie(nil), ++ ) ++} ++ ++func storeBlockOne(t *testing.T, s session) (*ethtypes.Block, *ethtypes.Transaction, ethtypes.Receipts) { ++ t.Helper() ++ ++ block, tx, receipts := blockOneFixture() ++ if err := s.p.StoreBlock(block); err != nil { ++ t.Fatalf("store block: %v", err) ++ } ++ if err := s.p.StoreReceipts(block.Hash(), receipts); err != nil { ++ t.Fatalf("store receipts: %v", err) ++ } ++ if err := s.p.StoreTransactions(1, block.Hash(), block.Transactions()); err != nil { ++ t.Fatalf("store transactions: %v", err) ++ } ++ return block, tx, receipts ++} ++ ++func TestGenesisBlockReadableByNumberAndHash(t *testing.T) { ++ ++ ++ s := newSession(t, 0) ++ genesisBlock := initGenesis(t, s) ++ genesisHash := genesisBlock.Hash() ++ ++ blockByNumber, err := s.p.GetBlockByNumber(0) ++ if err != nil { ++ t.Fatalf("get genesis by number: %v", err) ++ } ++ if got := blockByNumber.NumberU64(); got != 0 { ++ t.Fatalf("genesis number = %d, want 0", got) ++ } ++ ++ if got := blockByNumber.Hash(); got != genesisHash { ++ t.Fatalf("genesis hash by number = %s, want %s", got.Hex(), genesisHash.Hex()) ++ } ++ ++ blockByHash, err := s.p.GetBlockByHash(genesisHash) ++ if err != nil { ++ t.Fatalf("get genesis by hash: %v", err) ++ } ++ ++ if got := blockByHash.Hash(); got != genesisHash { ++ t.Fatalf("genesis hash by hash = %s, want %s", got.Hex(), genesisHash.Hex()) ++ } ++} ++ ++func TestPreparedSessionStoresAndReadsBlockReceiptsAndTransaction(t *testing.T) { ++ ++ ++ s := newSession(t, 0) ++ initGenesis(t, s) ++ s = prepareAtHeight(s, 1) ++ ++ ++ block, tx, storedReceipts := storeBlockOne(t, s) ++ blockHash := block.Hash() ++ txHash := tx.Hash() ++ ++ blockByNumber, err := s.p.GetBlockByNumber(1) ++ if err != nil { ++ t.Fatalf("get block 1 by number: %v", err) ++ } ++ if got := blockByNumber.NumberU64(); got != 1 { ++ t.Fatalf("block number = %d, want 1", got) ++ } ++ ++ if got := blockByNumber.Hash(); got != blockHash { ++ t.Fatalf("block hash by number = %s, want %s", got.Hex(), blockHash.Hex()) ++ } ++ if got := len(blockByNumber.Transactions()); got != 1 { ++ t.Fatalf("transaction count = %d, want 1", got) ++ } ++ ++ blockByHash, err := s.p.GetBlockByHash(blockHash) ++ if err != nil { ++ t.Fatalf("get block 1 by hash: %v", err) ++ } ++ ++ if got := blockByHash.Hash(); got != blockHash { ++ t.Fatalf("block hash by hash = %s, want %s", got.Hex(), blockHash.Hex()) ++ } ++ if got := blockByHash.NumberU64(); got != 1 { ++ t.Fatalf("block number by hash = %d, want 1", got) ++ } ++ ++ entry, err := s.p.GetTransactionByHash(txHash) ++ if err != nil { ++ t.Fatalf("get tx lookup entry: %v", err) ++ } ++ ++ if got := entry.Tx.Hash(); got != txHash { ++ t.Fatalf("lookup tx hash = %s, want %s", got.Hex(), txHash.Hex()) ++ } ++ if got := entry.TxIndex; got != 0 { ++ t.Fatalf("lookup tx index = %d, want 0", got) ++ } ++ if got := entry.BlockNum; got != 1 { ++ t.Fatalf("lookup block num = %d, want 1", got) ++ } ++ if got := entry.BlockHash; got != blockHash { ++ t.Fatalf("lookup block hash = %s, want %s", got.Hex(), blockHash.Hex()) ++ } ++ ++ receipts, err := s.p.GetReceiptsByHash(blockHash) ++ if err != nil { ++ t.Fatalf("get receipts: %v", err) ++ } ++ if got := len(receipts); got != 1 { ++ t.Fatalf("receipt count = %d, want 1", got) ++ } ++ r := receipts[0] ++ storedReceipt := storedReceipts[0] ++ ++ if got, want := r.Type, tx.Type(); got != want { ++ t.Fatalf("derived receipt type = %d, want %d", got, want) ++ } ++ if got, want := r.Status, storedReceipt.Status; got != want { ++ t.Fatalf("derived receipt status = %d, want %d", got, want) ++ } ++ if got, want := r.CumulativeGasUsed, storedReceipt.CumulativeGasUsed; got != want { ++ t.Fatalf("derived cumulative gas = %d, want %d", got, want) ++ } ++ if got, want := r.GasUsed, storedReceipt.GasUsed; got != want { ++ t.Fatalf("derived gas used = %d, want %d", got, want) ++ } ++ ++ if got := r.TxHash; got != txHash { ++ t.Fatalf("derived receipt tx hash = %s, want %s", got.Hex(), txHash.Hex()) ++ } ++ ++ if got := r.BlockHash; got != blockHash { ++ t.Fatalf("derived receipt block hash = %s, want %s", got.Hex(), blockHash.Hex()) ++ } ++ if got, want := r.BlockNumber.Uint64(), block.NumberU64(); got != want { ++ t.Fatalf("derived receipt block number = %d, want %d", got, want) ++ } ++ if got := r.TransactionIndex; got != 0 { ++ t.Fatalf("derived receipt tx index = %d, want 0", got) ++ } ++ if got, want := r.ContractAddress, (common.Address{}); got != want { ++ t.Fatalf("derived contract address = %s, want %s", got.Hex(), want.Hex()) ++ } ++ ++ ++ blockTwo := emptyBlockFixture(2) ++ if err := s.p.StoreBlock(blockTwo); err != nil { ++ t.Fatalf("store in-sequence block 2: %v", err) ++ } ++ blockTwoByNumber, err := s.p.GetBlockByNumber(2) ++ if err != nil { ++ t.Fatalf("get block 2 by number: %v", err) ++ } ++ if got := blockTwoByNumber.Hash(); got != blockTwo.Hash() { ++ t.Fatalf("block 2 hash by number = %s, want %s", got.Hex(), blockTwo.Hash().Hex()) ++ } ++} ++ ++func TestUnknownLookupErrorsAreSpecificSentinels(t *testing.T) { ++ ++ ++ s := newSession(t, 0) ++ initGenesis(t, s) ++ s = prepareAtHeight(s, 1) ++ storeBlockOne(t, s) ++ ++ _, blockErr := s.p.GetBlockByHash(common.HexToHash("0x99")) ++ ++ if !errors.Is(blockErr, core.ErrBlockNotFound) { ++ t.Fatalf("unknown block error = %v, want core.ErrBlockNotFound", blockErr) ++ } ++ ++ _, txErr := s.p.GetTransactionByHash(common.HexToHash("0x88")) ++ ++ if !errors.Is(txErr, core.ErrTxNotFound) { ++ t.Fatalf("unknown tx error = %v, want core.ErrTxNotFound", txErr) ++ } ++} ++ ++func TestReceiptsReportMissingReceiptAndMissingBlockErrors(t *testing.T) { ++ ++ ++ s := newSession(t, 0) ++ initGenesis(t, s) ++ s = prepareAtHeight(s, 1) ++ ++ _, missingErr := s.p.GetReceiptsByHash(common.HexToHash("0x99")) ++ ++ if missingErr == nil { ++ t.Fatal("missing receipts error = nil, want non-nil error") ++ } ++ ++ _, _, receipts := blockOneFixture() ++ orphanHash := common.HexToHash("0x77") ++ if err := s.p.StoreReceipts(orphanHash, receipts); err != nil { ++ t.Fatalf("store orphan receipts: %v", err) ++ } ++ _, orphanErr := s.p.GetReceiptsByHash(orphanHash) ++ ++ if !errors.Is(orphanErr, core.ErrBlockNotFound) { ++ t.Fatalf("orphan receipt error = %v, want core.ErrBlockNotFound", orphanErr) ++ } ++} ++ ++func TestStoreBlockPanicsForOutOfSequenceNonGenesisWrite(t *testing.T) { ++ ++ ++ s := newSession(t, 0) ++ initGenesis(t, s) ++ s = prepareAtHeight(s, 2) ++ ++ blockTwo := emptyBlockFixture(2) ++ ++ defer func() { ++ r := recover() ++ ++ if r == nil { ++ t.Fatal("StoreBlock panic = nil, want out-of-sequence panic") ++ } ++ }() ++ ++ _ = s.p.StoreBlock(blockTwo) ++} ++ ++func TestIndependentPluginInstancesKeepSeparateHistoricalState(t *testing.T) { ++ ++ ++ a := newSession(t, 0) ++ b := newSession(t, 0) ++ initGenesis(t, a) ++ initGenesis(t, b) ++ a = prepareAtHeight(a, 1) ++ b = prepareAtHeight(b, 1) ++ ++ block, _, _ := storeBlockOne(t, a) ++ blockHash := block.Hash() ++ ++ aBlock, err := a.p.GetBlockByHash(blockHash) ++ if err != nil { ++ t.Fatalf("get a block 1: %v", err) ++ } ++ ++ if got := aBlock.Hash(); got != blockHash { ++ t.Fatalf("a block hash = %s, want %s", got.Hex(), blockHash.Hex()) ++ } ++ ++ _, bErr := b.p.GetBlockByHash(blockHash) ++ if !errors.Is(bErr, core.ErrBlockNotFound) { ++ t.Fatalf("b block 1 error = %v, want core.ErrBlockNotFound", bErr) ++ } ++ bGenesis, err := b.p.GetBlockByNumber(0) ++ if err != nil { ++ t.Fatalf("get b genesis: %v", err) ++ } ++ expectedBGenesis := core.DefaultGenesis ++ expectedBGenesis.Config = polarparams.DefaultChainConfig ++ ++ if got, want := bGenesis.Hash(), expectedBGenesis.ToBlock().Hash(); got != want { ++ t.Fatalf("b genesis hash = %s, want %s", got.Hex(), want.Hex()) ++ } ++ ++ ++ storeBlockOne(t, b) ++} ++ ++func TestRepeatedPrepareWithSameContextIsIdempotent(t *testing.T) { ++ ++ ++ s := newSession(t, 0) ++ initGenesis(t, s) ++ s = prepareAtHeight(s, 1) ++ block, _, _ := storeBlockOne(t, s) ++ blockHash := block.Hash() ++ ++ s.p.Prepare(sdk.WrapSDKContext(s.ctx)) ++ s.p.Prepare(sdk.WrapSDKContext(s.ctx)) ++ ++ block, err := s.p.GetBlockByHash(blockHash) ++ if err != nil { ++ t.Fatalf("get block after repeated prepare: %v", err) ++ } ++ ++ if got := block.Hash(); got != blockHash { ++ t.Fatalf("block hash after repeated prepare = %s, want %s", got.Hex(), blockHash.Hex()) ++ } ++} ++ ++func TestStoreBlockUpdatesSequenceThroughSequentialWrites(t *testing.T) { ++ ++ ++ s := newSession(t, 0) ++ initGenesis(t, s) ++ s = prepareAtHeight(s, 1) ++ ++ blockOne, _, _ := blockOneFixture() ++ if err := s.p.StoreBlock(blockOne); err != nil { ++ t.Fatalf("store block 1: %v", err) ++ } ++ ++ ++ blockTwo := emptyBlockFixture(2) ++ if err := s.p.StoreBlock(blockTwo); err != nil { ++ t.Fatalf("store block 2 after block 1: %v", err) ++ } ++ ++ blockTwoByNumber, err := s.p.GetBlockByNumber(2) ++ if err != nil { ++ t.Fatalf("get block 2 by number: %v", err) ++ } ++ if got := blockTwoByNumber.Hash(); got != blockTwo.Hash() { ++ t.Fatalf("block 2 by number hash = %s, want %s", got.Hex(), blockTwo.Hash().Hex()) ++ } ++ ++ blockTwoByHash, err := s.p.GetBlockByHash(blockTwo.Hash()) ++ if err != nil { ++ t.Fatalf("get block 2 by hash: %v", err) ++ } ++ if got := blockTwoByHash.NumberU64(); got != 2 { ++ t.Fatalf("block 2 by hash number = %d, want 2", got) ++ } ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,24 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++ ++ ++set -euo pipefail ++ ++cd /workspace/repo/usercase-test-coderl ++ ++export GOWORK=off ++export GOPROXY=off ++export GOSUMDB=off ++export GOTOOLCHAIN=local ++export GOFLAGS="${GOFLAGS:-} -mod=readonly" ++ ++exec go test -v -count=1 . diff --git a/tasks/format-code-task-000555/tests/test.sh b/tasks/format-code-task-000555/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..bc5252a69e5104f595cf9b975a323f241bf2e791 --- /dev/null +++ b/tasks/format-code-task-000555/tests/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/go.mod +usercase-test-coderl/go.sum +usercase-test-coderl/historical_plugin_test.go +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000555/tests/test_command.sh b/tasks/format-code-task-000555/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-000555/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000563/environment/Dockerfile b/tasks/format-code-task-000563/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..c8f74d16ef071d021ed3c41d193ba70730dbcb02 --- /dev/null +++ b/tasks/format-code-task-000563/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:6e236d66a62aab63af3c75af426b0c4c2b10fa4855b9634415b313d84e6c9bae diff --git a/tasks/format-code-task-000563/environment/setup/files/blocklist b/tasks/format-code-task-000563/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000563/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000563/environment/setup/setup.sh b/tasks/format-code-task-000563/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000563/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000563/tests/test.patch b/tasks/format-code-task-000563/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..844ab4c93ccb9b8ff48b491bfa8239fe47d1b60a --- /dev/null +++ b/tasks/format-code-task-000563/tests/test.patch @@ -0,0 +1,404 @@ +diff --git a/test/lib/transports/ws2-lossless-ob.js b/test/lib/transports/ws2-lossless-ob.js +new file mode 100644 +index 0000000..422fb5d +--- /dev/null ++++ b/test/lib/transports/ws2-lossless-ob.js +@@ -0,0 +1,374 @@ ++/* eslint-env mocha */ ++'use strict' ++ ++const assert = require('assert') ++const CRC = require('crc-32') ++const http = require('http') ++const WebSocket = require('ws') ++const WSv2 = require('../../../lib/transports/ws2') ++ ++function makeChecksum (entries) { ++ const bids = entries ++ .filter(e => e.amount[0] !== '-') ++ .sort((a, b) => Number(b.price) - Number(a.price)) ++ const asks = entries ++ .filter(e => e.amount[0] === '-') ++ .sort((a, b) => Number(a.price) - Number(b.price)) ++ ++ const parts = [] ++ ++ for (let i = 0; i < 25; i += 1) { ++ if (bids[i]) parts.push(bids[i].price, bids[i].amount) ++ if (asks[i]) parts.push(asks[i].price, asks[i].amount) ++ } ++ ++ return CRC.str(parts.join(':')) ++} ++ ++function findEntry (ob, price) { ++ return ob.bids.concat(ob.asks).find((entry) => { ++ return entryPrice(entry) === price ++ }) ++} ++ ++function entryPrice (entry) { ++ if (Array.isArray(entry)) { ++ return entry[0] ++ } ++ ++ return Object.prototype.hasOwnProperty.call(entry, 'price') ++ ? entry.price ++ : entry.rate ++} ++ ++function entryAmount (entry) { ++ return Array.isArray(entry) ? entry[2] : entry.amount ++} ++ ++function waitForEvent (emitter, eventName) { ++ return new Promise((resolve) => { ++ emitter.once(eventName, resolve) ++ }) ++} ++ ++function sendAndWaitForOB (stream, packetJSON) { ++ const nextOB = waitForEvent(stream.ws, 'orderbook') ++ stream.serverClient.send(packetJSON) ++ return nextOB ++} ++ ++function sendAndWaitForChecksum (stream, packetJSON) { ++ const nextCS = waitForEvent(stream.ws, 'cs') ++ stream.serverClient.send(packetJSON) ++ return nextCS ++} ++ ++function delay (ms) { ++ return new Promise(resolve => setTimeout(resolve, ms)) ++} ++ ++async function closeStream (stream) { ++ if (!stream) return ++ ++ if (stream.ws && stream.ws.isOpen()) { ++ try { ++ await stream.ws.close() ++ } catch (e) {} ++ } ++ ++ if (stream.wss) { ++ await new Promise((resolve) => stream.wss.close(resolve)) ++ } ++ ++ if (stream.server) { ++ await new Promise((resolve) => stream.server.close(resolve)) ++ } ++} ++ ++function openBookStream (opts = {}) { ++ const { ++ manageOrderBooks = true, ++ symbol = 'tETHBTC', ++ prec = 'P0' ++ } = opts ++ ++ return new Promise((resolve, reject) => { ++ const server = http.createServer() ++ const wss = new WebSocket.Server({ server }) ++ ++ server.listen(0, () => { ++ const { port } = server.address() ++ const ws = new WSv2({ ++ manageOrderBooks, ++ url: `ws://127.0.0.1:${port}` ++ }) ++ let serverClient = null ++ let settled = false ++ ++ const fail = (err) => { ++ if (settled) return ++ settled = true ++ closeStream({ ws, wss, server }).then(() => reject(err)) ++ } ++ ++ wss.on('connection', (client) => { ++ serverClient = client ++ client.send(JSON.stringify({ event: 'info', version: 2 })) ++ client.on('message', (packetJSON) => { ++ const msg = JSON.parse(packetJSON) ++ ++ if (msg.event === 'subscribe' && msg.channel === 'book') { ++ client.send(JSON.stringify({ ++ event: 'subscribed', ++ chanId: 42, ++ channel: 'book', ++ symbol: msg.symbol, ++ prec: msg.prec, ++ len: msg.len ++ })) ++ } ++ }) ++ }) ++ ++ ws.once('open', () => { ++ ws.subscribeOrderBook(symbol, prec, '25') ++ }) ++ ++ ws.once('subscribed', () => { ++ settled = true ++ resolve({ ws, wss, server, serverClient }) ++ }) ++ ++ ws.once('error', fail) ++ ws.open().catch(fail) ++ }) ++ }) ++} ++ ++describe('WSv2 managed lossless order books', () => { ++ it('returns_lossless_order_book_entries_as_original_strings_after_managed_snapshot', async () => { ++ const stream = await openBookStream({ symbol: 'tETHBTC' }) ++ ++ try { ++ await sendAndWaitForOB( ++ stream, ++ '[42,[[0.00001000,1,2.50000000],[0.00001010,1,-3.75000000]]]' ++ ) ++ ++ const ob = stream.ws.getLosslessOB('tETHBTC') ++ assert(ob, 'expected a managed lossless order book') ++ ++ const bid = findEntry(ob, '0.00001000') ++ const ask = findEntry(ob, '0.00001010') ++ ++ assert(bid, 'expected bid entry to be readable by its original string price') ++ assert(ask, 'expected ask entry to be readable by its original string price') ++ assert.strictEqual(entryPrice(bid), '0.00001000') ++ assert.strictEqual(entryAmount(bid), '2.50000000') ++ assert.strictEqual(entryPrice(ask), '0.00001010') ++ assert.strictEqual(entryAmount(ask), '-3.75000000') ++ } finally { ++ await closeStream(stream) ++ } ++ }) ++ ++ it('keeps_lossless_order_book_updated_after_incremental_updates', async () => { ++ const stream = await openBookStream({ symbol: 'tLTCBTC' }) ++ ++ try { ++ await sendAndWaitForOB( ++ stream, ++ '[42,[[0.00002000,1,4.00000000],[0.00002010,1,-5.00000000]]]' ++ ) ++ await sendAndWaitForOB(stream, '[42,[0.00001990,1,1.23000000]]') ++ await sendAndWaitForOB(stream, '[42,[0.00002010,0,-1]]') ++ ++ const ob = stream.ws.getLosslessOB('tLTCBTC') ++ assert(ob, 'expected a managed lossless order book after updates') ++ ++ const addedBid = findEntry(ob, '0.00001990') ++ const deletedAsk = findEntry(ob, '0.00002010') ++ ++ assert(addedBid, 'expected incremental bid to be present') ++ assert.strictEqual(entryPrice(addedBid), '0.00001990') ++ assert.strictEqual(entryAmount(addedBid), '1.23000000') ++ assert.strictEqual(deletedAsk, undefined) ++ } finally { ++ await closeStream(stream) ++ } ++ }) ++ ++ it('returns_null_when_lossless_order_book_is_not_available', async () => { ++ const managedStream = await openBookStream({ symbol: 'tETHBTC' }) ++ ++ try { ++ assert.strictEqual(managedStream.ws.getLosslessOB('tUNKNOWN'), null) ++ assert.strictEqual(managedStream.ws.getLosslessOB('tETHBTC'), null) ++ } finally { ++ await closeStream(managedStream) ++ } ++ ++ const unmanagedStream = await openBookStream({ ++ manageOrderBooks: false, ++ symbol: 'tETHBTC' ++ }) ++ ++ try { ++ await sendAndWaitForOB( ++ unmanagedStream, ++ '[42,[[0.00001000,1,2.50000000]]]' ++ ) ++ assert.strictEqual(unmanagedStream.ws.getLosslessOB('tETHBTC'), null) ++ } finally { ++ await closeStream(unmanagedStream) ++ } ++ }) ++ ++ it('does_not_emit_checksum_error_for_precision_sensitive_valid_order_book', async () => { ++ const stream = await openBookStream({ symbol: 'tXRPBTC' }) ++ const errors = [] ++ ++ stream.ws.on('error', (err) => { ++ errors.push(err) ++ }) ++ ++ try { ++ const rawEntries = [ ++ { price: '0.00001000', amount: '2.50000000' }, ++ { price: '0.00001010', amount: '-3.75000000' } ++ ] ++ const checksum = makeChecksum(rawEntries) ++ ++ await sendAndWaitForOB( ++ stream, ++ '[42,[[0.00001000,1,2.50000000],[0.00001010,1,-3.75000000]]]' ++ ) ++ await sendAndWaitForChecksum(stream, `[42,"cs",${checksum}]`) ++ await delay(10) ++ ++ assert.deepStrictEqual(errors, []) ++ assert(stream.ws.getLosslessOB('tXRPBTC'), 'expected order book to still be managed') ++ } finally { ++ await closeStream(stream) ++ } ++ }) ++ ++ it('rejects_invalid_checksum_for_same_precision_sensitive_book', async () => { ++ const stream = await openBookStream({ symbol: 'tXRPBTC' }) ++ const errors = [] ++ ++ stream.ws.on('error', (err) => { ++ errors.push(err) ++ }) ++ ++ try { ++ const rawEntries = [ ++ { price: '0.00001000', amount: '2.50000000' }, ++ { price: '0.00001010', amount: '-3.75000000' } ++ ] ++ const invalidChecksum = makeChecksum(rawEntries) + 1 ++ ++ await sendAndWaitForOB( ++ stream, ++ '[42,[[0.00001000,1,2.50000000],[0.00001010,1,-3.75000000]]]' ++ ) ++ await sendAndWaitForChecksum(stream, `[42,"cs",${invalidChecksum}]`) ++ await delay(10) ++ ++ assert.strictEqual(errors.length, 1) ++ } finally { ++ await closeStream(stream) ++ } ++ }) ++ ++ it('handles_non_fixture_symbol_depth_and_checksum_with_exact_strings', async () => { ++ const stream = await openBookStream({ symbol: 'tDOGEBTC' }) ++ const errors = [] ++ ++ stream.ws.on('error', (err) => { ++ errors.push(err) ++ }) ++ ++ try { ++ const rawEntries = [ ++ { price: '0.00003000', amount: '7.50000000' }, ++ { price: '0.00002990', amount: '1.12500000' }, ++ { price: '0.00003010', amount: '-8.25000000' } ++ ] ++ const checksum = makeChecksum(rawEntries) ++ ++ await sendAndWaitForOB( ++ stream, ++ '[42,[[0.00003000,1,7.50000000],[0.00002990,1,1.12500000],[0.00003010,1,-8.25000000]]]' ++ ) ++ ++ const ob = stream.ws.getLosslessOB('tDOGEBTC') ++ assert(ob, 'expected lossless book for non-fixture symbol') ++ ++ const firstBid = findEntry(ob, '0.00003000') ++ const secondBid = findEntry(ob, '0.00002990') ++ const ask = findEntry(ob, '0.00003010') ++ ++ assert(firstBid, 'expected first bid with exact raw string price') ++ assert(secondBid, 'expected second bid beyond two-level happy path') ++ assert(ask, 'expected ask with exact raw string price') ++ assert.strictEqual(entryAmount(firstBid), '7.50000000') ++ assert.strictEqual(entryAmount(secondBid), '1.12500000') ++ assert.strictEqual(entryAmount(ask), '-8.25000000') ++ ++ await sendAndWaitForChecksum(stream, `[42,"cs",${checksum}]`) ++ await delay(10) ++ ++ assert.deepStrictEqual(errors, []) ++ } finally { ++ await closeStream(stream) ++ } ++ }) ++ ++ it('returns_null_for_unavailable_funding_and_unknown_after_other_book', async () => { ++ const fundingStream = await openBookStream({ symbol: 'fUSD' }) ++ ++ try { ++ assert.strictEqual(fundingStream.ws.getLosslessOB('fUSD'), null) ++ } finally { ++ await closeStream(fundingStream) ++ } ++ ++ const stream = await openBookStream({ symbol: 'tETHBTC' }) ++ ++ try { ++ await sendAndWaitForOB( ++ stream, ++ '[42,[[0.00001000,1,2.50000000]]]' ++ ) ++ assert.strictEqual(stream.ws.getLosslessOB('tUNSEEN'), null) ++ } finally { ++ await closeStream(stream) ++ } ++ }) ++ ++ it('preserves_existing_numeric_get_ob_view', async () => { ++ const stream = await openBookStream({ symbol: 'tETHBTC' }) ++ ++ try { ++ await sendAndWaitForOB( ++ stream, ++ '[42,[[0.00001000,1,2.50000000],[0.00001010,1,-3.75000000]]]' ++ ) ++ ++ const numericOB = stream.ws.getOB('tETHBTC') ++ const losslessOB = stream.ws.getLosslessOB('tETHBTC') ++ const numericBid = findEntry(numericOB, 0.00001) ++ const losslessBid = findEntry(losslessOB, '0.00001000') ++ ++ assert(numericBid, 'expected numeric getOB entry') ++ assert(losslessBid, 'expected lossless getLosslessOB entry') ++ assert.strictEqual(typeof entryPrice(numericBid), 'number') ++ assert.strictEqual(typeof entryAmount(numericBid), 'number') ++ assert.strictEqual(entryPrice(losslessBid), '0.00001000') ++ assert.strictEqual(entryAmount(losslessBid), '2.50000000') ++ } finally { ++ await closeStream(stream) ++ } ++ }) ++}) +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,19 @@ ++#!/bin/bash ++set -euo pipefail ++cd /testbed ++ ++ ++npm install --silent ++ ++case "${1:-}" in ++ base) ++ NODE_ENV=test npx mocha -b test/lib/transports/ws2-unit.js --grep '_handleOBMessage|_updateManagedOB' --invert ++ ;; ++ new) ++ NODE_ENV=test npx mocha -b test/lib/transports/ws2-lossless-ob.js ++ ;; ++ *) ++ echo "usage: $0 base|new" ++ exit 2 ++ ;; ++esac diff --git a/tasks/format-code-task-000563/tests/test.sh b/tasks/format-code-task-000563/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..714766e80c11ed467ea30372cac3ce649eab28ee --- /dev/null +++ b/tasks/format-code-task-000563/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test/lib/transports/ws2-lossless-ob.js +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000563/tests/test_command.sh b/tasks/format-code-task-000563/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..e8d2f32b64045b5a5a56e0ad5667da87d8e0bc2a --- /dev/null +++ b/tasks/format-code-task-000563/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new \ No newline at end of file diff --git a/tasks/format-code-task-000564/environment/Dockerfile b/tasks/format-code-task-000564/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..4ce00884e0b77d3e84168ec7638858365673fcf7 --- /dev/null +++ b/tasks/format-code-task-000564/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:4f2847f415ddff59604fe4b2e0cc032874cbb7d28108ff9fb3039b33b3624fdf diff --git a/tasks/format-code-task-000564/environment/setup/files/blocklist b/tasks/format-code-task-000564/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000564/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000564/environment/setup/setup.sh b/tasks/format-code-task-000564/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000564/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000564/tests/test.patch b/tasks/format-code-task-000564/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..84db71cdaabd0809e4698c11409205507a428443 --- /dev/null +++ b/tasks/format-code-task-000564/tests/test.patch @@ -0,0 +1,132 @@ +diff --git a/simplejson_test.go b/simplejson_test.go +index 4832c76..5a11156 100644 +--- a/simplejson_test.go ++++ b/simplejson_test.go +@@ -135,3 +135,101 @@ func TestStdlibInterfaces(t *testing.T) { + assert.Equal(t, nil, json.Unmarshal(p, val2)) + assert.Equal(t, val, val2) // stable + } ++ ++func TestSet(t *testing.T) { ++ js, err := NewJson([]byte(`{}`)) ++ assert.Equal(t, nil, err) ++ ++ js.Set("baz", "bing") ++ ++ s, err := js.GetPath("baz").String() ++ assert.Equal(t, nil, err) ++ assert.Equal(t, "bing", s) ++} ++ ++func TestReplace(t *testing.T) { ++ js, err := NewJson([]byte(`{}`)) ++ assert.Equal(t, nil, err) ++ ++ err = js.UnmarshalJSON([]byte(`{"baz":"bing"}`)) ++ assert.Equal(t, nil, err) ++ ++ s, err := js.GetPath("baz").String() ++ assert.Equal(t, nil, err) ++ assert.Equal(t, "bing", s) ++} ++ ++func TestSetPath(t *testing.T) { ++ js, err := NewJson([]byte(`{}`)) ++ assert.Equal(t, nil, err) ++ ++ js.SetPath([]string{"foo", "bar"}, "baz") ++ ++ s, err := js.GetPath("foo", "bar").String() ++ assert.Equal(t, nil, err) ++ assert.Equal(t, "baz", s) ++} ++ ++func TestSetPathNoPath(t *testing.T) { ++ js, err := NewJson([]byte(`{"some":"data","some_number":1.0,"some_bool":false}`)) ++ assert.Equal(t, nil, err) ++ ++ f := js.GetPath("some_number").MustFloat64(99.0) ++ assert.Equal(t, f, 1.0) ++ ++ js.SetPath([]string{}, map[string]interface{}{"foo": "bar"}) ++ ++ s, err := js.GetPath("foo").String() ++ assert.Equal(t, nil, err) ++ assert.Equal(t, "bar", s) ++ ++ f = js.GetPath("some_number").MustFloat64(99.0) ++ assert.Equal(t, f, 99.0) ++} ++ ++func TestPathWillAugmentExisting(t *testing.T) { ++ js, err := NewJson([]byte(`{"this":{"a":"aa","b":"bb","c":"cc"}}`)) ++ assert.Equal(t, nil, err) ++ ++ js.SetPath([]string{"this", "d"}, "dd") ++ ++ cases := []struct { ++ path []string ++ outcome string ++ }{ ++ { ++ path: []string{"this", "a"}, ++ outcome: "aa", ++ }, ++ { ++ path: []string{"this", "b"}, ++ outcome: "bb", ++ }, ++ { ++ path: []string{"this", "c"}, ++ outcome: "cc", ++ }, ++ { ++ path: []string{"this", "d"}, ++ outcome: "dd", ++ }, ++ } ++ ++ for _, tc := range cases { ++ s, err := js.GetPath(tc.path...).String() ++ assert.Equal(t, nil, err) ++ assert.Equal(t, tc.outcome, s) ++ } ++} ++ ++func TestPathWillOverwriteExisting(t *testing.T) { ++ ++ js, err := NewJson([]byte(`{"this":{"a":0.1,"b":"bb","c":"cc"}}`)) ++ assert.Equal(t, nil, err) ++ ++ js.SetPath([]string{"this", "a", "foo"}, "bar") ++ ++ s, err := js.GetPath("this", "a", "foo").String() ++ assert.Equal(t, nil, err) ++ assert.Equal(t, "bar", s) ++} +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,10 @@ ++H4sIAAAAAAAAA+2U227TQBCGc+2nmKbc2q4TkkqgICFABamoiMMVQpFjj2M3611rdxzVPD3jpE1K ++VRwStQLEfDfrw+z8/+zObjCrC5VOUS/D3mNxwpyORquRuTuunqPRIIrGw+Eg4jh+4k8wejRHt6gd ++xRagZ42hrrhd//9Rgu3+EzqaJqYsY50GLn84jR37PxiMh5v955H3/+k4Ou3BycNZ+DX/+f4fH4Wz ++Qoez2OVeksKqCWaYet4xfEKCuoKziw8vP7+FzFigvHBQWfRLk9YKHZwZfjWXmJCHV5WxdB09Cams ++wrmpYsq3f6Ioen/x+sv5m4nJslbhlcWY8EYhLSwnMrYBR7ZOqLYI3IrgmlIVesHquFErFxwNfgX9 ++J+vZobNJOC8or2cB9zAXRarpe0UGX+EI/PPuQLbqu6KsFF46o/vw7Xmrpj1glAbfZZuV2SuRlxVt ++ne80N5lS0KaAFCvUKeqk4AVkf9oQxIpXIm3atXWoaWO7Q60svqONdRPGzqGlnz1zICTKaATfZz3K ++IYKcqHLPwq4kQTvv9xUHL8IUl6GulWoL3W16YUOukKg5yO1mdqfNWxqH+CO8Omwtr+fu8rbOv7cz ++a+YVVhW2/VVoQqtjdZDN+xJ1er5f+U4B3OMfaw03Pc59rWF7DKbtt2Bu2gtmr9MzN+sj4y/BT0yt ++aRJB4P3pK1MQBEEQBEEQBEEQBEEQBEEQBEEQBEEQ/jp+AOvZrcIAKAAA +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-000564/tests/test.sh b/tasks/format-code-task-000564/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..9a49735867a2f2cbe786933d1082f3b017f35c5f --- /dev/null +++ b/tasks/format-code-task-000564/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +simplejson_test.go +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000564/tests/test_command.sh b/tasks/format-code-task-000564/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000564/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000590/environment/Dockerfile b/tasks/format-code-task-000590/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..370228c6ed79c683badc87950785215564938b5f --- /dev/null +++ b/tasks/format-code-task-000590/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:d4f1da048710c82bf6bca28783b01edb74b531cb0baef1ed75b54be7eff3ec10 diff --git a/tasks/format-code-task-000590/environment/setup/files/blocklist b/tasks/format-code-task-000590/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000590/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000590/environment/setup/setup.sh b/tasks/format-code-task-000590/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-000590/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000590/tests/test.patch b/tasks/format-code-task-000590/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..4820d37db4852027157e1e20018ac0022e769f49 --- /dev/null +++ b/tasks/format-code-task-000590/tests/test.patch @@ -0,0 +1,303 @@ +diff --git a/usercase-test-coderl/fixtures/bad/eval-error.lisp b/usercase-test-coderl/fixtures/bad/eval-error.lisp +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/fixtures/bad/eval-error.lisp +@@ -0,0 +1,1 @@ ++(+ missing-symbol 2) +diff --git a/usercase-test-coderl/fixtures/bad/parse-error.lisp b/usercase-test-coderl/fixtures/bad/parse-error.lisp +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/fixtures/bad/parse-error.lisp +@@ -0,0 +1,1 @@ ++(+ 1 2 +diff --git a/usercase-test-coderl/fixtures/testdata/evaluated-name.lisp b/usercase-test-coderl/fixtures/testdata/evaluated-name.lisp +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/fixtures/testdata/evaluated-name.lisp +@@ -0,0 +1,1 @@ ++(+ 10 5) +diff --git a/usercase-test-coderl/fixtures/testdata/load-example.lisp b/usercase-test-coderl/fixtures/testdata/load-example.lisp +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/fixtures/testdata/load-example.lisp +@@ -0,0 +1,1 @@ ++(+ 1 1) +diff --git a/usercase-test-coderl/fixtures/testdata/load-path/load-path-example.lisp b/usercase-test-coderl/fixtures/testdata/load-path/load-path-example.lisp +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/fixtures/testdata/load-path/load-path-example.lisp +@@ -0,0 +1,1 @@ ++(+ 1 1) +diff --git a/usercase-test-coderl/fixtures/testdata/stateful-define.lisp b/usercase-test-coderl/fixtures/testdata/stateful-define.lisp +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/fixtures/testdata/stateful-define.lisp +@@ -0,0 +1,2 @@ ++(define loaded-value 41) ++(+ loaded-value 1) +diff --git a/usercase-test-coderl/load_builtin_test.go b/usercase-test-coderl/load_builtin_test.go +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/load_builtin_test.go +@@ -0,0 +1,234 @@ ++package usercase_test_coderl ++ ++import ( ++ "bytes" ++ "fmt" ++ "os" ++ "path/filepath" ++ "runtime" ++ "strings" ++ "testing" ++ ++ "github.com/brettbuddin/shaden/lisp" ++ "github.com/brettbuddin/shaden/lisp/builtin" ++) ++ ++const fixtures = "/workspace/repo/usercase-test-coderl/fixtures" ++ ++ ++ ++ ++ ++ ++func newLoadedEnv(t *testing.T, loadPath ...string) *lisp.Environment { ++ t.Helper() ++ t.Setenv("SHADEN_LISP_PATH", strings.Join(loadPath, string(filepath.ListSeparator))) ++ env := lisp.NewEnvironment() ++ builtin.Load(env) ++ return env ++} ++ ++func evalSource(t *testing.T, env *lisp.Environment, source string) (any, error) { ++ t.Helper() ++ node, err := lisp.Parse(bytes.NewBufferString(source)) ++ if err != nil { ++ t.Fatalf("parse setup source: %v", err) ++ } ++ return env.Eval(node) ++} ++ ++func requireNoError(t *testing.T, err error) { ++ t.Helper() ++ if err != nil { ++ t.Fatalf("unexpected error: %v", err) ++ } ++} ++ ++func requireEqual(t *testing.T, want, got any) { ++ t.Helper() ++ if fmt.Sprintf("%#v", got) != fmt.Sprintf("%#v", want) { ++ t.Fatalf("got %#v, want %#v", got, want) ++ } ++} ++ ++ ++func requireErrorContains(t *testing.T, err error, parts ...string) { ++ t.Helper() ++ if err == nil { ++ t.Fatalf("got nil error, want error containing %q", parts) ++ } ++ message := err.Error() ++ for _, part := range parts { ++ if !strings.Contains(message, part) { ++ t.Fatalf("got error %q, want it to contain %q", message, part) ++ } ++ } ++} ++ ++func countOpenFDs(t *testing.T) int { ++ t.Helper() ++ entries, err := os.ReadDir("/proc/self/fd") ++ if err != nil { ++ t.Fatalf("count /proc/self/fd: %v", err) ++ } ++ return len(entries) ++} ++ ++func TestLoadPathInitializedFromEnvironment(t *testing.T) { ++ ++ ++ env := newLoadedEnv(t, fixtures+"/one", fixtures+"/two") ++ ++ got, err := env.GetSymbol("load-path") ++ requireNoError(t, err) ++ requireEqual(t, lisp.List{fixtures + "/one", fixtures + "/two"}, got) ++} ++ ++func TestLoadSearchesDefaultPathAndEvaluatesFileInSameEnvironment(t *testing.T) { ++ ++ ++ env := newLoadedEnv(t, fixtures+"/missing", fixtures) ++ ++ got, err := evalSource(t, env, `(load "testdata/load-example.lisp")`) ++ requireNoError(t, err) ++ requireEqual(t, 2, got) ++ ++ got, err = evalSource(t, env, `(load "testdata/stateful-define.lisp") loaded-value`) ++ requireNoError(t, err) ++ requireEqual(t, 41, got) ++} ++ ++func TestLoadUsesReplacedLoadPathForRelativeFiles(t *testing.T) { ++ ++ ++ env := newLoadedEnv(t, fixtures) ++ ++ got, err := evalSource(t, env, `(set! load-path (list "/workspace/repo/usercase-test-coderl/fixtures/testdata/load-path/")) (load "load-path-example.lisp")`) ++ requireNoError(t, err) ++ requireEqual(t, 2, got) ++ ++ loadPath, err := env.GetSymbol("load-path") ++ requireNoError(t, err) ++ requireEqual(t, lisp.List{"/workspace/repo/usercase-test-coderl/fixtures/testdata/load-path/"}, loadPath) ++} ++ ++func TestLoadEvaluatesPathArgumentBeforeOpening(t *testing.T) { ++ ++ ++ env := newLoadedEnv(t, fixtures) ++ ++ got, err := evalSource(t, env, `(define file-name "testdata/evaluated-name.lisp") (load file-name)`) ++ requireNoError(t, err) ++ requireEqual(t, 15, got) ++} ++ ++func TestLoadArgumentErrorsAreSpecific(t *testing.T) { ++ ++ ++ env := newLoadedEnv(t, fixtures) ++ ++ _, err := evalSource(t, env, `(load)`) ++ ++ requireErrorContains(t, err, "load", "1", "0") ++ ++ _, err = evalSource(t, env, `(load "a" "b")`) ++ ++ requireErrorContains(t, err, "load", "1", "2") ++ ++ _, err = evalSource(t, env, `(load 123)`) ++ ++ requireErrorContains(t, err, "load", "string") ++ ++ _, err = evalSource(t, env, `(load missing-path-symbol)`) ++ ++ requireErrorContains(t, err, "missing-path-symbol") ++ if strings.Contains(err.Error(), "load-path") { ++ t.Fatalf("got path lookup error %q, want evaluated argument failure before file lookup", err.Error()) ++ } ++} ++ ++func TestBuiltinLoadRegistersLoadForm(t *testing.T) { ++ ++ ++ t.Setenv("SHADEN_LISP_PATH", fixtures) ++ env := lisp.NewEnvironment() ++ builtin.Load(env) ++ ++ got, err := evalSource(t, env, `(load "testdata/load-example.lisp")`) ++ ++ requireNoError(t, err) ++ requireEqual(t, 2, got) ++} ++ ++func TestLoadMissingFileReportsPathAndLoadPath(t *testing.T) { ++ ++ ++ env := newLoadedEnv(t, fixtures) ++ ++ _, err := evalSource(t, env, `(load "testdata/doesntexist.lisp")`) ++ ++ requireErrorContains(t, err, "testdata/doesntexist.lisp", "load-path") ++} ++ ++func TestLoadParseAndEvaluationFailuresIncludeFileContext(t *testing.T) { ++ ++ ++ env := newLoadedEnv(t, fixtures+"/bad") ++ ++ _, err := evalSource(t, env, `(load "parse-error.lisp")`) ++ ++ requireErrorContains(t, err, "parse-error.lisp") ++ ++ _, err = evalSource(t, env, `(load "eval-error.lisp")`) ++ ++ requireErrorContains(t, err, "eval-error.lisp", "missing-symbol") ++} ++ ++func TestLoadPathStateIsIndependentAcrossEnvironments(t *testing.T) { ++ ++ ++ a := newLoadedEnv(t, fixtures) ++ b := newLoadedEnv(t, fixtures) ++ ++ got, err := evalSource(t, a, `(set! load-path (list "/workspace/repo/usercase-test-coderl/fixtures/testdata/load-path/")) (load "load-path-example.lisp")`) ++ requireNoError(t, err) ++ requireEqual(t, 2, got) ++ ++ aPath, err := a.GetSymbol("load-path") ++ requireNoError(t, err) ++ requireEqual(t, lisp.List{"/workspace/repo/usercase-test-coderl/fixtures/testdata/load-path/"}, aPath) ++ ++ bPath, err := b.GetSymbol("load-path") ++ requireNoError(t, err) ++ requireEqual(t, lisp.List{fixtures}, bPath) ++} ++ ++func TestLoadCanBeCalledRepeatedlyOnSameEnvironment(t *testing.T) { ++ ++ ++ env := newLoadedEnv(t, fixtures) ++ ++ got, err := evalSource(t, env, `(load "testdata/load-example.lisp") (load "testdata/load-example.lisp")`) ++ requireNoError(t, err) ++ requireEqual(t, 2, got) ++} ++ ++func TestLoadRepeatedCyclesDoNotLeakFileDescriptors(t *testing.T) { ++ ++ ++ runtime.GC() ++ before := countOpenFDs(t) ++ ++ for i := 0; i < 150; i++ { ++ env := newLoadedEnv(t, fixtures) ++ got, err := evalSource(t, env, `(load "testdata/load-example.lisp")`) ++ requireNoError(t, err) ++ requireEqual(t, 2, got) ++ } ++ ++ runtime.GC() ++ after := countOpenFDs(t) ++ if after > before+4 { ++ t.Fatalf("open file descriptors grew from %d to %d, want at most %d", before, after, before+4) ++ } ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,22 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++set -euo pipefail ++cd /workspace/repo ++ ++ ++export GOPATH="${GOPATH:-/root/go}" ++export GOMODCACHE="${GOMODCACHE:-${GOPATH}/pkg/mod}" ++export GOPROXY=off ++export GOSUMDB=off ++export GOFLAGS="${GOFLAGS:-} -mod=mod" ++ ++exec go test -v -count=1 ./usercase-test-coderl/... diff --git a/tasks/format-code-task-000590/tests/test.sh b/tasks/format-code-task-000590/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..08d03c136ca719790eff087df3c1757e9db1f176 --- /dev/null +++ b/tasks/format-code-task-000590/tests/test.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/fixtures/bad/eval-error.lisp +usercase-test-coderl/fixtures/bad/parse-error.lisp +usercase-test-coderl/fixtures/testdata/evaluated-name.lisp +usercase-test-coderl/fixtures/testdata/load-example.lisp +usercase-test-coderl/fixtures/testdata/load-path/load-path-example.lisp +usercase-test-coderl/fixtures/testdata/stateful-define.lisp +usercase-test-coderl/load_builtin_test.go +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000590/tests/test_command.sh b/tasks/format-code-task-000590/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-000590/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000599/environment/Dockerfile b/tasks/format-code-task-000599/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..8b8d2a9da12974f2935cb1f0b1a761a6372d3923 --- /dev/null +++ b/tasks/format-code-task-000599/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:994c37646758ba7e20bf2558802d607829e6d2bf8cf691490aa3c08311d51470 diff --git a/tasks/format-code-task-000599/environment/setup/files/blocklist b/tasks/format-code-task-000599/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000599/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000599/environment/setup/setup.sh b/tasks/format-code-task-000599/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000599/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000599/tests/test.patch b/tasks/format-code-task-000599/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..dc346f486d107eaff033e6f0706b632fd33311a3 --- /dev/null +++ b/tasks/format-code-task-000599/tests/test.patch @@ -0,0 +1,70 @@ +diff --git a/bootstrap/integration/checkout_integration_test.go b/bootstrap/integration/checkout_integration_test.go +index f7934dce57..aa3a4418e6 100644 +--- a/bootstrap/integration/checkout_integration_test.go ++++ b/bootstrap/integration/checkout_integration_test.go +@@ -375,3 +375,45 @@ func TestCheckoutDoesNotRetryOnHookFailure(t *testing.T) { + + tester.CheckMocks(t) + } ++ ++func TestRepositorylessCheckout(t *testing.T) { ++ t.Parallel() ++ ++ tester, err := NewBootstrapTester() ++ if err != nil { ++ t.Fatal(err) ++ } ++ defer tester.Close() ++ ++ if runtime.GOOS != "windows" { ++ var script = []string{ ++ "#!/bin/bash", ++ "export BUILDKITE_REPO=", ++ } ++ ++ if err := ioutil.WriteFile(filepath.Join(tester.HooksDir, "environment"), ++ []byte(strings.Join(script, "\n")), 0700); err != nil { ++ t.Fatal(err) ++ } ++ } else { ++ var script = []string{ ++ "@echo off", ++ "set BUILDKITE_REPO=", ++ } ++ ++ if err := ioutil.WriteFile(filepath.Join(tester.HooksDir, "environment.bat"), ++ []byte(strings.Join(script, "\r\n")), 0700); err != nil { ++ t.Fatal(err) ++ } ++ } ++ ++ tester.MustMock(t, "git").Expect().NotCalled() ++ ++ tester.ExpectGlobalHook("pre-checkout").Once() ++ tester.ExpectGlobalHook("post-checkout").Once() ++ tester.ExpectGlobalHook("pre-command").Once() ++ tester.ExpectGlobalHook("post-command").Once() ++ tester.ExpectGlobalHook("pre-exit").Once() ++ ++ tester.RunAndCheck(t) ++} +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,4 @@ ++H4sIAAAAAAAAA+3RTWrDMBCGYa1zirlAbMtY8QF6g5J98I9ITBMpSHKgt6/qTUqhzSahlLzPZkZI ++oJG+op+n47iz7lKqR6my1pilZt/r0mtTa73R9aatVZW7qlFiHjbRF3NMXRBRwfv027lb+/9Ucc0/ ++2Zh2gz+dOjcW8XC/O27lr+tr/qZtcv5N7pRU9xvhZ0+e/zDKEnxvx9Xey2cr64usw+xkmxev9uzj ++lHx4P9oYXw52ePNzkqLs83/EFLpzOblk96FLk3fl6q/fAwAAAAAAAAAAAAAAADyTDyqJ/lIAKAAA +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-000599/tests/test.sh b/tasks/format-code-task-000599/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8226c64171aca0262d10bc588c1b20dc7bda1227 --- /dev/null +++ b/tasks/format-code-task-000599/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +bootstrap/integration/checkout_integration_test.go +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000599/tests/test_command.sh b/tasks/format-code-task-000599/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000599/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000702/environment/Dockerfile b/tasks/format-code-task-000702/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..c5a01fc155f6a1e0af874b5e813fbd693b009e10 --- /dev/null +++ b/tasks/format-code-task-000702/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:0d18ef08aef755be3928f68f9cdfdc63b6b247b72121c5110e96463871ca7ecb diff --git a/tasks/format-code-task-000702/environment/setup/files/blocklist b/tasks/format-code-task-000702/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000702/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000702/environment/setup/setup.sh b/tasks/format-code-task-000702/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000702/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000702/tests/test.patch b/tasks/format-code-task-000702/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..25f222cb1980810432f53314f0794451bf504760 --- /dev/null +++ b/tasks/format-code-task-000702/tests/test.patch @@ -0,0 +1,414 @@ +diff --git a/tests/commands/test_init_command.py b/tests/commands/test_init_command.py +index 555e0d816c..432139695c 100644 +--- a/tests/commands/test_init_command.py ++++ b/tests/commands/test_init_command.py +@@ -1,3 +1,4 @@ ++import json + import os + + import pytest +@@ -30,6 +31,14 @@ def ask(self): + 'tag_format = "$version"\n' + ) + ++EXPECTED_JSON_CONFIG = { ++ "commitizen": { ++ "name": "cz_conventional_commits", ++ "version": "0.0.1", ++ "tag_format": "$version", ++ } ++} ++ + + def test_init_without_setup_pre_commit_hook(tmpdir, mocker, config): + mocker.patch( +@@ -85,47 +94,54 @@ def test_init_without_choosing_tag(config, mocker, tmpdir): + + + class TestPreCommitCases: +- @pytest.fixture(scope="function", autouse=True) +- def default_choices(_, mocker): ++ @pytest.fixture(scope="function", params=["pyproject.toml", ".cz.json"]) ++ def default_choice(_, request, mocker): + mocker.patch( + "questionary.select", + side_effect=[ +- FakeQuestion("pyproject.toml"), ++ FakeQuestion(request.param), + FakeQuestion("cz_conventional_commits"), + ], + ) + mocker.patch("questionary.confirm", return_value=FakeQuestion(True)) + mocker.patch("questionary.text", return_value=FakeQuestion("$version")) + mocker.patch("questionary.confirm", return_value=FakeQuestion(True)) ++ return request.param + +- def test_no_existing_pre_commit_conifg(_, tmpdir, config): ++ def test_no_existing_pre_commit_json_conifg(_, default_choice, tmpdir, config): + with tmpdir.as_cwd(): + commands.Init(config)() + +- with open("pyproject.toml", "r") as toml_file: +- config_data = toml_file.read() +- assert config_data == expected_config ++ with open(default_choice, "r") as file: ++ if "json" in default_choice: ++ assert json.load(file) == EXPECTED_JSON_CONFIG ++ else: ++ config_data = file.read() ++ assert config_data == expected_config + + with open(pre_commit_config_filename, "r") as pre_commit_file: + pre_commit_config_data = yaml.safe_load(pre_commit_file.read()) + assert pre_commit_config_data == {"repos": [cz_hook_config]} + +- def test_empty_pre_commit_config(_, tmpdir, config): ++ def test_empty_pre_commit_config(_, default_choice, tmpdir, config): + with tmpdir.as_cwd(): + p = tmpdir.join(pre_commit_config_filename) + p.write("") + + commands.Init(config)() + +- with open("pyproject.toml", "r") as toml_file: +- config_data = toml_file.read() +- assert config_data == expected_config ++ with open(default_choice, "r") as file: ++ if "json" in default_choice: ++ assert json.load(file) == EXPECTED_JSON_CONFIG ++ else: ++ config_data = file.read() ++ assert config_data == expected_config + + with open(pre_commit_config_filename, "r") as pre_commit_file: + pre_commit_config_data = yaml.safe_load(pre_commit_file.read()) + assert pre_commit_config_data == {"repos": [cz_hook_config]} + +- def test_pre_commit_config_without_cz_hook(_, tmpdir, config): ++ def test_pre_commit_config_without_cz_hook(_, default_choice, tmpdir, config): + existing_hook_config = { + "repo": "https://github.com/pre-commit/pre-commit-hooks", + "rev": "v1.2.3", +@@ -138,9 +154,12 @@ def test_pre_commit_config_without_cz_hook(_, tmpdir, config): + + commands.Init(config)() + +- with open("pyproject.toml", "r") as toml_file: +- config_data = toml_file.read() +- assert config_data == expected_config ++ with open(default_choice, "r") as file: ++ if "json" in default_choice: ++ assert json.load(file) == EXPECTED_JSON_CONFIG ++ else: ++ config_data = file.read() ++ assert config_data == expected_config + + with open(pre_commit_config_filename, "r") as pre_commit_file: + pre_commit_config_data = yaml.safe_load(pre_commit_file.read()) +@@ -148,16 +167,19 @@ def test_pre_commit_config_without_cz_hook(_, tmpdir, config): + "repos": [existing_hook_config, cz_hook_config] + } + +- def test_cz_hook_exists_in_pre_commit_config(_, tmpdir, config): ++ def test_cz_hook_exists_in_pre_commit_config(_, default_choice, tmpdir, config): + with tmpdir.as_cwd(): + p = tmpdir.join(pre_commit_config_filename) + p.write(yaml.safe_dump({"repos": [cz_hook_config]})) + + commands.Init(config)() + +- with open("pyproject.toml", "r") as toml_file: +- config_data = toml_file.read() +- assert config_data == expected_config ++ with open(default_choice, "r") as file: ++ if "json" in default_choice: ++ assert json.load(file) == EXPECTED_JSON_CONFIG ++ else: ++ config_data = file.read() ++ assert config_data == expected_config + + with open(pre_commit_config_filename, "r") as pre_commit_file: + pre_commit_config_data = yaml.safe_load(pre_commit_file.read()) +diff --git a/tests/test_conf.py b/tests/test_conf.py +index 919fb46e78..5ab66c2ff1 100644 +--- a/tests/test_conf.py ++++ b/tests/test_conf.py +@@ -1,3 +1,4 @@ ++import json + import os + from pathlib import Path + +@@ -23,6 +24,14 @@ + target-version = ['py36', 'py37', 'py38'] + """ + ++JSON_CONFIG = { ++ "commitizen": { ++ "name": "cz_jira", ++ "version": "1.0.0", ++ "version_files": ["commitizen/__version__.py", "pyproject.toml"], ++ "style": [["pointer", "reverse"], ["question", "underline"]], ++ } ++} + + _settings = { + "name": "cz_jira", +@@ -66,6 +75,8 @@ def config_files_manager(request, tmpdir): + with open(filename, "w") as f: + if "toml" in filename: + f.write(PYPROJECT) ++ if "json" in filename: ++ json.dump(JSON_CONFIG, f) + yield + + +@@ -129,3 +140,13 @@ def test_init_empty_config_content_with_existing_content(self, tmpdir): + + with open(path, "r") as toml_file: + assert toml_file.read() == existing_content + "[tool.commitizen]" ++ ++ ++class TestJsonConfig: ++ def test_init_empty_config_content(self, tmpdir): ++ path = tmpdir.mkdir("commitizen").join(".cz.json") ++ json_config = config.JsonConfig(data="{}", path=path) ++ json_config.init_empty_config_content() ++ ++ with open(path, "r") as json_file: ++ assert json.load(json_file) == {"commitizen": {}} +diff --git a/tests/test_cz_customize.py b/tests/test_cz_customize.py +index 2cf0a5917d..d74814087e 100644 +--- a/tests/test_cz_customize.py ++++ b/tests/test_cz_customize.py +@@ -1,13 +1,10 @@ + import pytest + +-from commitizen.config import BaseConfig, TomlConfig ++from commitizen.config import BaseConfig, JsonConfig, TomlConfig + from commitizen.cz.customize import CustomizeCommitsCz + from commitizen.exceptions import MissingCzCustomizeConfigError + +- +-@pytest.fixture(scope="module") +-def config(): +- toml_str = r""" ++TOML_STR = r""" + [tool.commitizen.customize] + message_template = "{{change_type}}:{% if show_message %} {{message}}{% endif %}" + example = "feature: this feature enable customize through config file" +@@ -36,8 +33,154 @@ def config(): + type = "confirm" + name = "show_message" + message = "Do you want to add body message in commit?" ++""" ++ ++JSON_STR = r""" ++ { ++ "commitizen": { ++ "name": "cz_jira", ++ "version": "1.0.0", ++ "version_files": [ ++ "commitizen/__version__.py", ++ "pyproject.toml" ++ ], ++ "customize": { ++ "message_template": "{{change_type}}:{% if show_message %} {{message}}{% endif %}", ++ "example": "feature: this feature enable customize through config file", ++ "schema": ": ", ++ "schema_pattern": "(feature|bug fix):(\\s.*)", ++ "bump_pattern": "^(break|new|fix|hotfix)", ++ "bump_map": { ++ "break": "MAJOR", ++ "new": "MINOR", ++ "fix": "PATCH", ++ "hotfix": "PATCH" ++ }, ++ "info": "This is a customized cz.", ++ "questions": [ ++ { ++ "type": "list", ++ "name": "change_type", ++ "choices": [ ++ { ++ "value": "feature", ++ "name": "feature: A new feature." ++ }, ++ { ++ "value": "bug fix", ++ "name": "bug fix: A bug fix." ++ } ++ ], ++ "message": "Select the type of change you are committing" ++ }, ++ { ++ "type": "input", ++ "name": "message", ++ "message": "Body." ++ }, ++ { ++ "type": "confirm", ++ "name": "show_message", ++ "message": "Do you want to add body message in commit?" ++ } ++ ] ++ } ++ } ++ } ++""" ++ ++TOML_STR_INFO_PATH = """ ++ [tool.commitizen.customize] ++ message_template = "{{change_type}}:{% if show_message %} {{message}}{% endif %}" ++ example = "feature: this feature enable customize through config file" ++ schema = ": " ++ bump_pattern = "^(break|new|fix|hotfix)" ++ bump_map = {"break" = "MAJOR", "new" = "MINOR", "fix" = "PATCH", "hotfix" = "PATCH"} ++ info_path = "info.txt" ++""" ++ ++JSON_STR_INFO_PATH = r""" ++ { ++ "commitizen": { ++ "customize": { ++ "message_template": "{{change_type}}:{% if show_message %} {{message}}{% endif %}", ++ "example": "feature: this feature enable customize through config file", ++ "schema": ": ", ++ "bump_pattern": "^(break|new|fix|hotfix)", ++ "bump_map": { ++ "break": "MAJOR", ++ "new": "MINOR", ++ "fix": "PATCH", ++ "hotfix": "PATCH" ++ }, ++ "info_path": "info.txt" ++ } ++ } ++ } ++""" ++ ++TOML_STR_WITHOUT_INFO = """ ++ [tool.commitizen.customize] ++ message_template = "{{change_type}}:{% if show_message %} {{message}}{% endif %}" ++ example = "feature: this feature enable customize through config file" ++ schema = ": " ++ bump_pattern = "^(break|new|fix|hotfix)" ++ bump_map = {"break" = "MAJOR", "new" = "MINOR", "fix" = "PATCH", "hotfix" = "PATCH"} ++""" ++ ++JSON_STR_WITHOUT_PATH = r""" ++ { ++ "commitizen": { ++ "customize": { ++ "message_template": "{{change_type}}:{% if show_message %} {{message}}{% endif %}", ++ "example": "feature: this feature enable customize through config file", ++ "schema": ": ", ++ "bump_pattern": "^(break|new|fix|hotfix)", ++ "bump_map": { ++ "break": "MAJOR", ++ "new": "MINOR", ++ "fix": "PATCH", ++ "hotfix": "PATCH" ++ } ++ } ++ } ++ } ++""" ++ ++ ++@pytest.fixture( ++ params=[ ++ TomlConfig(data=TOML_STR, path="not_exist.toml"), ++ JsonConfig(data=JSON_STR, path="not_exist.json"), ++ ] ++) ++def config(request): ++ """Parametrize the config fixture ++ ++ This fixture allow to test multiple config formats, ++ without add the builtin parametrize decorator + """ +- return TomlConfig(data=toml_str, path="not_exist.toml") ++ return request.param ++ ++ ++@pytest.fixture( ++ params=[ ++ TomlConfig(data=TOML_STR_INFO_PATH, path="not_exist.toml"), ++ JsonConfig(data=JSON_STR_INFO_PATH, path="not_exist.json"), ++ ] ++) ++def config_info(request): ++ return request.param ++ ++ ++@pytest.fixture( ++ params=[ ++ TomlConfig(data=TOML_STR_WITHOUT_INFO, path="not_exist.toml"), ++ JsonConfig(data=JSON_STR_WITHOUT_PATH, path="not_exist.json"), ++ ] ++) ++def config_without_info(request): ++ return request.param + + + def test_initialize_cz_customize_failed(): +@@ -126,34 +269,15 @@ def test_info(config): + assert "This is a customized cz." in cz.info() + + +-def test_info_with_info_path(tmpdir): ++def test_info_with_info_path(tmpdir, config_info): + with tmpdir.as_cwd(): + tmpfile = tmpdir.join("info.txt") + tmpfile.write("Test info") + +- toml_str = """ +- [tool.commitizen.customize] +- message_template = "{{change_type}}:{% if show_message %} {{message}}{% endif %}" +- example = "feature: this feature enable customize through config file" +- schema = ": " +- bump_pattern = "^(break|new|fix|hotfix)" +- bump_map = {"break" = "MAJOR", "new" = "MINOR", "fix" = "PATCH", "hotfix" = "PATCH"} +- info_path = "info.txt" +- """ +- config = TomlConfig(data=toml_str, path="not_exist.toml") +- cz = CustomizeCommitsCz(config) ++ cz = CustomizeCommitsCz(config_info) + assert "Test info" in cz.info() + + +-def test_info_without_info(): +- toml_str = """ +- [tool.commitizen.customize] +- message_template = "{{change_type}}:{% if show_message %} {{message}}{% endif %}" +- example = "feature: this feature enable customize through config file" +- schema = ": " +- bump_pattern = "^(break|new|fix|hotfix)" +- bump_map = {"break" = "MAJOR", "new" = "MINOR", "fix" = "PATCH", "hotfix" = "PATCH"} +- """ +- config = TomlConfig(data=toml_str, path="not_exist.toml") +- cz = CustomizeCommitsCz(config) ++def test_info_without_info(config_without_info): ++ cz = CustomizeCommitsCz(config_without_info) + assert cz.info() is None +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,5 @@ ++H4sIAAAAAAAAA+3SQWvCMBjG8Z79FDl4tTaxrTDYwZunzYOXnYq2HRbWREwU9NMv7bp1CJsXZcj+ ++v0MT3jeQ0OcN1/vqrchKfRgHtxJ50yRpV+98bfcyUZFKVRxPfV3KNJoEIrnZi77ZW7faCRHsjHG/ ++nbvUv1Nhn78rrctyU9crXYR2c707LuWvlPrKf5JKn3+cShWI6HpP+Nk/zz8vRBv8uiwGi5fl/Plp ++MVvOHz9rD8O+KLZHtzFajOpm5/ui+dhxNzL2Y4AqXfVTtD12Z7rZ0q/npVOW+wRMXZ3KpjU6DP76 ++jwAAAAAAAAAAAAAAAAD34x0AHrHuACgAAA== +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-000702/tests/test.sh b/tasks/format-code-task-000702/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..9802ff1a6cf8aa0eb3b51b3a4d223c699e64e14a --- /dev/null +++ b/tasks/format-code-task-000702/tests/test.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/commands/test_init_command.py +tests/test_conf.py +tests/test_cz_customize.py +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000702/tests/test_command.sh b/tasks/format-code-task-000702/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000702/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000705/environment/Dockerfile b/tasks/format-code-task-000705/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..c2cbaa66ae183302daaccb19142de8f65abd6ea5 --- /dev/null +++ b/tasks/format-code-task-000705/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:ed5d608d51ddd631c6596e57aaf194db6c4794bdaad697cf5c47ed110f73d8b6 diff --git a/tasks/format-code-task-000705/environment/setup/files/blocklist b/tasks/format-code-task-000705/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000705/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000705/environment/setup/setup.sh b/tasks/format-code-task-000705/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000705/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000705/tests/test.patch b/tasks/format-code-task-000705/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..b943c1e9f48875eb18eac02765f3544ca580072f --- /dev/null +++ b/tasks/format-code-task-000705/tests/test.patch @@ -0,0 +1,81 @@ +diff --git a/conans/test/integration/manifest_validation_test.py b/conans/test/integration/manifest_validation_test.py +index 1cc2b7c2e00..1eafefb8129 100644 +--- a/conans/test/integration/manifest_validation_test.py ++++ b/conans/test/integration/manifest_validation_test.py +@@ -5,6 +5,7 @@ + import os + from conans.util.files import save + from conans.model.ref import PackageReference ++from conans.paths import CONAN_MANIFEST + + + class ManifestValidationTest(unittest.TestCase): +@@ -63,3 +64,45 @@ def test_corrupted_package(self): + self.conan.run("install %s --build missing -i" % str(self.conan_reference)) + self.assertIn("%s: WARN: Bad package" % str(self.conan_reference), + self.conan.user_io.out) ++ ++ def test_missing_conanfile_manifest(self): ++ ++ self.conan.run("install %s --build missing" % str(self.conan_reference)) ++ self.assertNotIn("Conan %s not found, retrieving from server" % str(self.conan_reference), ++ self.conan.user_io.out) ++ ++ ++ ++ ++ ++ export_path = self.conan.paths.export(self.conan_reference) ++ file_path = os.path.join(export_path, CONAN_MANIFEST) ++ os.unlink(file_path) ++ ++ self.conan.run("install %s --integrity" % str(self.conan_reference)) ++ self.assertIn("Bad conanfile detected!", str(self.conan.user_io.out)) ++ self.assertIn("%s: Retrieving from remote 'default'" ++ % str(self.conan_reference), ++ self.conan.user_io.out) ++ ++ def test_missing_package_manifest(self): ++ ++ self.conan.run("install %s --build missing" % str(self.conan_reference)) ++ package_ref = PackageReference(self.conan_reference, ++ "5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9") ++ ++ ++ self.conan.run("install %s --build missing" % str(self.conan_reference)) ++ self.assertNotIn("Package for %s does not exist" % str(self.conan_reference), ++ self.conan.user_io.out) ++ self.assertIn("%s: Already installed!" % str(self.conan_reference), self.conan.user_io.out) ++ ++ ++ ++ ++ package_path = self.conan.paths.package(package_ref) ++ os.unlink(os.path.join(package_path, "conanmanifest.txt")) ++ ++ self.conan.run("install %s -i" % str(self.conan_reference), ignore_error=True) ++ self.assertIn("%s: WARN: Bad package" % str(self.conan_reference), ++ self.conan.user_io.out) +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,7 @@ ++H4sIAAAAAAAAA+3SPW/CMBAG4Mz5FRYLyVA3nzCxdqo6tN2RSUyxlNjIH5T8+zpGpRVSYQFVVd9n ++yCW+c3zSma6c6Noll7v76FYyb17XIXqnMbzndZEV87ys8zLK8nzml0h9s46+ccYyTUiklbLn6i7l ++/yj6NX/LjV02qu+ZbKnZXO+MS/Ovyvlx/lVZ+flXs6KISHa9Fn72z+fftCQMfsXbeDvYjZLkriGT ++WPRbpS1xUtgx/fltBhN3irVck8UxSV/94zGsJmlsnLDcZw9ldAxj3jxo1T+xnifTRkkmDQ1bhbT8 ++TTMrlKT+4on1eAl3rBNtWFuORdM01k7K0zP3dvzvc8gkO65Xygg7LApfzY3rrK8+bKM+JKEt391g ++KN8Lm2RErMmhkL4z8+Kahhuzdl2SEt4ZTvI0nsS/PR4AAAAAAAAAAAAAAAAAAAAAgLM+AFF2+RMA ++KAAA +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-000705/tests/test.sh b/tasks/format-code-task-000705/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..6f6fc19e91b451b1158e93cf07ac78b73395213b --- /dev/null +++ b/tasks/format-code-task-000705/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +conans/test/integration/manifest_validation_test.py +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000705/tests/test_command.sh b/tasks/format-code-task-000705/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000705/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000734/environment/Dockerfile b/tasks/format-code-task-000734/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..0ff4e4b887dfe69546c84d010a1dd863ff8ecfae --- /dev/null +++ b/tasks/format-code-task-000734/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:53b70a39b9886e2f0685ef61132c73b30986e012739cbfca056fdbbb2a6cf282 diff --git a/tasks/format-code-task-000734/environment/setup/files/blocklist b/tasks/format-code-task-000734/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000734/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000734/environment/setup/setup.sh b/tasks/format-code-task-000734/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000734/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000751/environment/Dockerfile b/tasks/format-code-task-000751/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..c9539322a9b4ceda8e52d731244e2a980b51e0ed --- /dev/null +++ b/tasks/format-code-task-000751/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:54dfdba6a0f4c0587b2549cd2db96c8606a7b70b393c247e6c181e16d55ed325 diff --git a/tasks/format-code-task-000751/environment/setup/files/blocklist b/tasks/format-code-task-000751/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000751/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000751/environment/setup/setup.sh b/tasks/format-code-task-000751/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000751/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000751/tests/test.patch b/tasks/format-code-task-000751/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..6b9df243b11577d0afb3aca2eac28ee1e42baeb4 --- /dev/null +++ b/tasks/format-code-task-000751/tests/test.patch @@ -0,0 +1,90 @@ +diff --git a/test/src/analyzers/lint_analyzer/rules/rules_list/missing_test_assertion/examples/custom_methods_example.dart b/test/src/analyzers/lint_analyzer/rules/rules_list/missing_test_assertion/examples/custom_methods_example.dart +new file mode 100644 +index 0000000000..6d64f5764a +--- /dev/null ++++ b/test/src/analyzers/lint_analyzer/rules/rules_list/missing_test_assertion/examples/custom_methods_example.dart +@@ -0,0 +1,9 @@ ++void main() { ++ print('Hello'); ++ ++ customTest(null, () => 1 == 1); ++ ++ otherTestMethod(null, () => 1 == 1); ++ ++ excludedTestMethod(null, () => 1 == 1); ++} +diff --git a/test/src/analyzers/lint_analyzer/rules/rules_list/missing_test_assertion/missing_test_assertion_test.dart b/test/src/analyzers/lint_analyzer/rules/rules_list/missing_test_assertion/missing_test_assertion_test.dart +index aa09cf1ba9..c8cbd1e0e7 100644 +--- a/test/src/analyzers/lint_analyzer/rules/rules_list/missing_test_assertion/missing_test_assertion_test.dart ++++ b/test/src/analyzers/lint_analyzer/rules/rules_list/missing_test_assertion/missing_test_assertion_test.dart +@@ -10,6 +10,8 @@ const _incorrectExamplePath = + 'missing_test_assertion/examples/incorrect_example.dart'; + const _customAssertionsExamplePath = + 'missing_test_assertion/examples/custom_assertions_example.dart'; ++const _customMethodsExamplePath = ++ 'missing_test_assertion/examples/custom_methods_example.dart'; + + void main() { + group('MissingTestAssertion', () { +@@ -31,7 +33,7 @@ void main() { + RuleTestHelper.verifyNoIssues(issues); + }); + +- test('with custom config reports no issues', () async { ++ test('with custom assertions config reports no issues', () async { + final unit = + await RuleTestHelper.resolveFromFile(_customAssertionsExamplePath); + final config = { +@@ -71,5 +73,31 @@ void main() { + ], + ); + }); ++ ++ test('with custom methods config reports about found issues', () async { ++ final unit = ++ await RuleTestHelper.resolveFromFile(_customMethodsExamplePath); ++ final config = { ++ 'include-methods': [ ++ 'customTest', ++ 'otherTestMethod', ++ ], ++ }; ++ final issues = MissingTestAssertionRule(config).check(unit); ++ ++ RuleTestHelper.verifyIssues( ++ issues: issues, ++ startLines: [4, 6], ++ startColumns: [3, 3], ++ locationTexts: [ ++ 'customTest(null, () => 1 == 1)', ++ 'otherTestMethod(null, () => 1 == 1)', ++ ], ++ messages: [ ++ 'Missing test assertion.', ++ 'Missing test assertion.', ++ ], ++ ); ++ }); + }); + } +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,5 @@ ++H4sIAAAAAAAAA+3SPU/EIBwG8M79FOTiainccU1MHNwcHdwbWogSKTX8qVE/vS3Gl5ict9xFjc9v ++4J1AeKi6yXnT2vDAi2OpZ41SuZ59rXNbKFnLZq3kRha1ENt6XTB1tBt9MlHSkbEijmP6bt2++T+q +++sg/WUptPw6DDqai28OdsS9/qeR7/qIRc/6brWgKVh/uCrv98/x7w3LwnTWlfbwfY2JXF9eX5ys+ ++UeTeddzomE7J3PHOhbOTZXJVLmNs2ZYLTrHnOmj/9GwjzZtCat+6PE7e0mvZejcvHhyRCzdt/m6a ++yMbkxrBjOHer5bjyp18KAAAAAAAAAAAAAAAAAAAAAOD3eQEg/mfIACgAAA== +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-000751/tests/test.sh b/tasks/format-code-task-000751/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..82c1789732c69eb69f6f69bf1877ac5c19858bb5 --- /dev/null +++ b/tasks/format-code-task-000751/tests/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test/src/analyzers/lint_analyzer/rules/rules_list/missing_test_assertion/examples/custom_methods_example.dart +test/src/analyzers/lint_analyzer/rules/rules_list/missing_test_assertion/missing_test_assertion_test.dart +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000751/tests/test_command.sh b/tasks/format-code-task-000751/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000751/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000756/environment/Dockerfile b/tasks/format-code-task-000756/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..b8c9cf9beebdeab2397fb61f980c8dcda474421e --- /dev/null +++ b/tasks/format-code-task-000756/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:f260c8214727f3f08fc053b66c619246cf5928fb049b3c217c5bb91f307ce16a diff --git a/tasks/format-code-task-000756/environment/setup/files/blocklist b/tasks/format-code-task-000756/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000756/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000756/environment/setup/setup.sh b/tasks/format-code-task-000756/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000756/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000756/tests/test.patch b/tasks/format-code-task-000756/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..183f2cda118024624612b13759c6587d67a5bead --- /dev/null +++ b/tasks/format-code-task-000756/tests/test.patch @@ -0,0 +1,101 @@ +diff --git a/web/lib/src/lilac.spec.ts b/web/lib/src/lilac.spec.ts +index 2e749d33e..bdd5a7109 100644 +--- a/web/lib/src/lilac.spec.ts ++++ b/web/lib/src/lilac.spec.ts +@@ -10,6 +10,7 @@ import { + getValueNode, + getValueNodes, + isSignalField, ++ listFieldParents, + listFields, + listValueNodes + } from './lilac'; +@@ -234,10 +235,22 @@ describe('lilac', () => { + }); + }); + ++ describe('listFieldParents', () => { ++ it('lists the parents of a field', () => { ++ const parents = listFieldParents( ++ schema.fields!.complex_field.fields!.propertyA.fields!.text_statistics, ++ schema ++ ); ++ expect(parents).toBeDefined(); ++ expect(parents).toHaveLength(2); ++ expect(parents[0]).toEqual(schema.fields!.complex_field); ++ expect(parents[1]).toEqual(schema.fields!.complex_field.fields!.propertyA); ++ }); ++ }); ++ + describe('listValues', () => { + it('should return a list of values', () => { + const values = listValueNodes(row); +- + expect(values).toBeDefined(); + expect(L.path(values[0])).toEqual(['title']); + expect(L.value(values[0])).toEqual('title text'); +@@ -247,8 +260,8 @@ describe('lilac', () => { + + const paths = values.map(f => L.path(f)); + expect(paths).toContainEqual(['title']); +- expect(paths).toContainEqual(['complex_list_of_struct', '*']); +- expect(paths).toContainEqual(['complex_list_of_struct', '*', 'propertyA']); ++ expect(paths).toContainEqual(['complex_list_of_struct', '0']); ++ expect(paths).toContainEqual(['complex_list_of_struct', '0', 'propertyA']); + }); + it('returns cached results', () => { + const values = listValueNodes(row); +@@ -285,9 +298,14 @@ describe('lilac', () => { + }); + }); + +- it('should return a value by path with repeated fields', () => { ++ it('should return first value by path with repeated fields', () => { + const value = getValueNode(row, ['complex_list_of_struct', '*']); +- expect(L.path(value!)).toEqual(['complex_list_of_struct', '*']); ++ expect(L.path(value!)).toEqual(['complex_list_of_struct', '0']); ++ }); ++ ++ it('should return specific index when no wildcard is given', () => { ++ const value = getValueNode(row, ['complex_list_of_struct', '1']); ++ expect(L.path(value!)).toEqual(['complex_list_of_struct', '1']); + }); + }); + +@@ -302,6 +320,7 @@ describe('lilac', () => { + end: 100, + start: 82 + }); ++ expect(values).toHaveLength(2); + }); + }); + +@@ -352,7 +371,7 @@ describe('lilac', () => { + + describe('nested lists', () => { + it('can get values', () => { +- expect(L.path(row.nested_list_of_list[0][0])).toEqual(['nested_list_of_list', '*', '*']); ++ expect(L.path(row.nested_list_of_list[0][0])).toEqual(['nested_list_of_list', '0', '0']); + expect(L.dtype(row.nested_list_of_list[0][0])).toEqual('string'); + }); + }); +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,4 @@ ++H4sIAAAAAAAAA+3S32rDIBTHca/zFI7d+yetyeOUaIQGUlOi6fb4y3KxjcHWm5Yx+v3cHEXBc/ip ++/DKM/SGmixb3Ylatc1tdfa/b2rra2rZtm10jjLVNbYR0d+voiyWXbpZSzNNUfrt37fyfUp/5l5jL ++IUynU5d6lY+3e+Na/tbYj/xdu1vz3zf1XkhzuxZ+9uD5Pz9pPyTtu3ysQi+3T+BjX6Xzq7wM7zs5 ++L0m+RK/Hwes8h7WOXVD5HIMqufrrAQAAAAAAAAAAAAAAAIAH9gYEcU//ACgAAA== +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-000756/tests/test.sh b/tasks/format-code-task-000756/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..5a6a4482d43f9c7ee93ea2ab32d33c21c1f6c675 --- /dev/null +++ b/tasks/format-code-task-000756/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +web/lib/src/lilac.spec.ts +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000756/tests/test_command.sh b/tasks/format-code-task-000756/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000756/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000758/environment/Dockerfile b/tasks/format-code-task-000758/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..50c577920a03d7d5b0bf219a4754d4736dd1cd69 --- /dev/null +++ b/tasks/format-code-task-000758/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:6fe4110d8ec93eac3f0e76fc75f39c6f191133f8b9d9481cc2e543c5930b9e35 diff --git a/tasks/format-code-task-000758/environment/setup/files/blocklist b/tasks/format-code-task-000758/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000758/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000758/environment/setup/setup.sh b/tasks/format-code-task-000758/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000758/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000758/tests/test.patch b/tasks/format-code-task-000758/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..adb05c7c6264e94ac21e38c2ffea9cb75d2d076f --- /dev/null +++ b/tasks/format-code-task-000758/tests/test.patch @@ -0,0 +1,641 @@ +diff --git a/exporter/exporter_test.go b/exporter/exporter_test.go +index 669b057d16..7b235d7b93 100644 +--- a/exporter/exporter_test.go ++++ b/exporter/exporter_test.go +@@ -340,7 +340,7 @@ func TestImportingUsersGroupsSecretScopes(t *testing.T) { + }, + { + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/ServicePrincipals?filter=applicationId%20eq%20%27spn%27", ++ Resource: "/api/2.0/preview/scim/v2/ServicePrincipals?excludedAttributes=roles&filter=applicationId%20eq%20%27spn%27", + Response: scim.User{ID: "321", DisplayName: "spn", ApplicationID: "spn", + Groups: []scim.ComplexValue{ + {Display: "admins", Value: "a", Ref: "Groups/a", Type: "direct"}, +@@ -394,7 +394,7 @@ func TestImportingUsersGroupsSecretScopes(t *testing.T) { + }, + { + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/Users?filter=userName%20eq%20%27test%40test.com%27", ++ Resource: "/api/2.0/preview/scim/v2/Users?excludedAttributes=roles&filter=userName%20eq%20%27test%40test.com%27", + Response: scim.UserList{ + Resources: []scim.User{ + {ID: "123", DisplayName: "test@test.com", UserName: "test@test.com"}, +@@ -1275,7 +1275,7 @@ func TestImportingUser(t *testing.T) { + { + Method: "GET", + ReuseRequest: true, +- Resource: "/api/2.0/preview/scim/v2/Users?filter=userName%20eq%20%27me%27", ++ Resource: "/api/2.0/preview/scim/v2/Users?excludedAttributes=roles&filter=userName%20eq%20%27me%27", + Response: scim.UserList{ + Resources: []scim.User{ + { +@@ -1601,7 +1601,7 @@ func TestImportingDLTPipelines(t *testing.T) { + }, + { + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/Users?filter=userName%20eq%20%27user%40domain.com%27", ++ Resource: "/api/2.0/preview/scim/v2/Users?excludedAttributes=roles&filter=userName%20eq%20%27user%40domain.com%27", + Response: scim.UserList{ + Resources: []scim.User{ + {ID: "123", DisplayName: "user@domain.com", UserName: "user@domain.com"}, +diff --git a/exporter/importables_test.go b/exporter/importables_test.go +index bbcdc9a51f..1c084ef071 100644 +--- a/exporter/importables_test.go ++++ b/exporter/importables_test.go +@@ -444,7 +444,7 @@ func TestUserSearchFails(t *testing.T) { + { + ReuseRequest: true, + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/Users?filter=userName%20eq%20%27dbc%27", ++ Resource: "/api/2.0/preview/scim/v2/Users?excludedAttributes=roles&filter=userName%20eq%20%27dbc%27", + Status: 404, + Response: apierr.NotFound("nope"), + }, +@@ -473,7 +473,7 @@ func TestSpnSearchFails(t *testing.T) { + { + ReuseRequest: true, + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/ServicePrincipals?filter=applicationId%20eq%20%27dbc%27", ++ Resource: "/api/2.0/preview/scim/v2/ServicePrincipals?excludedAttributes=roles&filter=applicationId%20eq%20%27dbc%27", + Status: 404, + Response: apierr.NotFound("nope"), + }, +@@ -502,7 +502,7 @@ func TestSpnSearchSuccess(t *testing.T) { + { + ReuseRequest: true, + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/ServicePrincipals?filter=applicationId%20eq%20%27dbc%27", ++ Resource: "/api/2.0/preview/scim/v2/ServicePrincipals?excludedAttributes=roles&filter=applicationId%20eq%20%27dbc%27", + Response: scim.UserList{Resources: []scim.User{ + {ID: "321", DisplayName: "spn", ApplicationID: "dbc"}, + }}, +@@ -556,7 +556,7 @@ func TestUserImportSkipNonDirectGroups(t *testing.T) { + { + ReuseRequest: true, + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/Users?filter=userName%20eq%20%27dbc%27", ++ Resource: "/api/2.0/preview/scim/v2/Users?excludedAttributes=roles&filter=userName%20eq%20%27dbc%27", + Response: scim.UserList{ + Resources: []scim.User{ + { +diff --git a/qa/testing.go b/qa/testing.go +index 43dd50ec..9ed9f078 100644 +--- a/qa/testing.go ++++ b/qa/testing.go +@@ -9,6 +9,7 @@ import ( + "math/rand" + "net/http" + "net/http/httptest" ++ "net/url" + "os" + "regexp" + "sort" +@@ -411,7 +412,7 @@ func HttpFixtureClientWithToken(t *testing.T, fixtures []HTTPFixture, token stri + server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { + found := false + for i, fixture := range fixtures { +- if (req.Method == fixture.Method && req.RequestURI == fixture.Resource) || fixture.MatchAny { ++ if (req.Method == fixture.Method && matchesFixtureResource(req, fixture.Resource)) || fixture.MatchAny { + if fixture.Status == 0 { + rw.WriteHeader(200) + } else { +@@ -502,6 +503,36 @@ func HttpFixtureClientWithToken(t *testing.T, fixtures []HTTPFixture, token stri + }, server, nil + } + ++func matchesFixtureResource(req *http.Request, resource string) bool { ++ fixtureURL, err := url.ParseRequestURI(resource) ++ if err != nil { ++ return req.RequestURI == resource ++ } ++ return req.URL.Path == fixtureURL.Path && queryValuesEqual(req.URL.Query(), fixtureURL.Query()) ++} ++ ++func queryValuesEqual(left, right url.Values) bool { ++ if len(left) != len(right) { ++ return false ++ } ++ for key, leftValues := range left { ++ rightValues, ok := right[key] ++ if !ok || len(leftValues) != len(rightValues) { ++ return false ++ } ++ leftSorted := append([]string(nil), leftValues...) ++ rightSorted := append([]string(nil), rightValues...) ++ sort.Strings(leftSorted) ++ sort.Strings(rightSorted) ++ for i := range leftSorted { ++ if leftSorted[i] != rightSorted[i] { ++ return false ++ } ++ } ++ } ++ return true ++} ++ + // HTTPFixturesApply is a helper method + func HTTPFixturesApply(t *testing.T, fixtures []HTTPFixture, callback func(ctx context.Context, client *common.DatabricksClient)) { + client, server, err := HttpFixtureClient(t, fixtures) +diff --git a/scim/data_group_test.go b/scim/data_group_test.go +index c34337b67d..3bcf59bee9 100644 +--- a/scim/data_group_test.go ++++ b/scim/data_group_test.go +@@ -18,7 +18,7 @@ func TestDataSourceGroup(t *testing.T) { + Fixtures: []qa.HTTPFixture{ + { + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/Groups?filter=displayName%20eq%20%27ds%27", ++ Resource: "/api/2.0/preview/scim/v2/Groups?excludedAttributes=roles&filter=displayName%20eq%20%27ds%27", + Response: GroupList{ + Resources: []Group{ + { +@@ -29,11 +29,6 @@ func TestDataSourceGroup(t *testing.T) { + Value: "allow-cluster-create", + }, + }, +- Roles: []ComplexValue{ +- { +- Value: "a", +- }, +- }, + Members: []ComplexValue{ + { + Ref: "Users/1112", +@@ -57,6 +52,43 @@ func TestDataSourceGroup(t *testing.T) { + }, + }, + }, ++ { ++ Method: "GET", ++ Resource: "/api/2.0/preview/scim/v2/Groups/eerste", ++ Response: Group{ ++ DisplayName: "ds", ++ ID: "eerste", ++ Entitlements: []ComplexValue{ ++ { ++ Value: "allow-cluster-create", ++ }, ++ }, ++ Roles: []ComplexValue{ ++ { ++ Value: "a", ++ }, ++ }, ++ Members: []ComplexValue{ ++ { ++ Ref: "Users/1112", ++ Value: "1112", ++ }, ++ { ++ Ref: "ServicePrincipals/1113", ++ Value: "1113", ++ }, ++ { ++ Ref: "Groups/1114", ++ Value: "1114", ++ }, ++ }, ++ Groups: []ComplexValue{ ++ { ++ Value: "abc", ++ }, ++ }, ++ }, ++ }, + { + Method: "GET", + Resource: "/api/2.0/preview/scim/v2/Groups/abc", +diff --git a/scim/data_service_principal_test.go b/scim/data_service_principal_test.go +index 4ebaaa64c4..d40256bb32 100644 +--- a/scim/data_service_principal_test.go ++++ b/scim/data_service_principal_test.go +@@ -12,7 +12,7 @@ func TestDataServicePrincipalReadByAppId(t *testing.T) { + Fixtures: []qa.HTTPFixture{ + { + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/ServicePrincipals?filter=applicationId%20eq%20%27abc%27", ++ Resource: "/api/2.0/preview/scim/v2/ServicePrincipals?excludedAttributes=roles&filter=applicationId%20eq%20%27abc%27", + Response: UserList{ + Resources: []User{ + { +@@ -56,7 +56,7 @@ func TestDataServicePrincipalReadNotFound(t *testing.T) { + Fixtures: []qa.HTTPFixture{ + { + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/ServicePrincipals?filter=applicationId%20eq%20%27abc%27", ++ Resource: "/api/2.0/preview/scim/v2/ServicePrincipals?excludedAttributes=roles&filter=applicationId%20eq%20%27abc%27", + Response: UserList{}, + }, + }, +@@ -74,7 +74,7 @@ func TestDataServicePrincipalReadError(t *testing.T) { + Fixtures: []qa.HTTPFixture{ + { + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/ServicePrincipals?filter=applicationId%20eq%20%27abc%27", ++ Resource: "/api/2.0/preview/scim/v2/ServicePrincipals?excludedAttributes=roles&filter=applicationId%20eq%20%27abc%27", + Status: 500, + }, + }, +diff --git a/scim/data_service_principals_test.go b/scim/data_service_principals_test.go +index b77cbfa0ec..97ee25a7b1 100644 +--- a/scim/data_service_principals_test.go ++++ b/scim/data_service_principals_test.go +@@ -12,7 +12,7 @@ func TestDataServicePrincipalsReadByDisplayName(t *testing.T) { + Fixtures: []qa.HTTPFixture{ + { + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/ServicePrincipals?filter=displayName%20co%20%27def%27", ++ Resource: "/api/2.0/preview/scim/v2/ServicePrincipals?excludedAttributes=roles&filter=displayName%20co%20%27def%27", + Response: UserList{ + Resources: []User{ + { +@@ -46,7 +46,7 @@ func TestDataServicePrincipalsReadNotFound(t *testing.T) { + Fixtures: []qa.HTTPFixture{ + { + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/ServicePrincipals?filter=displayName%20co%20%27def%27", ++ Resource: "/api/2.0/preview/scim/v2/ServicePrincipals?excludedAttributes=roles&filter=displayName%20co%20%27def%27", + Response: UserList{}, + }, + }, +@@ -64,7 +64,7 @@ func TestDataServicePrincipalsReadNoFilter(t *testing.T) { + Fixtures: []qa.HTTPFixture{ + { + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/ServicePrincipals?", ++ Resource: "/api/2.0/preview/scim/v2/ServicePrincipals?excludedAttributes=roles", + Response: UserList{ + Resources: []User{ + { +@@ -98,7 +98,7 @@ func TestDataServicePrincipalsReadError(t *testing.T) { + Fixtures: []qa.HTTPFixture{ + { + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/ServicePrincipals?filter=displayName%20co%20%27def%27", ++ Resource: "/api/2.0/preview/scim/v2/ServicePrincipals?excludedAttributes=roles&filter=displayName%20co%20%27def%27", + Status: 500, + }, + }, +diff --git a/scim/data_user_test.go b/scim/data_user_test.go +index cee7ae47d0..b79567b18b 100644 +--- a/scim/data_user_test.go ++++ b/scim/data_user_test.go +@@ -16,7 +16,7 @@ func TestDataSourceUser(t *testing.T) { + Fixtures: []qa.HTTPFixture{ + { + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/Users?filter=userName%20eq%20%27ds%27", ++ Resource: "/api/2.0/preview/scim/v2/Users?excludedAttributes=roles&filter=userName%20eq%20%27ds%27", + Response: UserList{ + Resources: []User{ + { +@@ -53,7 +53,7 @@ func TestDataSourceUserGerUser(t *testing.T) { + }, + { + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/Users?filter=userName%20eq%20%27searching_error%27", ++ Resource: "/api/2.0/preview/scim/v2/Users?excludedAttributes=roles&filter=userName%20eq%20%27searching_error%27", + Status: 404, + Response: apierr.APIError{ + Message: "searching_error", +@@ -61,7 +61,7 @@ func TestDataSourceUserGerUser(t *testing.T) { + }, + { + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/Users?filter=userName%20eq%20%27empty_search%27", ++ Resource: "/api/2.0/preview/scim/v2/Users?excludedAttributes=roles&filter=userName%20eq%20%27empty_search%27", + Response: UserList{}, + }, + }, func(ctx context.Context, client *common.DatabricksClient) { +diff --git a/scim/resource_group_test.go b/scim/resource_group_test.go +index 93ccae4699..c23e7c8ca9 100644 +--- a/scim/resource_group_test.go ++++ b/scim/resource_group_test.go +@@ -354,7 +354,7 @@ func TestCreateForceOverwriteCannotListGroups(t *testing.T) { + qa.HTTPFixturesApply(t, []qa.HTTPFixture{ + { + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/Groups?filter=displayName%20eq%20%27abc%27", ++ Resource: "/api/2.0/preview/scim/v2/Groups?excludedAttributes=roles&filter=displayName%20eq%20%27abc%27", + Status: 417, + Response: apierr.APIError{ + Message: "cannot find group", +@@ -376,7 +376,7 @@ func TestCreateForceOverwriteFindsAndSetsGroupID(t *testing.T) { + qa.HTTPFixturesApply(t, []qa.HTTPFixture{ + { + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/Groups?filter=displayName%20eq%20%27abc%27", ++ Resource: "/api/2.0/preview/scim/v2/Groups?excludedAttributes=roles&filter=displayName%20eq%20%27abc%27", + Response: GroupList{ + Resources: []Group{ + { +@@ -392,6 +392,13 @@ func TestCreateForceOverwriteFindsAndSetsGroupID(t *testing.T) { + ID: "123", + }, + }, ++ { ++ Method: "GET", ++ Resource: "/api/2.0/preview/scim/v2/Groups/123", ++ Response: Group{ ++ ID: "123", ++ }, ++ }, + { + Method: "PUT", + Resource: "/api/2.0/preview/scim/v2/Groups/123", +diff --git a/scim/resource_service_principal_test.go b/scim/resource_service_principal_test.go +index 27f19ab4a3..67a0c631c6 100644 +--- a/scim/resource_service_principal_test.go ++++ b/scim/resource_service_principal_test.go +@@ -555,7 +555,7 @@ func TestCreateForceOverwriteCannotListServicePrincipals(t *testing.T) { + qa.HTTPFixturesApply(t, []qa.HTTPFixture{ + { + Method: "GET", +- Resource: fmt.Sprintf("/api/2.0/preview/scim/v2/ServicePrincipals?filter=applicationId%%20eq%%20%%27%s%%27", appID), ++ Resource: fmt.Sprintf("/api/2.0/preview/scim/v2/ServicePrincipals?excludedAttributes=roles&filter=applicationId%%20eq%%20%%27%s%%27", appID), + Status: 417, + Response: apierr.APIError{ + Message: "cannot find service principal", +@@ -578,7 +578,7 @@ func TestCreateForceOverwriteCannotListAccServicePrincipals(t *testing.T) { + qa.HTTPFixturesApply(t, []qa.HTTPFixture{ + { + Method: "GET", +- Resource: fmt.Sprintf("/api/2.0/preview/scim/v2/ServicePrincipals?filter=applicationId%%20eq%%20%%27%s%%27", appID), ++ Resource: fmt.Sprintf("/api/2.0/preview/scim/v2/ServicePrincipals?excludedAttributes=roles&filter=applicationId%%20eq%%20%%27%s%%27", appID), + Response: UserList{ + TotalResults: 0, + }, +@@ -600,7 +600,7 @@ func TestCreateForceOverwriteFindsAndSetsServicePrincipalID(t *testing.T) { + qa.HTTPFixturesApply(t, []qa.HTTPFixture{ + { + Method: "GET", +- Resource: fmt.Sprintf("/api/2.0/preview/scim/v2/ServicePrincipals?filter=applicationId%%20eq%%20%%27%s%%27", appID), ++ Resource: fmt.Sprintf("/api/2.0/preview/scim/v2/ServicePrincipals?excludedAttributes=roles&filter=applicationId%%20eq%%20%%27%s%%27", appID), + Response: UserList{ + Resources: []User{ + { +diff --git a/scim/resource_user_test.go b/scim/resource_user_test.go +index 933b72e7bb..f94320ed55 100644 +--- a/scim/resource_user_test.go ++++ b/scim/resource_user_test.go +@@ -604,7 +604,7 @@ func TestCreateForceOverwriteCannotListUsers(t *testing.T) { + qa.HTTPFixturesApply(t, []qa.HTTPFixture{ + { + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/Users?filter=userName%20eq%20%27me%40example.com%27", ++ Resource: "/api/2.0/preview/scim/v2/Users?excludedAttributes=roles&filter=userName%20eq%20%27me%40example.com%27", + Status: 417, + Response: apierr.APIErrorBody{ + Message: "cannot find user", +@@ -626,7 +626,7 @@ func TestCreateForceOverwriteCannotListAccUsers(t *testing.T) { + qa.HTTPFixturesApply(t, []qa.HTTPFixture{ + { + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/Users?filter=userName%20eq%20%27me%40example.com%27", ++ Resource: "/api/2.0/preview/scim/v2/Users?excludedAttributes=roles&filter=userName%20eq%20%27me%40example.com%27", + Response: UserList{ + TotalResults: 0, + }, +@@ -647,7 +647,7 @@ func TestCreateForceOverwriteFindsAndSetsID(t *testing.T) { + qa.HTTPFixturesApply(t, []qa.HTTPFixture{ + { + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/Users?filter=userName%20eq%20%27me%40example.com%27", ++ Resource: "/api/2.0/preview/scim/v2/Users?excludedAttributes=roles&filter=userName%20eq%20%27me%40example.com%27", + Response: UserList{ + Resources: []User{ + { +@@ -689,7 +689,7 @@ func TestCreateForceOverwriteFindsAndSetsAccID(t *testing.T) { + qa.HTTPFixturesApply(t, []qa.HTTPFixture{ + { + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/Users?filter=userName%20eq%20%27me%40example.com%27", ++ Resource: "/api/2.0/preview/scim/v2/Users?excludedAttributes=roles&filter=userName%20eq%20%27me%40example.com%27", + Response: UserList{ + Resources: []User{ + { +diff --git a/scim/users_test.go b/scim/users_test.go +index 47f63c457f..3c1763a4cb 100644 +--- a/scim/users_test.go ++++ b/scim/users_test.go +@@ -14,7 +14,7 @@ func TestUsersFilter(t *testing.T) { + client, server, err := qa.HttpFixtureClient(t, []qa.HTTPFixture{ + { + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/Users?", ++ Resource: "/api/2.0/preview/scim/v2/Users?excludedAttributes=roles", + + Response: UserList{ + Resources: []User{ +@@ -24,7 +24,7 @@ func TestUsersFilter(t *testing.T) { + }, + { + Method: "GET", +- Resource: "/api/2.0/preview/scim/v2/Users?filter=userName%20eq%20somebody", ++ Resource: "/api/2.0/preview/scim/v2/Users?excludedAttributes=roles&filter=userName%20eq%20somebody", + Response: UserList{}, + }, + }) + +diff --git a/scim/scim_roles_filter_test.go b/scim/scim_roles_filter_test.go +new file mode 100644 +index 0000000000..7d2a2f6a11 +--- /dev/null ++++ b/scim/scim_roles_filter_test.go +@@ -0,0 +1,170 @@ ++package scim ++ ++import ( ++ "context" ++ "testing" ++ ++ "github.com/databricks/terraform-provider-databricks/common" ++ "github.com/databricks/terraform-provider-databricks/qa" ++) ++ ++func TestUsersAPIListExcludesRolesWithoutFilter(t *testing.T) { ++ qa.HTTPFixturesApply(t, []qa.HTTPFixture{ ++ { ++ Method: "GET", ++ Resource: "/api/2.0/preview/scim/v2/Users?excludedAttributes=roles", ++ Response: UserList{ ++ Resources: []User{ ++ {ID: "u-list-1", UserName: "list-user@example.com"}, ++ }, ++ }, ++ }, ++ }, func(ctx context.Context, client *common.DatabricksClient) { ++ users, err := NewUsersAPI(ctx, client).Filter("") ++ if err != nil { ++ t.Fatalf("filter users without filter: %v", err) ++ } ++ if len(users) != 1 || users[0].ID != "u-list-1" { ++ t.Fatalf("unexpected users response: %#v", users) ++ } ++ }) ++} ++ ++func TestUsersAPIFilterExcludesRolesAndPreservesFilter(t *testing.T) { ++ qa.HTTPFixturesApply(t, []qa.HTTPFixture{ ++ { ++ Method: "GET", ++ Resource: "/api/2.0/preview/scim/v2/Users?excludedAttributes=roles&filter=userName%20co%20%27robot%27", ++ Response: UserList{ ++ Resources: []User{ ++ {ID: "u-filter-1", UserName: "robot.owner@example.com"}, ++ }, ++ }, ++ }, ++ }, func(ctx context.Context, client *common.DatabricksClient) { ++ users, err := NewUsersAPI(ctx, client).Filter("userName co 'robot'") ++ if err != nil { ++ t.Fatalf("filter users with filter: %v", err) ++ } ++ if len(users) != 1 || users[0].UserName != "robot.owner@example.com" { ++ t.Fatalf("unexpected users response: %#v", users) ++ } ++ }) ++} ++ ++func TestServicePrincipalsAPIExcludesRolesForListAndFilter(t *testing.T) { ++ qa.HTTPFixturesApply(t, []qa.HTTPFixture{ ++ { ++ Method: "GET", ++ Resource: "/api/2.0/preview/scim/v2/ServicePrincipals?excludedAttributes=roles", ++ Response: UserList{ ++ Resources: []User{ ++ {ID: "sp-list-1", ApplicationID: "svc-list"}, ++ }, ++ }, ++ }, ++ { ++ Method: "GET", ++ Resource: "/api/2.0/preview/scim/v2/ServicePrincipals?excludedAttributes=roles&filter=applicationId%20eq%20%27svc-123%27", ++ Response: UserList{ ++ Resources: []User{ ++ {ID: "sp-filter-1", ApplicationID: "svc-123"}, ++ }, ++ }, ++ }, ++ }, func(ctx context.Context, client *common.DatabricksClient) { ++ api := NewServicePrincipalsAPI(ctx, client) ++ listed, err := api.Filter("") ++ if err != nil { ++ t.Fatalf("list service principals: %v", err) ++ } ++ if len(listed) != 1 || listed[0].ApplicationID != "svc-list" { ++ t.Fatalf("unexpected service principal list response: %#v", listed) ++ } ++ filtered, err := api.Filter("applicationId eq 'svc-123'") ++ if err != nil { ++ t.Fatalf("filter service principals: %v", err) ++ } ++ if len(filtered) != 1 || filtered[0].ID != "sp-filter-1" { ++ t.Fatalf("unexpected service principal filter response: %#v", filtered) ++ } ++ }) ++} ++ ++func TestGroupsAPIFilterIncludeRolesOption(t *testing.T) { ++ qa.HTTPFixturesApply(t, []qa.HTTPFixture{ ++ { ++ Method: "GET", ++ Resource: "/api/2.0/preview/scim/v2/Groups?excludedAttributes=roles&filter=displayName%20eq%20%27team-alpha%27", ++ Response: GroupList{ ++ Resources: []Group{ ++ {ID: "group-alpha", DisplayName: "team-alpha"}, ++ }, ++ }, ++ }, ++ { ++ Method: "GET", ++ Resource: "/api/2.0/preview/scim/v2/Groups?filter=displayName%20eq%20%27team-beta%27", ++ Response: GroupList{ ++ Resources: []Group{ ++ { ++ ID: "group-beta", ++ DisplayName: "team-beta", ++ Roles: []ComplexValue{{Value: "roles-are-requested"}}, ++ }, ++ }, ++ }, ++ }, ++ }, func(ctx context.Context, client *common.DatabricksClient) { ++ api := NewGroupsAPI(ctx, client) ++ withoutRoles, err := api.Filter("displayName eq 'team-alpha'", false) ++ if err != nil { ++ t.Fatalf("filter groups without roles: %v", err) ++ } ++ if len(withoutRoles.Resources) != 1 || withoutRoles.Resources[0].ID != "group-alpha" { ++ t.Fatalf("unexpected groups response without roles: %#v", withoutRoles) ++ } ++ withRoles, err := api.Filter("displayName eq 'team-beta'", true) ++ if err != nil { ++ t.Fatalf("filter groups with roles: %v", err) ++ } ++ if len(withRoles.Resources) != 1 || len(withRoles.Resources[0].Roles) != 1 { ++ t.Fatalf("unexpected groups response with roles: %#v", withRoles) ++ } ++ }) ++} ++ ++func TestGroupsAPIReadByDisplayNameReturnsFullGroupAfterLeanLookup(t *testing.T) { ++ qa.HTTPFixturesApply(t, []qa.HTTPFixture{ ++ { ++ Method: "GET", ++ Resource: "/api/2.0/preview/scim/v2/Groups?excludedAttributes=roles&filter=displayName%20eq%20%27complete-team%27", ++ Response: GroupList{ ++ Resources: []Group{ ++ {ID: "complete-group-id", DisplayName: "complete-team"}, ++ }, ++ }, ++ }, ++ { ++ Method: "GET", ++ Resource: "/api/2.0/preview/scim/v2/Groups/complete-group-id", ++ Response: Group{ ++ ID: "complete-group-id", ++ DisplayName: "complete-team", ++ Roles: []ComplexValue{{Value: "full-role"}}, ++ Members: []ComplexValue{{Value: "members-from-full-read"}}, ++ }, ++ }, ++ }, func(ctx context.Context, client *common.DatabricksClient) { ++ group, err := NewGroupsAPI(ctx, client).ReadByDisplayName("complete-team") ++ if err != nil { ++ t.Fatalf("read group by display name: %v", err) ++ } ++ if len(group.Roles) != 1 || group.Roles[0].Value != "full-role" { ++ t.Fatalf("expected complete group roles from full read, got %#v", group) ++ } ++ if len(group.Members) != 1 || group.Members[0].Value != "members-from-full-read" { ++ t.Fatalf("expected complete group members from full read, got %#v", group) ++ } ++ }) ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,21 @@ ++#!/bin/bash ++set -euo pipefail ++cd /testbed ++ ++ ++ ++BASE_SKIP='TestGlobalInitScriptsBodyErrors|TestImportingWithError|TestUsersAPIListExcludesRolesWithoutFilter|TestUsersAPIFilterExcludesRolesAndPreservesFilter|TestServicePrincipalsAPIExcludesRolesForListAndFilter|TestGroupsAPIFilterIncludeRolesOption|TestGroupsAPIReadByDisplayNameReturnsFullGroupAfterLeanLookup' ++NEW_RUN='^(TestImportingUsersGroupsSecretScopes|TestImportingUser|TestImportingDLTPipelines|TestUserSearchFails|TestSpnSearchFails|TestSpnSearchSuccess|TestUserImportSkipNonDirectGroups|TestDataSourceGroup|TestDataServicePrincipalReadByAppId|TestDataServicePrincipalReadNotFound|TestDataServicePrincipalReadError|TestDataServicePrincipalsReadByDisplayName|TestDataServicePrincipalsReadNotFound|TestDataServicePrincipalsReadNoFilter|TestDataServicePrincipalsReadError|TestDataSourceUser|TestDataSourceUserGerUser|TestCreateForceOverwriteCannotListGroups|TestCreateForceOverwriteFindsAndSetsGroupID|TestCreateForceOverwriteCannotListServicePrincipals|TestCreateForceOverwriteCannotListAccServicePrincipals|TestCreateForceOverwriteFindsAndSetsServicePrincipalID|TestCreateForceOverwriteCannotListUsers|TestCreateForceOverwriteCannotListAccUsers|TestCreateForceOverwriteFindsAndSetsID|TestCreateForceOverwriteFindsAndSetsAccID|TestUsersFilter|TestUsersAPIListExcludesRolesWithoutFilter|TestUsersAPIFilterExcludesRolesAndPreservesFilter|TestServicePrincipalsAPIExcludesRolesForListAndFilter|TestGroupsAPIFilterIncludeRolesOption|TestGroupsAPIReadByDisplayNameReturnsFullGroupAfterLeanLookup)$' ++ ++case "${1:-}" in ++ base) ++ go test -count=1 -timeout 600s -skip "$BASE_SKIP" ./exporter/ ./scim/ ++ ;; ++ new) ++ go test -count=1 -timeout 600s -run "$NEW_RUN" ./exporter/ ./scim/ ++ ;; ++ *) ++ echo "usage: $0 base|new" >&2 ++ exit 2 ++ ;; ++esac diff --git a/tasks/format-code-task-000758/tests/test.sh b/tasks/format-code-task-000758/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..01ee83034e18edc0c7dd77a8544b133ffc804a24 --- /dev/null +++ b/tasks/format-code-task-000758/tests/test.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +exporter/exporter_test.go +exporter/importables_test.go +qa/testing.go +scim/data_group_test.go +scim/data_service_principal_test.go +scim/data_service_principals_test.go +scim/data_user_test.go +scim/resource_group_test.go +scim/resource_service_principal_test.go +scim/resource_user_test.go +scim/users_test.go +scim/scim_roles_filter_test.go +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000758/tests/test_command.sh b/tasks/format-code-task-000758/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..e8d2f32b64045b5a5a56e0ad5667da87d8e0bc2a --- /dev/null +++ b/tasks/format-code-task-000758/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new \ No newline at end of file diff --git a/tasks/format-code-task-000767/environment/Dockerfile b/tasks/format-code-task-000767/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..35cac012e9b20be67a881627fdf4e11bb72352ab --- /dev/null +++ b/tasks/format-code-task-000767/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:9e6879c43570fdd48058f4175304642187411b420d622824a3be7c9776b502fa diff --git a/tasks/format-code-task-000767/environment/setup/files/blocklist b/tasks/format-code-task-000767/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000767/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000767/environment/setup/setup.sh b/tasks/format-code-task-000767/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000767/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000767/tests/test.patch b/tasks/format-code-task-000767/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..45eccf8d7f8403bc9bdab7f9ab3d19964b13b997 --- /dev/null +++ b/tasks/format-code-task-000767/tests/test.patch @@ -0,0 +1,54 @@ +diff --git a/tests/conftest.py b/tests/conftest.py +index 27e4d300..01406bc8 100644 +--- a/tests/conftest.py ++++ b/tests/conftest.py +@@ -15,6 +15,16 @@ + "adapter_type": "snowflake", + }, + "nodes": { ++ "model.with_version.v1": { ++ "patch_path": "project://bb/with_version.yml", ++ "path": "aa/bb/with_version.sql", ++ "root_path": "/path/to/aa", ++ "config": { ++ "materialized": "table", ++ }, ++ "version": "1", ++ "latest_version": "1", ++ }, + "model.with_schema": { + "patch_path": "project://bb/with_schema.yml", + "path": "aa/bb/with_schema.sql", +diff --git a/tests/unit/test_check_model_has_properties_file.py b/tests/unit/test_check_model_has_properties_file.py +index 72ffe5ae..5e95bfc4 100644 +--- a/tests/unit/test_check_model_has_properties_file.py ++++ b/tests/unit/test_check_model_has_properties_file.py +@@ -5,6 +5,7 @@ + TESTS = ( + (["aa/bb/with_schema.sql", "--is_test"], True, True, 0), + (["aa/bb/with_schema.sql", "--is_test"], False, True, 1), ++ (["aa/bb/with_version.sql", "--is_test"], True, True, 0), + (["aa/bb/without_schema.sql", "--is_test"], True, False, 1), + (["aa/bb/some_snapshot.sql", "--is_test"], True, True, 0), + ) +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,5 @@ ++H4sIAAAAAAAAA+3S0Q6CIBQGYK99ClrXaZjo4zAVGiwFJ9jW24euVWurbmqt+j82OTvihP0k9ahb ++waXZp9G7rIOSsXkObue5piyjYTCWhT6lrMwjwt62oyuj89VASDRY6x+te/b+SyWX/L10nje26yoj ++Eqde949n+dMiO+efl0XIPy8yGpH167Zw35/nv1yktTZpXTkVN4LMl6CWIu4PXlmzIauOhDI0yfRw ++aWPNdqqS/nDqjEb7091RstnxzgrZclU53g+2l4PX0vGtbuX0yWoff/rEAAAAAAAAAAAAAAAAAAAA ++AAC/4whRgDWbACgAAA== +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-000767/tests/test.sh b/tasks/format-code-task-000767/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..a84b14e1bfa7526db183b41c7af90084f0cead0f --- /dev/null +++ b/tasks/format-code-task-000767/tests/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/conftest.py +tests/unit/test_check_model_has_properties_file.py +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000767/tests/test_command.sh b/tasks/format-code-task-000767/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000767/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000769/environment/Dockerfile b/tasks/format-code-task-000769/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..b86a88d307301e9c3aa5e2bbcc2ac260ab4afab7 --- /dev/null +++ b/tasks/format-code-task-000769/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:669d8be6ea4011150e20ac472a2cd92d3521f3670e661d485e21aa5174930758 diff --git a/tasks/format-code-task-000769/environment/setup/files/blocklist b/tasks/format-code-task-000769/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000769/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000769/environment/setup/setup.sh b/tasks/format-code-task-000769/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000769/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000769/tests/test.patch b/tasks/format-code-task-000769/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..d9f3a77feb4d45ba51e921807e69e70125d026f5 --- /dev/null +++ b/tasks/format-code-task-000769/tests/test.patch @@ -0,0 +1,240 @@ +diff --git a/tests/functional/logging/test_meta_logging.py b/tests/functional/logging/test_meta_logging.py +index 19b107252..85a279e18 100644 +--- a/tests/functional/logging/test_meta_logging.py ++++ b/tests/functional/logging/test_meta_logging.py +@@ -1,4 +1,5 @@ + import json ++import os + + import pytest + +@@ -14,9 +15,7 @@ def models(): + return {"model1.sql": model1, "model2.sql": model2, "model3.sql": model3} + + +-# This test checks that various events contain node_info, +-# which is supplied by the log_contextvars context manager +-def test_meta(project, logs_dir): ++def run_and_capture_node_info_logs(logs_dir): + run_dbt(["--log-format=json", "run"]) + + # get log file +@@ -35,12 +34,51 @@ def test_meta(project, logs_dir): + if "node_info" not in log_dct["data"]: + continue + +- print(f"--- log_dct: {log_dct}") +- node_info = log_dct["data"]["node_info"] +- node_path = node_info["node_path"] +- if node_path == "model1.sql": +- assert node_info["meta"] == {} +- elif node_path == "model2.sql": +- assert node_info["meta"] == {"owners": ["team1", "team2"]} +- elif node_path == "model3.sql": +- assert node_info["meta"] == {"key": 1} ++ yield log_dct["data"]["node_info"] ++ ++ ++def load_manifest(project): ++ manifest_path = os.path.join(project.project_root, "target", "manifest.json") ++ with open(manifest_path) as fp: ++ return json.load(fp) ++ ++ ++ ++ ++def test_meta(project, logs_dir): ++ for node_info_log in run_and_capture_node_info_logs(logs_dir): ++ if node_info_log["unique_id"] == "model.test.model1": ++ assert node_info_log["meta"] == {} ++ elif node_info_log["unique_id"] == "model.test.model2": ++ assert node_info_log["meta"] == {"owners": ["team1", "team2"]} ++ elif node_info_log["unique_id"] == "model.test.model3": ++ assert node_info_log["meta"] == {"key": 1} ++ ++ ++def test_checksum(project, logs_dir): ++ extra_model_path = os.path.join(project.project_root, "models", "checksum_extra_model.sql") ++ with open(extra_model_path, "w") as fp: ++ fp.write("select 42 as answer\n") ++ ++ node_info_logs = list(run_and_capture_node_info_logs(logs_dir)) ++ manifest = load_manifest(project) ++ ++ expected_unique_ids = { ++ "model.test.model1", ++ "model.test.model2", ++ "model.test.model3", ++ "model.test.checksum_extra_model", ++ } ++ node_info_by_unique_id = {unique_id: [] for unique_id in expected_unique_ids} ++ for node_info_log in node_info_logs: ++ unique_id = node_info_log.get("unique_id") ++ if unique_id in expected_unique_ids: ++ node_info_by_unique_id[unique_id].append(node_info_log) ++ ++ assert {unique_id for unique_id, logs in node_info_by_unique_id.items() if logs} == expected_unique_ids ++ ++ for unique_id, logs in node_info_by_unique_id.items(): ++ expected_checksum = manifest["nodes"][unique_id]["checksum"]["checksum"] ++ for node_info_log in logs: ++ assert "node_checksum" in node_info_log ++ assert node_info_log["node_checksum"] == expected_checksum +diff --git a/tests/unit/contracts/graph/test_node_info_checksum.py b/tests/unit/contracts/graph/test_node_info_checksum.py +new file mode 100644 +index 000000000..e929a7045 +--- /dev/null ++++ b/tests/unit/contracts/graph/test_node_info_checksum.py +@@ -0,0 +1,89 @@ ++from dbt.artifacts.resources import FileHash ++from dbt.contracts.graph.nodes import ModelNode, SeedNode, SourceDefinition ++from dbt.node_types import NodeType ++ ++ ++def missing_checksum_model(name): ++ return ModelNode( ++ alias=name, ++ name=name, ++ database="test_db", ++ schema="test_schema", ++ resource_type=NodeType.Model, ++ package_name="test", ++ path=f"models/{name}.sql", ++ original_file_path=f"models/{name}.sql", ++ unique_id=f"model.test.{name}", ++ fqn=["test", name], ++ checksum=None, ++ raw_code="select 1 as id", ++ language="sql", ++ refs=[], ++ sources=[], ++ metrics=[], ++ depends_on={"macros": [], "nodes": []}, ++ config={}, ++ tags=[], ++ description="", ++ columns={}, ++ meta={}, ++ group=None, ++ docs={"show": True, "node_color": None}, ++ patch_path=None, ++ build_path=None, ++ unrendered_config={}, ++ created_at=0.0, ++ relation_name=None, ++ ) ++ ++ ++def test_node_info_includes_null_checksum_when_missing(): ++ for node in [ ++ missing_checksum_model("missing_checksum_model"), ++ missing_checksum_model("another_missing_checksum_model"), ++ ]: ++ node_info = node.node_info ++ assert "node_checksum" in node_info ++ assert node_info["node_checksum"] is None ++ ++ ++def test_node_info_exposes_checksum_for_non_model_nodes(): ++ node = SeedNode( ++ alias="seed_checksum", ++ name="seed_checksum", ++ database="test_db", ++ schema="test_schema", ++ resource_type=NodeType.Seed, ++ package_name="test", ++ path="seeds/seed_checksum.csv", ++ original_file_path="seeds/seed_checksum.csv", ++ unique_id="seed.test.seed_checksum", ++ fqn=["test", "seed_checksum"], ++ checksum=FileHash(name="sha256", checksum="seed-checksum"), ++ ) ++ ++ node_info = node.node_info ++ assert "node_checksum" in node_info ++ assert node_info["node_checksum"] == "seed-checksum" ++ ++ ++def test_node_info_includes_null_checksum_without_checksum_attribute(): ++ node = SourceDefinition( ++ database="test_db", ++ schema="test_schema", ++ name="source_table", ++ resource_type=NodeType.Source, ++ package_name="test", ++ path="models/schema.yml", ++ original_file_path="models/schema.yml", ++ unique_id="source.test.raw.source_table", ++ fqn=["test", "raw", "source_table"], ++ source_name="raw", ++ source_description="", ++ loader="seed", ++ identifier="source_table", ++ ) ++ ++ node_info = node.node_info ++ assert "node_checksum" in node_info ++ assert node_info["node_checksum"] is None +diff --git a/tests/unit/events/test_types.py b/tests/unit/events/test_types.py +index 1dd6d00b8..194801849 100644 +--- a/tests/unit/events/test_types.py ++++ b/tests/unit/events/test_types.py +@@ -129,6 +129,7 @@ def test_node_info_events(): + "alias": "some_alias", + "relation_name": "some.relation.name", + }, ++ "node_checksum": "some_checksum", + } + event = LogStartLine( + description="some description", +@@ -151,6 +152,8 @@ def test_node_info_events(): + assert event.node_info.node_relation.database == "" + assert event.node_info.node_relation.relation_name == "some_schema.some_alias" + ++ assert event.node_info.node_checksum == "some_checksum" ++ + + def test_extra_dict_on_event(monkeypatch): + +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,37 @@ ++#!/bin/bash ++set -uo pipefail ++cd /testbed ++ ++ ++ ++pg_isready -q 2>/dev/null || pg_ctlcluster 16 main start 2>/dev/null || true ++ ++ ++su - postgres -c "psql -c \"SELECT 1 FROM pg_roles WHERE rolname='root'\" | grep -q 1" 2>/dev/null || \ ++ su - postgres -c "psql -c \"CREATE USER root WITH PASSWORD 'password' SUPERUSER;\"" 2>/dev/null || true ++su - postgres -c "psql -c \"SELECT 1 FROM pg_database WHERE datname='dbt'\" | grep -q 1" 2>/dev/null || \ ++ su - postgres -c "psql -c \"CREATE DATABASE dbt OWNER root;\"" 2>/dev/null || true ++ ++ ++pip install -e /testbed/core --no-input --no-deps --quiet 2>/dev/null || true ++ ++ ++case "${1:-}" in ++ base) ++ python3 -m pytest \ ++ tests/functional/logging/test_meta_logging.py::test_meta \ ++ tests/unit/events/test_types.py::test_extra_dict_on_event \ ++ -v ++ ;; ++ new) ++ python3 -m pytest \ ++ tests/functional/logging/test_meta_logging.py::test_checksum \ ++ tests/unit/events/test_types.py::test_node_info_events \ ++ tests/unit/contracts/graph/test_node_info_checksum.py \ ++ -v ++ ;; ++ *) ++ echo "usage: $0 base|new" ++ exit 2 ++ ;; ++esac diff --git a/tasks/format-code-task-000769/tests/test.sh b/tasks/format-code-task-000769/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..50bdb333302653aa7fb56fcefe769e0b7da7e5c7 --- /dev/null +++ b/tasks/format-code-task-000769/tests/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/functional/logging/test_meta_logging.py +tests/unit/contracts/graph/test_node_info_checksum.py +tests/unit/events/test_types.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000769/tests/test_command.sh b/tasks/format-code-task-000769/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..e8d2f32b64045b5a5a56e0ad5667da87d8e0bc2a --- /dev/null +++ b/tasks/format-code-task-000769/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new \ No newline at end of file diff --git a/tasks/format-code-task-000794/environment/Dockerfile b/tasks/format-code-task-000794/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..7a9cfb1af631efa77af1a5fa1a122fc4b1f05db7 --- /dev/null +++ b/tasks/format-code-task-000794/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:a0a08bdfde14876b70e394c8dd117ebe405d36dffdcaa1c5061fb2510a90d0af diff --git a/tasks/format-code-task-000794/environment/setup/files/blocklist b/tasks/format-code-task-000794/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000794/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000794/environment/setup/setup.sh b/tasks/format-code-task-000794/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-000794/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000794/tests/test.patch b/tasks/format-code-task-000794/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..2ca402e141fb89ef215f4e979ef80c0d5f8e52e7 --- /dev/null +++ b/tasks/format-code-task-000794/tests/test.patch @@ -0,0 +1,465 @@ +diff --git a/usercase-test-coderl/nested_calls.test.ts b/usercase-test-coderl/nested_calls.test.ts +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/nested_calls.test.ts +@@ -0,0 +1,431 @@ ++import { expect } from "chai"; ++import { BN } from "bn.js"; ++ ++import { FakeBlockchain } from "../lib/FakeBlockchain"; ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++type Storage = { readonly [key: string]: string }; ++ ++function account(address: string, code: ReadonlyArray = [], storage: Storage = {}) { ++ return { ++ address, ++ nonce: 0, ++ value: new BN(0), ++ code, ++ storage, ++ }; ++} ++ ++function runCode( ++ chain: FakeBlockchain, ++ code: ReadonlyArray, ++ env: { account?: string; caller?: string; value?: number; data?: ReadonlyArray; depth?: number } = {}, ++) { ++ return chain.vm.runCode({ ++ account: env.account || "1", ++ caller: env.caller || "aa", ++ code, ++ data: env.data || [], ++ value: new BN(env.value || 0), ++ depth: env.depth || 0, ++ }).state; ++} ++ ++function stackAsDecimalStrings(state: { stack: ArrayLike }): string[] { ++ return Array.from(state.stack).map(value => value.toString(10)); ++} ++ ++const RETURN_32_BYTES_WITH_42 = [0x60, 0x2a, 0x60, 0x00, 0x52, 0x60, 0x20, 0x60, 0x00, 0xf3]; ++const RETURN_ONE_BYTE_AB = [0x60, 0xab, 0x60, 0x00, 0x52, 0x60, 0x01, 0x60, 0x1f, 0xf3]; ++const STORE_42_AT_SLOT_1_AND_STOP = [0x60, 0x2a, 0x60, 0x01, 0x55, 0x00]; ++const STORE_42_AT_SLOT_1_AND_REVERT = [0x60, 0x2a, 0x60, 0x01, 0x55, 0xfd]; ++ ++const CALL_TARGET_2_RETURN_32_TO_OFFSET_0 = [ ++ 0x60, ++ 0x20, ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x02, ++ 0x61, ++ 0xff, ++ 0xff, ++ 0xf1, ++]; ++ ++const CALL_TARGET_2_RETURN_4_TO_OFFSET_0 = [ ++ 0x60, ++ 0x04, ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x02, ++ 0x61, ++ 0xff, ++ 0xff, ++ 0xf1, ++]; ++ ++const CALL_TARGET_2_NO_RETURN_WITH_VALUE_7 = [ ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x07, ++ 0x60, ++ 0x02, ++ 0x61, ++ 0xff, ++ 0xff, ++ 0xf1, ++]; ++ ++const CALLCODE_TARGET_2_NO_RETURN_WITH_VALUE_7 = [ ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x07, ++ 0x60, ++ 0x02, ++ 0x61, ++ 0xff, ++ 0xff, ++ 0xf2, ++]; ++ ++const DELEGATECALL_TARGET_2_NO_RETURN = [ ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x02, ++ 0x61, ++ 0xff, ++ 0xff, ++ 0xf4, ++]; ++ ++const WRITE_INPUT_01020304_TO_MEMORY = [0x63, 0x01, 0x02, 0x03, 0x04, 0x60, 0x00, 0x52]; ++ ++const CALL_WITH_INPUT_01020304 = [ ++ ...WRITE_INPUT_01020304_TO_MEMORY, ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x04, ++ 0x60, ++ 0x1c, ++ 0x60, ++ 0x07, ++ 0x60, ++ 0x02, ++ 0x61, ++ 0xff, ++ 0xff, ++ 0xf1, ++]; ++ ++const CALLCODE_WITH_INPUT_01020304 = [ ++ ...WRITE_INPUT_01020304_TO_MEMORY, ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x04, ++ 0x60, ++ 0x1c, ++ 0x60, ++ 0x07, ++ 0x60, ++ 0x02, ++ 0x61, ++ 0xff, ++ 0xff, ++ 0xf2, ++]; ++ ++const DELEGATECALL_WITH_INPUT_01020304 = [ ++ ...WRITE_INPUT_01020304_TO_MEMORY, ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x00, ++ 0x60, ++ 0x04, ++ 0x60, ++ 0x1c, ++ 0x60, ++ 0x02, ++ 0x61, ++ 0xff, ++ 0xff, ++ 0xf4, ++]; ++ ++describe("usercase nested contract-call execution", () => { ++ it("returns CALL success flag, copied return memory, and lastReturned bytes", () => { ++ ++ ++ const chain = new FakeBlockchain(); ++ chain.setAddress("2", account("2", RETURN_32_BYTES_WITH_42)); ++ ++ const state = runCode(chain, CALL_TARGET_2_RETURN_32_TO_OFFSET_0); ++ ++ expect(stackAsDecimalStrings(state)).to.deep.equal(["1"]); ++ expect(state.memory).to.deep.equal([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42]); ++ expect(state.lastReturned).to.deep.equal([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42]); ++ expect(state.pc).to.equal(16); ++ expect(state.stopped).to.equal(true); ++ expect(state.reverted).to.equal(false); ++ expect(chain.layeredAccounts.length).to.equal(1); ++ }); ++ ++ it("rolls back target storage and clears return data when CALL reverts", () => { ++ ++ ++ const chain = new FakeBlockchain(); ++ chain.setAddress("2", account("2", STORE_42_AT_SLOT_1_AND_REVERT)); ++ ++ const state = runCode(chain, CALL_TARGET_2_RETURN_32_TO_OFFSET_0); ++ ++ expect(stackAsDecimalStrings(state)).to.deep.equal(["0"]); ++ expect(state.memory).to.deep.equal([]); ++ expect(state.lastReturned).to.deep.equal([]); ++ expect(chain.getAddress("2").storage).to.deep.equal({}); ++ expect(state.pc).to.equal(16); ++ expect(state.stopped).to.equal(true); ++ expect(state.reverted).to.equal(false); ++ expect(chain.layeredAccounts.length).to.equal(1); ++ }); ++ ++ it("uses the documented nested frame environment for CALL, CALLCODE, and DELEGATECALL", () => { ++ ++ ++ const observedFrames: Array<{ ++ readonly opcode: string; ++ readonly account: string; ++ readonly caller: string; ++ readonly value: string; ++ readonly depth: number; ++ readonly data: ReadonlyArray; ++ }> = []; ++ ++ for (const code of [CALL_WITH_INPUT_01020304, CALLCODE_WITH_INPUT_01020304, DELEGATECALL_WITH_INPUT_01020304]) { ++ const chain = new FakeBlockchain(); ++ chain.setAddress("2", account("2", [0x00])); ++ chain.vm.on("step", event => { ++ if (event.previousEnv.depth === 1) { ++ observedFrames.push({ ++ opcode: event.currentOpcode.type, ++ account: event.previousEnv.account, ++ caller: event.previousEnv.caller, ++ value: event.previousEnv.value.toString(10), ++ depth: event.previousEnv.depth, ++ data: event.previousEnv.data, ++ }); ++ } ++ }); ++ ++ const state = runCode(chain, code, { account: "10", caller: "aa", value: 99 }); ++ expect(stackAsDecimalStrings(state)).to.deep.equal(["1"]); ++ expect(state.lastReturned).to.deep.equal([]); ++ expect(chain.layeredAccounts.length).to.equal(1); ++ } ++ ++ ++ expect(observedFrames).to.have.length(3); ++ expect(observedFrames).to.have.deep.members([ ++ { opcode: "STOP", account: "2", caller: "10", value: "7", depth: 1, data: [1, 2, 3, 4] }, ++ { opcode: "STOP", account: "10", caller: "10", value: "7", depth: 1, data: [1, 2, 3, 4] }, ++ { opcode: "STOP", account: "10", caller: "aa", value: "0", depth: 1, data: [1, 2, 3, 4] }, ++ ]); ++ }); ++ ++ it("commits successful storage writes to the account selected by each call mode", () => { ++ ++ ++ const callChain = new FakeBlockchain(); ++ callChain.setAddress("2", account("2", STORE_42_AT_SLOT_1_AND_STOP)); ++ callChain.setAddress("10", account("10")); ++ const callState = runCode(callChain, CALL_TARGET_2_NO_RETURN_WITH_VALUE_7, { account: "10", caller: "aa", value: 99 }); ++ ++ expect(stackAsDecimalStrings(callState)).to.deep.equal(["1"]); ++ expect(callChain.getAddress("2").storage).to.deep.equal({ "1": "2a" }); ++ expect(callChain.getAddress("10").storage).to.deep.equal({}); ++ expect(callChain.layeredAccounts.length).to.equal(1); ++ ++ const callcodeChain = new FakeBlockchain(); ++ callcodeChain.setAddress("2", account("2", STORE_42_AT_SLOT_1_AND_STOP)); ++ callcodeChain.setAddress("10", account("10")); ++ const callcodeState = runCode(callcodeChain, CALLCODE_TARGET_2_NO_RETURN_WITH_VALUE_7, { ++ account: "10", ++ caller: "aa", ++ value: 99, ++ }); ++ ++ expect(stackAsDecimalStrings(callcodeState)).to.deep.equal(["1"]); ++ expect(callcodeChain.getAddress("2").storage).to.deep.equal({}); ++ expect(callcodeChain.getAddress("10").storage).to.deep.equal({ "1": "2a" }); ++ expect(callcodeChain.layeredAccounts.length).to.equal(1); ++ ++ const delegateChain = new FakeBlockchain(); ++ delegateChain.setAddress("2", account("2", STORE_42_AT_SLOT_1_AND_STOP)); ++ delegateChain.setAddress("10", account("10")); ++ const delegateState = runCode(delegateChain, DELEGATECALL_TARGET_2_NO_RETURN, { ++ account: "10", ++ caller: "aa", ++ value: 99, ++ }); ++ ++ expect(stackAsDecimalStrings(delegateState)).to.deep.equal(["1"]); ++ expect(delegateChain.getAddress("2").storage).to.deep.equal({}); ++ expect(delegateChain.getAddress("10").storage).to.deep.equal({ "1": "2a" }); ++ expect(delegateChain.layeredAccounts.length).to.equal(1); ++ }); ++ ++ it("zero-pads copied return memory while preserving the full lastReturned value", () => { ++ ++ ++ const chain = new FakeBlockchain(); ++ chain.setAddress("2", account("2", RETURN_ONE_BYTE_AB)); ++ ++ const state = runCode(chain, CALL_TARGET_2_RETURN_4_TO_OFFSET_0); ++ ++ expect(stackAsDecimalStrings(state)).to.deep.equal(["1"]); ++ expect(state.memory).to.deep.equal([171, 0, 0, 0]); ++ expect(state.lastReturned).to.deep.equal([171]); ++ expect(state.pc).to.equal(16); ++ expect(chain.layeredAccounts.length).to.equal(1); ++ }); ++ ++ it("continues execution after success and failure call opcodes", () => { ++ ++ ++ const successChain = new FakeBlockchain(); ++ successChain.setAddress("2", account("2", RETURN_32_BYTES_WITH_42)); ++ const successState = runCode(successChain, [...CALL_TARGET_2_RETURN_32_TO_OFFSET_0, 0x3d]); ++ ++ expect(stackAsDecimalStrings(successState)).to.deep.equal(["1", "32"]); ++ expect(successState.pc).to.equal(17); ++ expect(successState.stopped).to.equal(true); ++ expect(successChain.layeredAccounts.length).to.equal(1); ++ ++ const revertChain = new FakeBlockchain(); ++ revertChain.setAddress("2", account("2", STORE_42_AT_SLOT_1_AND_REVERT)); ++ const revertState = runCode(revertChain, [...CALL_TARGET_2_RETURN_32_TO_OFFSET_0, 0x3d]); ++ ++ expect(stackAsDecimalStrings(revertState)).to.deep.equal(["0", "0"]); ++ expect(revertState.pc).to.equal(17); ++ expect(revertState.stopped).to.equal(true); ++ expect(revertChain.layeredAccounts.length).to.equal(1); ++ }); ++ ++ it("rejects CALL when reached without stack arguments", () => { ++ ++ ++ const chain = new FakeBlockchain(); ++ ++ ++ expect(() => runCode(chain, [0xf1])).to.throw(); ++ }); ++ ++ it("keeps checkpoint behavior usable after a successful nested call commits", () => { ++ ++ ++ const chain = new FakeBlockchain(); ++ chain.setAddress("2", account("2", STORE_42_AT_SLOT_1_AND_STOP)); ++ ++ const state = runCode(chain, CALL_TARGET_2_NO_RETURN_WITH_VALUE_7); ++ expect(stackAsDecimalStrings(state)).to.deep.equal(["1"]); ++ expect(chain.getAddress("2").storage).to.deep.equal({ "1": "2a" }); ++ ++ ++ chain.checkpoint(); ++ chain.setAddress("2", account("2", [], { "9": "9" })); ++ expect(chain.getAddress("2").storage).to.deep.equal({ "9": "9" }); ++ chain.revert(); ++ expect(chain.getAddress("2").storage).to.deep.equal({ "1": "2a" }); ++ }); ++ ++ it("does not mutate accounts not selected by CALL", () => { ++ ++ ++ const chain = new FakeBlockchain(); ++ chain.setAddress("2", account("2", STORE_42_AT_SLOT_1_AND_STOP)); ++ chain.setAddress("3", account("3")); ++ ++ const state = runCode(chain, CALL_TARGET_2_NO_RETURN_WITH_VALUE_7, { account: "10", caller: "aa", value: 99 }); ++ ++ expect(stackAsDecimalStrings(state)).to.deep.equal(["1"]); ++ expect(chain.getAddress("2").storage).to.deep.equal({ "1": "2a" }); ++ ++ expect(chain.getAddress("3").storage).to.deep.equal({}); ++ expect(chain.layeredAccounts.length).to.equal(1); ++ }); ++ ++ it("keeps checkpoint layers bounded across repeated nested call cleanup cycles", () => { ++ ++ ++ const chain = new FakeBlockchain(); ++ chain.setAddress("2", account("2", RETURN_32_BYTES_WITH_42)); ++ chain.setAddress("3", account("3", STORE_42_AT_SLOT_1_AND_REVERT)); ++ ++ expect(chain.layeredAccounts.length).to.equal(1); ++ ++ for (let i = 0; i < 60; i++) { ++ const successState = runCode(chain, CALL_TARGET_2_RETURN_32_TO_OFFSET_0); ++ expect(stackAsDecimalStrings(successState)).to.deep.equal(["1"]); ++ expect(chain.layeredAccounts.length).to.equal(1); ++ ++ chain.setAddress("2", account("2", STORE_42_AT_SLOT_1_AND_REVERT)); ++ const revertState = runCode(chain, CALL_TARGET_2_RETURN_32_TO_OFFSET_0); ++ expect(stackAsDecimalStrings(revertState)).to.deep.equal(["0"]); ++ expect(chain.layeredAccounts.length).to.equal(1); ++ ++ chain.setAddress("2", account("2", RETURN_32_BYTES_WITH_42)); ++ } ++ ++ expect(chain.layeredAccounts.length).to.equal(1); ++ }); ++}); +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,24 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++set -euo pipefail ++ ++cd /workspace/repo ++ ++if [ ! -x ./node_modules/.bin/mocha ]; then ++ echo "repo-local node_modules is required for offline test execution" >&2 ++ exit 1 ++fi ++ ++exec ./node_modules/.bin/mocha \ ++ -r ts-node/register \ ++ -r tsconfig-paths/register \ ++ /workspace/repo/usercase-test-coderl/nested_calls.test.ts diff --git a/tasks/format-code-task-000794/tests/test.sh b/tasks/format-code-task-000794/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..46ff7946b9123bfc88faf79b25e4ec3a3ec9c0e8 --- /dev/null +++ b/tasks/format-code-task-000794/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/nested_calls.test.ts +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000794/tests/test_command.sh b/tasks/format-code-task-000794/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-000794/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000840/environment/Dockerfile b/tasks/format-code-task-000840/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..dfab34d85ea84ee8501c9cde93bc5f64eb11bb1a --- /dev/null +++ b/tasks/format-code-task-000840/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:07c36be55ff4f8b7a14645ab8d20ef801c15d4df873f25a674ba8b12d4946bf9 diff --git a/tasks/format-code-task-000840/environment/setup/files/blocklist b/tasks/format-code-task-000840/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000840/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000840/environment/setup/setup.sh b/tasks/format-code-task-000840/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000840/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000840/tests/test.patch b/tasks/format-code-task-000840/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..bed488c397d56b8830f165c460525af37acab62a --- /dev/null +++ b/tasks/format-code-task-000840/tests/test.patch @@ -0,0 +1,103 @@ +diff --git a/packages/ts-morph/src/tests/compiler/tools/typeCheckerTests.ts b/packages/ts-morph/src/tests/compiler/tools/typeCheckerTests.ts +index cd946a08..76c56d38 100644 +--- a/packages/ts-morph/src/tests/compiler/tools/typeCheckerTests.ts ++++ b/packages/ts-morph/src/tests/compiler/tools/typeCheckerTests.ts +@@ -89,4 +89,27 @@ describe("TypeChecker", () => { + ); + }); + }); ++ ++ describe(nameof("isTypeAssignableTo"), () => { ++ function getTwoTypes(text: string) { ++ const { sourceFile, project } = getInfoFromText(text); ++ const decls = sourceFile.getVariableDeclarations(); ++ return { a: decls[0].getType(), b: decls[1].getType(), checker: project.getTypeChecker() }; ++ } ++ ++ it("should return true when source string literal type is assignable to target string type", () => { ++ const { a, b, checker } = getTwoTypes("let a: 'test'; let b: string;"); ++ expect(checker.isTypeAssignableTo(a, b)).to.equal(true); ++ }); ++ ++ it("should return false when source string type is not assignable to target string literal type", () => { ++ const { a, b, checker } = getTwoTypes("let a: 'test'; let b: string;"); ++ expect(checker.isTypeAssignableTo(b, a)).to.equal(false); ++ }); ++ ++ it("should return false when source number type is not assignable to target string type", () => { ++ const { a, b, checker } = getTwoTypes("let a: number; let b: string;"); ++ expect(checker.isTypeAssignableTo(a, b)).to.equal(false); ++ }); ++ }); + }); +diff --git a/packages/ts-morph/src/tests/compiler/type/typeTests.ts b/packages/ts-morph/src/tests/compiler/type/typeTests.ts +index dbb947da..457ec664 100644 +--- a/packages/ts-morph/src/tests/compiler/type/typeTests.ts ++++ b/packages/ts-morph/src/tests/compiler/type/typeTests.ts +@@ -992,4 +992,44 @@ let unknownType: unknown; + runTest("let myType: string;", undefined); + }); + }); ++ ++ describe(nameof("isAssignableTo"), () => { ++ function getTwoTypes(text: string) { ++ const result = getInfoFromTextWithTypeChecking(text); ++ const decls = result.sourceFile.getVariableDeclarations(); ++ return { a: decls[0].getType(), b: decls[1].getType() }; ++ } ++ ++ it("should return true when the string literal type is assignable to the string type", () => { ++ const { a, b } = getTwoTypes("let a: 'test'; let b: string;"); ++ expect(a.isAssignableTo(b)).to.equal(true); ++ }); ++ ++ it("should return false when the string type is not assignable to the string literal type", () => { ++ const { a, b } = getTwoTypes("let a: 'test'; let b: string;"); ++ expect(b.isAssignableTo(a)).to.equal(false); ++ }); ++ ++ it("should return false when number is not assignable to string", () => { ++ const { a, b } = getTwoTypes("let a: number; let b: string;"); ++ expect(a.isAssignableTo(b)).to.equal(false); ++ }); ++ ++ it("should return true when a type is assignable to itself", () => { ++ const { a, b } = getTwoTypes("let a: string; let b: string;"); ++ expect(a.isAssignableTo(b)).to.equal(true); ++ expect(b.isAssignableTo(a)).to.equal(true); ++ }); ++ ++ it("should return true when any is assignable to string", () => { ++ const { a, b } = getTwoTypes("let a: any; let b: string;"); ++ expect(a.isAssignableTo(b)).to.equal(true); ++ }); ++ ++ it("should return true when a subclass type is assignable to the base interface type", () => { ++ const { a, b } = getTwoTypes("interface Base { x: number } interface Sub extends Base { y: number } let a: Sub; let b: Base;"); ++ expect(a.isAssignableTo(b)).to.equal(true); ++ expect(b.isAssignableTo(a)).to.equal(false); ++ }); ++ }); + }); +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 00000000..a049112c +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["cd packages/ts-morph && npx cross-env TS_NODE_TRANSPILE_ONLY=\"true\" mocha --grep \"isAssignableTo|isTypeAssignableTo\""] ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++cd packages/ts-morph && npx cross-env TS_NODE_TRANSPILE_ONLY="true" mocha --grep "isAssignableTo|isTypeAssignableTo" ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-000840/tests/test.sh b/tasks/format-code-task-000840/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..84295fabfbdf3e4ae34de44fcdcff571cc441258 --- /dev/null +++ b/tasks/format-code-task-000840/tests/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +packages/ts-morph/src/tests/compiler/tools/typeCheckerTests.ts +packages/ts-morph/src/tests/compiler/type/typeTests.ts +test_commands.json +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000840/tests/test_command.sh b/tasks/format-code-task-000840/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000840/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000847/environment/Dockerfile b/tasks/format-code-task-000847/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..42d09b4ef2edd40341f7720e93af8fe9979864a2 --- /dev/null +++ b/tasks/format-code-task-000847/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:fda63f4e10c2c13d8bfdb23d629a587dc50532339357883029a46d83c7faff19 diff --git a/tasks/format-code-task-000847/environment/setup/files/blocklist b/tasks/format-code-task-000847/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000847/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000847/environment/setup/setup.sh b/tasks/format-code-task-000847/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000847/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000847/tests/test.patch b/tasks/format-code-task-000847/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..9fbb8eca0ae4e811a7c09445b42096034d7c375a --- /dev/null +++ b/tasks/format-code-task-000847/tests/test.patch @@ -0,0 +1,161 @@ +diff --git a/tests/test_env_loader.py b/tests/test_env_loader.py +index 2e85a00..83a9fe6 100644 +--- a/tests/test_env_loader.py ++++ b/tests/test_env_loader.py +@@ -505,3 +505,120 @@ def test_filtering_unknown_variables_with_prefix(): + assert not settings.get("IGNOREME") + # Smoke test. + assert settings.get("MYCONFIG") == "ham" ++ ++ ++def test_uppercase_boolean_envvars_are_cast_to_bool(monkeypatch): ++ monkeypatch.setenv("BOOLCAST_ENABLED", "True") ++ monkeypatch.setenv("BOOLCAST_DISABLED", "False") ++ loaded = {} ++ load_from_env( ++ obj=loaded, ++ prefix="BOOLCAST", ++ key=None, ++ silent=True, ++ identifier="env_global", ++ env=False, ++ ) ++ assert loaded["ENABLED"] is True ++ assert loaded["DISABLED"] is False ++ ++ ++def test_uppercase_boolean_envvars_work_through_settings_get(monkeypatch): ++ monkeypatch.setenv("DIRECT_BOOL_TRUE", "True") ++ monkeypatch.setenv("DIRECT_BOOL_FALSE", "False") ++ from dynaconf import Dynaconf ++ ++ settings_obj = Dynaconf() ++ assert settings_obj.get("DIRECT_BOOL_TRUE", sysenv_fallback=True) is True ++ assert settings_obj.get("DIRECT_BOOL_FALSE", sysenv_fallback=True) is False ++ ++ ++def test_uppercase_boolean_envvars_work_with_default_dynaconf_prefix( ++ monkeypatch, ++): ++ monkeypatch.setenv("DYNACONF_THING", "True") ++ monkeypatch.setenv("DYNACONF_SWITCH", "False") ++ from dynaconf import Dynaconf ++ ++ settings_obj = Dynaconf() ++ assert settings_obj.THING is True ++ assert settings_obj.SWITCH is False ++ ++ ++def test_lowercase_boolean_envvars_still_cast_to_bool(monkeypatch): ++ monkeypatch.setenv("BOOLLOWER_ON", "true") ++ monkeypatch.setenv("BOOLLOWER_OFF", "false") ++ loaded = {} ++ load_from_env( ++ obj=loaded, ++ prefix="BOOLLOWER", ++ key=None, ++ silent=True, ++ identifier="env_global", ++ env=False, ++ ) ++ assert loaded["ON"] is True ++ assert loaded["OFF"] is False ++ ++ ++def test_uppercase_boolean_strings_inside_envvar_toml_structures_remain_strings( ++ monkeypatch, ++): ++ monkeypatch.setenv("BOOLSTRUCT_FLAGS", '["True", "False"]') ++ monkeypatch.setenv("BOOLSTRUCT_OPTIONS", '{on="True", off="False"}') ++ loaded = {} ++ load_from_env( ++ obj=loaded, ++ prefix="BOOLSTRUCT", ++ key=None, ++ silent=True, ++ identifier="env_global", ++ env=False, ++ ) ++ assert loaded["FLAGS"][0] == "True" ++ assert isinstance(loaded["FLAGS"][0], str) ++ assert loaded["FLAGS"][1] == "False" ++ assert isinstance(loaded["FLAGS"][1], str) ++ assert loaded["OPTIONS"]["on"] == "True" ++ assert isinstance(loaded["OPTIONS"]["on"], str) ++ assert loaded["OPTIONS"]["off"] == "False" ++ assert isinstance(loaded["OPTIONS"]["off"], str) ++ ++ ++def test_toml_file_quoted_uppercase_booleans_remain_strings(tmp_path): ++ settings_file = tmp_path / "typed_values.toml" ++ settings_file.write_text( ++ 'file_true_word = "True"\n' ++ 'file_false_word = "False"\n' ++ "file_true_bool = true\n" ++ "file_false_bool = false\n" ++ ) ++ from dynaconf import Dynaconf ++ ++ settings_obj = Dynaconf(settings_file=str(settings_file)) ++ assert settings_obj.FILE_TRUE_WORD == "True" ++ assert isinstance(settings_obj.FILE_TRUE_WORD, str) ++ assert settings_obj.FILE_FALSE_WORD == "False" ++ assert isinstance(settings_obj.FILE_FALSE_WORD, str) ++ assert settings_obj.FILE_TRUE_BOOL is True ++ assert settings_obj.FILE_FALSE_BOOL is False ++ ++ ++def test_envvar_explicit_string_preservation_for_uppercase_boolean_words( ++ monkeypatch, ++): ++ monkeypatch.setenv("BOOLSTRING_AS_STRING", "@str True") ++ monkeypatch.setenv("BOOLSTRING_QUOTED", '"False"') ++ loaded = {} ++ load_from_env( ++ obj=loaded, ++ prefix="BOOLSTRING", ++ key=None, ++ silent=True, ++ identifier="env_global", ++ env=False, ++ ) ++ assert loaded["AS_STRING"] == "True" ++ assert isinstance(loaded["AS_STRING"], str) ++ assert loaded["QUOTED"] == "False" ++ assert isinstance(loaded["QUOTED"], str) +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,31 @@ ++#!/bin/bash ++set -uo pipefail ++cd /testbed ++ ++case "${1:-}" in ++ base) ++ python -m pytest tests/test_env_loader.py tests/test_utils.py -v \ ++ --deselect=tests/test_env_loader.py::test_uppercase_boolean_envvars_are_cast_to_bool \ ++ --deselect=tests/test_env_loader.py::test_uppercase_boolean_envvars_work_through_settings_get \ ++ --deselect=tests/test_env_loader.py::test_uppercase_boolean_envvars_work_with_default_dynaconf_prefix \ ++ --deselect=tests/test_env_loader.py::test_lowercase_boolean_envvars_still_cast_to_bool \ ++ --deselect=tests/test_env_loader.py::test_uppercase_boolean_strings_inside_envvar_toml_structures_remain_strings \ ++ --deselect=tests/test_env_loader.py::test_toml_file_quoted_uppercase_booleans_remain_strings \ ++ --deselect=tests/test_env_loader.py::test_envvar_explicit_string_preservation_for_uppercase_boolean_words ++ ;; ++ new) ++ python -m pytest \ ++ tests/test_env_loader.py::test_uppercase_boolean_envvars_are_cast_to_bool \ ++ tests/test_env_loader.py::test_uppercase_boolean_envvars_work_through_settings_get \ ++ tests/test_env_loader.py::test_uppercase_boolean_envvars_work_with_default_dynaconf_prefix \ ++ tests/test_env_loader.py::test_lowercase_boolean_envvars_still_cast_to_bool \ ++ tests/test_env_loader.py::test_uppercase_boolean_strings_inside_envvar_toml_structures_remain_strings \ ++ tests/test_env_loader.py::test_toml_file_quoted_uppercase_booleans_remain_strings \ ++ tests/test_env_loader.py::test_envvar_explicit_string_preservation_for_uppercase_boolean_words \ ++ -v ++ ;; ++ *) ++ echo "usage: $0 base|new" ++ exit 2 ++ ;; ++esac diff --git a/tasks/format-code-task-000847/tests/test.sh b/tasks/format-code-task-000847/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..9ee9d13232514440f6f5a0027741f38c205f6638 --- /dev/null +++ b/tasks/format-code-task-000847/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/test_env_loader.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000847/tests/test_command.sh b/tasks/format-code-task-000847/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..e8d2f32b64045b5a5a56e0ad5667da87d8e0bc2a --- /dev/null +++ b/tasks/format-code-task-000847/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new \ No newline at end of file diff --git a/tasks/format-code-task-000871/environment/Dockerfile b/tasks/format-code-task-000871/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..e02f19a0f6dcb1a9096efe99d5f9926e7c54de57 --- /dev/null +++ b/tasks/format-code-task-000871/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:3ba0be04cb143acbe6e53bc88eb5c2932ee307eac456be71d8cf24e155169dff diff --git a/tasks/format-code-task-000871/environment/setup/files/blocklist b/tasks/format-code-task-000871/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000871/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000871/environment/setup/setup.sh b/tasks/format-code-task-000871/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000871/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000871/tests/test.patch b/tasks/format-code-task-000871/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..b977078ca418627910c8fe58bb5b9b95a560cbc3 --- /dev/null +++ b/tasks/format-code-task-000871/tests/test.patch @@ -0,0 +1,213 @@ +diff --git a/elyra/tests/pipeline/airflow/test_airflow_data_exchange.py b/elyra/tests/pipeline/airflow/test_airflow_data_exchange.py +new file mode 100644 +index 00000000..ad2c8a71 +--- /dev/null ++++ b/elyra/tests/pipeline/airflow/test_airflow_data_exchange.py +@@ -0,0 +1,176 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++import os ++from types import SimpleNamespace ++ ++import pytest ++ ++from elyra.pipeline.airflow.component_parser_airflow import AirflowComponentParser ++from elyra.pipeline.catalog_connector import FilesystemComponentCatalogConnector ++from elyra.pipeline.component_catalog import ComponentCatalog ++ ++SYSTEM_PARAMETERS = {"label", "component_source", "component_description"} ++ ++ ++def _get_resource_path(filename): ++ root = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))) ++ resource_path = os.path.join(root, '..', '..', '..', 'tests/pipeline', 'resources', 'components', filename) ++ return os.path.normpath(resource_path) ++ ++ ++def _parse_airflow_operator(filename): ++ ++ reader = FilesystemComponentCatalogConnector([".py"]) ++ path = _get_resource_path(filename) ++ component_definition = reader.read_catalog_entry({"path": path}, {}) ++ ++ catalog_type = "local-file-catalog" ++ entry = { ++ "component_id": reader.get_unique_component_hash(catalog_type, {"path": path}, ["path"]), ++ "catalog_type": catalog_type, ++ "categories": ["Test"], ++ "component_definition": component_definition, ++ "component_identifier": {"path": path}, ++ } ++ component_entry = SimpleNamespace(**entry) ++ ++ parser = AirflowComponentParser() ++ component = parser.parse(component_entry)[0] ++ return ComponentCatalog.to_canvas_properties(component), catalog_type, component_entry ++ ++ ++@pytest.fixture(scope="module") ++def airflow_properties(): ++ properties_json, catalog_type, component_entry = _parse_airflow_operator('airflow_test_operator.py') ++ return properties_json ++ ++ ++def _parameter_info(properties_json, ref): ++ return next(p for p in properties_json['uihints']['parameter_info'] ++ if p.get('parameter_ref') == ref) ++ ++ ++def _operator_param_refs(properties_json): ++ refs = [] ++ for p in properties_json['uihints']['parameter_info']: ++ ref = p.get('parameter_ref') ++ if ref and ref.replace('elyra_', '') not in SYSTEM_PARAMETERS and ref not in SYSTEM_PARAMETERS: ++ refs.append(ref) ++ return refs ++ ++ ++def test_every_operator_parameter_uses_oneof_control(airflow_properties): ++ refs = _operator_param_refs(airflow_properties) ++ assert len(refs) > 0 ++ for ref in refs: ++ info = _parameter_info(airflow_properties, ref) ++ assert info['custom_control_id'] == "OneOfControl" ++ ++ ++def test_operator_parameter_offers_native_and_parent_output_controls(airflow_properties): ++ for ref in _operator_param_refs(airflow_properties): ++ info = _parameter_info(airflow_properties, ref) ++ controls = info['data']['controls'] ++ ++ ++ assert len(controls) == 2 ++ ++ ++ assert "NestedEnumControl" in controls ++ nested = controls["NestedEnumControl"] ++ assert nested['format'] == "inputpath" ++ assert nested['allownooptions'] is False ++ ++ ++ native_controls = [c for c in controls if c != "NestedEnumControl"] ++ assert len(native_controls) == 1 ++ ++ ++ for control in controls.values(): ++ assert isinstance(control['label'], str) ++ assert control['label'].strip() != "" ++ ++ ++@pytest.mark.parametrize("ref, native_control, data_type", [ ++ ("elyra_test_string_no_default", "StringControl", "string"), ++ ("elyra_test_string_default_value", "StringControl", "string"), ++ ("elyra_test_bool_true", "BooleanControl", "boolean"), ++ ("elyra_test_bool_default", "BooleanControl", "boolean"), ++ ("elyra_test_int_non_zero", "NumberControl", "number"), ++ ("elyra_test_int_default", "NumberControl", "number"), ++ ("elyra_test_unusual_type_dict", "StringControl", "dictionary"), ++ ("elyra_test_unusual_type_list", "StringControl", "list"), ++]) ++def test_native_control_matches_parameter_type(airflow_properties, ref, native_control, data_type): ++ info = _parameter_info(airflow_properties, ref) ++ controls = info['data']['controls'] ++ assert native_control in controls ++ assert controls[native_control]['format'] == data_type ++ ++ ++@pytest.mark.parametrize("ref, expected_required", [ ++ ++ ("elyra_test_string_no_default", True), ++ ("elyra_test_bool_default", True), ++ ("elyra_test_int_default", True), ++ ++ ("elyra_test_string_default_value", False), ++ ("elyra_test_bool_true", False), ++ ("elyra_test_int_non_zero", False), ++]) ++def test_required_reflects_presence_of_default(airflow_properties, ref, expected_required): ++ info = _parameter_info(airflow_properties, ref) ++ assert info['data']['required'] is expected_required ++ ++ ++@pytest.mark.parametrize("ref, native_control, expected_value", [ ++ ("elyra_test_string_no_default", "StringControl", ""), ++ ("elyra_test_string_default_value", "StringControl", "default"), ++ ("elyra_test_bool_default", "BooleanControl", False), ++ ("elyra_test_bool_false", "BooleanControl", False), ++ ("elyra_test_bool_true", "BooleanControl", True), ++ ("elyra_test_int_default", "NumberControl", 0), ++ ("elyra_test_int_zero", "NumberControl", 0), ++ ("elyra_test_int_non_zero", "NumberControl", 1), ++]) ++def test_current_parameters_record_active_control_and_default_value(airflow_properties, ++ ref, native_control, expected_value): ++ entry = airflow_properties['current_parameters'][ref] ++ assert isinstance(entry, dict) ++ assert entry['activeControl'] == native_control ++ assert entry[native_control] == expected_value ++ ++ if isinstance(expected_value, bool): ++ assert entry[native_control] is expected_value ++ ++ ++def test_system_parameters_are_not_wrapped(airflow_properties): ++ ++ ++ label_info = _parameter_info(airflow_properties, "label") ++ assert label_info['custom_control_id'] != "OneOfControl" ++ ++ assert airflow_properties['current_parameters']['label'] == "" ++ assert not isinstance(airflow_properties['current_parameters']['label'], dict) ++ assert isinstance(airflow_properties['current_parameters']['component_source'], str) ++ ++ ++def test_operator_with_no_inputs_renders_only_system_parameters(): ++ properties_json, _, _ = _parse_airflow_operator('airflow_test_operator_no_inputs.py') ++ ++ assert len(properties_json['current_parameters'].keys()) == 2 ++ assert properties_json['current_parameters']['label'] == "" ++ assert not isinstance(properties_json['current_parameters']['label'], dict) +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,26 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++set -euo pipefail ++HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ++cd /testbed ++ ++ ++ ++ ++ ++ ++export PYTHONPATH="/testbed/.venv/lib/python3.11/site-packages${PYTHONPATH:+:$PYTHONPATH}" ++PYTEST="python3.11 -m pytest -p no:cacheprovider -q" ++ ++ ++$PYTEST \ ++ "elyra/tests/pipeline/kfp/test_component_parser_kfp.py::test_parse_kfp_component_file" \ ++ "elyra/tests/pipeline/kfp/test_component_parser_kfp.py::test_parse_kfp_component_file_no_inputs" \ ++ "elyra/tests/pipeline/kfp/test_component_parser_kfp.py::test_parse_components_invalid_file" \ ++ "elyra/tests/pipeline/airflow/test_component_parser_airflow.py::test_parse_airflow_component_file_no_inputs" ++ ++ ++$PYTEST elyra/tests/pipeline/airflow/test_airflow_data_exchange.py diff --git a/tasks/format-code-task-000871/tests/test.sh b/tasks/format-code-task-000871/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7150074e17c7c1f76f6a2fd276eb3a87773cd064 --- /dev/null +++ b/tasks/format-code-task-000871/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +elyra/tests/pipeline/airflow/test_airflow_data_exchange.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000871/tests/test_command.sh b/tasks/format-code-task-000871/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000871/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000878/environment/Dockerfile b/tasks/format-code-task-000878/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..31606b0dfb08841b2472970f4ebc0fcdf683909a --- /dev/null +++ b/tasks/format-code-task-000878/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:00de9bd95221d372517167db7c17daf106c245da777c815a7b879c49f17f44a4 diff --git a/tasks/format-code-task-000878/environment/setup/files/blocklist b/tasks/format-code-task-000878/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000878/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000878/environment/setup/setup.sh b/tasks/format-code-task-000878/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000878/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000878/tests/test.patch b/tasks/format-code-task-000878/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..4fd096f788eb56cb7c462db14c854ee1f5e58238 --- /dev/null +++ b/tasks/format-code-task-000878/tests/test.patch @@ -0,0 +1,193 @@ +diff --git a/tests/test_datastructures.py b/tests/test_datastructures.py +index 42405c2..52555b8 100644 +--- a/tests/test_datastructures.py ++++ b/tests/test_datastructures.py +@@ -330,3 +330,14 @@ def test_multidict(): + assert q.getlist("a") == ["123"] + q.update([("a", "456")], a="789", b="123") + assert q == MultiDict([("a", "456"), ("a", "789"), ("b", "123")]) ++ ++ ++def test_url_from_scope_without_query_string(): ++ scope = { ++ "type": "http", ++ "scheme": "https", ++ "path": "/hello", ++ "headers": [(b"host", b"example.org")], ++ } ++ ++ assert str(URL(scope=scope)) == "https://example.org/hello" +diff --git a/tests/test_requests.py b/tests/test_requests.py +index defdf3a..fe5189b 100644 +--- a/tests/test_requests.py ++++ b/tests/test_requests.py +@@ -2,8 +2,10 @@ import asyncio + + import pytest + ++from starlette.applications import Starlette + from starlette.requests import ClientDisconnect, Request, State + from starlette.responses import JSONResponse, Response ++from starlette.routing import Route + from starlette.testclient import TestClient + + +@@ -358,3 +360,16 @@ def test_request_send_push_promise_without_setting_send(): + client = TestClient(app) + response = client.get("/") + assert response.json() == {"json": "Send channel not available"} ++ ++ ++async def show_base_url(request): ++ return JSONResponse({"base_url": str(request.base_url)}) ++ ++ ++def test_request_base_url_includes_root_path_without_request_path_or_query(): ++ app = Starlette(routes=[Route("/items/{item_id}", show_base_url, methods=["GET"])]) ++ client = TestClient(app, base_url="https://example.org", root_path="/api") ++ ++ assert client.get("/items/123?debug=true").json() == { ++ "base_url": "https://example.org/api/" ++ } +diff --git a/tests/test_routing.py b/tests/test_routing.py +index 3c0c4cd..8fdb3ba 100644 +--- a/tests/test_routing.py ++++ b/tests/test_routing.py +@@ -1,5 +1,6 @@ + import pytest + ++from starlette.applications import Starlette + from starlette.responses import JSONResponse, PlainTextResponse, Response + from starlette.routing import Host, Mount, NoMatchFound, Route, Router, WebSocketRoute + from starlette.testclient import TestClient +@@ -353,3 +354,56 @@ def test_subdomain_reverse_urls(): + ).make_absolute_url("https://whatever") + == "https://foo.example.org/homepage" + ) ++ ++ ++async def url_for_with_root_path(request): ++ user_id = request.path_params.get("user_id", 42) ++ return JSONResponse( ++ { ++ "home": str(request.url_for("homepage")), ++ "detail": str(request.url_for("accounts:detail", user_id=user_id)), ++ } ++ ) ++ ++ ++url_for_with_root_path_routes = [ ++ Route("/", url_for_with_root_path, name="homepage", methods=["GET"]), ++ Mount( ++ "/accounts", ++ name="accounts", ++ routes=[ ++ Route( ++ "/users/{user_id}/", ++ url_for_with_root_path, ++ name="detail", ++ methods=["GET"], ++ ) ++ ], ++ ), ++] ++ ++ ++def test_request_url_for_preserves_root_path_for_root_and_mount(): ++ app = Starlette(routes=url_for_with_root_path_routes) ++ client = TestClient(app, base_url="https://example.org", root_path="/api/v1") ++ ++ assert client.get("/").json() == { ++ "home": "https://example.org/api/v1/", ++ "detail": "https://example.org/api/v1/accounts/users/42/", ++ } ++ assert client.get("/accounts/users/42/").json() == { ++ "home": "https://example.org/api/v1/", ++ "detail": "https://example.org/api/v1/accounts/users/42/", ++ } ++ ++ ++def test_request_url_for_uses_configured_root_path_value(): ++ app = Starlette(routes=url_for_with_root_path_routes) ++ client = TestClient( ++ app, base_url="https://outside.example", root_path="/service-area" ++ ) ++ ++ assert client.get("/accounts/users/7/").json() == { ++ "home": "https://outside.example/service-area/", ++ "detail": "https://outside.example/service-area/accounts/users/7/", ++ } +diff --git a/tests/test_testclient.py b/tests/test_testclient.py +index 504034b..39826b0 100644 +--- a/tests/test_testclient.py ++++ b/tests/test_testclient.py +@@ -4,6 +4,7 @@ import pytest + + from starlette.applications import Starlette + from starlette.responses import JSONResponse ++from starlette.routing import Route, WebSocketRoute + from starlette.testclient import TestClient + from starlette.websockets import WebSocket, WebSocketDisconnect + +@@ -113,3 +114,28 @@ def test_websocket_blocking_receive(): + with client.websocket_connect("/") as websocket: + data = websocket.receive_json() + assert data == {"message": "test"} ++ ++ ++async def echo_root_path(request): ++ return JSONResponse({"root_path": request.scope["root_path"]}) ++ ++ ++def test_testclient_sets_root_path_on_http_scope(): ++ app = Starlette(routes=[Route("/", echo_root_path, methods=["GET"])]) ++ client = TestClient(app, root_path="/proxy-prefix") ++ ++ assert client.get("/").json() == {"root_path": "/proxy-prefix"} ++ ++ ++async def echo_websocket_root_path(websocket): ++ await websocket.accept() ++ await websocket.send_text(websocket.scope["root_path"]) ++ await websocket.close() ++ ++ ++def test_testclient_sets_root_path_on_websocket_scope(): ++ app = Starlette(routes=[WebSocketRoute("/ws", echo_websocket_root_path)]) ++ client = TestClient(app, root_path="/ws-prefix") ++ ++ with client.websocket_connect("/ws") as websocket: ++ assert websocket.receive_text() == "/ws-prefix" +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,28 @@ ++#!/bin/bash ++set -uo pipefail ++cd /testbed ++ ++ ++pip install -e . --quiet --no-input ++pip install pytest requests --quiet --no-input ++ ++ ++case "${1:-}" in ++ base) ++ python -m pytest tests/test_routing.py -v -k "not test_request_url_for_preserves_root_path_for_root_and_mount and not test_request_url_for_uses_configured_root_path_value" ++ ;; ++ new) ++ python -m pytest \ ++ tests/test_routing.py::test_request_url_for_preserves_root_path_for_root_and_mount \ ++ tests/test_routing.py::test_request_url_for_uses_configured_root_path_value \ ++ tests/test_requests.py::test_request_base_url_includes_root_path_without_request_path_or_query \ ++ tests/test_testclient.py::test_testclient_sets_root_path_on_http_scope \ ++ tests/test_testclient.py::test_testclient_sets_root_path_on_websocket_scope \ ++ tests/test_datastructures.py::test_url_from_scope_without_query_string \ ++ -v ++ ;; ++ *) ++ echo "usage: $0 base|new" ++ exit 2 ++ ;; ++esac diff --git a/tasks/format-code-task-000878/tests/test.sh b/tasks/format-code-task-000878/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..5144cc6ae57db1ce37394f9b55fa3c2bf7d54514 --- /dev/null +++ b/tasks/format-code-task-000878/tests/test.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/test_datastructures.py +tests/test_requests.py +tests/test_routing.py +tests/test_testclient.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000878/tests/test_command.sh b/tasks/format-code-task-000878/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..e8d2f32b64045b5a5a56e0ad5667da87d8e0bc2a --- /dev/null +++ b/tasks/format-code-task-000878/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new \ No newline at end of file diff --git a/tasks/format-code-task-000885/environment/Dockerfile b/tasks/format-code-task-000885/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..f8935379128da40227c949c3b87a75e07cedcbcd --- /dev/null +++ b/tasks/format-code-task-000885/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:b17700b43bb1830e996b4632cfd717cd71017ac46306d051be800edcf0c1edc8 diff --git a/tasks/format-code-task-000885/environment/setup/files/blocklist b/tasks/format-code-task-000885/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000885/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000885/environment/setup/setup.sh b/tasks/format-code-task-000885/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-000885/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000885/tests/test.patch b/tasks/format-code-task-000885/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..5c4b4b487449ce7fa7740ba1d11d0e6a04be40b1 --- /dev/null +++ b/tasks/format-code-task-000885/tests/test.patch @@ -0,0 +1,416 @@ +diff --git a/usercase-test-coderl/usecase.sh b/usercase-test-coderl/usecase.sh +new file mode 100755 +--- /dev/null ++++ b/usercase-test-coderl/usecase.sh +@@ -0,0 +1,387 @@ ++#!/usr/bin/env bash ++ ++set -u ++export LANG=C.UTF-8 LC_ALL=C.UTF-8 TZ=UTC ++ ++fail() { echo "FAIL: $*" >&2; exit 1; } ++ ++REPO=/workspace/repo ++FOLDER2LMDB="$REPO/utils/dataset/folder2lmdb.py" ++ ++[ -f "$FOLDER2LMDB" ] || fail "missing folder2lmdb entry point" ++ ++TMP=$(mktemp -d) ++trap 'rm -rf "$TMP"' EXIT ++cd "$TMP" || fail "cd temp" ++ ++mkdir -p "$TMP/pyshim" ++cat > "$TMP/pyshim/sitecustomize.py" <<'PY' ++import pickle ++try: ++ import pyarrow as pa ++ if not hasattr(pa, "serialize"): ++ class _Serialized: ++ def __init__(self, obj): ++ self.obj = obj ++ def to_buffer(self): ++ return pickle.dumps(self.obj) ++ pa.serialize = lambda obj: _Serialized(obj) ++ if not hasattr(pa, "deserialize"): ++ pa.deserialize = lambda buf: pickle.loads(buf) ++except Exception: ++ pass ++PY ++export PYTHONPATH="$TMP/pyshim:$REPO:${PYTHONPATH:-}" ++ ++python3 - <<'PY' >deps.out 2>deps.err ++import fire ++import lmdb ++import pyarrow ++import torch ++import torchvision ++import timm ++PY ++ec=$? ++[ "$ec" -eq 0 ] || fail "python dependency import failed: $(cat deps.err)" ++ ++SRC_ROOT="$TMP/src_root" ++DATA_ROOT="$TMP/data_root" ++ ++python3 - "$SRC_ROOT" "$DATA_ROOT" <<'PY' >img.out 2>img.err ++import sys ++from pathlib import Path ++from PIL import Image ++ ++src_root = Path(sys.argv[1]) ++data_root = Path(sys.argv[2]) ++ ++def write_pair(split_dir): ++ (split_dir / "class0").mkdir(parents=True, exist_ok=True) ++ (split_dir / "class1").mkdir(parents=True, exist_ok=True) ++ Image.new("RGB", (2, 2), (255, 0, 0)).save(split_dir / "class0" / "a.png") ++ Image.new("RGB", (2, 2), (0, 255, 0)).save(split_dir / "class1" / "b.png") ++ ++write_pair(src_root / "train") ++for parent, split in [ ++ ("train_lmdb", "train"), ++ ("val_lmdb", "val"), ++ ("test_lmdb", "test"), ++]: ++ write_pair(data_root / parent / split) ++PY ++ec=$? ++[ "$ec" -eq 0 ] || fail "image fixture setup failed: $(cat img.err)" ++ ++ ++ ++ ++python3 "$FOLDER2LMDB" "$SRC_ROOT" --name train --write_frequency 1 >out 2>err ++ec=$? ++[ "$ec" -eq 0 ] || fail "F1 exit $ec; want 0" ++ ++grep -Fq "$SRC_ROOT/train" out || fail "F1 stdout did not mention source directory: $(cat out)" ++grep -Fq "$SRC_ROOT/train.lmdb" out || fail "F1 stdout did not mention LMDB path: $(cat out)" ++ ++[ "$(grep -Ecx '\[[0-9]+/2\]' out)" -ge 2 ] || fail "F1 stdout missing periodic progress lines: $(cat out)" ++grep -Fxq "Flushing database ..." out || fail "F1 stdout missing flush message: $(cat out)" ++ ++! grep -q "Traceback" err || fail "F1 traceback: $(cat err)" ++ ++[ -e "$SRC_ROOT/train.lmdb" ] || fail "F1 missing LMDB path" ++[ -f "$SRC_ROOT/train_images_idx.txt" ] || fail "F1 missing sidecar index" ++ ++[ "$(wc -l < "$SRC_ROOT/train_images_idx.txt")" -eq 2 ] || fail "F1 sidecar wrong line count: $(cat "$SRC_ROOT/train_images_idx.txt")" ++grep -Fxq "a.png 0" "$SRC_ROOT/train_images_idx.txt" || fail "F1 sidecar missing a.png index: $(cat "$SRC_ROOT/train_images_idx.txt")" ++grep -Fxq "b.png 1" "$SRC_ROOT/train_images_idx.txt" || fail "F1 sidecar missing b.png index: $(cat "$SRC_ROOT/train_images_idx.txt")" ++ ++python3 - "$SRC_ROOT/train.lmdb" <<'PY' >out 2>err ++import lmdb ++import os ++import sys ++ ++env = lmdb.open(sys.argv[1], subdir=os.path.isdir(sys.argv[1]), readonly=True, lock=False, readahead=False, meminit=False) ++with env.begin(write=False) as txn: ++ ++ numeric_keys = [] ++ for key, _ in txn.cursor(): ++ try: ++ if key.decode("ascii").isdigit(): ++ numeric_keys.append(key) ++ except UnicodeDecodeError: ++ pass ++ print("NUMERIC_KEY_COUNT=%d" % len(numeric_keys)) ++ print("HAS_METADATA=%s,%s" % (txn.get(b"__keys__") is not None, txn.get(b"__len__") is not None)) ++PY ++ec=$? ++EXPECTED_KEYS=$(cat <<'EOF' ++NUMERIC_KEY_COUNT=2 ++HAS_METADATA=True,True ++EOF ++) ++[ "$ec" -eq 0 ] || fail "F1 metadata exit $ec; want 0" ++[ "$(cat out)" = "$EXPECTED_KEYS" ] || fail "F1 metadata: $(cat out)" ++[ ! -s err ] || fail "F1 metadata stderr: $(cat err)" ++ ++rm -rf "$SRC_ROOT/train" ++ ++ ++ ++ ++python3 - "$SRC_ROOT/train.lmdb" <<'PY' >out 2>err ++import importlib ++import inspect ++import sys ++from torchvision import transforms ++ ++def open_lmdb_reader(db_path, transform=None, target_transform=None): ++ ++ for modname in ("utils.dataset.folder2lmdb", "utils.dataset.dataset", "utils.dataset"): ++ mod = importlib.import_module(modname) ++ for _, obj in vars(mod).items(): ++ if inspect.isclass(obj) and "lmdb" in obj.__name__.lower(): ++ try: ++ return obj(db_path, transform, target_transform) ++ except TypeError: ++ try: ++ return obj(db_path, transform=transform, target_transform=target_transform) ++ except TypeError: ++ pass ++ raise AssertionError("no importable LMDB reader class found") ++ ++ds = open_lmdb_reader(sys.argv[1], transforms.Grayscale(num_output_channels=1), lambda t: t + 7) ++print("LEN=%d" % len(ds)) ++items = [] ++for i in range(len(ds)): ++ arr, target = ds[i] ++ items.append((arr.shape, str(arr.dtype), int(target), int(arr[0][0]))) ++print("ITEMS=" + "|".join("%s,%s,%d,%d" % item for item in sorted(items, key=lambda item: item[2]))) ++PY ++ec=$? ++EXPECTED_READ=$(cat <<'EOF' ++LEN=2 ++ITEMS=(2, 2),uint8,7,76|(2, 2),uint8,8,150 ++EOF ++) ++[ "$ec" -eq 0 ] || fail "F2 exit $ec; want 0" ++ ++[ "$(cat out)" = "$EXPECTED_READ" ] || fail "F2 stdout: $(cat out)" ++! grep -q "Traceback" err || fail "F2 traceback: $(cat err)" ++ ++for spec in "train_lmdb train" "val_lmdb val" "test_lmdb test"; do ++ set -- $spec ++ python3 "$FOLDER2LMDB" "$DATA_ROOT/$1" --name "$2" --write_frequency 1 >setup.out 2>setup.err ++ ec=$? ++ [ "$ec" -eq 0 ] || fail "setup convert $1/$2 failed: $(cat setup.err)" ++done ++rm -rf "$DATA_ROOT/train_lmdb/train" "$DATA_ROOT/val_lmdb/val" "$DATA_ROOT/test_lmdb/test" ++ ++ ++ ++ ++python3 - "$DATA_ROOT" <<'PY' >out 2>err ++import sys ++from types import SimpleNamespace ++from utils.dataflow import get_dataset, get_transforms ++ ++common = dict(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225], ++ dataset_dir=sys.argv[1], batch_size=4, num_workers=0, train_portion=1) ++lmdb_cfg = SimpleNamespace(dataset="imagenet_lmdb", **common) ++folder_cfg = SimpleNamespace(dataset="imagenet", **common) ++lmdb_transforms = get_transforms(lmdb_cfg) ++folder_transforms = get_transforms(folder_cfg) ++print("TRANSFORMS_EQUAL=%s,%s,%s" % tuple(str(repr(a) == repr(b)) for a, b in zip(lmdb_transforms, folder_transforms))) ++datasets = get_dataset(*lmdb_transforms, lmdb_cfg) ++print("DATASET_COUNT=%d" % len(datasets)) ++print("LENS=" + ",".join(str(len(d)) for d in datasets)) ++PY ++ec=$? ++EXPECTED_DATAFLOW=$(cat <out 2>err ++ec=$? ++[ "$ec" -eq 0 ] || fail "F4 exit $ec; want 0; stderr: $(cat err)" ++grep -Fxq "TRAIN_MAIN_RETURNED" out || fail "F4 missing completion marker; stdout: $(cat out)" ++! grep -q "Traceback" err || fail "F4 traceback: $(cat err)" ++ ++ ++ ++ ++run_validate_lmdb "$DATA_ROOT" >out 2>err ++ec=$? ++[ "$ec" -eq 0 ] || fail "F5 exit $ec; want 0; stderr: $(cat err)" ++grep -Fxq "VALIDATE_MAIN_RETURNED" out || fail "F5 missing completion marker; stdout: $(cat out)" ++! grep -q "Traceback" err || fail "F5 traceback: $(cat err)" ++ ++ ++ ++ ++MISSING_SRC="$TMP/missing_source_root" ++mkdir -p "$MISSING_SRC" ++python3 "$FOLDER2LMDB" "$MISSING_SRC" --name train --write_frequency 1 >out 2>err ++ec=$? ++[ "$ec" -ne 0 ] || fail "F6 exit $ec; want non-zero" ++ ++ ++ ++ ++ ++rm -f "$DATA_ROOT/train_lmdb/train_images_idx.txt" ++python3 - "$DATA_ROOT/train_lmdb/train.lmdb" <<'PY' >out 2>err ++import importlib ++import inspect ++import sys ++ ++def open_lmdb_reader(db_path): ++ ++ for modname in ("utils.dataset.folder2lmdb", "utils.dataset.dataset", "utils.dataset"): ++ mod = importlib.import_module(modname) ++ for _, obj in vars(mod).items(): ++ if inspect.isclass(obj) and "lmdb" in obj.__name__.lower(): ++ try: ++ return obj(db_path) ++ except TypeError: ++ pass ++ raise AssertionError("no importable LMDB reader class found") ++ ++open_lmdb_reader(sys.argv[1]) ++PY ++ec=$? ++[ "$ec" -ne 0 ] || fail "F7 exit $ec; want non-zero" ++ ++ ++ ++ ++ ++FALLBACK_ROOT="$TMP/fallback_root" ++python3 - "$FALLBACK_ROOT" <<'PY' >out 2>err ++import sys ++from pathlib import Path ++from PIL import Image ++ ++root = Path(sys.argv[1]) ++(root / "val" / "class0").mkdir(parents=True, exist_ok=True) ++Image.new("RGB", (2, 2), (255, 0, 0)).save(root / "val" / "class0" / "fallback.png") ++PY ++ec=$? ++[ "$ec" -eq 0 ] || fail "F8 fallback image setup failed: $(cat err)" ++run_validate_lmdb "$FALLBACK_ROOT" >out 2>err ++ec=$? ++[ "$ec" -ne 0 ] || fail "F8 exit $ec; want non-zero" ++ ++! grep -Fxq "VALIDATE_MAIN_RETURNED" out || fail "F8 unexpectedly completed validation" ++ ++echo "PASS" ++exit 0 +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,19 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++export PIP_NO_INDEX=1 ++export PIP_DISABLE_PIP_VERSION_CHECK=1 ++export HF_HUB_OFFLINE=1 ++export TRANSFORMERS_OFFLINE=1 ++export TORCH_HOME=/workspace/repo/.offline_torch ++export XDG_CACHE_HOME=/workspace/repo/.offline_cache ++set -e ++cd /workspace/repo ++mkdir -p "$TORCH_HOME" "$XDG_CACHE_HOME" ++exec bash /workspace/repo/usercase-test-coderl/usecase.sh diff --git a/tasks/format-code-task-000885/tests/test.sh b/tasks/format-code-task-000885/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..d4d80bb634b14076ae561be99f395189577b7ac6 --- /dev/null +++ b/tasks/format-code-task-000885/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/usecase.sh +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000885/tests/test_command.sh b/tasks/format-code-task-000885/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-000885/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000903/environment/Dockerfile b/tasks/format-code-task-000903/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..3858ccd28d08b88f1833e75b7e641e6a7eea6202 --- /dev/null +++ b/tasks/format-code-task-000903/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:2a150135de4c1f8b4727cd6f73f63742e5560090dd8764ba1295261a8951c0b7 diff --git a/tasks/format-code-task-000903/environment/setup/files/blocklist b/tasks/format-code-task-000903/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000903/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000903/environment/setup/setup.sh b/tasks/format-code-task-000903/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000903/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000903/tests/test.patch b/tasks/format-code-task-000903/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..41e2918f9ee02d46bd0e92472ca49ef6b8486139 --- /dev/null +++ b/tasks/format-code-task-000903/tests/test.patch @@ -0,0 +1,77 @@ +diff --git a/core/rawdb/freezer_table_test.go b/core/rawdb/freezer_table_test.go +index 5c4cc40eddc7..939d0939464d 100644 +--- a/core/rawdb/freezer_table_test.go ++++ b/core/rawdb/freezer_table_test.go +@@ -994,6 +994,52 @@ func TestSequentialReadByteLimit(t *testing.T) { + } + } + ++ ++ ++func TestSequentialReadNoByteLimit(t *testing.T) { ++ rm, wm, sg := metrics.NewMeter(), metrics.NewMeter(), metrics.NewGauge() ++ fname := fmt.Sprintf("batchread-3-%d", rand.Uint64()) ++ { ++ f, err := newTable(os.TempDir(), fname, rm, wm, sg, 100, true, false) ++ if err != nil { ++ t.Fatal(err) ++ } ++ ++ ++ writeChunks(t, f, 30, 10) ++ f.Close() ++ } ++ for i, tc := range []struct { ++ items uint64 ++ want int ++ }{ ++ {1, 1}, ++ {30, 30}, ++ {31, 30}, ++ } { ++ { ++ f, err := newTable(os.TempDir(), fname, rm, wm, sg, 100, true, false) ++ if err != nil { ++ t.Fatal(err) ++ } ++ items, err := f.RetrieveItems(0, tc.items, 0) ++ if err != nil { ++ t.Fatal(err) ++ } ++ if have, want := len(items), tc.want; have != want { ++ t.Fatalf("test %d: want %d items, have %d ", i, want, have) ++ } ++ for ii, have := range items { ++ want := getChunk(10, ii) ++ if !bytes.Equal(want, have) { ++ t.Fatalf("test %d: data corruption item %d: have\n%x\n, want \n%x\n", i, ii, have, want) ++ } ++ } ++ f.Close() ++ } ++ } ++} ++ + func TestFreezerReadonly(t *testing.T) { + tmpdir := os.TempDir() + // Case 1: Check it fails on non-existent file. +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,4 @@ ++H4sIAAAAAAAAA+3RwYqDMBSF4az7FPcF1KRtzGqeRdSEmcJoQKN9/aqblsJMNy3D0P/b3As3kAMn ++b6bTt69CPxfqVfTCWbvNxf3cdmP3xrjSWOeUNmZZlNiXJboxjakeRNQQY/rt3aP7P5Vf+09hTFUb ++u67ufT5+Pe+Ph/2747X/w9r/sdyXSvTzIvzszftvvWzFN8HvPqOsq2SzZG2c+vRhJEunLsQpyUHr ++UfKijUMohvrsm2L319kBAAAAAAAAAAAAAACAd3cBhxdQ+AAoAAA= +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-000903/tests/test.sh b/tasks/format-code-task-000903/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..2c1f76aded6d58f4b1ba154dbfa4abccfd050c69 --- /dev/null +++ b/tasks/format-code-task-000903/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +core/rawdb/freezer_table_test.go +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000903/tests/test_command.sh b/tasks/format-code-task-000903/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000903/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000904/environment/Dockerfile b/tasks/format-code-task-000904/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..9934dab0a7622e2099e729ce2da5b377419179ab --- /dev/null +++ b/tasks/format-code-task-000904/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:e0179c62910b4efa11b63530dea404546723d69246ce32207fab2344cf579672 diff --git a/tasks/format-code-task-000904/environment/setup/files/blocklist b/tasks/format-code-task-000904/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000904/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000904/environment/setup/setup.sh b/tasks/format-code-task-000904/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000904/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000904/tests/test.patch b/tasks/format-code-task-000904/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..a6ada79f34d954b65d97245773208ae7bbc01f66 --- /dev/null +++ b/tasks/format-code-task-000904/tests/test.patch @@ -0,0 +1,297 @@ +diff --git a/pkg/api/postage_test.go b/pkg/api/postage_test.go +index cc6ec6ec..c3dee5f2 100644 +--- a/pkg/api/postage_test.go ++++ b/pkg/api/postage_test.go +@@ -8,10 +8,14 @@ import ( + "bytes" + "context" + "encoding/hex" ++ "encoding/json" + "errors" + "fmt" + "math/big" + "net/http" ++ "os" ++ "path/filepath" ++ "strings" + "testing" + "time" + +@@ -26,6 +30,7 @@ import ( + contractMock "github.com/ethersphere/bee/pkg/postage/postagecontract/mock" + postagetesting "github.com/ethersphere/bee/pkg/postage/testing" + "github.com/ethersphere/bee/pkg/sctx" ++ "github.com/ethersphere/bee/pkg/storage" + ) + + func TestPostageCreateStamp(t *testing.T) { +@@ -201,15 +206,15 @@ func TestPostageCreateStamp(t *testing.T) { + } + + func TestPostageGetStamps(t *testing.T) { +- b := postagetesting.MustNewBatch() +- b.Value = big.NewInt(20) ++ b := postagetesting.MustNewBatch(postagetesting.WithValue(20)) + si := postage.NewStampIssuer("", "", b.ID, big.NewInt(3), 11, 10, 1000, true) + mp := mockpost.New(mockpost.WithIssuer(si)) + cs := &postage.ChainState{Block: 10, TotalAmount: big.NewInt(5), CurrentPrice: big.NewInt(2)} +- bs := mock.New(mock.WithChainState(cs), mock.WithBatch(b)) +- ts, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true, Post: mp, BatchStore: bs, BlockTime: big.NewInt(2)}) + + t.Run("single stamp", func(t *testing.T) { ++ bs := mock.New(mock.WithChainState(cs), mock.WithBatch(b)) ++ ts, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true, Post: mp, BatchStore: bs, BlockTime: big.NewInt(2)}) ++ + jsonhttptest.Request(t, ts, http.MethodGet, "/stamps", http.StatusOK, + jsonhttptest.WithExpectedJSONResponse(&api.PostageStampsResponse{ + Stamps: []api.PostageStampResponse{ +@@ -230,6 +235,211 @@ func TestPostageGetStamps(t *testing.T) { + }), + ) + }) ++ ++ t.Run("expired batch", func(t *testing.T) { ++ bsForNonExistingBatch := newSelectiveBatchStore(cs, nil) ++ tsForNonExistingBatch, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true, Post: mp, BatchStore: bsForNonExistingBatch, BlockTime: big.NewInt(2)}) ++ ++ resp := getStampsResponse(t, tsForNonExistingBatch, "/stamps") ++ if len(resp.Stamps) != 0 { ++ t.Fatalf("expected default /stamps response to omit stale stamp %x; got %+v", b.ID, resp.Stamps) ++ } ++ ++ staleStamp, ok := findStamp(getStampsResponse(t, tsForNonExistingBatch, "/stamps?all=true"), b.ID) ++ if !ok { ++ t.Fatalf("expected all=true response to include stale stamp %x", b.ID) ++ } ++ if staleStamp.Exists || staleStamp.Usable { ++ t.Fatalf("expected stale stamp %x returned by all=true to be unavailable/non-existing; got %+v", b.ID, staleStamp) ++ } ++ }) ++} ++ ++func TestPostageGetStamps_FilterStaleByDefault(t *testing.T) { ++ ts, existingID, staleID := newStampsFilteringTestServer(t) ++ ++ resp := getStampsResponse(t, ts, "/stamps") ++ ++ if !containsStamp(resp, existingID) { ++ t.Fatalf("expected default /stamps response to include stamp backed by an existing batch %x; got %+v", existingID, resp.Stamps) ++ } ++ if containsStamp(resp, staleID) { ++ t.Fatalf("expected default /stamps response to omit stale stamp %x; got %+v", staleID, resp.Stamps) ++ } ++} ++ ++func TestPostageGetStamps_AllTrueIncludesStale(t *testing.T) { ++ ts, existingID, staleID := newStampsFilteringTestServer(t) ++ ++ resp := getStampsResponse(t, ts, "/stamps?all=true") ++ ++ if !containsStamp(resp, existingID) { ++ t.Fatalf("expected all=true response to include stamp backed by an existing batch %x; got %+v", existingID, resp.Stamps) ++ } ++ staleStamp, ok := findStamp(resp, staleID) ++ if !ok { ++ t.Fatalf("expected all=true response to include stale stamp %x; got %+v", staleID, resp.Stamps) ++ } ++ if staleStamp.Exists { ++ t.Fatalf("expected stale stamp %x returned by all=true to have exists=false", staleID) ++ } ++ if staleStamp.Usable { ++ t.Fatalf("expected stale stamp %x returned by all=true to have usable=false", staleID) ++ } ++} ++ ++func TestPostageGetStamps_AllQueryParsing(t *testing.T) { ++ ts, _, staleID := newStampsFilteringTestServer(t) ++ ++ if !containsStamp(getStampsResponse(t, ts, "/stamps?all=TRUE"), staleID) { ++ t.Fatalf("expected all=TRUE to include stale stamp %x", staleID) ++ } ++ ++ for _, path := range []string{"/stamps", "/stamps?all=false", "/stamps?all=yes"} { ++ resp := getStampsResponse(t, ts, path) ++ if containsStamp(resp, staleID) { ++ t.Fatalf("expected %s to filter stale stamp %x; got %+v", path, staleID, resp.Stamps) ++ } ++ } ++} ++ ++func TestOpenAPIStampsDocumentsAllParameter(t *testing.T) { ++ for _, name := range []string{"Swarm.yaml", "SwarmDebug.yaml"} { ++ t.Run(name, func(t *testing.T) { ++ body, err := os.ReadFile(filepath.Join("..", "..", "openapi", name)) ++ if err != nil { ++ t.Fatal(err) ++ } ++ ++ block := openAPIPathBlock(t, string(body), ` "/stamps":`) ++ if !strings.Contains(block, "name: all") || !strings.Contains(block, "in: query") { ++ t.Fatalf("%s /stamps block should document an all query parameter; block:\n%s", name, block) ++ } ++ for _, oldPhrase := range []string{ ++ "Get all available stamps for this node", ++ "Returns an array of all available postage batches.", ++ } { ++ if strings.Contains(block, oldPhrase) { ++ t.Fatalf("%s /stamps block still contains stale default-response wording %q; block:\n%s", name, oldPhrase, block) ++ } ++ } ++ }) ++ } ++} ++ ++func newStampsFilteringTestServer(t *testing.T) (*http.Client, []byte, []byte) { ++ t.Helper() ++ ++ existingBatch := postagetesting.MustNewBatch(postagetesting.WithValue(20)) ++ staleBatch := postagetesting.MustNewBatch(postagetesting.WithValue(30)) ++ ++ existingIssuer := postage.NewStampIssuer("", "", existingBatch.ID, big.NewInt(3), 11, 10, 1000, true) ++ staleIssuer := postage.NewStampIssuer("", "", staleBatch.ID, big.NewInt(4), 12, 10, 1001, true) ++ mp := mockpost.New(mockpost.WithIssuer(existingIssuer)) ++ if err := mp.Add(staleIssuer); err != nil { ++ t.Fatal(err) ++ } ++ ++ cs := &postage.ChainState{Block: 10, TotalAmount: big.NewInt(5), CurrentPrice: big.NewInt(2)} ++ bs := newSelectiveBatchStore(cs, existingBatch) ++ ts, _, _, _ := newTestServer(t, testServerOptions{DebugAPI: true, Post: mp, BatchStore: bs, BlockTime: big.NewInt(2)}) ++ ++ return ts, existingBatch.ID, staleBatch.ID ++} ++ ++type selectiveBatchStore struct { ++ *mock.BatchStore ++ batch *postage.Batch ++} ++ ++func newSelectiveBatchStore(cs *postage.ChainState, batch *postage.Batch) *selectiveBatchStore { ++ return &selectiveBatchStore{ ++ BatchStore: mock.New(mock.WithChainState(cs)), ++ batch: batch, ++ } ++} ++ ++func (bs *selectiveBatchStore) Get(id []byte) (*postage.Batch, error) { ++ if bs.batch != nil && bytes.Equal(bs.batch.ID, id) { ++ return bs.batch, nil ++ } ++ return nil, storage.ErrNotFound ++} ++ ++func (bs *selectiveBatchStore) Exists(id []byte) (bool, error) { ++ return bs.batch != nil && bytes.Equal(bs.batch.ID, id), nil ++} ++ ++func (bs *selectiveBatchStore) Iterate(f func(*postage.Batch) (bool, error)) error { ++ if bs.batch == nil { ++ return nil ++ } ++ _, err := f(bs.batch) ++ return err ++} ++ ++type observedPostageStampsResponse struct { ++ Stamps []observedPostageStamp `json:"stamps"` ++} ++ ++type observedPostageStamp struct { ++ BatchID string `json:"batchID"` ++ Exists bool `json:"exists"` ++ Usable bool `json:"usable"` ++} ++ ++func getStampsResponse(t *testing.T, client *http.Client, path string) observedPostageStampsResponse { ++ t.Helper() ++ ++ req, err := http.NewRequest(http.MethodGet, path, nil) ++ if err != nil { ++ t.Fatal(err) ++ } ++ res, err := client.Do(req) ++ if err != nil { ++ t.Fatal(err) ++ } ++ defer res.Body.Close() ++ ++ if res.StatusCode != http.StatusOK { ++ t.Fatalf("got status %d, want %d", res.StatusCode, http.StatusOK) ++ } ++ ++ var out observedPostageStampsResponse ++ if err := json.NewDecoder(res.Body).Decode(&out); err != nil { ++ t.Fatal(err) ++ } ++ return out ++} ++ ++func containsStamp(resp observedPostageStampsResponse, batchID []byte) bool { ++ _, ok := findStamp(resp, batchID) ++ return ok ++} ++ ++func findStamp(resp observedPostageStampsResponse, batchID []byte) (observedPostageStamp, bool) { ++ want := hex.EncodeToString(batchID) ++ for _, stamp := range resp.Stamps { ++ if stamp.BatchID == want { ++ return stamp, true ++ } ++ } ++ return observedPostageStamp{}, false ++} ++ ++func openAPIPathBlock(t *testing.T, body, marker string) string { ++ t.Helper() ++ ++ start := strings.Index(body, marker) ++ if start < 0 { ++ t.Fatalf("openapi document does not contain marker %q", marker) ++ } ++ rest := body[start+len(marker):] ++ end := strings.Index(rest, "\n \"/") ++ if end < 0 { ++ return rest ++ } ++ return rest[:end] + } + + // TestGetAllBatches tests that the endpoint that returns all living +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,33 @@ ++#!/bin/bash ++set -euo pipefail ++ ++cd /testbed ++ ++prepare_go_env() { ++ ++ ++ sed -i '/go-msgio v0.0.6/d' go.sum ++ GONOSUMCHECK='*' GONOSUMDB='*' GOFLAGS='-mod=mod' go get golang.org/x/net@v0.33.0 golang.org/x/sys@v0.28.0 ++ GONOSUMCHECK='*' GONOSUMDB='*' GOFLAGS='-mod=mod' go mod tidy ++} ++ ++run_api_test() { ++ local pattern="$1" ++ GONOSUMCHECK='*' GONOSUMDB='*' GOFLAGS='-mod=mod' go test -v -run "$pattern" -count=1 ./pkg/api/ ++} ++ ++prepare_go_env ++ ++case "${1:-}" in ++ base) ++ run_api_test '^TestPostageGetStamps$/^single_stamp$' ++ ;; ++ new) ++ run_api_test '^TestPostageGetStamps$/^expired_batch$' ++ run_api_test '^(TestPostageGetStamps_FilterStaleByDefault|TestPostageGetStamps_AllTrueIncludesStale|TestPostageGetStamps_AllQueryParsing|TestOpenAPIStampsDocumentsAllParameter)$' ++ ;; ++ *) ++ echo "usage: $0 base|new" ++ exit 2 ++ ;; ++esac diff --git a/tasks/format-code-task-000904/tests/test.sh b/tasks/format-code-task-000904/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..3c069dffba18cfb7a0589f1d1295625a0b48e374 --- /dev/null +++ b/tasks/format-code-task-000904/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +pkg/api/postage_test.go +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000904/tests/test_command.sh b/tasks/format-code-task-000904/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..e8d2f32b64045b5a5a56e0ad5667da87d8e0bc2a --- /dev/null +++ b/tasks/format-code-task-000904/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new \ No newline at end of file diff --git a/tasks/format-code-task-000932/environment/Dockerfile b/tasks/format-code-task-000932/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..a0975b9b28cb29df62353837761970df09909881 --- /dev/null +++ b/tasks/format-code-task-000932/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:24fadce099f6c8cb979686992433d79330f7074bb3a965a5c69345a4034748e2 diff --git a/tasks/format-code-task-000932/environment/setup/files/blocklist b/tasks/format-code-task-000932/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000932/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000932/environment/setup/setup.sh b/tasks/format-code-task-000932/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000932/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000932/tests/test.patch b/tasks/format-code-task-000932/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..076870f5650b551322743e2959a2a2a3fec6fcbc --- /dev/null +++ b/tasks/format-code-task-000932/tests/test.patch @@ -0,0 +1,155 @@ +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 0000000..5c87055 +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["python -m pytest tests/test_json.py -k \"json_writer_validator or json_writer_custom or json_writer_no_validator or json_writer_issue\" -v"] ++} +diff --git a/tests/test_json.py b/tests/test_json.py +index e482961..def1a5a 100644 +--- a/tests/test_json.py ++++ b/tests/test_json.py +@@ -661,3 +661,128 @@ def test_map_of_union_of_array_and_map(): + + new_records = roundtrip(schema, records) + assert records == new_records ++ ++ ++ ++ ++ ++ ++ ++ ++_WEATHER_SCHEMA = { ++ "doc": "A weather reading.", ++ "name": "Weather", ++ "namespace": "test", ++ "type": "record", ++ "fields": [ ++ {"name": "station", "type": "string"}, ++ {"name": "time", "type": "long"}, ++ {"name": "temp", "type": "int"}, ++ ], ++} ++ ++ ++def test_json_writer_validator_true_raises_on_type_mismatch(): ++ """When validator=True is passed, json_writer must raise an error ++ if a record doesn't conform to the schema.""" ++ from fastavro._validate_common import ValidationError ++ ++ parsed_schema = parse_schema(deepcopy(_WEATHER_SCHEMA)) ++ records = [ ++ {"station": "011990-99999", "temp": 0, "time": "last day"}, ++ ] ++ text_stream = StringIO() ++ with pytest.raises(ValidationError): ++ json_writer(text_stream, parsed_schema, records, validator=True) ++ ++ ++def test_json_writer_validator_true_passes_valid_records(): ++ """When validator=True is passed and the records DO match the schema, ++ json_writer must succeed and write the expected JSON output.""" ++ parsed_schema = parse_schema(deepcopy(_WEATHER_SCHEMA)) ++ records = [ ++ {"station": "011990-99999", "temp": 0, "time": 1433269388}, ++ {"station": "011990-99999", "temp": -11, "time": 1433273379}, ++ ] ++ text_stream = StringIO() ++ json_writer(text_stream, parsed_schema, records, validator=True) ++ output = text_stream.getvalue() ++ ++ assert "011990-99999" in output ++ assert "1433269388" in output ++ assert "1433273379" in output ++ ++ ++def test_json_writer_no_validator_is_backward_compatible(): ++ """Without the validator argument, json_writer must NOT validate the ++ records — preserving the pre-fix behavior. Even mismatched records ++ must be written as-is without raising.""" ++ parsed_schema = parse_schema(deepcopy(_WEATHER_SCHEMA)) ++ records = [ ++ {"station": "011990-99999", "temp": 0, "time": 1433269388}, ++ {"station": "011990-99999", "temp": 22, "time": "last day"}, ++ {"station": "011990-99999", "temp": -11, "time": 1433273379}, ++ {"station": "012650-99999", "temp": 111.9, "time": 1433275478}, ++ ] ++ text_stream = StringIO() ++ ++ json_writer(text_stream, parsed_schema, records) ++ output = text_stream.getvalue() ++ assert "last day" in output ++ assert "111.9" in output ++ ++ ++def test_json_writer_custom_validator_callable_is_invoked(): ++ """When validator is a custom callable, json_writer must call it once ++ per record with (record, schema, named_schemas).""" ++ parsed_schema = parse_schema(deepcopy(_WEATHER_SCHEMA)) ++ records = [ ++ {"station": "A", "temp": 1, "time": 100}, ++ {"station": "B", "temp": 2, "time": 200}, ++ ] ++ ++ calls = [] ++ ++ def my_validator(record, schema, named_schemas): ++ calls.append(record) ++ ++ text_stream = StringIO() ++ json_writer(text_stream, parsed_schema, records, validator=my_validator) ++ assert calls == records ++ ++ ++def test_json_writer_custom_validator_can_raise(): ++ """A custom validator's exception must propagate out of json_writer.""" ++ parsed_schema = parse_schema(deepcopy(_WEATHER_SCHEMA)) ++ records = [ ++ {"station": "A", "temp": 1, "time": 100}, ++ ] ++ ++ class MyValidatorError(Exception): ++ pass ++ ++ def my_validator(record, schema, named_schemas): ++ raise MyValidatorError("nope") ++ ++ text_stream = StringIO() ++ with pytest.raises(MyValidatorError): ++ json_writer(text_stream, parsed_schema, records, validator=my_validator) ++ ++ ++def test_json_writer_issue_reproduction_with_validator(): ++ """Exact reproduction from the issue, but using the validator=True ++ parameter that the fix added. The 2nd record has a string time ++ (bad) and must trigger a validation error before all records are ++ consumed.""" ++ from fastavro._validate_common import ValidationError ++ ++ parsed_schema = parse_schema(deepcopy(_WEATHER_SCHEMA)) ++ records = [ ++ {"station": "011990-99999", "temp": 0, "time": 1433269388}, ++ {"station": "011990-99999", "temp": 22, "time": "last day"}, ++ {"station": "011990-99999", "temp": -11, "time": 1433273379}, ++ {"station": "012650-99999", "temp": 111.9, "time": 1433275478}, ++ ] ++ text_stream = StringIO() ++ with pytest.raises(ValidationError): ++ json_writer(text_stream, parsed_schema, records, validator=True) +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++python -m pytest -v -rA tests/test_json.py::test_json_writer_validator_true_raises_on_type_mismatch tests/test_json.py::test_json_writer_validator_true_passes_valid_records tests/test_json.py::test_json_writer_no_validator_is_backward_compatible tests/test_json.py::test_json_writer_custom_validator_callable_is_invoked tests/test_json.py::test_json_writer_custom_validator_can_raise tests/test_json.py::test_json_writer_issue_reproduction_with_validator ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-000932/tests/test.sh b/tasks/format-code-task-000932/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..9571a824226e4abb83f7b9a4bcc7e833c85b774e --- /dev/null +++ b/tasks/format-code-task-000932/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test_commands.json +tests/test_json.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000932/tests/test_command.sh b/tasks/format-code-task-000932/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000932/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000935/environment/Dockerfile b/tasks/format-code-task-000935/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..1efbed63c5eb7f18f011888c990e4abba81d8f3a --- /dev/null +++ b/tasks/format-code-task-000935/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:51d54d6c1eefe34bde9916a0dc8e0231b85124f82dc60969928681cafaffb8fc diff --git a/tasks/format-code-task-000935/environment/setup/files/blocklist b/tasks/format-code-task-000935/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000935/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000935/environment/setup/setup.sh b/tasks/format-code-task-000935/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000935/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000935/tests/test.patch b/tasks/format-code-task-000935/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..27c30569dca7d9839eb88d49ed4449dd68d041ea --- /dev/null +++ b/tasks/format-code-task-000935/tests/test.patch @@ -0,0 +1,200 @@ +diff --git a/test/issue-543-request-not-null.test.js b/test/issue-543-request-not-null.test.js +new file mode 100644 +index 00000000..1e595e7a +--- /dev/null ++++ b/test/issue-543-request-not-null.test.js +@@ -0,0 +1,172 @@ ++'use strict' ++ ++ ++ ++ ++ ++const t = require('tap') ++const test = t.test ++const Fastify = require('..') ++ ++ ++ ++test('onSend hook receives non-null request when onRequest hook errors', t => { ++ t.plan(5) ++ const fastify = Fastify() ++ ++ fastify.addHook('onRequest', function (req, res, next) { ++ next(new Error('onrequest error')) ++ }) ++ ++ fastify.addHook('onSend', function (request, reply, payload, next) { ++ t.notEqual(request, null, 'request must not be null in onSend') ++ t.type(request, 'object', 'request must be an object') ++ t.ok(request.headers, 'request.headers must be defined') ++ t.ok(request.req, 'request.req must be defined') ++ next() ++ }) ++ ++ fastify.get('/', function (req, reply) { ++ reply.send({ hello: 'world' }) ++ }) ++ ++ fastify.inject({ method: 'GET', url: '/' }, res => { ++ t.strictEqual(res.statusCode, 500) ++ }) ++}) ++ ++test('errorHandler receives reply with non-null request when onRequest hook errors', t => { ++ t.plan(4) ++ const fastify = Fastify() ++ ++ fastify.addHook('onRequest', function (req, res, next) { ++ next(new Error('onrequest error')) ++ }) ++ ++ fastify.setErrorHandler(function (err, reply) { ++ t.ok(err, 'err is forwarded') ++ t.notEqual(reply.request, null, 'reply.request must not be null') ++ t.ok(reply.request && reply.request.headers, 'reply.request.headers must be accessible') ++ reply.code(500).send(err) ++ }) ++ ++ fastify.get('/', function (req, reply) { ++ reply.send({ hello: 'world' }) ++ }) ++ ++ fastify.inject({ method: 'GET', url: '/' }, res => { ++ t.strictEqual(res.statusCode, 500) ++ }) ++}) ++ ++ ++ ++test('onSend hook receives non-null request when use() middleware errors', t => { ++ t.plan(5) ++ const fastify = Fastify() ++ ++ fastify.use(function (req, res, next) { ++ next(new Error('middleware error')) ++ }) ++ ++ fastify.addHook('onSend', function (request, reply, payload, next) { ++ t.notEqual(request, null, 'request must not be null in onSend') ++ t.type(request, 'object', 'request must be an object') ++ t.ok(request.headers, 'request.headers must be defined') ++ t.ok(request.req, 'request.req must be defined') ++ next() ++ }) ++ ++ fastify.get('/', function (req, reply) { ++ reply.send({ hello: 'world' }) ++ }) ++ ++ fastify.inject({ method: 'GET', url: '/' }, res => { ++ t.strictEqual(res.statusCode, 500) ++ }) ++}) ++ ++test('errorHandler receives reply with non-null request when use() middleware errors', t => { ++ t.plan(4) ++ const fastify = Fastify() ++ ++ fastify.use(function (req, res, next) { ++ next(new Error('middleware error')) ++ }) ++ ++ fastify.setErrorHandler(function (err, reply) { ++ t.ok(err, 'err is forwarded') ++ t.notEqual(reply.request, null, 'reply.request must not be null') ++ t.ok(reply.request && reply.request.headers, 'reply.request.headers must be accessible') ++ reply.code(500).send(err) ++ }) ++ ++ fastify.get('/', function (req, reply) { ++ reply.send({ hello: 'world' }) ++ }) ++ ++ fastify.inject({ method: 'GET', url: '/' }, res => { ++ t.strictEqual(res.statusCode, 500) ++ }) ++}) ++ ++ ++ ++test('onSend hook receives non-null request when custom content-type parser errors', t => { ++ t.plan(5) ++ const fastify = Fastify() ++ ++ fastify.addContentTypeParser('application/jsoff', function (req, done) { ++ done(new Error('parser error')) ++ }) ++ ++ fastify.addHook('onSend', function (request, reply, payload, next) { ++ t.notEqual(request, null, 'request must not be null in onSend') ++ t.type(request, 'object', 'request must be an object') ++ t.ok(request.headers, 'request.headers must be defined') ++ t.ok(request.req, 'request.req must be defined') ++ next() ++ }) ++ ++ fastify.post('/', function (req, reply) { ++ reply.send({ hello: 'world' }) ++ }) ++ ++ fastify.inject({ ++ method: 'POST', ++ url: '/', ++ payload: 'anything', ++ headers: { 'content-type': 'application/jsoff' } ++ }, res => { ++ t.ok(res.statusCode >= 400, 'response is an error') ++ }) ++}) ++ ++test('errorHandler receives reply with non-null request when custom content-type parser errors', t => { ++ t.plan(4) ++ const fastify = Fastify() ++ ++ fastify.addContentTypeParser('application/jsoff', function (req, done) { ++ done(new Error('parser error')) ++ }) ++ ++ fastify.setErrorHandler(function (err, reply) { ++ t.ok(err, 'err is forwarded') ++ t.notEqual(reply.request, null, 'reply.request must not be null') ++ t.ok(reply.request && reply.request.headers, 'reply.request.headers must be accessible') ++ reply.code(500).send(err) ++ }) ++ ++ fastify.post('/', function (req, reply) { ++ reply.send({ hello: 'world' }) ++ }) ++ ++ fastify.inject({ ++ method: 'POST', ++ url: '/', ++ payload: 'anything', ++ headers: { 'content-type': 'application/jsoff' } ++ }, res => { ++ t.strictEqual(res.statusCode, 500) ++ }) ++}) +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 00000000..2936e408 +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["./node_modules/.bin/tap test/issue-543-request-not-null.test.js"] ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++./node_modules/.bin/tap test/issue-543-request-not-null.test.js ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-000935/tests/test.sh b/tasks/format-code-task-000935/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a202dfc2c76fbfb1df245251aea48d226d7d616 --- /dev/null +++ b/tasks/format-code-task-000935/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test/issue-543-request-not-null.test.js +test_commands.json +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000935/tests/test_command.sh b/tasks/format-code-task-000935/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000935/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000950/environment/Dockerfile b/tasks/format-code-task-000950/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..ef7fad931ea2290ec19ef2a368683b4cd349067d --- /dev/null +++ b/tasks/format-code-task-000950/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:3f440d2fab07c7124d2a0ed4263276923d3dde6a1dcaf196497c0bf67de22858 diff --git a/tasks/format-code-task-000950/environment/setup/files/blocklist b/tasks/format-code-task-000950/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000950/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000950/environment/setup/setup.sh b/tasks/format-code-task-000950/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-000950/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000950/tests/test.patch b/tasks/format-code-task-000950/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..2baaf1cd292e9d6dd533c906cc62c96b82516f08 --- /dev/null +++ b/tasks/format-code-task-000950/tests/test.patch @@ -0,0 +1,163 @@ +diff --git a/usercase-test-coderl/usecase.sh b/usercase-test-coderl/usecase.sh +new file mode 100755 +--- /dev/null ++++ b/usercase-test-coderl/usecase.sh +@@ -0,0 +1,141 @@ ++#!/usr/bin/env bash ++ ++set -u ++export LANG=C LC_ALL=C TZ=UTC ++ ++BIN=/workspace/repo/tools/filter.py ++ ++fail() { ++ echo "FAIL: $*" >&2 ++ exit 1 ++} ++ ++[ -x "$BIN" ] || fail "tools/filter.py is not executable" ++ ++TMP=$(mktemp -d) ++trap 'rm -rf "$TMP"' EXIT ++cd "$TMP" || exit 1 ++ ++assert_file_equals() { ++ local actual=$1 ++ local expected=$2 ++ local label=$3 ++ ++ if ! cmp -s "$actual" "$expected"; then ++ echo "FAIL: $label" >&2 ++ echo "--- actual ---" >&2 ++ sed -n l "$actual" >&2 ++ echo "--- expected ---" >&2 ++ sed -n l "$expected" >&2 ++ exit 1 ++ fi ++} ++ ++ ++ ++ ++cat > trace.txt <<'EOF' ++X|stale|caller|| ++E|main|root|/bin/app|/bin/app ++E|child|main|/bin/app|/bin/app ++X|child|main|/bin/app|/bin/app ++X|main|root|/bin/app|/bin/app ++EOF ++"$BIN" -f trace.txt >out 2>err ++ec=$? ++cat >expected_out <<'EOF' ++E|main|root|main|root|/bin/app|/bin/app ++E|child|main|child|main|/bin/app|/bin/app ++X|child|main|0x0|0x0|| ++X|main|root|0x0|0x0|| ++EOF ++: >expected_err ++[ "$ec" -eq 0 ] || fail "F1 exit $ec; want 0" ++assert_file_equals out expected_out "F1 stdout" ++assert_file_equals err expected_err "F1 stderr" ++ ++ ++ ++ ++cat > trace.txt <<'EOF' ++E|0x401000|0x0|/tmp/a.out| ++X|0x401000|0x0|/tmp/a.out| ++EOF ++"$BIN" -f trace.txt >out 2>err ++ec=$? ++cat >expected_out <<'EOF' ++E|0x401000|0x0|0x401000|0x0|/tmp/a.out| ++X|0x401000|0x0|0x0|0x0|| ++EOF ++: >expected_err ++[ "$ec" -eq 0 ] || fail "F2 exit $ec; want 0" ++assert_file_equals out expected_out "F2 stdout" ++assert_file_equals err expected_err "F2 stderr" ++ ++ ++ ++ ++cat > trace.txt <<'EOF' ++E|outer|root|| ++E|inner|outer|| ++X|outer|root|| ++EOF ++"$BIN" -f trace.txt >out 2>err ++ec=$? ++cat >expected_out <<'EOF' ++E|outer|root|outer|root|| ++E|inner|outer|inner|outer|| ++X|inner|outer|0x0|0x0|| ++X|outer|root|0x0|0x0|| ++EOF ++cat >expected_err <<'EOF' ++Filter - Warning: Incorrect exit func: outer(3), expect: inner(2) ++EOF ++[ "$ec" -eq 0 ] || fail "F3 exit $ec; want 0" ++assert_file_equals out expected_out "F3 stdout" ++assert_file_equals err expected_err "F3 stderr" ++ ++ ++ ++ ++cat > trace.txt <<'EOF' ++Q|bad|row|| ++EOF ++"$BIN" -f trace.txt >out 2>err ++ec=$? ++: >expected_out ++cat >expected_err <<'EOF' ++Filter - Warning: Incorrect type: Q at line 1, the type must be E or X ++EOF ++[ "$ec" -ne 0 ] || fail "F4 exit $ec; want non-zero" ++assert_file_equals out expected_out "F4 stdout" ++assert_file_equals err expected_err "F4 stderr" ++ ++ ++ ++ ++"$BIN" -h >out 2>err ++ec=$? ++cat >expected_out <<'EOF' ++usage: filter.py -f trace.txt ++EOF ++: >expected_err ++[ "$ec" -eq 0 ] || fail "F5 exit $ec; want 0" ++assert_file_equals out expected_out "F5 stdout" ++assert_file_equals err expected_err "F5 stderr" ++ ++ ++ ++ ++"$BIN" >out 2>err ++ec=$? ++cat >expected_out <<'EOF' ++usage: filter.py -f trace.txt ++EOF ++: >expected_err ++[ "$ec" -ne 0 ] || fail "F6 exit $ec; want non-zero" ++assert_file_equals out expected_out "F6 stdout" ++assert_file_equals err expected_err "F6 stderr" ++ ++echo "PASS" ++exit 0 +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,12 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++exec bash /workspace/repo/usercase-test-coderl/usecase.sh diff --git a/tasks/format-code-task-000950/tests/test.sh b/tasks/format-code-task-000950/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..d4d80bb634b14076ae561be99f395189577b7ac6 --- /dev/null +++ b/tasks/format-code-task-000950/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/usecase.sh +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000950/tests/test_command.sh b/tasks/format-code-task-000950/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-000950/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000957/environment/Dockerfile b/tasks/format-code-task-000957/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..c0ffbe43c1cbfabbcc9d913457786eca05f85d40 --- /dev/null +++ b/tasks/format-code-task-000957/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:1dd7a4278934796049646797f3627b1b5d3b4e9b2c42fad994e4765256575b3e diff --git a/tasks/format-code-task-000957/environment/setup/files/blocklist b/tasks/format-code-task-000957/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000957/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000957/environment/setup/setup.sh b/tasks/format-code-task-000957/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000957/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000957/tests/test.patch b/tasks/format-code-task-000957/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..127f68c316971433c650cea5bcc8fc04d761774b --- /dev/null +++ b/tasks/format-code-task-000957/tests/test.patch @@ -0,0 +1,416 @@ +diff --git a/tests/unit/test_find_unused_load_balancers_codespec.py b/tests/unit/test_find_unused_load_balancers_codespec.py +new file mode 100644 +index 0000000..a0847e2 +--- /dev/null ++++ b/tests/unit/test_find_unused_load_balancers_codespec.py +@@ -0,0 +1,399 @@ ++import json ++import os ++import shutil ++import tempfile ++import unittest ++from urllib.parse import quote_plus ++ ++from mock import patch ++ ++import shared.find_unused as find_unused_module ++from shared.nodes import Account, Region ++ ++ ++class TestFindUnusedLoadBalancersCodeSpec(unittest.TestCase): ++ def setUp(self): ++ self.original_cwd = os.getcwd() ++ self.temp_dir = tempfile.mkdtemp() ++ os.chdir(self.temp_dir) ++ self.account_data = {"id": "111122223333", "name": "fixture"} ++ ++ def tearDown(self): ++ os.chdir(self.original_cwd) ++ shutil.rmtree(self.temp_dir) ++ ++ def write_json(self, relative_path, payload): ++ path = os.path.join(self.temp_dir, relative_path) ++ parent = os.path.dirname(path) ++ if not os.path.isdir(parent): ++ os.makedirs(parent) ++ with open(path, "w") as output: ++ json.dump(payload, output) ++ ++ def write_query(self, region_name, query_name, payload): ++ self.write_json( ++ "account-data/{}/{}/{}.json".format( ++ self.account_data["name"], region_name, query_name ++ ), ++ payload, ++ ) ++ ++ def write_parameter(self, region_name, service, function, identifier, payload): ++ self.write_json( ++ "account-data/{}/{}/{}-{}/{}".format( ++ self.account_data["name"], ++ region_name, ++ service, ++ function, ++ quote_plus(identifier), ++ ), ++ payload, ++ ) ++ ++ def make_region(self, region_name="us-test-1"): ++ return Region(Account(None, self.account_data), {"RegionName": region_name}) ++ ++ def finder(self): ++ finder = getattr(find_unused_module, "find_unused_load_balancers", None) ++ self.assertTrue( ++ callable(finder), ++ "shared.find_unused.find_unused_load_balancers must be callable", ++ ) ++ return finder ++ ++ def test_codespec_classic_load_balancer_classification_and_order(self): ++ region_name = "us-test-1" ++ self.write_query( ++ region_name, ++ "elb-describe-load-balancers", ++ { ++ "LoadBalancerDescriptions": [ ++ { ++ "LoadBalancerName": "classic-registered", ++ "Instances": [{"InstanceId": "i-123"}], ++ }, ++ {"LoadBalancerName": "classic-field-omitted"}, ++ {"LoadBalancerName": "classic-empty", "Instances": []}, ++ ] ++ }, ++ ) ++ self.write_query( ++ region_name, "elbv2-describe-load-balancers", {"LoadBalancers": []} ++ ) ++ ++ self.assertEqual( ++ self.finder()(self.make_region(region_name)), ++ [ ++ { ++ "id": "classic-field-omitted", ++ "name": "classic-field-omitted", ++ "type": "classic", ++ }, ++ { ++ "id": "classic-empty", ++ "name": "classic-empty", ++ "type": "classic", ++ }, ++ ], ++ ) ++ ++ def test_codespec_v2_registered_targets_and_empty_target_groups(self): ++ region_name = "us-test-2" ++ self.write_query( ++ region_name, "elb-describe-load-balancers", {"LoadBalancerDescriptions": []} ++ ) ++ load_balancers = [ ++ { ++ "LoadBalancerArn": "arn:lb:no-groups", ++ "LoadBalancerName": "no-groups", ++ "Type": "application", ++ }, ++ { ++ "LoadBalancerArn": "arn:lb:all-empty", ++ "LoadBalancerName": "all-empty", ++ "Type": "network", ++ }, ++ { ++ "LoadBalancerArn": "arn:lb:unhealthy-target", ++ "LoadBalancerName": "unhealthy-target", ++ "Type": "application", ++ }, ++ { ++ "LoadBalancerArn": "arn:lb:mixed", ++ "LoadBalancerName": "mixed", ++ "Type": "network", ++ }, ++ ] ++ self.write_query( ++ region_name, ++ "elbv2-describe-load-balancers", ++ {"LoadBalancers": load_balancers}, ++ ) ++ groups = { ++ "arn:lb:no-groups": [], ++ "arn:lb:all-empty": ["arn:tg:empty-a", "arn:tg:empty-b"], ++ "arn:lb:unhealthy-target": ["arn:tg:unhealthy"], ++ "arn:lb:mixed": ["arn:tg:mixed-empty", "arn:tg:mixed-registered"], ++ } ++ for load_balancer_arn, target_group_arns in groups.items(): ++ self.write_parameter( ++ region_name, ++ "elbv2", ++ "describe-target-groups", ++ load_balancer_arn, ++ { ++ "TargetGroups": [ ++ {"TargetGroupArn": target_group_arn} ++ for target_group_arn in target_group_arns ++ ] ++ }, ++ ) ++ ++ for target_group_arn in [ ++ "arn:tg:empty-a", ++ "arn:tg:empty-b", ++ "arn:tg:mixed-empty", ++ ]: ++ self.write_parameter( ++ region_name, ++ "elbv2", ++ "describe-target-health", ++ target_group_arn, ++ {"TargetHealthDescriptions": []}, ++ ) ++ self.write_parameter( ++ region_name, ++ "elbv2", ++ "describe-target-health", ++ "arn:tg:unhealthy", ++ { ++ "TargetHealthDescriptions": [ ++ { ++ "Target": {"Id": "i-unhealthy"}, ++ "TargetHealth": {"State": "unhealthy"}, ++ } ++ ] ++ }, ++ ) ++ self.write_parameter( ++ region_name, ++ "elbv2", ++ "describe-target-health", ++ "arn:tg:mixed-registered", ++ { ++ "TargetHealthDescriptions": [ ++ { ++ "Target": {"Id": "i-draining"}, ++ "TargetHealth": {"State": "draining"}, ++ } ++ ] ++ }, ++ ) ++ ++ self.assertEqual( ++ self.finder()(self.make_region(region_name)), ++ [ ++ { ++ "id": "arn:lb:no-groups", ++ "name": "no-groups", ++ "type": "application", ++ }, ++ { ++ "id": "arn:lb:all-empty", ++ "name": "all-empty", ++ "type": "network", ++ }, ++ ], ++ ) ++ ++ def test_codespec_v2_incomplete_collection_is_not_reported_unused(self): ++ region_name = "us-test-3" ++ self.write_query( ++ region_name, "elb-describe-load-balancers", {"LoadBalancerDescriptions": []} ++ ) ++ self.write_query( ++ region_name, ++ "elbv2-describe-load-balancers", ++ { ++ "LoadBalancers": [ ++ { ++ "LoadBalancerArn": "arn:lb:groups-missing", ++ "LoadBalancerName": "groups-missing", ++ "Type": "application", ++ }, ++ { ++ "LoadBalancerArn": "arn:lb:health-missing", ++ "LoadBalancerName": "health-missing", ++ "Type": "network", ++ }, ++ { ++ "LoadBalancerArn": "arn:lb:complete-empty", ++ "LoadBalancerName": "complete-empty", ++ "Type": "application", ++ }, ++ ] ++ }, ++ ) ++ self.write_parameter( ++ region_name, ++ "elbv2", ++ "describe-target-groups", ++ "arn:lb:health-missing", ++ { ++ "TargetGroups": [ ++ {"TargetGroupArn": "arn:tg:known-empty"}, ++ {"TargetGroupArn": "arn:tg:health-missing"}, ++ ] ++ }, ++ ) ++ self.write_parameter( ++ region_name, ++ "elbv2", ++ "describe-target-health", ++ "arn:tg:known-empty", ++ {"TargetHealthDescriptions": []}, ++ ) ++ self.write_parameter( ++ region_name, ++ "elbv2", ++ "describe-target-groups", ++ "arn:lb:complete-empty", ++ {"TargetGroups": [{"TargetGroupArn": "arn:tg:complete-empty"}]}, ++ ) ++ self.write_parameter( ++ region_name, ++ "elbv2", ++ "describe-target-health", ++ "arn:tg:complete-empty", ++ {"TargetHealthDescriptions": []}, ++ ) ++ ++ self.assertEqual( ++ self.finder()(self.make_region(region_name)), ++ [ ++ { ++ "id": "arn:lb:complete-empty", ++ "name": "complete-empty", ++ "type": "application", ++ } ++ ], ++ ) ++ ++ def write_region_basics(self, region_name): ++ self.write_query( ++ region_name, "ec2-describe-security-groups", {"SecurityGroups": []} ++ ) ++ self.write_query( ++ region_name, ++ "ec2-describe-network-interfaces", ++ {"NetworkInterfaces": []}, ++ ) ++ self.write_query(region_name, "ec2-describe-volumes", {"Volumes": []}) ++ self.write_query(region_name, "ec2-describe-addresses", {"Addresses": []}) ++ ++ def test_codespec_report_aggregation_and_empty_category_omission(self): ++ region_names = ["classic-region", "v2-region", "used-region"] ++ self.write_json( ++ "account-data/{}/describe-regions.json".format( ++ self.account_data["name"] ++ ), ++ {"Regions": [{"RegionName": name} for name in region_names]}, ++ ) ++ for region_name in region_names: ++ self.write_region_basics(region_name) ++ ++ self.write_query( ++ "classic-region", ++ "elb-describe-load-balancers", ++ { ++ "LoadBalancerDescriptions": [ ++ {"LoadBalancerName": "classic-report", "Instances": []} ++ ] ++ }, ++ ) ++ self.write_query( ++ "classic-region", "elbv2-describe-load-balancers", {"LoadBalancers": []} ++ ) ++ ++ self.write_query( ++ "v2-region", "elb-describe-load-balancers", {"LoadBalancerDescriptions": []} ++ ) ++ self.write_query( ++ "v2-region", ++ "elbv2-describe-load-balancers", ++ { ++ "LoadBalancers": [ ++ { ++ "LoadBalancerArn": "arn:lb:v2-report", ++ "LoadBalancerName": "v2-report", ++ "Type": "application", ++ } ++ ] ++ }, ++ ) ++ self.write_parameter( ++ "v2-region", ++ "elbv2", ++ "describe-target-groups", ++ "arn:lb:v2-report", ++ {"TargetGroups": []}, ++ ) ++ ++ self.write_query( ++ "used-region", ++ "elb-describe-load-balancers", ++ { ++ "LoadBalancerDescriptions": [ ++ { ++ "LoadBalancerName": "classic-used", ++ "Instances": [{"InstanceId": "i-used"}], ++ } ++ ] ++ }, ++ ) ++ self.write_query( ++ "used-region", "elbv2-describe-load-balancers", {"LoadBalancers": []} ++ ) ++ ++ with patch.object(find_unused_module, "get_resource_nodes", return_value={}): ++ report = find_unused_module.find_unused_resources([self.account_data]) ++ ++ self.assertEqual( ++ report, ++ [ ++ { ++ "account": {"id": "111122223333", "name": "fixture"}, ++ "regions": [ ++ { ++ "region": "classic-region", ++ "unused_resources": { ++ "load_balancers": [ ++ { ++ "id": "classic-report", ++ "name": "classic-report", ++ "type": "classic", ++ } ++ ] ++ }, ++ }, ++ { ++ "region": "v2-region", ++ "unused_resources": { ++ "load_balancers": [ ++ { ++ "id": "arn:lb:v2-report", ++ "name": "v2-report", ++ "type": "application", ++ } ++ ] ++ }, ++ }, ++ {"region": "used-region", "unused_resources": {}}, ++ ], ++ } ++ ], ++ ) ++ ++ ++if __name__ == "__main__": ++ unittest.main() + +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,5 @@ ++#!/bin/bash ++set -euo pipefail ++ ++ ++nosetests tests/unit/test_find_unused.py tests/unit/test_find_unused_load_balancers_codespec.py diff --git a/tasks/format-code-task-000957/tests/test.sh b/tasks/format-code-task-000957/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..a02c214b374e30cbbceb957df53cdf1f8348740d --- /dev/null +++ b/tasks/format-code-task-000957/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/unit/test_find_unused_load_balancers_codespec.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000957/tests/test_command.sh b/tasks/format-code-task-000957/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000957/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-000968/environment/Dockerfile b/tasks/format-code-task-000968/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..0304b093860014bee5d2fee96af258ba2cdbb308 --- /dev/null +++ b/tasks/format-code-task-000968/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:9dbe78b6c098668b0cca6e958bfb2c41346dd2de2ecb5e37f21e28efb010f1d6 diff --git a/tasks/format-code-task-000968/environment/setup/files/blocklist b/tasks/format-code-task-000968/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-000968/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-000968/environment/setup/setup.sh b/tasks/format-code-task-000968/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-000968/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-000968/tests/test.patch b/tasks/format-code-task-000968/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..f3c7ebbadae4853286ceba4a2c640d789cc089a6 --- /dev/null +++ b/tasks/format-code-task-000968/tests/test.patch @@ -0,0 +1,409 @@ +diff --git a/f5/bigip/test/test_collection_pagination_contract.py b/f5/bigip/test/test_collection_pagination_contract.py +new file mode 100644 +index 0000000..a818f08 +--- /dev/null ++++ b/f5/bigip/test/test_collection_pagination_contract.py +@@ -0,0 +1,388 @@ ++from f5.bigip import exceptions ++from f5.bigip.ltm import LTM ++from f5.bigip.ltm.nat import NAT ++from f5.bigip.ltm.nat import NATCollection ++from f5.bigip.resource import UnregisteredKind ++from f5.bigip.rest_collection import RESTInterfaceCollection ++ ++import pytest ++ ++ ++APPLIANCE = 'https://bigip.example' ++ ++ ++class FakeResponse(object): ++ def __init__(self, payload): ++ self.payload = payload ++ ++ def json(self): ++ return self.payload ++ ++ ++class RoutedSession(object): ++ def __init__(self, routes, events=None, reject_repeated_urls=False): ++ self.routes = routes ++ self.events = events if events is not None else [] ++ self.reject_repeated_urls = reject_repeated_urls ++ self.counts = {} ++ ++ def get(self, url, *args, **kwargs): ++ self.events.append(('get', url, args, kwargs)) ++ self.counts[url] = self.counts.get(url, 0) + 1 ++ if self.reject_repeated_urls and self.counts[url] > 1: ++ raise AssertionError('continuation URL requested twice: %s' % url) ++ result = self.routes[url] ++ if isinstance(result, Exception): ++ raise result ++ return FakeResponse(result) ++ ++ ++class FakeBigIP(object): ++ def __init__(self, session): ++ self._meta_data = { ++ 'bigip': self, ++ 'hostname': 'bigip.example', ++ 'uri': APPLIANCE + '/mgmt/tm/', ++ 'icr_session': session, ++ } ++ ++ ++def nat_item(name, kind='tm:ltm:nat:natstate'): ++ return { ++ 'kind': kind, ++ 'name': name, ++ 'generation': 1, ++ 'selfLink': 'https://localhost/mgmt/tm/ltm/nat/~Common~%s' % name, ++ } ++ ++ ++def nat_collection(routes, **session_kwargs): ++ session = RoutedSession(routes, **session_kwargs) ++ collection = NATCollection(LTM(FakeBigIP(session))) ++ return collection, session ++ ++ ++def test_codespec_single_page_collection_behavior_is_unchanged(): ++ nat_url = APPLIANCE + '/mgmt/tm/ltm/nat/' ++ nat_routes = {nat_url: {'items': [nat_item('only')]}} ++ resource_collection, resource_session = nat_collection(nat_routes) ++ ++ resources = resource_collection.get_collection() ++ ++ assert len(resources) == 1 ++ assert isinstance(resources[0], NAT) ++ assert resources[0].name == 'only' ++ assert [event[1] for event in resource_session.events] == [nat_url] ++ ++ ltm_url = APPLIANCE + '/mgmt/tm/ltm/' ++ ltm_routes = {ltm_url: {'items': [{'reference': 'only'}]}} ++ organizing_session = RoutedSession(ltm_routes) ++ organizing_collection = LTM(FakeBigIP(organizing_session)) ++ ++ assert organizing_collection.get_collection() == [{'reference': 'only'}] ++ assert [event[1] for event in organizing_session.events] == [ltm_url] ++ ++ ++def test_codespec_resource_collection_walks_all_links_and_hydrates_each_page(): ++ first = APPLIANCE + '/mgmt/tm/ltm/nat/' ++ second = APPLIANCE + '/mgmt/tm/ltm/nat/?$skip=1' ++ third = APPLIANCE + '/mgmt/tm/ltm/nat/?$skip=2' ++ beta_uri = APPLIANCE + '/mgmt/tm/ltm/nat/~Common~beta/' ++ routes = { ++ first: { ++ 'items': [nat_item('alpha')], ++ 'nextLink': 'https://localhost/mgmt/tm/ltm/nat/?$skip=1', ++ }, ++ second: { ++ 'items': [], ++ 'nextLink': '/mgmt/tm/ltm/nat/?$skip=2', ++ }, ++ third: { ++ 'items': [nat_item('beta'), nat_item('alpha')], ++ }, ++ beta_uri: nat_item('beta'), ++ } ++ collection, session = nat_collection(routes) ++ ++ resources = collection.get_collection() ++ ++ assert [resource.name for resource in resources] == [ ++ 'alpha', 'beta', 'alpha'] ++ assert all(isinstance(resource, NAT) for resource in resources) ++ assert [event[1] for event in session.events] == [first, second, third] ++ ++ resources[1].refresh() ++ assert session.events[-1][1] == beta_uri ++ ++ ++def test_codespec_organizing_collection_keeps_raw_order_past_empty_page(): ++ first = APPLIANCE + '/mgmt/tm/ltm/' ++ second = APPLIANCE + '/mgmt/tm/ltm/?$skip=1' ++ third = APPLIANCE + '/mgmt/tm/ltm/?$skip=2' ++ routes = { ++ first: { ++ 'items': [{'reference': 'first'}], ++ 'nextLink': '/mgmt/tm/ltm/?$skip=1', ++ }, ++ second: { ++ 'nextLink': 'https://localhost/mgmt/tm/ltm/?$skip=2', ++ }, ++ third: { ++ 'items': [{'reference': 'second'}, {'reference': 'first'}], ++ }, ++ } ++ session = RoutedSession(routes) ++ collection = LTM(FakeBigIP(session)) ++ ++ assert collection.get_collection() == [ ++ {'reference': 'first'}, ++ {'reference': 'second'}, ++ {'reference': 'first'}, ++ ] ++ assert [event[1] for event in session.events] == [first, second, third] ++ ++ ++def test_codespec_kindless_items_remain_raw_across_resource_pages(): ++ first = APPLIANCE + '/mgmt/tm/ltm/nat/' ++ second = APPLIANCE + '/mgmt/tm/ltm/nat/?$skip=1' ++ raw_item = {'name': 'server-summary', 'count': 2} ++ routes = { ++ first: { ++ 'items': [raw_item], ++ 'nextLink': '/mgmt/tm/ltm/nat/?$skip=1', ++ }, ++ second: { ++ 'items': [nat_item('typed')], ++ }, ++ } ++ collection, session = nat_collection(routes) ++ ++ results = collection.get_collection() ++ ++ assert results[0] == raw_item ++ assert isinstance(results[0], dict) ++ assert isinstance(results[1], NAT) ++ assert [event[1] for event in session.events] == [first, second] ++ ++ ++def test_codespec_unregistered_kind_on_later_page_is_not_ignored(): ++ first = APPLIANCE + '/mgmt/tm/ltm/nat/' ++ second = APPLIANCE + '/mgmt/tm/ltm/nat/?$skip=1' ++ routes = { ++ first: { ++ 'items': [nat_item('valid')], ++ 'nextLink': '/mgmt/tm/ltm/nat/?$skip=1', ++ }, ++ second: { ++ 'items': [nat_item('alien', kind='tm:ltm:alien:alienstate')], ++ }, ++ } ++ collection, unused_session = nat_collection(routes) ++ ++ with pytest.raises(UnregisteredKind): ++ collection.get_collection() ++ ++ ++class LaterPageFailure(Exception): ++ pass ++ ++ ++def test_codespec_organizing_collection_later_failure_propagates(): ++ first = APPLIANCE + '/mgmt/tm/ltm/' ++ second = APPLIANCE + '/mgmt/tm/ltm/?$skip=1' ++ failure = LaterPageFailure('organizing page failed') ++ routes = { ++ first: { ++ 'items': [{'reference': 'first'}], ++ 'nextLink': '/mgmt/tm/ltm/?$skip=1', ++ }, ++ second: failure, ++ } ++ session = RoutedSession(routes) ++ collection = LTM(FakeBigIP(session)) ++ ++ with pytest.raises(LaterPageFailure) as raised: ++ collection.get_collection() ++ assert raised.value is failure ++ ++ ++def test_codespec_later_page_transport_failure_propagates(): ++ first = APPLIANCE + '/mgmt/tm/ltm/nat/' ++ second = APPLIANCE + '/mgmt/tm/ltm/nat/?$skip=1' ++ failure = LaterPageFailure('second page failed') ++ routes = { ++ first: { ++ 'items': [nat_item('valid')], ++ 'nextLink': '/mgmt/tm/ltm/nat/?$skip=1', ++ }, ++ second: failure, ++ } ++ collection, unused_session = nat_collection(routes) ++ ++ with pytest.raises(LaterPageFailure) as raised: ++ collection.get_collection() ++ assert raised.value is failure ++ ++ ++def test_codespec_resource_collection_rejects_normalized_link_cycle(): ++ first = APPLIANCE + '/mgmt/tm/ltm/nat/' ++ routes = { ++ first: { ++ 'items': [nat_item('valid')], ++ 'nextLink': 'https://localhost/mgmt/tm/ltm/nat/', ++ }, ++ } ++ collection, session = nat_collection( ++ routes, reject_repeated_urls=True) ++ pagination_error = getattr(exceptions, 'PaginationLoop', None) ++ ++ assert pagination_error is not None, 'PaginationLoop must be public' ++ assert issubclass(pagination_error, exceptions.BigIPException) ++ with pytest.raises(pagination_error) as raised: ++ collection.get_collection() ++ assert first in str(raised.value) ++ assert session.counts[first] == 1 ++ ++ ++def test_codespec_organizing_collection_rejects_normalized_link_cycle(): ++ first = APPLIANCE + '/mgmt/tm/ltm/' ++ routes = { ++ first: { ++ 'items': [{'reference': 'first'}], ++ 'nextLink': 'https://localhost/mgmt/tm/ltm/', ++ }, ++ } ++ session = RoutedSession(routes, reject_repeated_urls=True) ++ collection = LTM(FakeBigIP(session)) ++ pagination_error = getattr(exceptions, 'PaginationLoop', None) ++ ++ assert pagination_error is not None, 'PaginationLoop must be public' ++ assert issubclass(pagination_error, exceptions.BigIPException) ++ with pytest.raises(pagination_error) as raised: ++ collection.get_collection() ++ assert first in str(raised.value) ++ assert session.counts[first] == 1 ++ ++ ++class LegacyBigIP(object): ++ def __init__(self, session): ++ self.icr_session = session ++ ++ ++class RecordingLegacyCollection(RESTInterfaceCollection): ++ def __init__(self, session, events, delete_results=None): ++ self.bigip = LegacyBigIP(session) ++ self.base_uri = APPLIANCE + '/mgmt/tm/ltm/pool/' ++ self.events = events ++ self.delete_results = delete_results or {} ++ ++ def delete(self, name=None, folder='Common', timeout=30): ++ self.events.append(('delete', name, folder, timeout)) ++ return self.delete_results.get(name, True) ++ ++ ++def test_codespec_delete_all_snapshots_pages_then_deletes_matches_in_order(): ++ events = [] ++ first = APPLIANCE + '/mgmt/tm/ltm/pool/' ++ second = APPLIANCE + '/mgmt/tm/ltm/pool/?$skip=2' ++ routes = { ++ first: { ++ 'items': [ ++ {'name': 'keep-one'}, ++ {'name': 'ignore-one'}, ++ ], ++ 'nextLink': 'https://localhost/mgmt/tm/ltm/pool/?$skip=2', ++ }, ++ second: { ++ 'items': [ ++ {'name': 'keep-two'}, ++ {'name': 'ignore-two'}, ++ ], ++ }, ++ } ++ session = RoutedSession(routes, events=events) ++ collection = RecordingLegacyCollection(session, events) ++ ++ assert collection.delete_all( ++ folder='Tenant', startswith='keep-', timeout=17) is True ++ assert events[:2][0][0:2] == ('get', first) ++ assert events[:2][1][0:2] == ('get', second) ++ assert events[2:] == [ ++ ('delete', 'keep-one', 'Tenant', 17), ++ ('delete', 'keep-two', 'Tenant', 17), ++ ] ++ assert events[0][3]['params'] == { ++ '$select': 'name,selfLink', ++ '$filter': 'partition eq Tenant', ++ } ++ assert events[0][3]['timeout'] == 17 ++ assert events[1][2] == () ++ assert events[1][3]['timeout'] == 17 ++ assert not events[1][3].get('params') ++ ++ ++def test_codespec_delete_all_stops_after_first_failed_delete(): ++ events = [] ++ first = APPLIANCE + '/mgmt/tm/ltm/pool/' ++ second = APPLIANCE + '/mgmt/tm/ltm/pool/?$skip=1' ++ routes = { ++ first: { ++ 'items': [{'name': 'keep-one'}], ++ 'nextLink': '/mgmt/tm/ltm/pool/?$skip=1', ++ }, ++ second: { ++ 'items': [{'name': 'keep-two'}, {'name': 'keep-three'}], ++ }, ++ } ++ session = RoutedSession(routes, events=events) ++ collection = RecordingLegacyCollection( ++ session, events, delete_results={'keep-two': False}) ++ ++ assert collection.delete_all(startswith='keep-') is False ++ assert [event[1] for event in events if event[0] == 'get'] == [ ++ first, second] ++ assert [event[1] for event in events if event[0] == 'delete'] == [ ++ 'keep-one', 'keep-two'] ++ ++ ++def test_codespec_delete_all_later_page_failure_prevents_deletion(): ++ events = [] ++ first = APPLIANCE + '/mgmt/tm/ltm/pool/' ++ second = APPLIANCE + '/mgmt/tm/ltm/pool/?$skip=1' ++ failure = LaterPageFailure('delete discovery failed') ++ routes = { ++ first: { ++ 'items': [{'name': 'keep-one'}], ++ 'nextLink': '/mgmt/tm/ltm/pool/?$skip=1', ++ }, ++ second: failure, ++ } ++ session = RoutedSession(routes, events=events) ++ collection = RecordingLegacyCollection(session, events) ++ ++ with pytest.raises(LaterPageFailure) as raised: ++ collection.delete_all(startswith='keep-') ++ assert raised.value is failure ++ assert [event for event in events if event[0] == 'delete'] == [] ++ ++ ++def test_codespec_delete_all_rejects_cycle_before_any_delete(): ++ events = [] ++ first = APPLIANCE + '/mgmt/tm/ltm/pool/' ++ routes = { ++ first: { ++ 'items': [{'name': 'keep-one'}], ++ 'nextLink': 'https://localhost/mgmt/tm/ltm/pool/', ++ }, ++ } ++ session = RoutedSession( ++ routes, events=events, reject_repeated_urls=True) ++ collection = RecordingLegacyCollection(session, events) ++ pagination_error = getattr(exceptions, 'PaginationLoop', None) ++ ++ assert pagination_error is not None, 'PaginationLoop must be public' ++ assert issubclass(pagination_error, exceptions.BigIPException) ++ with pytest.raises(pagination_error) as raised: ++ collection.delete_all(startswith='keep-') ++ assert first in str(raised.value) ++ assert [event for event in events if event[0] == 'delete'] == [] +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,10 @@ ++#!/bin/bash ++set -euo pipefail ++ ++ ++py.test -q \ ++ f5/bigip/test/test_collection_pagination_contract.py \ ++ f5/bigip/test/test_REST_interface_collections.py::test_delete_all \ ++ f5/bigip/test/test_REST_interface_collections.py::test_delete_all_startswith \ ++ f5/bigip/test/test_REST_interface_collections.py::test_delete_all_fail \ ++ f5/bigip/test/test_REST_interface_collections.py::test_delete_all_http_error diff --git a/tasks/format-code-task-000968/tests/test.sh b/tasks/format-code-task-000968/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..16b6f4751a2a87259ae699aff2343583f1e1944c --- /dev/null +++ b/tasks/format-code-task-000968/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +f5/bigip/test/test_collection_pagination_contract.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-000968/tests/test_command.sh b/tasks/format-code-task-000968/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-000968/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001010/environment/Dockerfile b/tasks/format-code-task-001010/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..183f055efcb9c6550b0b425f368a665934b6915c --- /dev/null +++ b/tasks/format-code-task-001010/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:49b7aecddfaa0f59219f814a71db340accf301eeab224df6df7261f2120d7ba9 diff --git a/tasks/format-code-task-001010/environment/setup/files/blocklist b/tasks/format-code-task-001010/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001010/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001010/environment/setup/setup.sh b/tasks/format-code-task-001010/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001010/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001010/tests/test.patch b/tasks/format-code-task-001010/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..0d066819d57651868089e5896604067c7f0be70e --- /dev/null +++ b/tasks/format-code-task-001010/tests/test.patch @@ -0,0 +1,170 @@ +diff --git a/tests/test_bgp_facts_contract.py b/tests/test_bgp_facts_contract.py +new file mode 100644 +index 000000000..88912a2aa +--- /dev/null ++++ b/tests/test_bgp_facts_contract.py +@@ -0,0 +1,155 @@ ++import importlib.util ++import re ++import sys ++import types ++import unittest ++ ++ ++FIXTURE = """\ ++BGP neighbor is 192.0.2.1, remote AS 65001, local AS 65000, external link ++ Description: v4-edge ++ BGP version 4, remote router ID 198.51.100.1 ++ BGP state = Established ++ Message statistics: ++ Sent Rcvd ++ Opens: 4 5 ++ Notifications: 1 2 ++ Updates: 30 40 ++ Keepalives: 50 60 ++ Route Refresh: 7 8 ++ Capability: 9 10 ++ Total: 101 125 ++ Minimum time between advertisement runs is 30 seconds ++ 0 accepted prefixes ++ Connections established 3; dropped 1 ++ ++BGP neighbor is 2001:db8::1, remote AS 65101, local AS 65000, external link ++ Description: v6-compressed ++ BGP version 4, remote router ID 203.0.113.1 ++ BGP state = Active ++ Message statistics: ++ Opens: 6 7 ++ Notifications: 0 1 ++ Updates: 8 9 ++ Keepalives: 10 11 ++ Route Refresh: 2 3 ++ Capability: 4 5 ++ Total: 30 36 ++ Minimum time between advertisement runs is 45 seconds ++ 12 accepted prefixes ++ Connections established 4; dropped 2 ++ ++BGP neighbor is 2001:0db8:0:0:0:0:0:2, remote AS 65102, local AS 65000, external link ++ Description: v6-expanded ++ BGP version 4, remote router ID 203.0.113.2 ++ BGP state = Idle ++ Message statistics: ++ Opens: 1 0 ++ Total: 1 0 ++ Minimum time between advertisement runs is 5 seconds ++ 0 accepted prefixes ++ Connections established 0; dropped 0 ++""" ++ ++ ++class _FakeAnsibleModule(object): ++ def __init__(self, *args, **kwargs): ++ self.result = None ++ ++ def run_command(self, command, **kwargs): ++ self.command = command ++ return 0, FIXTURE, "" ++ ++ def exit_json(self, **kwargs): ++ self.result = kwargs ++ ++ def fail_json(self, **kwargs): ++ raise AssertionError("module failed: %r" % (kwargs,)) ++ ++ ++def load_bgp_module(): ++ ++ ++ ansible_pkg = types.ModuleType("ansible") ++ module_utils_pkg = types.ModuleType("ansible.module_utils") ++ basic_mod = types.ModuleType("ansible.module_utils.basic") ++ basic_mod.AnsibleModule = _FakeAnsibleModule ++ basic_mod.re = re ++ sys.modules.update({ ++ "ansible": ansible_pkg, ++ "ansible.module_utils": module_utils_pkg, ++ "ansible.module_utils.basic": basic_mod, ++ }) ++ spec = importlib.util.spec_from_file_location( ++ "sonic_bgp_facts_contract", "ansible/library/bgp_facts.py" ++ ) ++ module = importlib.util.module_from_spec(spec) ++ spec.loader.exec_module(module) ++ return module ++ ++ ++class BgpFactsContractTests(unittest.TestCase): ++ @classmethod ++ def setUpClass(cls): ++ cls.bgp = load_bgp_module() ++ ++ def collect(self): ++ instance = self.bgp.BgpModule() ++ instance.run() ++ return instance.module.result["ansible_facts"]["bgp_neighbors"] ++ ++ def test_all_reported_address_families_are_distinct_neighbors(self): ++ neighbors = self.collect() ++ self.assertEqual( ++ set(neighbors), ++ {"192.0.2.1", "2001:db8::1", "2001:0db8:0:0:0:0:0:2"}, ++ ) ++ ++ def test_ipv6_neighbors_preserve_the_same_core_fields(self): ++ neighbors = self.collect() ++ expected = { ++ "2001:db8::1": (65101, "v6-compressed", "active", 45, 12, 4, 2, "203.0.113.1"), ++ "2001:0db8:0:0:0:0:0:2": (65102, "v6-expanded", "idle", 5, 0, 0, 0, "203.0.113.2"), ++ } ++ for address, values in expected.items(): ++ self.assertIn(address, neighbors) ++ neighbor = neighbors[address] ++ self.assertEqual(neighbor["remote AS"], values[0]) ++ self.assertEqual(neighbor["description"], values[1]) ++ self.assertEqual(neighbor["state"], values[2]) ++ self.assertEqual(neighbor["mrai"], values[3]) ++ self.assertEqual(neighbor["accepted prefixes"], values[4]) ++ self.assertEqual(neighbor["connections established"], values[5]) ++ self.assertEqual(neighbor["connections dropped"], values[6]) ++ self.assertEqual(neighbor["remote routerid"], values[7]) ++ self.assertEqual(neighbor["local AS"], 65000) ++ ++ def test_message_statistics_are_complete_integer_pairs_per_neighbor(self): ++ neighbors = self.collect() ++ self.assertIn("2001:db8::1", neighbors) ++ self.assertEqual(neighbors["2001:db8::1"].get("message statistics"), { ++ "Opens": {"sent": 6, "rcvd": 7}, ++ "Notifications": {"sent": 0, "rcvd": 1}, ++ "Updates": {"sent": 8, "rcvd": 9}, ++ "Keepalives": {"sent": 10, "rcvd": 11}, ++ "Route Refresh": {"sent": 2, "rcvd": 3}, ++ "Capability": {"sent": 4, "rcvd": 5}, ++ "Total": {"sent": 30, "rcvd": 36}, ++ }) ++ self.assertIn("2001:0db8:0:0:0:0:0:2", neighbors) ++ self.assertEqual(neighbors["2001:0db8:0:0:0:0:0:2"].get("message statistics", {}).get("Total"), ++ {"sent": 1, "rcvd": 0}) ++ ++ def test_existing_ipv4_record_remains_compatible(self): ++ neighbors = self.collect() ++ self.assertIn("192.0.2.1", neighbors) ++ neighbor = neighbors["192.0.2.1"] ++ self.assertEqual(neighbor["remote AS"], 65001) ++ self.assertEqual(neighbor["local AS"], 65000) ++ self.assertEqual(neighbor["description"], "v4-edge") ++ self.assertEqual(neighbor["state"], "established") ++ self.assertEqual(neighbor["message statistics"]["Total"], {"sent": 101, "rcvd": 125}) ++ ++ ++if __name__ == "__main__": ++ unittest.main() +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,4 @@ ++#!/bin/bash ++set -euo pipefail ++ ++PYTHONDONTWRITEBYTECODE=1 python tests/test_bgp_facts_contract.py diff --git a/tasks/format-code-task-001010/tests/test.sh b/tasks/format-code-task-001010/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..67281261984caa967aeea802e052c2a0f258ba9f --- /dev/null +++ b/tasks/format-code-task-001010/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/test_bgp_facts_contract.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001010/tests/test_command.sh b/tasks/format-code-task-001010/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001010/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001017/environment/Dockerfile b/tasks/format-code-task-001017/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..675fa97b61cb4eb7e92c301d2b5730e1e269a008 --- /dev/null +++ b/tasks/format-code-task-001017/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:093dcf302b2d071743ee8914c715b735994b0fe1f251bc52fa19ead4110f8dfb diff --git a/tasks/format-code-task-001017/environment/setup/files/blocklist b/tasks/format-code-task-001017/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001017/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001017/environment/setup/setup.sh b/tasks/format-code-task-001017/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001017/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001017/tests/test.patch b/tasks/format-code-task-001017/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..15d103dcfee93a0f911846ca3f3a59cf36176933 --- /dev/null +++ b/tasks/format-code-task-001017/tests/test.patch @@ -0,0 +1,137 @@ +diff --git a/tests/unit/plugins/modules/test_redis_tls_profile.py b/tests/unit/plugins/modules/test_redis_tls_profile.py +new file mode 100644 +index 000000000..28cf8b977 +--- /dev/null ++++ b/tests/unit/plugins/modules/test_redis_tls_profile.py +@@ -0,0 +1,114 @@ ++# -*- coding: utf-8 -*- ++ ++from __future__ import absolute_import, division, print_function ++ ++import pytest ++ ++from ansible.module_utils import basic ++from ansible_collections.community.general.plugins.module_utils import redis as redis_utils ++from ansible_collections.community.general.plugins.modules import redis_data_info, redis_info ++from ansible_collections.community.general.tests.unit.plugins.modules.utils import ( ++ AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args, ++) ++from ansible_collections.community.general.tests.unit.compat.mock import MagicMock, patch ++ ++ ++class _FakeRedis(MagicMock): ++ def ping(self): ++ return True ++ ++ def info(self): ++ return {'redis_version': '8.0.0'} ++ ++ def get(self, key): ++ return 'value' ++ ++ ++class TestRedisTlsProfileModules(ModuleTestCase): ++ def test_redis_info_forwards_complete_client_profile(self): ++ with patch('ansible_collections.community.general.plugins.modules.redis_info.redis_client', ++ side_effect=_FakeRedis) as client: ++ with self.assertRaises(AnsibleExitJson): ++ set_module_args({ ++ 'tls': True, ++ 'ca_certs': '/etc/ssl/ca.pem', ++ 'client_cert_file': '/etc/redis/client.crt', ++ 'client_key_file': '/etc/redis/client.key', ++ 'client_key_password': 'secret', ++ }) ++ redis_info.main() ++ kwargs = client.call_args.kwargs ++ self.assertEqual(kwargs['ssl'], True) ++ self.assertEqual(kwargs['ssl_ca_certs'], '/etc/ssl/ca.pem') ++ self.assertEqual(kwargs['ssl_certfile'], '/etc/redis/client.crt') ++ self.assertEqual(kwargs['ssl_keyfile'], '/etc/redis/client.key') ++ self.assertEqual(kwargs['ssl_password'], 'secret') ++ ++ def test_redis_data_info_forwards_profile_without_optional_password(self): ++ with patch('ansible_collections.community.general.plugins.module_utils.redis.Redis', ++ side_effect=_FakeRedis) as client: ++ with self.assertRaises(AnsibleExitJson): ++ set_module_args({ ++ 'key': 'answer', ++ 'tls': True, ++ 'client_cert_file': '/etc/redis/client.crt', ++ 'client_key_file': '/etc/redis/client.key', ++ }) ++ redis_data_info.main() ++ kwargs = client.call_args.kwargs ++ self.assertEqual(kwargs['ssl_certfile'], '/etc/redis/client.crt') ++ self.assertEqual(kwargs['ssl_keyfile'], '/etc/redis/client.key') ++ self.assertNotIn('ssl_password', kwargs) ++ ++ def test_tls_defaults_and_ca_fallback_are_preserved(self): ++ with patch('ansible_collections.community.general.plugins.modules.redis_info.redis_client', ++ side_effect=_FakeRedis) as info_client: ++ with self.assertRaises(AnsibleExitJson): ++ set_module_args({}) ++ redis_info.main() ++ info_kwargs = info_client.call_args.kwargs ++ self.assertEqual(info_kwargs['ssl'], False) ++ self.assertIsNone(info_kwargs['ssl_ca_certs']) ++ self.assertNotIn('ssl_certfile', info_kwargs) ++ ++ with patch('ansible_collections.community.general.plugins.module_utils.redis.Redis', ++ side_effect=_FakeRedis) as data_client: ++ with self.assertRaises(AnsibleExitJson): ++ set_module_args({'key': 'answer'}) ++ redis_data_info.main() ++ self.assertEqual(data_client.call_args.kwargs['ssl'], True) ++ self.assertEqual(data_client.call_args.kwargs['ssl_ca_certs'], redis_utils.certifi.where()) ++ ++ def test_legacy_password_and_username_are_unchanged(self): ++ with patch('ansible_collections.community.general.plugins.modules.redis_info.redis_client', ++ side_effect=_FakeRedis) as client: ++ with self.assertRaises(AnsibleExitJson): ++ set_module_args({ ++ 'login_user': 'app', ++ 'login_password': 'pw', ++ 'tls': False, ++ }) ++ redis_info.main() ++ kwargs = client.call_args.kwargs ++ self.assertEqual(kwargs['username'], 'app') ++ self.assertEqual(kwargs['password'], 'pw') ++ self.assertEqual(kwargs['ssl'], False) ++ ++ ++@pytest.mark.parametrize('args, expected_names', [ ++ ({'client_cert_file': '/tmp/client.crt'}, ('client_cert_file', 'client_key_file')), ++ ({'client_key_file': '/tmp/client.key'}, ('client_cert_file', 'client_key_file')), ++ ({'client_key_password': 'secret'}, ('client_key_password', 'client_key_file')), ++ ({'tls': False, 'client_cert_file': '/tmp/client.crt', 'client_key_file': '/tmp/client.key'}, ++ ('tls', 'client_cert_file')), ++]) ++def test_inconsistent_client_profile_is_rejected_by_module(args, expected_names): ++ def fail_json(module, **kwargs): ++ raise AnsibleFailJson(kwargs) ++ ++ with patch.object(basic.AnsibleModule, 'fail_json', new=fail_json): ++ set_module_args(args) ++ with pytest.raises(AnsibleFailJson) as result: ++ redis_info.main() ++ message = result.value.args[0]['msg'] ++ assert all(name in message for name in expected_names) +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,12 @@ ++#!/bin/bash ++set -euo pipefail ++ ++ ++COLLECTION_ROOT="$(mktemp -d)" ++trap 'unlink "${COLLECTION_ROOT}/ansible_collections/community/general" 2>/dev/null || true; rmdir "${COLLECTION_ROOT}/ansible_collections/community" "${COLLECTION_ROOT}/ansible_collections" "${COLLECTION_ROOT}" 2>/dev/null || true' EXIT ++mkdir -p "${COLLECTION_ROOT}/ansible_collections/community" ++ln -s "${PWD}" "${COLLECTION_ROOT}/ansible_collections/community/general" ++PYTHONPATH="${COLLECTION_ROOT}${PYTHONPATH:+:${PYTHONPATH}}" \ ++ .build_env/venv/bin/python -m pytest -q \ ++ tests/unit/plugins/modules/test_redis_tls_profile.py \ ++ tests/unit/plugins/modules/test_redis_info.py diff --git a/tasks/format-code-task-001017/tests/test.sh b/tasks/format-code-task-001017/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..3aae5bf32a0db76d6cc0ae1a93066c76c36af266 --- /dev/null +++ b/tasks/format-code-task-001017/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/unit/plugins/modules/test_redis_tls_profile.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001017/tests/test_command.sh b/tasks/format-code-task-001017/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001017/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001019/environment/Dockerfile b/tasks/format-code-task-001019/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..4285c446d27a59e284b68977a8860c578f70d9cb --- /dev/null +++ b/tasks/format-code-task-001019/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:4a800273a1197650af9be84beba01305bd7af9d987212750e15539718e9608e9 diff --git a/tasks/format-code-task-001019/environment/setup/files/blocklist b/tasks/format-code-task-001019/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001019/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001019/environment/setup/setup.sh b/tasks/format-code-task-001019/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001019/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001019/tests/test.patch b/tasks/format-code-task-001019/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..6022ef555c41ad343b70866658af3733ea456f11 --- /dev/null +++ b/tasks/format-code-task-001019/tests/test.patch @@ -0,0 +1,267 @@ +diff --git a/ckan/tests/cli/test_recursive_config_loader_codespec.py b/ckan/tests/cli/test_recursive_config_loader_codespec.py +new file mode 100644 +index 0000000000..67b5789256 +--- /dev/null ++++ b/ckan/tests/cli/test_recursive_config_loader_codespec.py +@@ -0,0 +1,247 @@ ++# -*- coding: utf-8 -*- ++ ++import os ++import textwrap ++ ++import pytest ++ ++from ckan.cli import CKANConfigLoader ++from ckan.exceptions import CkanConfigurationException ++ ++ ++def _write_config(path, content): ++ path.parent.mkdir(parents=True, exist_ok=True) ++ path.write_text(textwrap.dedent(content).strip() + "\n") ++ return path ++ ++ ++@pytest.fixture ++def codespec_three_level_config(tmp_path): ++ base = _write_config( ++ tmp_path / "base" / "base.ini", ++ """ ++ [DEFAULT] ++ precedence_default = base-default ++ base_default = %(here)s/base-default ++ ++ [app:main] ++ use = egg:ckan ++ precedence_app = base-app ++ base_marker = base ++ base_only = %(here)s/base-app ++ """, ++ ) ++ middle = _write_config( ++ tmp_path / "middle" / "middle.ini", ++ """ ++ [DEFAULT] ++ precedence_default = middle-default ++ middle_default = %(here)s/middle-default ++ ++ [app:main] ++ use = config:../base/base.ini ++ precedence_app = middle-app ++ middle_marker = middle ++ middle_only = %(here)s/middle-app ++ """, ++ ) ++ leaf = _write_config( ++ tmp_path / "leaf.ini", ++ """ ++ [DEFAULT] ++ precedence_default = leaf-default ++ leaf_default = %(here)s/leaf-default ++ ++ [app:main] ++ use = config:middle/middle.ini ++ precedence_app = leaf-app ++ leaf_marker = leaf ++ leaf_only = %(here)s/leaf-app ++ """, ++ ) ++ ++ return CKANConfigLoader(str(leaf)).get_config(), leaf, middle, base ++ ++ ++def test_codespec_three_level_chain_and_relative_references( ++ codespec_three_level_config, ++): ++ config, _leaf, _middle, _base = codespec_three_level_config ++ ++ assert config["leaf_marker"] == "leaf" ++ assert config["middle_marker"] == "middle" ++ assert config["base_marker"] == "base" ++ ++ ++def test_codespec_application_values_use_child_precedence( ++ codespec_three_level_config, ++): ++ config, _leaf, _middle, _base = codespec_three_level_config ++ ++ assert config["precedence_app"] == "leaf-app" ++ ++ ++def test_codespec_each_file_has_its_own_here_interpolation( ++ codespec_three_level_config, ++): ++ config, leaf, middle, base = codespec_three_level_config ++ ++ assert config["leaf_only"] == os.path.join(str(leaf.parent), "leaf-app") ++ assert config["middle_only"] == os.path.join(str(middle.parent), "middle-app") ++ assert config["base_only"] == os.path.join(str(base.parent), "base-app") ++ ++ ++def test_codespec_defaults_accumulate_with_declaring_file_interpolation( ++ codespec_three_level_config, ++): ++ config, leaf, middle, base = codespec_three_level_config ++ ++ assert config["leaf_default"] == os.path.join(str(leaf.parent), "leaf-default") ++ assert config["middle_default"] == os.path.join( ++ str(middle.parent), "middle-default" ++ ) ++ assert config["base_default"] == os.path.join(str(base.parent), "base-default") ++ ++ global_conf = config["global_conf"] ++ assert global_conf["leaf_default"] == config["leaf_default"] ++ assert global_conf["middle_default"] == config["middle_default"] ++ assert global_conf["base_default"] == config["base_default"] ++ ++ ++def test_codespec_default_conflicts_use_farthest_ancestor( ++ codespec_three_level_config, ++): ++ config, _leaf, _middle, _base = codespec_three_level_config ++ ++ assert config["precedence_default"] == "base-default" ++ assert config["global_conf"]["precedence_default"] == "base-default" ++ ++ ++def test_codespec_root_and_terminal_metadata(codespec_three_level_config): ++ config, leaf, _middle, base = codespec_three_level_config ++ global_conf = config["global_conf"] ++ ++ assert global_conf["here"] == str(base.parent) ++ assert global_conf["__file__"] == str(leaf.resolve()) ++ assert config["__file__"] == str(leaf.resolve()) ++ ++ ++def test_codespec_absolute_parent_reference_is_supported(tmp_path): ++ base = _write_config( ++ tmp_path / "elsewhere" / "base.ini", ++ """ ++ [app:main] ++ use = egg:ckan ++ inherited = yes ++ """, ++ ) ++ leaf = _write_config( ++ tmp_path / "leaf.ini", ++ """ ++ [app:main] ++ use = config:{} ++ local = yes ++ """.format(base), ++ ) ++ ++ config = CKANConfigLoader(str(leaf)).get_config() ++ ++ assert config["local"] == "yes" ++ assert config["inherited"] == "yes" ++ ++ ++def test_codespec_missing_nested_parent_reports_both_paths(tmp_path): ++ missing = tmp_path / "base" / "missing.ini" ++ middle = _write_config( ++ tmp_path / "middle" / "middle.ini", ++ """ ++ [app:main] ++ use = config:../base/missing.ini ++ middle = yes ++ """, ++ ) ++ leaf = _write_config( ++ tmp_path / "leaf.ini", ++ """ ++ [app:main] ++ use = config:middle/middle.ini ++ leaf = yes ++ """, ++ ) ++ ++ with pytest.raises(CkanConfigurationException) as error: ++ CKANConfigLoader(str(leaf)) ++ ++ message = str(error.value).lower() ++ assert "not found" in message ++ assert str(middle.resolve()) in str(error.value) ++ assert str(missing.resolve()) in str(error.value) ++ ++ ++def test_codespec_empty_parent_reference_is_rejected(tmp_path): ++ leaf = _write_config( ++ tmp_path / "leaf.ini", ++ """ ++ [app:main] ++ use = config: ++ local = yes ++ """, ++ ) ++ ++ with pytest.raises(CkanConfigurationException) as error: ++ CKANConfigLoader(str(leaf)) ++ ++ message = str(error.value).lower() ++ assert "config" in message ++ assert "empty" in message ++ assert str(leaf.resolve()) in str(error.value) ++ ++ ++def test_codespec_direct_cycle_reports_the_chain(tmp_path): ++ leaf = _write_config( ++ tmp_path / "leaf.ini", ++ """ ++ [app:main] ++ use = config:leaf.ini ++ """, ++ ) ++ ++ with pytest.raises(CkanConfigurationException) as error: ++ CKANConfigLoader(str(leaf)) ++ ++ message = str(error.value).lower() ++ assert "circular" in message ++ assert str(leaf.resolve()) in str(error.value) ++ ++ ++def test_codespec_indirect_cycle_reports_every_file(tmp_path): ++ first = _write_config( ++ tmp_path / "first.ini", ++ """ ++ [app:main] ++ use = config:second.ini ++ """, ++ ) ++ second = _write_config( ++ tmp_path / "second.ini", ++ """ ++ [app:main] ++ use = config:nested/third.ini ++ """, ++ ) ++ third = _write_config( ++ tmp_path / "nested" / "third.ini", ++ """ ++ [app:main] ++ use = config:../first.ini ++ """, ++ ) ++ ++ with pytest.raises(CkanConfigurationException) as error: ++ CKANConfigLoader(str(first)) ++ ++ message = str(error.value).lower() ++ assert "circular" in message ++ assert str(first.resolve()) in str(error.value) ++ assert str(second.resolve()) in str(error.value) ++ assert str(third.resolve()) in str(error.value) +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,9 @@ ++#!/bin/bash ++set -euo pipefail ++ ++ ++pytest -q --confcutdir=ckan/tests \ ++ ckan/tests/cli/test_recursive_config_loader_codespec.py \ ++ ckan/tests/cli/test_cli.py::test_ckan_config_loader_parse_file \ ++ ckan/tests/cli/test_cli.py::test_ckan_config_loader_parse_two_files \ ++ --disable-warnings diff --git a/tasks/format-code-task-001019/tests/test.sh b/tasks/format-code-task-001019/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..eea8e306f35c714a0fc146a5f84d71069bd2b983 --- /dev/null +++ b/tasks/format-code-task-001019/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +ckan/tests/cli/test_recursive_config_loader_codespec.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001019/tests/test_command.sh b/tasks/format-code-task-001019/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001019/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001021/environment/Dockerfile b/tasks/format-code-task-001021/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..29f5b6ede722a743e3a102f226e56743f7356794 --- /dev/null +++ b/tasks/format-code-task-001021/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:6e01078e4f0c13769f19cdfd9067c008bb7e392d8b930daaaad232f56eaf8f4b diff --git a/tasks/format-code-task-001021/environment/setup/files/blocklist b/tasks/format-code-task-001021/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001021/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001021/environment/setup/setup.sh b/tasks/format-code-task-001021/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001021/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001021/tests/test.patch b/tasks/format-code-task-001021/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..7bf8cae646d32416e1be675fc637116302f9f75d --- /dev/null +++ b/tasks/format-code-task-001021/tests/test.patch @@ -0,0 +1,379 @@ +diff --git a/artemis/modules/utils/wappalyzer/codespec_batch_cli_test.go b/artemis/modules/utils/wappalyzer/codespec_batch_cli_test.go +new file mode 100644 +index 00000000..e1c74119 +--- /dev/null ++++ b/artemis/modules/utils/wappalyzer/codespec_batch_cli_test.go +@@ -0,0 +1,362 @@ ++package main_test ++ ++import ( ++ "encoding/json" ++ "fmt" ++ "net/http" ++ "net/http/httptest" ++ "os" ++ "os/exec" ++ "path/filepath" ++ "strconv" ++ "strings" ++ "sync/atomic" ++ "testing" ++) ++ ++func buildCodespecScanner(t *testing.T) string { ++ t.Helper() ++ binary := filepath.Join(t.TempDir(), "wappalyzer-codespec") ++ command := exec.Command("go", "build", "-o", binary, ".") ++ output, err := command.CombinedOutput() ++ if err != nil { ++ t.Fatalf("build scanner: %v\n%s", err, output) ++ } ++ return binary ++} ++ ++func writeCodespecTargets(t *testing.T, contents string) string { ++ t.Helper() ++ path := filepath.Join(t.TempDir(), "targets.txt") ++ if err := os.WriteFile(path, []byte(contents), 0o600); err != nil { ++ t.Fatal(err) ++ } ++ return path ++} ++ ++func runCodespecScanner(t *testing.T, binary string, args ...string) ([]byte, []byte, error) { ++ t.Helper() ++ command := exec.Command(binary, args...) ++ var stdout strings.Builder ++ var stderr strings.Builder ++ command.Stdout = &stdout ++ command.Stderr = &stderr ++ err := command.Run() ++ return []byte(stdout.String()), []byte(stderr.String()), err ++} ++ ++func decodeCodespecResults(t *testing.T, output []byte) map[string][]string { ++ t.Helper() ++ var results map[string][]string ++ if err := json.Unmarshal(output, &results); err != nil { ++ t.Fatalf("stdout is not one JSON result object: %v\nstdout: %s", err, output) ++ } ++ return results ++} ++ ++func containsCodespecTechnology(technologies []string, name string) bool { ++ for _, technology := range technologies { ++ if technology == name || strings.HasPrefix(technology, name+":") { ++ return true ++ } ++ } ++ return false ++} ++ ++func technologyCodespecServer(t *testing.T, status int, hits *atomic.Int32) *httptest.Server { ++ t.Helper() ++ return httptest.NewServer(http.HandlerFunc(func(response http.ResponseWriter, request *http.Request) { ++ if hits != nil { ++ hits.Add(1) ++ } ++ response.Header().Set("Server", "nginx/1.25.4") ++ response.Header().Set("X-Powered-By", "PHP/8.2.12") ++ response.WriteHeader(status) ++ _, _ = response.Write([]byte(``)) ++ })) ++} ++ ++func TestCodespecInputNormalizationAndFetchOnce(t *testing.T) { ++ binary := buildCodespecScanner(t) ++ var hits atomic.Int32 ++ server := technologyCodespecServer(t, http.StatusOK, &hits) ++ defer server.Close() ++ ++ first := server.URL + "/first" ++ second := server.URL + "/second#section" ++ input := fmt.Sprintf(" # %s/commented-out\n\n %s \n%s\n\t%s\t\n", server.URL, first, second, first) ++ stdout, stderr, err := runCodespecScanner(t, binary, writeCodespecTargets(t, input)) ++ if err != nil { ++ t.Fatalf("scanner failed: %v\nstderr: %s", err, stderr) ++ } ++ results := decodeCodespecResults(t, stdout) ++ ++ if hits.Load() != 2 { ++ t.Fatalf("expected one fetch per unique normalized target, got %d", hits.Load()) ++ } ++ if len(results) != 2 { ++ t.Fatalf("expected exactly two target keys, got %#v", results) ++ } ++ if _, ok := results[first]; !ok { ++ t.Errorf("missing normalized first target %q in %#v", first, results) ++ } ++ if _, ok := results[second]; !ok { ++ t.Errorf("missing original target including fragment %q in %#v", second, results) ++ } ++} ++ ++func TestCodespecMixedSuccessFailureContinuesBatch(t *testing.T) { ++ binary := buildCodespecScanner(t) ++ server := technologyCodespecServer(t, http.StatusOK, nil) ++ defer server.Close() ++ ++ invalid := "codespec target without a scheme" ++ stdout, stderr, err := runCodespecScanner( ++ t, ++ binary, ++ writeCodespecTargets(t, server.URL+"\n"+invalid+"\n"), ++ ) ++ if err != nil { ++ t.Fatalf("a target-level failure aborted the batch: %v\nstderr: %s", err, stderr) ++ } ++ results := decodeCodespecResults(t, stdout) ++ ++ if technologies, ok := results[invalid]; !ok || technologies == nil || len(technologies) != 0 { ++ t.Errorf("failed target must be present with a non-null empty list, got %#v", results[invalid]) ++ } ++ technologies, ok := results[server.URL] ++ if !ok || len(technologies) < 2 { ++ t.Fatalf("successful target was not fingerprinted: %#v", results) ++ } ++ if !strings.Contains(string(stderr), invalid) { ++ t.Errorf("failure diagnostic does not identify %q: %s", invalid, stderr) ++ } ++} ++ ++func writeCodespecIncompleteResponse(response http.ResponseWriter, header string) { ++ hijacker := response.(http.Hijacker) ++ connection, buffer, err := hijacker.Hijack() ++ if err != nil { ++ return ++ } ++ defer connection.Close() ++ _, _ = buffer.WriteString("HTTP/1.1 200 OK\r\n" + header + "\r\nContent-Length: 4096\r\n\r\npartial") ++ _ = buffer.Flush() ++} ++ ++func TestCodespecRequestFailureRetriesOnce(t *testing.T) { ++ binary := buildCodespecScanner(t) ++ var hits atomic.Int32 ++ server := httptest.NewServer(http.HandlerFunc(func(response http.ResponseWriter, request *http.Request) { ++ if hits.Add(1) == 1 { ++ connection, _, err := response.(http.Hijacker).Hijack() ++ if err == nil { ++ _ = connection.Close() ++ } ++ return ++ } ++ response.Header().Set("X-Powered-By", "PHP/8.2.12") ++ _, _ = response.Write([]byte("complete")) ++ })) ++ defer server.Close() ++ ++ stdout, stderr, err := runCodespecScanner(t, binary, writeCodespecTargets(t, server.URL+"\n")) ++ if err != nil { ++ t.Fatalf("request failure aborted the batch: %v\nstderr: %s", err, stderr) ++ } ++ results := decodeCodespecResults(t, stdout) ++ if hits.Load() != 2 { ++ t.Fatalf("expected one retry after request failure, got %d requests", hits.Load()) ++ } ++ if !containsCodespecTechnology(results[server.URL], "PHP") { ++ t.Fatalf("retry response was not fingerprinted: %#v", results) ++ } ++ if len(stderr) != 0 { ++ t.Errorf("recovered request failure produced a diagnostic: %s", stderr) ++ } ++} ++ ++func TestCodespecResponseReadFailureRetriesAndDiscardsPartialData(t *testing.T) { ++ binary := buildCodespecScanner(t) ++ var hits atomic.Int32 ++ server := httptest.NewServer(http.HandlerFunc(func(response http.ResponseWriter, request *http.Request) { ++ if hits.Add(1) == 1 { ++ writeCodespecIncompleteResponse(response, "Server: nginx/1.25.4") ++ return ++ } ++ response.Header().Set("X-Powered-By", "PHP/8.2.12") ++ _, _ = response.Write([]byte("complete")) ++ })) ++ defer server.Close() ++ ++ stdout, stderr, err := runCodespecScanner(t, binary, writeCodespecTargets(t, server.URL+"\n")) ++ if err != nil { ++ t.Fatalf("response read failure aborted the batch: %v\nstderr: %s", err, stderr) ++ } ++ results := decodeCodespecResults(t, stdout) ++ if hits.Load() != 2 { ++ t.Fatalf("expected one retry after the incomplete response, got %d requests", hits.Load()) ++ } ++ if !containsCodespecTechnology(results[server.URL], "PHP") { ++ t.Fatalf("retry response was not fingerprinted: %#v", results) ++ } ++ if containsCodespecTechnology(results[server.URL], "Nginx") { ++ t.Fatalf("partial first response leaked into the result: %#v", results) ++ } ++ if len(stderr) != 0 { ++ t.Errorf("recovered failure produced a diagnostic: %s", stderr) ++ } ++} ++ ++func TestCodespecExhaustedResponseFailureIsExplicit(t *testing.T) { ++ binary := buildCodespecScanner(t) ++ var hits atomic.Int32 ++ server := httptest.NewServer(http.HandlerFunc(func(response http.ResponseWriter, request *http.Request) { ++ hits.Add(1) ++ writeCodespecIncompleteResponse(response, "Server: nginx/1.25.4") ++ })) ++ defer server.Close() ++ ++ stdout, stderr, err := runCodespecScanner(t, binary, writeCodespecTargets(t, server.URL+"\n")) ++ if err != nil { ++ t.Fatalf("exhausted target failure aborted the batch: %v\nstderr: %s", err, stderr) ++ } ++ results := decodeCodespecResults(t, stdout) ++ if hits.Load() != 2 { ++ t.Fatalf("expected exactly two attempts, got %d", hits.Load()) ++ } ++ if technologies, ok := results[server.URL]; !ok || technologies == nil || len(technologies) != 0 { ++ t.Errorf("exhausted response failure must produce an explicit empty result, got %#v", results) ++ } ++ if !strings.Contains(string(stderr), server.URL) { ++ t.Errorf("response failure diagnostic does not identify target: %s", stderr) ++ } ++} ++ ++func TestCodespecNon2xxResponseRemainsFingerprintable(t *testing.T) { ++ binary := buildCodespecScanner(t) ++ var hits atomic.Int32 ++ server := technologyCodespecServer(t, http.StatusServiceUnavailable, &hits) ++ defer server.Close() ++ ++ stdout, stderr, err := runCodespecScanner(t, binary, writeCodespecTargets(t, server.URL+"\n")) ++ if err != nil { ++ t.Fatalf("scanner failed on an HTTP response: %v\nstderr: %s", err, stderr) ++ } ++ results := decodeCodespecResults(t, stdout) ++ if !containsCodespecTechnology(results[server.URL], "Nginx") { ++ t.Fatalf("503 response headers were not fingerprinted: %#v", results[server.URL]) ++ } ++ if hits.Load() != 1 { ++ t.Fatalf("received HTTP status was retried, got %d requests", hits.Load()) ++ } ++} ++ ++func TestCodespecResponseBodyAnalysisIsLimitedToOneMiB(t *testing.T) { ++ binary := buildCodespecScanner(t) ++ marker := `` ++ filler := strings.Repeat(" ", 1024*1024+128) ++ server := httptest.NewServer(http.HandlerFunc(func(response http.ResponseWriter, request *http.Request) { ++ if request.URL.Path == "/early" { ++ _, _ = response.Write([]byte(marker + filler)) ++ return ++ } ++ _, _ = response.Write([]byte(filler + marker)) ++ })) ++ defer server.Close() ++ ++ early := server.URL + "/early" ++ late := server.URL + "/late" ++ stdout, stderr, err := runCodespecScanner(t, binary, writeCodespecTargets(t, early+"\n"+late+"\n")) ++ if err != nil { ++ t.Fatalf("oversized response aborted the batch: %v\nstderr: %s", err, stderr) ++ } ++ results := decodeCodespecResults(t, stdout) ++ if !containsCodespecTechnology(results[early], "WordPress") { ++ t.Fatalf("technology inside the analysis prefix was lost: %#v", results[early]) ++ } ++ if containsCodespecTechnology(results[late], "WordPress") { ++ t.Fatalf("technology beyond the 1 MiB analysis prefix was used: %#v", results[late]) ++ } ++} ++ ++func TestCodespecRedirectLimitAndOriginalResultKey(t *testing.T) { ++ binary := buildCodespecScanner(t) ++ server := httptest.NewServer(http.HandlerFunc(func(response http.ResponseWriter, request *http.Request) { ++ step, err := strconv.Atoi(strings.TrimPrefix(request.URL.Path, "/")) ++ if err != nil { ++ http.Error(response, "bad test path", http.StatusBadRequest) ++ return ++ } ++ if step < 6 { ++ http.Redirect(response, request, fmt.Sprintf("/%d", step+1), http.StatusFound) ++ return ++ } ++ response.Header().Set("Server", "nginx/1.25.4") ++ _, _ = response.Write([]byte("final")) ++ })) ++ defer server.Close() ++ ++ fiveRedirects := server.URL + "/1" ++ sixRedirects := server.URL + "/0" ++ stdout, stderr, err := runCodespecScanner( ++ t, ++ binary, ++ writeCodespecTargets(t, fiveRedirects+"\n"+sixRedirects+"\n"), ++ ) ++ if err != nil { ++ t.Fatalf("redirect target failure aborted the batch: %v\nstderr: %s", err, stderr) ++ } ++ results := decodeCodespecResults(t, stdout) ++ if !containsCodespecTechnology(results[fiveRedirects], "Nginx") { ++ t.Fatalf("five-redirect response was not fingerprinted under its input key: %#v", results) ++ } ++ if technologies, ok := results[sixRedirects]; !ok || technologies == nil || len(technologies) != 0 { ++ t.Fatalf("six-redirect target must be an explicit failure: %#v", results) ++ } ++ if _, finalURLWasUsed := results[server.URL+"/6"]; finalURLWasUsed { ++ t.Fatalf("redirect destination was used as a result key: %#v", results) ++ } ++ if !strings.Contains(string(stderr), sixRedirects) { ++ t.Errorf("redirect-limit diagnostic does not identify target: %s", stderr) ++ } ++} ++ ++func TestCodespecSuccessfulRunKeepsStderrClean(t *testing.T) { ++ binary := buildCodespecScanner(t) ++ server := technologyCodespecServer(t, http.StatusOK, nil) ++ defer server.Close() ++ ++ stdout, stderr, err := runCodespecScanner(t, binary, writeCodespecTargets(t, server.URL+"\n")) ++ if err != nil { ++ t.Fatalf("scanner failed: %v\nstderr: %s", err, stderr) ++ } ++ decodeCodespecResults(t, stdout) ++ if len(stderr) != 0 { ++ t.Errorf("successful run wrote diagnostics to stderr: %s", stderr) ++ } ++} ++ ++func TestCodespecInvalidInvocationFailsBeforeScanning(t *testing.T) { ++ binary := buildCodespecScanner(t) ++ var hits atomic.Int32 ++ server := technologyCodespecServer(t, http.StatusOK, &hits) ++ defer server.Close() ++ targets := writeCodespecTargets(t, server.URL+"\n") ++ ++ for name, args := range map[string][]string{ ++ "missing path": nil, ++ "extra argument": {targets, "unexpected"}, ++ "directory path": {t.TempDir()}, ++ } { ++ t.Run(name, func(t *testing.T) { ++ stdout, _, err := runCodespecScanner(t, binary, args...) ++ if err == nil { ++ t.Fatalf("invalid invocation succeeded; stdout: %s", stdout) ++ } ++ }) ++ } ++ if hits.Load() != 0 { ++ t.Fatalf("invalid invocation triggered %d HTTP requests", hits.Load()) ++ } ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/bin/bash ++set -euo pipefail ++ ++ ++cd artemis/modules/utils/wappalyzer ++go test -count=1 -run '^TestCodespec' . diff --git a/tasks/format-code-task-001021/tests/test.sh b/tasks/format-code-task-001021/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..382b21a809fb91161cf92077e3131895a0d6715e --- /dev/null +++ b/tasks/format-code-task-001021/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +artemis/modules/utils/wappalyzer/codespec_batch_cli_test.go +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001021/tests/test_command.sh b/tasks/format-code-task-001021/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001021/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001028/environment/Dockerfile b/tasks/format-code-task-001028/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..9b866b27389e62dcdb748a47337c49e4c0610e1b --- /dev/null +++ b/tasks/format-code-task-001028/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:69a7d749439f3411eea9e91c9cf5e8f22332b2be77c4caedb403fe82087aecd9 diff --git a/tasks/format-code-task-001028/environment/setup/files/blocklist b/tasks/format-code-task-001028/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001028/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001028/environment/setup/setup.sh b/tasks/format-code-task-001028/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001028/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001028/tests/test.patch b/tasks/format-code-task-001028/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..98f82a5eb23a156491e0525e0a98ef76cde8bba4 --- /dev/null +++ b/tasks/format-code-task-001028/tests/test.patch @@ -0,0 +1,234 @@ +diff --git a/common/src/test/java/org/apache/rocketmq/common/message/MessageDecoderValidationContractTest.java b/common/src/test/java/org/apache/rocketmq/common/message/MessageDecoderValidationContractTest.java +new file mode 100644 +index 000000000..4758ea833 +--- /dev/null ++++ b/common/src/test/java/org/apache/rocketmq/common/message/MessageDecoderValidationContractTest.java +@@ -0,0 +1,208 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++package org.apache.rocketmq.common.message; ++ ++import java.nio.ByteBuffer; ++import java.util.Arrays; ++import java.util.List; ++import org.junit.Assert; ++import org.junit.Test; ++ ++public class MessageDecoderValidationContractTest { ++ @Test ++ public void validFramesDecodeAndCountWithoutChangingTheWireOrder() throws Exception { ++ Message first = new Message("topic", "one".getBytes()); ++ first.setFlag(7); ++ first.putUserProperty("kind", "first"); ++ Message second = new Message("topic", "two".getBytes()); ++ second.setFlag(9); ++ second.putUserProperty("kind", "second"); ++ ++ byte[] encoded = MessageDecoder.encodeMessages(Arrays.asList(first, second)); ++ ByteBuffer decodedBuffer = bufferAtOffset(encoded); ++ List decoded = MessageDecoder.decodeMessages(decodedBuffer); ++ ++ Assert.assertEquals(2, decoded.size()); ++ Assert.assertEquals(3 + encoded.length, decodedBuffer.position()); ++ Assert.assertEquals(7, decoded.get(0).getFlag()); ++ Assert.assertArrayEquals("one".getBytes(), decoded.get(0).getBody()); ++ Assert.assertEquals("first", decoded.get(0).getProperty("kind")); ++ Assert.assertEquals(9, decoded.get(1).getFlag()); ++ Assert.assertArrayEquals("two".getBytes(), decoded.get(1).getBody()); ++ Assert.assertEquals("second", decoded.get(1).getProperty("kind")); ++ ++ ByteBuffer countBuffer = bufferAtOffset(encoded); ++ Assert.assertEquals(2, MessageDecoder.countInnerMsgNum(countBuffer)); ++ Assert.assertEquals(3 + encoded.length, countBuffer.position()); ++ } ++ ++ @Test ++ public void singleFrameDecodeStopsAtItsDeclaredBoundary() throws Exception { ++ Message first = new Message("topic", "first".getBytes()); ++ Message second = new Message("topic", "second".getBytes()); ++ byte[] firstBytes = MessageDecoder.encodeMessage(first); ++ byte[] encoded = MessageDecoder.encodeMessages(Arrays.asList(first, second)); ++ ByteBuffer buffer = bufferAtOffset(encoded); ++ ++ Message decoded = MessageDecoder.decodeMessage(buffer); ++ ++ Assert.assertArrayEquals("first".getBytes(), decoded.getBody()); ++ Assert.assertEquals(3 + firstBytes.length, buffer.position()); ++ Assert.assertTrue(buffer.hasRemaining()); ++ } ++ ++ @Test ++ public void emptyBatchOperationsRemainSupported() throws Exception { ++ ByteBuffer decodeBuffer = bufferAtOffset(new byte[0]); ++ Assert.assertTrue(MessageDecoder.decodeMessages(decodeBuffer).isEmpty()); ++ Assert.assertEquals(3, decodeBuffer.position()); ++ ++ ByteBuffer countBuffer = bufferAtOffset(new byte[0]); ++ Assert.assertEquals(0, MessageDecoder.countInnerMsgNum(countBuffer)); ++ Assert.assertEquals(3, countBuffer.position()); ++ } ++ ++ @Test ++ public void singleFrameRejectsTruncatedDataAndPreservesInputPosition() { ++ assertSingleFrameRejected(truncatedHeader()); ++ assertSingleFrameRejected(truncatedFrame()); ++ } ++ ++ @Test ++ public void singleFrameRejectsNegativeComponentLengthsAndPreservesInputPosition() { ++ assertSingleFrameRejected(frameWithLengths(22, -1, 0)); ++ assertSingleFrameRejected(frameWithLengths(22, 0, -1)); ++ } ++ ++ @Test ++ public void singleFrameRejectsInconsistentTotalSizeAndPreservesInputPosition() { ++ assertSingleFrameRejected(frameWithLengths(21, 0, 0)); ++ assertSingleFrameRejected(frameWithLengths(30, 0, 0)); ++ } ++ ++ @Test ++ public void batchDecodeIsAtomicWhenALaterFrameIsMalformed() throws Exception { ++ Message valid = new Message("topic", "ok".getBytes()); ++ byte[] validBytes = MessageDecoder.encodeMessage(valid); ++ byte[] malformed = truncatedFrame(); ++ byte[] input = new byte[validBytes.length + malformed.length]; ++ System.arraycopy(validBytes, 0, input, 0, validBytes.length); ++ System.arraycopy(malformed, 0, input, validBytes.length, malformed.length); ++ ++ ByteBuffer buffer = bufferAtOffset(input); ++ Assert.assertThrows(IllegalArgumentException.class, () -> MessageDecoder.decodeMessages(buffer)); ++ Assert.assertEquals(3, buffer.position()); ++ } ++ ++ @Test ++ public void frameCounterRejectsMalformedFramesAndPreservesInputPosition() { ++ ByteBuffer buffer = bufferAtOffset(truncatedHeader()); ++ ++ Assert.assertThrows(IllegalArgumentException.class, () -> MessageDecoder.countInnerMsgNum(buffer)); ++ Assert.assertEquals(3, buffer.position()); ++ } ++ ++ @Test ++ public void frameCounterValidatesFrameContentsAndIsAtomicAcrossTheBatch() { ++ Message valid = new Message("topic", "ok".getBytes()); ++ byte[] validBytes = MessageDecoder.encodeMessage(valid); ++ byte[] malformed = frameWithLengths(22, -1, 0); ++ byte[] input = new byte[validBytes.length + malformed.length]; ++ System.arraycopy(validBytes, 0, input, 0, validBytes.length); ++ System.arraycopy(malformed, 0, input, validBytes.length, malformed.length); ++ ByteBuffer buffer = bufferAtOffset(input); ++ ++ Assert.assertThrows(IllegalArgumentException.class, () -> MessageDecoder.countInnerMsgNum(buffer)); ++ Assert.assertEquals(3, buffer.position()); ++ } ++ ++ @Test ++ public void encodersRejectUnrepresentableMessagesWithAConsistentException() { ++ Message missingBody = new Message(); ++ missingBody.setTopic("topic"); ++ Assert.assertThrows(IllegalArgumentException.class, () -> MessageDecoder.encodeMessage(missingBody)); ++ ++ Message oversizedProperties = new Message("topic", new byte[0]); ++ oversizedProperties.putUserProperty("large", repeat('x', Short.MAX_VALUE)); ++ Assert.assertThrows(IllegalArgumentException.class, ++ () -> MessageDecoder.encodeMessage(oversizedProperties)); ++ ++ Assert.assertThrows(IllegalArgumentException.class, ++ () -> MessageDecoder.encodeMessages(Arrays.asList(new Message("topic", new byte[0]), null))); ++ } ++ ++ private static void assertSingleFrameRejected(byte[] bytes) { ++ ByteBuffer buffer = bufferAtOffset(bytes); ++ Assert.assertThrows(IllegalArgumentException.class, () -> MessageDecoder.decodeMessage(buffer)); ++ Assert.assertEquals(3, buffer.position()); ++ } ++ ++ private static byte[] frameWithLengths(int totalSize, int bodyLength, int propertiesLength) { ++ return frameWithLengths(totalSize, bodyLength, propertiesLength, 0); ++ } ++ ++ private static byte[] frameWithLengths(int totalSize, int bodyLength, int propertiesLength, int extraBytes) { ++ int actualSize = Math.max(22, totalSize) + Math.max(0, bodyLength) + Math.max(0, propertiesLength) ++ + extraBytes; ++ ByteBuffer buffer = ByteBuffer.allocate(actualSize); ++ buffer.putInt(totalSize); ++ buffer.putInt(0); ++ buffer.putInt(0); ++ buffer.putInt(0); ++ buffer.putInt(bodyLength); ++ if (bodyLength > 0) { ++ buffer.put(new byte[bodyLength]); ++ } ++ buffer.putShort((short) propertiesLength); ++ if (propertiesLength > 0) { ++ buffer.put(new byte[propertiesLength]); ++ } ++ return buffer.array(); ++ } ++ ++ private static byte[] truncatedFrame() { ++ ByteBuffer buffer = ByteBuffer.allocate(22); ++ buffer.putInt(22); ++ buffer.putInt(0); ++ buffer.putInt(0); ++ buffer.putInt(0); ++ buffer.putInt(1); ++ buffer.put((byte) 1); ++ return buffer.array(); ++ } ++ ++ private static byte[] truncatedHeader() { ++ ByteBuffer buffer = ByteBuffer.allocate(4); ++ buffer.putInt(10); ++ return buffer.array(); ++ } ++ ++ private static ByteBuffer bufferAtOffset(byte[] bytes) { ++ ByteBuffer buffer = ByteBuffer.allocate(bytes.length + 3); ++ buffer.put(new byte[] {11, 12, 13}); ++ buffer.put(bytes); ++ buffer.flip(); ++ buffer.position(3); ++ return buffer; ++ } ++ ++ private static String repeat(char value, int count) { ++ char[] chars = new char[count]; ++ Arrays.fill(chars, value); ++ return new String(chars); ++ } ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,15 @@ ++#!/bin/bash ++set -euo pipefail ++ ++ ++BUILD_DIR="$(mktemp -d)" ++trap 'rm -rf "${BUILD_DIR}"' EXIT ++find common/src/main/java/org/apache/rocketmq/common/message -name '*.java' -print > "${BUILD_DIR}/main-sources" ++javac -source 8 -target 8 -cp common/target/classes -d "${BUILD_DIR}/classes" @"${BUILD_DIR}/main-sources" ++JUNIT_JAR=/root/.m2/repository/junit/junit/4.13.2/junit-4.13.2.jar ++HAMCREST_JAR=/root/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar ++TEST_CP="${BUILD_DIR}/classes:common/target/classes:${JUNIT_JAR}:${HAMCREST_JAR}" ++javac -source 8 -target 8 -cp "${TEST_CP}" -d "${BUILD_DIR}/test-classes" \ ++ common/src/test/java/org/apache/rocketmq/common/message/MessageDecoderValidationContractTest.java ++java -cp "${BUILD_DIR}/test-classes:${TEST_CP}" org.junit.runner.JUnitCore \ ++ org.apache.rocketmq.common.message.MessageDecoderValidationContractTest diff --git a/tasks/format-code-task-001028/tests/test.sh b/tasks/format-code-task-001028/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7fec67a6840c2390b69cde904f72f63ad8cb094a --- /dev/null +++ b/tasks/format-code-task-001028/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +common/src/test/java/org/apache/rocketmq/common/message/MessageDecoderValidationContractTest.java +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001028/tests/test_command.sh b/tasks/format-code-task-001028/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001028/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001072/environment/Dockerfile b/tasks/format-code-task-001072/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..4b8b49d5caf5475b2e1600840e819dffc182c6d6 --- /dev/null +++ b/tasks/format-code-task-001072/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:07ca4265d22b078b8b6a04cbecd4bc4cea8a1916c3ee299fadc4308fed1daf41 diff --git a/tasks/format-code-task-001072/environment/setup/files/blocklist b/tasks/format-code-task-001072/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001072/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001072/environment/setup/setup.sh b/tasks/format-code-task-001072/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001072/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001072/tests/test.patch b/tasks/format-code-task-001072/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..aad884dabc0cfaa9da7768963b1bf8c1cadaf902 --- /dev/null +++ b/tasks/format-code-task-001072/tests/test.patch @@ -0,0 +1,214 @@ +diff --git a/tests/test_codespec_pass_culture.py b/tests/test_codespec_pass_culture.py +new file mode 100644 +index 000000000..92942798f +--- /dev/null ++++ b/tests/test_codespec_pass_culture.py +@@ -0,0 +1,198 @@ ++ ++ ++import pytest ++ ++from openfisca_core.model_api import MONTH ++from openfisca_france.scenarios import init_single_entity ++ ++from .cache import tax_benefit_system ++ ++ ++PUBLIC_VARIABLES = { ++ "pass_culture_compte_active": (bool, False), ++ "pass_culture_autorisation_parentale": (bool, False), ++ "pass_culture_eligibilite": (bool, False), ++ "pass_culture_montant": (float, 0), ++ "pass_culture_plafond_numerique": (float, 0), ++ } ++ ++ ++def calculate(variable_name, period, **inputs): ++ scenario = init_single_entity( ++ tax_benefit_system.new_scenario(), ++ period = period, ++ parent1 = inputs, ++ ) ++ return scenario.new_simulation().calculate(variable_name, period = period)[0] ++ ++ ++def test_pass_culture_public_monthly_surface(): ++ missing = sorted(set(PUBLIC_VARIABLES) - set(tax_benefit_system.variables)) ++ assert not missing, "Missing public Pass Culture variables: {}".format(", ".join(missing)) ++ ++ for variable_name, (value_type, default_value) in PUBLIC_VARIABLES.items(): ++ variable = tax_benefit_system.variables[variable_name] ++ assert variable.entity.key == "individu" ++ assert variable.definition_period == MONTH ++ assert variable.value_type is value_type ++ assert variable.default_value == default_value ++ ++ ++@pytest.mark.parametrize( ++ "period,age,expected", ++ [ ++ ("2021-04", 18, False), ++ ("2021-05", 17, False), ++ ("2021-05", 18, True), ++ ("2021-05", 19, False), ++ ("2021-12", 17, False), ++ ("2022-01", 14, False), ++ ("2022-01", 15, True), ++ ("2022-01", 16, True), ++ ("2022-01", 17, True), ++ ("2022-01", 18, True), ++ ("2022-01", 19, False), ++ ], ++ ) ++def test_pass_culture_calendar_and_age_boundaries(period, age, expected): ++ assert calculate( ++ "pass_culture_eligibilite", ++ period, ++ age = age, ++ nationalite = "FR", ++ ressortissant_eee = False, ++ residence_continue_annees = 0, ++ ) == expected ++ ++ ++@pytest.mark.parametrize( ++ "nationalite,ressortissant_eee,residence_continue_annees,expected", ++ [ ++ ("FR", False, 0, True), ++ ("DE", True, 0, True), ++ ("XX", False, 0.99, False), ++ ("XX", False, 1, True), ++ ("XX", False, 4, True), ++ ], ++ ) ++def test_pass_culture_nationality_and_residence_paths( ++ nationalite, ++ ressortissant_eee, ++ residence_continue_annees, ++ expected, ++ ): ++ assert calculate( ++ "pass_culture_eligibilite", ++ "2022-06", ++ age = 18, ++ nationalite = nationalite, ++ ressortissant_eee = ressortissant_eee, ++ residence_continue_annees = residence_continue_annees, ++ ) == expected ++ ++ ++def test_pass_culture_eligibility_is_independent_of_account_controls(): ++ assert calculate( ++ "pass_culture_eligibilite", ++ "2022-06", ++ age = 15, ++ nationalite = "FR", ++ pass_culture_compte_active = False, ++ pass_culture_autorisation_parentale = False, ++ ) ++ ++ ++@pytest.mark.parametrize( ++ "age,active,authorized,expected_amount,expected_digital", ++ [ ++ (15, False, True, 0, 0), ++ (15, True, False, 0, 0), ++ (15, True, True, 20, 20), ++ (18, True, False, 300, 100), ++ (19, True, True, 0, 0), ++ ], ++ ) ++def test_pass_culture_account_and_parental_authorization_gates( ++ age, ++ active, ++ authorized, ++ expected_amount, ++ expected_digital, ++ ): ++ inputs = dict( ++ age = age, ++ nationalite = "FR", ++ pass_culture_compte_active = active, ++ pass_culture_autorisation_parentale = authorized, ++ ) ++ assert calculate("pass_culture_montant", "2022-06", **inputs) == expected_amount ++ assert calculate("pass_culture_plafond_numerique", "2022-06", **inputs) == expected_digital ++ ++ ++def test_pass_culture_default_inactive_account_has_no_credit(): ++ inputs = dict( ++ age = 18, ++ nationalite = "FR", ++ ) ++ assert calculate("pass_culture_eligibilite", "2022-06", **inputs) ++ assert calculate("pass_culture_montant", "2022-06", **inputs) == 0 ++ assert calculate("pass_culture_plafond_numerique", "2022-06", **inputs) == 0 ++ ++ ++def test_pass_culture_ineligible_resident_has_no_credit(): ++ inputs = dict( ++ age = 18, ++ nationalite = "XX", ++ ressortissant_eee = False, ++ residence_continue_annees = 0.99, ++ pass_culture_compte_active = True, ++ ) ++ assert not calculate("pass_culture_eligibilite", "2022-06", **inputs) ++ assert calculate("pass_culture_montant", "2022-06", **inputs) == 0 ++ assert calculate("pass_culture_plafond_numerique", "2022-06", **inputs) == 0 ++ ++ ++@pytest.mark.parametrize( ++ "period,age,expected", ++ [ ++ ("2021-04", 18, 0), ++ ("2021-05", 17, 0), ++ ("2021-05", 18, 300), ++ ("2022-01", 15, 20), ++ ("2022-01", 16, 30), ++ ("2022-01", 17, 30), ++ ("2022-01", 18, 300), ++ ], ++ ) ++def test_pass_culture_full_credit_schedule(period, age, expected): ++ assert calculate( ++ "pass_culture_montant", ++ period, ++ age = age, ++ nationalite = "FR", ++ pass_culture_compte_active = True, ++ pass_culture_autorisation_parentale = True, ++ ) == expected ++ ++ ++@pytest.mark.parametrize( ++ "period,age,expected", ++ [ ++ ("2021-04", 18, 0), ++ ("2021-05", 17, 0), ++ ("2021-05", 18, 100), ++ ("2022-06", 15, 20), ++ ("2022-06", 16, 30), ++ ("2022-06", 17, 30), ++ ("2022-06", 18, 100), ++ ], ++ ) ++def test_pass_culture_digital_credit_cap(period, age, expected): ++ assert calculate( ++ "pass_culture_plafond_numerique", ++ period, ++ age = age, ++ nationalite = "FR", ++ pass_culture_compte_active = True, ++ pass_culture_autorisation_parentale = True, ++ ) == expected +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,5 @@ ++#!/bin/bash ++set -euo pipefail ++ ++ ++pytest --assert=plain -q tests/test_codespec_pass_culture.py diff --git a/tasks/format-code-task-001072/tests/test.sh b/tasks/format-code-task-001072/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..788d0b20b70de63b327a93ff7f86f739bdc41952 --- /dev/null +++ b/tasks/format-code-task-001072/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/test_codespec_pass_culture.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001072/tests/test_command.sh b/tasks/format-code-task-001072/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001072/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001075/environment/Dockerfile b/tasks/format-code-task-001075/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..244b56ecc43ca1d56b2ee6b7d19000e4a9ea2e4a --- /dev/null +++ b/tasks/format-code-task-001075/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:6d5c1f9575157a0ce950c6ccc126d3f2da875c4100a0412ec76120de12701f13 diff --git a/tasks/format-code-task-001075/environment/setup/files/blocklist b/tasks/format-code-task-001075/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001075/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001075/environment/setup/setup.sh b/tasks/format-code-task-001075/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001075/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001075/tests/test.patch b/tasks/format-code-task-001075/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..038422e48bad2b0ea854f188a037d7afe13d5ec1 --- /dev/null +++ b/tasks/format-code-task-001075/tests/test.patch @@ -0,0 +1,191 @@ +diff --git a/altair/utils/tests/test_plugin_registry_scopes.py b/altair/utils/tests/test_plugin_registry_scopes.py +new file mode 100644 +index 0000000..31d1c57 +--- /dev/null ++++ b/altair/utils/tests/test_plugin_registry_scopes.py +@@ -0,0 +1,91 @@ ++import pytest ++ ++from altair.utils import PluginRegistry ++ ++ ++def test_codespec_registry_permanent_activation_and_options(): ++ registry = PluginRegistry(entry_point_group='codespec.missing.plugins') ++ ++ def affine(value, scale=1, offset=0): ++ return value * scale + offset ++ ++ def identity(value): ++ return value ++ ++ registry.register('affine', affine) ++ registry.register('identity', identity) ++ ++ assert registry.active is None ++ assert registry.options == {} ++ ++ activation = registry.enable('affine', scale=2, offset=3) ++ assert hasattr(activation, '__enter__') ++ assert hasattr(activation, '__exit__') ++ assert registry.active == 'affine' ++ assert registry.options == {'scale': 2, 'offset': 3} ++ assert registry.get()(4) == 11 ++ assert registry.get()(4, scale=5) == 23 ++ ++ exposed_options = registry.options ++ exposed_options['scale'] = 100 ++ assert registry.options == {'scale': 2, 'offset': 3} ++ assert registry.get()(4) == 11 ++ ++ registry.enable('identity') ++ assert registry.active == 'identity' ++ assert registry.options == {} ++ assert registry.get() is identity ++ ++ ++def test_codespec_registry_nested_scopes_restore_exact_state(): ++ registry = PluginRegistry(entry_point_group='codespec.missing.plugins') ++ ++ def decorate(value, left='<', right='>'): ++ return left + value + right ++ ++ registry.register('decorate', decorate) ++ registry.register('upper', lambda value: value.upper()) ++ registry.enable('decorate', left='[', right=']') ++ ++ with registry.enable('upper'): ++ assert registry.active == 'upper' ++ assert registry.options == {} ++ assert registry.get()('inside') == 'INSIDE' ++ ++ with registry.enable(None, left='{', right='}'): ++ assert registry.active == 'upper' ++ assert registry.options == {'left': '{', 'right': '}'} ++ ++ assert registry.active == 'upper' ++ assert registry.options == {} ++ assert registry.get()('again') == 'AGAIN' ++ ++ assert registry.active == 'decorate' ++ assert registry.options == {'left': '[', 'right': ']'} ++ assert registry.get()('outside') == '[outside]' ++ ++ ++def test_codespec_registry_exception_and_failed_enable_are_atomic(): ++ registry = PluginRegistry(entry_point_group='codespec.missing.plugins') ++ registry.register('base', lambda value, prefix='': prefix + value) ++ registry.register('temporary', lambda value: value.upper()) ++ registry.enable('base', prefix='saved:') ++ ++ with pytest.raises(RuntimeError, match='scope failed'): ++ with registry.enable('temporary'): ++ assert registry.active == 'temporary' ++ raise RuntimeError('scope failed') ++ ++ assert registry.active == 'base' ++ assert registry.options == {'prefix': 'saved:'} ++ assert registry.get()('value') == 'saved:value' ++ ++ with pytest.raises(ValueError, match='unknown'): ++ registry.enable('unknown', discarded=True) ++ assert registry.active == 'base' ++ assert registry.options == {'prefix': 'saved:'} ++ assert registry.get()('value') == 'saved:value' ++ ++ empty = PluginRegistry(entry_point_group='codespec.missing.plugins') ++ with pytest.raises(ValueError): ++ empty.enable(None, option=True) +diff --git a/altair/vegalite/v2/tests/test_data_transformer_scopes.py b/altair/vegalite/v2/tests/test_data_transformer_scopes.py +new file mode 100644 +index 0000000..7e6012e +--- /dev/null ++++ b/altair/vegalite/v2/tests/test_data_transformer_scopes.py +@@ -0,0 +1,75 @@ ++import pandas as pd ++import pytest ++ ++import altair.vegalite.v2 as alt ++from altair.vegalite.data import MaxRowsError ++ ++ ++def test_codespec_transformer_options_reach_chart_serialization(): ++ plugin_name = 'codespec_option_transformer' ++ data = pd.DataFrame({'x': [1, 2]}) ++ ++ def annotate(data, label, multiplier=1): ++ records = data.to_dict(orient='records') ++ return { ++ 'values': [dict(row, label=label, x=row['x'] * multiplier) ++ for row in records] ++ } ++ ++ alt.data_transformers.register(plugin_name, annotate) ++ try: ++ with alt.data_transformers.enable(plugin_name, ++ label='scoped', multiplier=10): ++ values = alt.Chart(data).mark_point().to_dict()['data']['values'] ++ assert values == [ ++ {'x': 10, 'label': 'scoped'}, ++ {'x': 20, 'label': 'scoped'}, ++ ] ++ assert alt.data_transformers.active == plugin_name ++ assert alt.data_transformers.options == { ++ 'label': 'scoped', 'multiplier': 10 ++ } ++ ++ restored = alt.Chart(data).mark_point().to_dict()['data']['values'] ++ assert restored == [{'x': 1}, {'x': 2}] ++ assert alt.data_transformers.active == 'default' ++ assert alt.data_transformers.options == {} ++ finally: ++ alt.data_transformers.enable('default') ++ alt.data_transformers.register(plugin_name, None) ++ ++ ++def test_codespec_default_transformer_honors_limit_and_zero(): ++ data = pd.DataFrame({'x': [1, 2, 3]}) ++ ++ with alt.data_transformers.enable('default', max_rows=3): ++ values = alt.Chart(data).mark_point().to_dict()['data']['values'] ++ assert values == [{'x': 1}, {'x': 2}, {'x': 3}] ++ ++ with alt.data_transformers.enable('default', max_rows=2): ++ with pytest.raises(MaxRowsError, match='greater than the max of 2'): ++ alt.Chart(data).mark_point().to_dict() ++ ++ with alt.data_transformers.enable('default', max_rows=0): ++ empty = pd.DataFrame({'x': []}) ++ assert alt.Chart(empty).mark_point().to_dict()['data']['values'] == [] ++ with pytest.raises(MaxRowsError, match='greater than the max of 0'): ++ alt.Chart(data.iloc[:1]).mark_point().to_dict() ++ ++ ++def test_codespec_default_transformer_none_disables_limit_temporarily(): ++ oversized = pd.DataFrame({'x': range(5001)}) ++ ++ with pytest.raises(MaxRowsError): ++ alt.Chart(oversized).mark_point().to_dict() ++ ++ with alt.data_transformers.enable('default', max_rows=None): ++ values = alt.Chart(oversized).mark_point().to_dict()['data']['values'] ++ assert len(values) == 5001 ++ assert values[0] == {'x': 0} ++ assert values[-1] == {'x': 5000} ++ ++ assert alt.data_transformers.active == 'default' ++ assert alt.data_transformers.options == {} ++ with pytest.raises(MaxRowsError): ++ alt.Chart(oversized).mark_point().to_dict() +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/bin/bash ++set -euo pipefail ++ ++pytest -q \ ++ altair/utils/tests/test_plugin_registry_scopes.py \ ++ altair/vegalite/v2/tests/test_data_transformer_scopes.py \ ++ altair/vegalite/tests/test_data.py \ ++ altair/vegalite/v2/tests/test_api.py diff --git a/tasks/format-code-task-001075/tests/test.sh b/tasks/format-code-task-001075/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..edc7a365e072b295476727b8503409ffc2df2a84 --- /dev/null +++ b/tasks/format-code-task-001075/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +altair/utils/tests/test_plugin_registry_scopes.py +altair/vegalite/v2/tests/test_data_transformer_scopes.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001075/tests/test_command.sh b/tasks/format-code-task-001075/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001075/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001081/environment/Dockerfile b/tasks/format-code-task-001081/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..e5323d274aedbd3bbab9b78aa6318866e7328e3b --- /dev/null +++ b/tasks/format-code-task-001081/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:ea3dcf7bd7a1e98bfa5cf9a63e868cbc687ca4ca6ca924bbe2d22eb0aea3c2d1 diff --git a/tasks/format-code-task-001081/environment/setup/files/blocklist b/tasks/format-code-task-001081/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001081/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001081/environment/setup/setup.sh b/tasks/format-code-task-001081/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001081/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001081/tests/test.patch b/tasks/format-code-task-001081/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..a17e6e279cf08c8739f8d214b0673c32cf708683 --- /dev/null +++ b/tasks/format-code-task-001081/tests/test.patch @@ -0,0 +1,124 @@ +diff --git a/doc/sphinxext/tests/test_parameter_sections_codespec.py b/doc/sphinxext/tests/test_parameter_sections_codespec.py +new file mode 100644 +index 0000000000..31eceb87bf +--- /dev/null ++++ b/doc/sphinxext/tests/test_parameter_sections_codespec.py +@@ -0,0 +1,108 @@ ++import os ++import sys ++ ++sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) ++ ++from docscrape import ClassDoc, FunctionDoc, NumpyDocString ++ ++ ++DOC = """ ++calculate(x) ++ ++Compute a scaled value. ++ ++Parameters ++---------- ++x : int ++ Input value. ++ ++Other parameters ++---------------- ++scale : float, optional ++ First line of the scale description. ++ ++ Second paragraph remains separate. ++mode : str ++ ++Returns ++------- ++result : float ++ The final result. ++ ++Yields ++------ ++step : float ++ Intermediate values as they are produced. ++empty : object ++ ++Warns ++----- ++RuntimeWarning ++ If the input is outside the recommended range. ++""" ++ ++ ++def calculate(x): ++ pass ++ ++ ++def test_parameter_like_sections_are_parsed_with_multiline_descriptions(): ++ doc = NumpyDocString(DOC) ++ ++ assert doc['Other Parameters'] == [ ++ ('scale', 'float, optional', [ ++ 'First line of the scale description.', ++ '', ++ 'Second paragraph remains separate.', ++ ]), ++ ('mode', 'str', []), ++ ] ++ assert doc['Yields'] == [ ++ ('step', 'float', ['Intermediate values as they are produced.']), ++ ('empty', 'object', []), ++ ] ++ assert doc['Warns'] == [ ++ ('RuntimeWarning', '', ++ ['If the input is outside the recommended range.']), ++ ] ++ ++ ++def test_parameter_like_sections_render_in_document_order(): ++ rendered = str(NumpyDocString(DOC)) ++ names = [ ++ 'Parameters', 'Other Parameters', 'Returns', 'Yields', 'Warns', ++ ] ++ positions = [rendered.index(name) for name in names] ++ assert positions == sorted(positions) ++ assert 'scale : float, optional' in rendered ++ assert 'Second paragraph remains separate.' in rendered ++ assert 'step : float' in rendered ++ assert 'RuntimeWarning :' in rendered ++ ++ ++def test_function_doc_exposes_yields_and_other_parameters(): ++ doc = FunctionDoc(calculate, doc=DOC) ++ assert doc['Yields'][0][0] == 'step' ++ assert doc['Other Parameters'][0][0] == 'scale' ++ rendered = str(doc) ++ assert rendered.startswith('.. function:: calculate') ++ assert 'Other Parameters\n----------------' in rendered ++ assert 'Yields\n------' in rendered ++ assert 'Warns\n-----' in rendered ++ ++ ++def test_class_doc_accepts_and_renders_parameter_like_sections(): ++ doc = ClassDoc(None, doc=DOC) ++ assert doc['Yields'][1] == ('empty', 'object', []) ++ assert doc['Other Parameters'][1][0] == 'mode' ++ rendered = str(doc) ++ assert 'Other Parameters\n----------------' in rendered ++ assert 'Yields\n------' in rendered ++ assert 'Warns\n-----' in rendered ++ ++ ++def test_missing_parameter_like_sections_remain_empty(): ++ doc = NumpyDocString('plain summary') ++ assert doc['Other Parameters'] == [] ++ assert doc['Yields'] == [] ++ assert doc['Warns'] == [] +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,5 @@ ++#!/bin/bash ++set -euo pipefail ++ ++ ++python2 -m pytest -q doc/sphinxext/tests/test_parameter_sections_codespec.py diff --git a/tasks/format-code-task-001081/tests/test.sh b/tasks/format-code-task-001081/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..db21407ddd256df572701eabaf3bef2fd030b4c8 --- /dev/null +++ b/tasks/format-code-task-001081/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +doc/sphinxext/tests/test_parameter_sections_codespec.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001081/tests/test_command.sh b/tasks/format-code-task-001081/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001081/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001086/environment/Dockerfile b/tasks/format-code-task-001086/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..501b6d66eeb07454f245c3388c8eb592817dc590 --- /dev/null +++ b/tasks/format-code-task-001086/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:d536aa4384049034fc74fc9e886b7f3e5749e206dcc7faef3eb51102d82018c2 diff --git a/tasks/format-code-task-001086/environment/setup/files/blocklist b/tasks/format-code-task-001086/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001086/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001086/environment/setup/setup.sh b/tasks/format-code-task-001086/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001086/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001086/tests/test.patch b/tasks/format-code-task-001086/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..eac1a5a48a3b2af9d2c74974e7b285246ad3da56 --- /dev/null +++ b/tasks/format-code-task-001086/tests/test.patch @@ -0,0 +1,119 @@ +diff --git a/tests/util/test_measurement_conversion_contract.py b/tests/util/test_measurement_conversion_contract.py +new file mode 100644 +index 00000000000..f9450a91872 +--- /dev/null ++++ b/tests/util/test_measurement_conversion_contract.py +@@ -0,0 +1,98 @@ ++ ++ ++import pytest ++ ++from homeassistant.const import ( ++ LENGTH_CENTIMETERS, ++ LENGTH_FEET, ++ LENGTH_INCHES, ++ LENGTH_KILOMETERS, ++ LENGTH_METERS, ++ LENGTH_MILES, ++ LENGTH_YARD, ++ MASS_GRAMS, ++ MASS_KILOGRAMS, ++ MASS_OUNCES, ++ MASS_POUNDS, ++ PRESSURE_BAR, ++ PRESSURE_HPA, ++ PRESSURE_PA, ++ VOLUME_FLUID_OUNCE, ++ VOLUME_GALLONS, ++ VOLUME_LITERS, ++ VOLUME_MILLILITERS, ++) ++from homeassistant.util import volume as volume_util ++from homeassistant.util import distance as distance_util ++from homeassistant.util import pressure as pressure_util ++from homeassistant.util.unit_system import IMPERIAL_SYSTEM, METRIC_SYSTEM ++ ++ ++def test_unit_system_mass_converts_to_metric_units(): ++ ++ assert METRIC_SYSTEM.mass(2.5, MASS_KILOGRAMS) == pytest.approx(2500) ++ assert METRIC_SYSTEM.mass(16, MASS_OUNCES) == pytest.approx(453.59237) ++ ++ ++def test_unit_system_mass_converts_to_imperial_units(): ++ ++ assert IMPERIAL_SYSTEM.mass(1000, MASS_GRAMS) == pytest.approx(2.20462262) ++ assert IMPERIAL_SYSTEM.mass(1, MASS_KILOGRAMS) == pytest.approx(2.20462262) ++ assert IMPERIAL_SYSTEM.mass(1, MASS_POUNDS) == 1 ++ ++ ++def test_volume_converts_every_advertised_unit_pair(): ++ ++ expected_liters = { ++ VOLUME_LITERS: 1.0, ++ VOLUME_MILLILITERS: 0.001, ++ VOLUME_GALLONS: 3.785, ++ VOLUME_FLUID_OUNCE: 0.0295735, ++ } ++ ++ for source, source_liters in expected_liters.items(): ++ for target, target_liters in expected_liters.items(): ++ result = volume_util.convert(10, source, target) ++ assert result == pytest.approx(10 * source_liters / target_liters, rel=1e-5) ++ ++ ++def test_distance_supports_all_advertised_units_and_round_trips(): ++ ++ expected_meters = { ++ LENGTH_METERS: 1.0, ++ LENGTH_KILOMETERS: 1000.0, ++ LENGTH_CENTIMETERS: 0.01, ++ LENGTH_MILES: 1609.344, ++ LENGTH_FEET: 0.3048, ++ LENGTH_INCHES: 0.0254, ++ LENGTH_YARD: 0.9144, ++ } ++ for source, source_meters in expected_meters.items(): ++ converted = distance_util.convert(1, source, LENGTH_METERS) ++ assert converted == pytest.approx(source_meters, rel=1e-6) ++ assert distance_util.convert(converted, LENGTH_METERS, source) == pytest.approx( ++ 1, rel=1e-6 ++ ) ++ ++ ++def test_pressure_accepts_bar_without_changing_existing_units(): ++ ++ assert PRESSURE_BAR in pressure_util.VALID_UNITS ++ assert pressure_util.convert(1, PRESSURE_BAR, PRESSURE_PA) == pytest.approx(100000) ++ assert pressure_util.convert(1000, PRESSURE_HPA, PRESSURE_BAR) == pytest.approx(1) ++ assert pressure_util.convert(0, PRESSURE_PA, PRESSURE_BAR) == 0 ++ ++ ++def test_unit_system_volume_preserves_zero(): ++ ++ assert METRIC_SYSTEM.volume(0, VOLUME_GALLONS) == 0 ++ ++ ++def test_measurement_converters_reject_bad_values_and_units(): ++ ++ with pytest.raises(TypeError): ++ METRIC_SYSTEM.mass("2", MASS_GRAMS) ++ with pytest.raises(ValueError): ++ METRIC_SYSTEM.mass(2, "stones") ++ with pytest.raises(ValueError): ++ volume_util.convert(2, VOLUME_LITERS, "cups") +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,10 @@ ++#!/bin/bash ++set -euo pipefail ++ ++ ++/root/.venv/bin/pytest -q \ ++ tests/util/test_measurement_conversion_contract.py \ ++ tests/util/test_unit_system.py \ ++ tests/util/test_volume.py \ ++ tests/util/test_distance.py \ ++ tests/util/test_pressure.py diff --git a/tasks/format-code-task-001086/tests/test.sh b/tasks/format-code-task-001086/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..9a38e4d23dfbbb5eaff1a6346332a5c22d690135 --- /dev/null +++ b/tasks/format-code-task-001086/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/util/test_measurement_conversion_contract.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001086/tests/test_command.sh b/tasks/format-code-task-001086/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001086/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001162/environment/Dockerfile b/tasks/format-code-task-001162/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..63f10fb278f28e73eb3171ec00585e111a0e807a --- /dev/null +++ b/tasks/format-code-task-001162/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:c4a6edb2ee5fbe26678544531a61f4ba9ea53a67a25efd0e6d207d4e560dfd97 diff --git a/tasks/format-code-task-001162/environment/setup/files/blocklist b/tasks/format-code-task-001162/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001162/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001162/environment/setup/setup.sh b/tasks/format-code-task-001162/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001162/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001162/tests/test.patch b/tasks/format-code-task-001162/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..823b5d498396271bd46063f7b4a8c30e86c2a004 --- /dev/null +++ b/tasks/format-code-task-001162/tests/test.patch @@ -0,0 +1,143 @@ +diff --git a/tests/lib/rules/no-invalid-html-attribute-create-element.js b/tests/lib/rules/no-invalid-html-attribute-create-element.js +new file mode 100644 +index 00000000..05a108a5 +--- /dev/null ++++ b/tests/lib/rules/no-invalid-html-attribute-create-element.js +@@ -0,0 +1,125 @@ ++ ++ ++ ++ ++'use strict'; ++ ++const RuleTester = require('eslint').RuleTester; ++const rule = require('../../../lib/rules/no-invalid-html-attribute'); ++ ++const parserOptions = { ++ ecmaVersion: 2018, ++ sourceType: 'module', ++ ecmaFeatures: { ++ jsx: true, ++ }, ++}; ++ ++const ruleTester = new RuleTester({ parserOptions }); ++ ++ruleTester.run('no-invalid-html-attribute createElement parity', rule, { ++ valid: [ ++ { ++ code: 'React.createElement("link", { rel: "alternate stylesheet" })', ++ }, ++ { ++ code: 'React.createElement("link", { rel: "alternate\\tstylesheet" })', ++ }, ++ { ++ code: 'React.createElement("link", { rel: "shortcut icon" })', ++ }, ++ { ++ code: 'React.createElement("a", { rel: ["alternate", "tag"] })', ++ }, ++ { ++ code: 'React.createElement("a", { rel: getRel() })', ++ }, ++ { ++ code: 'React.createElement("a", { rel: [getRel(), relValue] })', ++ }, ++ { ++ code: 'React.createElement("Widget", { rel: "not-a-standard-token" })', ++ }, ++ { ++ code: 'const rel = "alternate"; React.createElement("a", { rel })', ++ }, ++ { ++ code: '', ++ }, ++ ], ++ invalid: [ ++ { ++ code: 'React.createElement("link", { rel: "alternate mystery" })', ++ errors: [{ ++ messageId: 'neverValid', ++ data: { attributeName: 'rel', reportingValue: 'mystery' }, ++ }], ++ }, ++ { ++ code: 'React.createElement("a", { rel: "alternate canonical" })', ++ errors: [{ ++ messageId: 'notValidFor', ++ data: { ++ attributeName: 'rel', ++ reportingValue: 'canonical', ++ elementName: 'a', ++ }, ++ }], ++ }, ++ { ++ code: 'React.createElement("link", { rel: "shortcut" })', ++ errors: [{ ++ messageId: 'notAlone', ++ data: { reportingValue: 'shortcut', missingValue: 'icon' }, ++ }], ++ }, ++ { ++ code: 'React.createElement("link", { rel: "shortcut stylesheet" })', ++ errors: [{ ++ messageId: 'notPaired', ++ data: { ++ reportingValue: 'shortcut', ++ secondValue: 'stylesheet', ++ missingValue: 'icon', ++ }, ++ }], ++ }, ++ { ++ code: 'React.createElement("link", { rel: "shortcut\\tstylesheet" })', ++ errors: [{ ++ messageId: 'notPaired', ++ data: { ++ reportingValue: 'shortcut', ++ secondValue: 'stylesheet', ++ missingValue: 'icon', ++ }, ++ }], ++ }, ++ { ++ code: 'React.createElement("link", { rel: ["shortcut", "alternate"] })', ++ errors: [{ ++ messageId: 'notAlone', ++ data: { reportingValue: 'shortcut', missingValue: 'icon' }, ++ }], ++ }, ++ { ++ code: 'React.createElement("link", { rel: ["alternate mystery", "shortcut icon"] })', ++ errors: [{ ++ messageId: 'neverValid', ++ data: { attributeName: 'rel', reportingValue: 'mystery' }, ++ }], ++ }, ++ { ++ code: '', ++ output: '', ++ errors: [{ ++ messageId: 'notValidFor', ++ data: { ++ attributeName: 'rel', ++ reportingValue: 'canonical', ++ elementName: 'a', ++ }, ++ }], ++ }, ++ ], ++}); +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,7 @@ ++#!/bin/bash ++set -euo pipefail ++ ++ ++./node_modules/.bin/mocha \ ++ tests/lib/rules/no-invalid-html-attribute.js \ ++ tests/lib/rules/no-invalid-html-attribute-create-element.js diff --git a/tasks/format-code-task-001162/tests/test.sh b/tasks/format-code-task-001162/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..4a641a7524f962cc961efba8d54b25bec4cb183b --- /dev/null +++ b/tasks/format-code-task-001162/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/lib/rules/no-invalid-html-attribute-create-element.js +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001162/tests/test_command.sh b/tasks/format-code-task-001162/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001162/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001165/environment/Dockerfile b/tasks/format-code-task-001165/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..3716a2d0e6917b5c747d4ada88de36ac21407063 --- /dev/null +++ b/tasks/format-code-task-001165/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:010759cb01cc888f6716bbee370b52a55e26cd2eb0a560d83dd677b0f1471677 diff --git a/tasks/format-code-task-001165/environment/setup/files/blocklist b/tasks/format-code-task-001165/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001165/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001165/environment/setup/setup.sh b/tasks/format-code-task-001165/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001165/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001165/tests/test.patch b/tasks/format-code-task-001165/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..86717ece2f62f7d739e1b8c5d931189dd8cf3f88 --- /dev/null +++ b/tasks/format-code-task-001165/tests/test.patch @@ -0,0 +1,192 @@ +diff --git a/turbo/rpchelper/pending_events_codespec_test.go b/turbo/rpchelper/pending_events_codespec_test.go +new file mode 100644 +index 0000000000..d62ce0619b +--- /dev/null ++++ b/turbo/rpchelper/pending_events_codespec_test.go +@@ -0,0 +1,176 @@ ++package rpchelper ++ ++import ( ++ "context" ++ "math/big" ++ "reflect" ++ "testing" ++ ++ libcommon "github.com/erigontech/erigon-lib/common" ++ remote "github.com/erigontech/erigon-lib/gointerfaces/remoteproto" ++ txpool "github.com/erigontech/erigon-lib/gointerfaces/txpoolproto" ++ "github.com/erigontech/erigon-lib/log/v3" ++ "github.com/erigontech/erigon-lib/rlp" ++ "github.com/erigontech/erigon/core/types" ++) ++ ++func newPendingEventFilters() *Filters { ++ return New(context.Background(), FiltersConfig{}, nil, nil, nil, func() {}, log.New()) ++} ++ ++func pendingTestLogs() types.Logs { ++ return types.Logs{&types.Log{ ++ Address: libcommon.HexToAddress("0x0000000000000000000000000000000000000042"), ++ Topics: []libcommon.Hash{libcommon.HexToHash("0x01")}, ++ Data: []byte{0xaa, 0xbb}, ++ }} ++} ++ ++func pendingTestBlock() *types.Block { ++ return types.NewBlock(&types.Header{Difficulty: big.NewInt(1), Number: big.NewInt(42)}, nil, nil, nil, nil) ++} ++ ++func encodePending(t *testing.T, value interface{}) []byte { ++ t.Helper() ++ payload, err := rlp.EncodeToBytes(value) ++ if err != nil { ++ t.Fatalf("encode pending payload: %v", err) ++ } ++ return payload ++} ++ ++func TestRemotePendingLogsAreDecodedAndBroadcast(t *testing.T) { ++ f := newPendingEventFilters() ++ first, firstID := f.SubscribePendingLogs(1) ++ second, secondID := f.SubscribePendingLogs(1) ++ defer f.UnsubscribePendingLogs(firstID) ++ defer f.UnsubscribePendingLogs(secondID) ++ ++ want := pendingTestLogs() ++ f.OnNewEvent(&remote.SubscribeReply{Type: remote.Event_PENDING_LOGS, Data: encodePending(t, want)}) ++ ++ for name, ch := range map[string]<-chan types.Logs{"first": first, "second": second} { ++ select { ++ case got := <-ch: ++ if !reflect.DeepEqual(got, want) { ++ t.Errorf("%s subscriber got %#v, want %#v", name, got, want) ++ } ++ default: ++ t.Errorf("%s subscriber received no pending logs", name) ++ } ++ } ++} ++ ++func TestRemotePendingBlockIsDecodedStoredAndBroadcast(t *testing.T) { ++ f := newPendingEventFilters() ++ ch, id := f.SubscribePendingBlock(1) ++ defer f.UnsubscribePendingBlock(id) ++ ++ f.OnNewEvent(&remote.SubscribeReply{Type: remote.Event_PENDING_BLOCK, Data: encodePending(t, pendingTestBlock())}) ++ ++ select { ++ case got := <-ch: ++ if got == nil || got.NumberU64() != 42 { ++ t.Fatalf("subscriber got block number %v, want 42", got) ++ } ++ default: ++ t.Fatal("subscriber received no pending block") ++ } ++ stored := f.LastPendingBlock() ++ if stored == nil || stored.NumberU64() != 42 { ++ t.Fatalf("LastPendingBlock returned %v, want block 42", stored) ++ } ++} ++ ++func TestRemotePendingPayloadErrorsDoNotNotifyOrMutate(t *testing.T) { ++ t.Run("empty", func(t *testing.T) { ++ assertRemotePendingPayloadIgnored(t, nil) ++ }) ++ t.Run("malformed", func(t *testing.T) { ++ assertRemotePendingPayloadIgnored(t, []byte{0xff}) ++ }) ++} ++ ++func assertRemotePendingPayloadIgnored(t *testing.T, payload []byte) { ++ t.Helper() ++ f := newPendingEventFilters() ++ logs, logsID := f.SubscribePendingLogs(1) ++ block, blockID := f.SubscribePendingBlock(1) ++ defer f.UnsubscribePendingLogs(logsID) ++ defer f.UnsubscribePendingBlock(blockID) ++ ++ f.OnNewEvent(&remote.SubscribeReply{Type: remote.Event_PENDING_LOGS, Data: payload}) ++ if len(logs) != 0 { ++ t.Fatalf("invalid remote log payload produced %d notification(s)", len(logs)) ++ } ++ f.OnNewEvent(&remote.SubscribeReply{Type: remote.Event_PENDING_BLOCK, Data: payload}) ++ if len(block) != 0 { ++ t.Fatalf("invalid remote block payload produced %d notification(s)", len(block)) ++ } ++ if got := f.LastPendingBlock(); got != nil { ++ t.Fatalf("invalid remote block changed pending state to %v", got) ++ } ++} ++ ++func TestRemoteNilEventIsIgnored(t *testing.T) { ++ f := newPendingEventFilters() ++ defer func() { ++ if r := recover(); r != nil { ++ t.Fatalf("OnNewEvent(nil) panicked: %v", r) ++ } ++ }() ++ f.OnNewEvent(nil) ++} ++ ++func TestTxpoolPendingHandlersRejectInvalidPayloads(t *testing.T) { ++ f := newPendingEventFilters() ++ logs, logsID := f.SubscribePendingLogs(2) ++ blocks, blocksID := f.SubscribePendingBlock(2) ++ defer f.UnsubscribePendingLogs(logsID) ++ defer f.UnsubscribePendingBlock(blocksID) ++ ++ validBlock := pendingTestBlock() ++ f.HandlePendingLogs(&txpool.OnPendingLogsReply{RplLogs: encodePending(t, pendingTestLogs())}) ++ f.HandlePendingBlock(&txpool.OnPendingBlockReply{RplBlock: encodePending(t, validBlock)}) ++ if len(logs) != 1 || len(blocks) != 1 { ++ t.Fatalf("valid txpool payloads were not delivered: logs=%d blocks=%d", len(logs), len(blocks)) ++ } ++ if got := f.LastPendingBlock(); got == nil || got.NumberU64() != 42 { ++ t.Fatalf("valid txpool block was not stored: %v", got) ++ } ++ ++ f.HandlePendingLogs(&txpool.OnPendingLogsReply{RplLogs: []byte{0xff}}) ++ if len(logs) != 1 { ++ t.Errorf("invalid txpool log payload produced a notification: logs=%d", len(logs)) ++ } ++ f.HandlePendingBlock(&txpool.OnPendingBlockReply{RplBlock: []byte{0xff}}) ++ if len(blocks) != 1 { ++ t.Errorf("invalid txpool block payload produced a notification: blocks=%d", len(blocks)) ++ } ++ got := f.LastPendingBlock() ++ if got == nil || got.HeaderNoCopy() == nil || got.HeaderNoCopy().Number == nil || got.HeaderNoCopy().Number.Uint64() != 42 { ++ t.Fatalf("invalid txpool block replaced stored block: %v", got) ++ } ++} ++ ++func TestTxpoolNilRepliesAreIgnored(t *testing.T) { ++ f := newPendingEventFilters() ++ logs, logsID := f.SubscribePendingLogs(1) ++ blocks, blocksID := f.SubscribePendingBlock(1) ++ defer f.UnsubscribePendingLogs(logsID) ++ defer f.UnsubscribePendingBlock(blocksID) ++ ++ call := func(name string, fn func()) { ++ defer func() { ++ if r := recover(); r != nil { ++ t.Errorf("nil %s reply panicked: %v", name, r) ++ } ++ }() ++ fn() ++ } ++ call("logs", func() { f.HandlePendingLogs(nil) }) ++ call("block", func() { f.HandlePendingBlock(nil) }) ++ if len(logs) != 0 || len(blocks) != 0 || f.LastPendingBlock() != nil { ++ t.Errorf("nil txpool replies changed observable state: logs=%d blocks=%d pending=%v", len(logs), len(blocks), f.LastPendingBlock()) ++ } ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,5 @@ ++#!/bin/bash ++set -euo pipefail ++ ++ ++go test ./turbo/rpchelper -run '^Test(RemotePending|RemoteNil|TxpoolPending|TxpoolNil)' diff --git a/tasks/format-code-task-001165/tests/test.sh b/tasks/format-code-task-001165/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8e9bc24c98325c8a90d75b32b3cbc15f333541c8 --- /dev/null +++ b/tasks/format-code-task-001165/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +turbo/rpchelper/pending_events_codespec_test.go +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001165/tests/test_command.sh b/tasks/format-code-task-001165/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001165/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001191/environment/Dockerfile b/tasks/format-code-task-001191/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..6bcdc1d80e97c60a059303dac9fcf16fc088188a --- /dev/null +++ b/tasks/format-code-task-001191/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:d685a1c7a5165b81d7ef745f2efcae6fe9a509e411dbfb701984f605699cb0d9 diff --git a/tasks/format-code-task-001191/environment/setup/files/blocklist b/tasks/format-code-task-001191/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001191/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001191/environment/setup/setup.sh b/tasks/format-code-task-001191/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001191/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001191/tests/test.patch b/tasks/format-code-task-001191/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..51b731cab6d12844b2b5fd4f3e6b011ac8839e11 --- /dev/null +++ b/tasks/format-code-task-001191/tests/test.patch @@ -0,0 +1,196 @@ +diff --git a/ets_qdisc_integration_test.go b/ets_qdisc_integration_test.go +new file mode 100644 +index 0000000..c6cdfd6 +--- /dev/null ++++ b/ets_qdisc_integration_test.go +@@ -0,0 +1,180 @@ ++package tc ++ ++import ( ++ "errors" ++ "reflect" ++ "testing" ++ "time" ++ ++ "github.com/florianl/go-tc/internal/unix" ++ "github.com/google/go-cmp/cmp" ++ "github.com/mdlayher/netlink" ++) ++ ++ ++ ++type etsQdiscConn struct { ++ last netlink.Message ++ request []byte ++ dumps int ++} ++ ++func (c *etsQdiscConn) Close() error { return nil } ++func (c *etsQdiscConn) JoinGroup(uint32) error { return nil } ++func (c *etsQdiscConn) LeaveGroup(uint32) error { return nil } ++func (c *etsQdiscConn) SetOption(netlink.ConnOption, bool) error { return nil } ++func (c *etsQdiscConn) SetReadDeadline(time.Time) error { return nil } ++ ++func (c *etsQdiscConn) Send(m netlink.Message) (netlink.Message, error) { ++ c.last = m ++ if m.Header.Type != netlink.HeaderType(unix.RTM_GETQDISC) { ++ c.request = append(c.request[:0], m.Data...) ++ } ++ return m, nil ++} ++ ++func (c *etsQdiscConn) Receive() ([]netlink.Message, error) { ++ if c.last.Header.Type != netlink.HeaderType(unix.RTM_GETQDISC) || len(c.request) == 0 { ++ return nil, nil ++ } ++ var attrs []netlink.Attribute ++ ad, err := netlink.NewAttributeDecoder(c.request[20:]) ++ if err != nil { ++ return nil, err ++ } ++ for ad.Next() { ++ attrs = append(attrs, netlink.Attribute{Type: ad.Type(), Data: ad.Bytes()}) ++ } ++ if err := ad.Err(); err != nil { ++ return nil, err ++ } ++ var ordered []netlink.Attribute ++ firstType := uint16(tcaKind) ++ if c.dumps%2 == 1 { ++ firstType = tcaOptions ++ } ++ for _, attr := range attrs { ++ if attr.Type == firstType { ++ ordered = append(ordered, attr) ++ } ++ } ++ for _, attr := range attrs { ++ if attr.Type != firstType { ++ ordered = append(ordered, attr) ++ } ++ } ++ encoded, err := netlink.MarshalAttributes(ordered) ++ if err != nil { ++ return nil, err ++ } ++ c.dumps++ ++ return []netlink.Message{{ ++ Header: netlink.Header{Type: netlink.HeaderType(unix.RTM_NEWQDISC), Sequence: c.last.Header.Sequence, PID: c.last.Header.PID}, ++ Data: append(append([]byte(nil), c.request[:20]...), encoded...), ++ }}, nil ++} ++ ++var _ tcConn = (*etsQdiscConn)(nil) ++ ++func setPublicETSField(t *testing.T, attr *Attribute, ets *Ets) { ++ t.Helper() ++ field := reflect.ValueOf(attr).Elem().FieldByName("Ets") ++ if !field.IsValid() { ++ t.Fatalf("Attribute does not expose an Ets field") ++ } ++ wantType := reflect.TypeOf((*Ets)(nil)) ++ if field.Type() != wantType { ++ t.Fatalf("Attribute.Ets has type %v, want %v", field.Type(), wantType) ++ } ++ field.Set(reflect.ValueOf(ets)) ++} ++ ++func publicETSField(t *testing.T, attr *Attribute) *Ets { ++ t.Helper() ++ field := reflect.ValueOf(attr).Elem().FieldByName("Ets") ++ if !field.IsValid() { ++ t.Fatalf("Attribute does not expose an Ets field") ++ } ++ ets, ok := field.Interface().(*Ets) ++ if !ok { ++ t.Fatalf("Attribute.Ets has type %v, want *Ets", field.Type()) ++ } ++ return ets ++} ++ ++func TestETSQdiscPublicRoundTripAndOperations(t *testing.T) { ++ quanta := []uint32{4500, 3000, 2500} ++ prioMap := []uint8{0, 1, 1, 1, 2, 3, 4, 5} ++ want := Object{ ++ Msg: Msg{Family: unix.AF_UNSPEC, Ifindex: 7, Handle: 0x10000, Parent: HandleRoot}, ++ Attribute: Attribute{Kind: "ets"}, ++ } ++ wantEts := &Ets{NBands: uint8Ptr(0), NStrict: uint8Ptr(3), Quanta: &quanta, PrioMap: &prioMap} ++ setPublicETSField(t, &want.Attribute, wantEts) ++ ++ conn := &etsQdiscConn{} ++ tc := &Tc{con: conn} ++ qd := tc.Qdisc() ++ if err := qd.Add(&want); err != nil { ++ t.Fatalf("Add(ets) failed: %v", err) ++ } ++ if err := qd.Replace(&want); err != nil { ++ t.Fatalf("Replace(ets) failed: %v", err) ++ } ++ if err := qd.Change(&want); err != nil { ++ t.Fatalf("Change(ets) failed: %v", err) ++ } ++ if err := qd.Link(&want); err != nil { ++ t.Fatalf("Link(ets) failed: %v", err) ++ } ++ ++ for i := 0; i < 2; i++ { ++ got, err := qd.Get() ++ if err != nil { ++ t.Fatalf("Get(ets) failed: %v", err) ++ } ++ if len(got) != 1 { ++ t.Fatalf("Get(ets) returned %d objects, want 1", len(got)) ++ } ++ if diff := cmp.Diff(want.Msg, got[0].Msg); diff != "" { ++ t.Fatalf("ETS qdisc message did not round-trip (-want +got):\n%s", diff) ++ } ++ if got[0].Kind != "ets" { ++ t.Fatalf("Get returned kind %q, want ets", got[0].Kind) ++ } ++ if diff := cmp.Diff(wantEts, publicETSField(t, &got[0].Attribute)); diff != "" { ++ t.Fatalf("ETS options did not round-trip (-want +got):\n%s", diff) ++ } ++ } ++ ++ if err := qd.Delete(&Object{Msg: want.Msg, Attribute: Attribute{Kind: "ets"}}); err != nil { ++ t.Fatalf("Delete(ets) failed: %v", err) ++ } ++} ++ ++func TestETSQdiscValidationAndCompatibility(t *testing.T) { ++ conn := &etsQdiscConn{} ++ qd := (&Tc{con: conn}).Qdisc() ++ ++ cases := []struct { ++ name string ++ obj *Object ++ want error ++ }{ ++ {name: "missing options", obj: &Object{Msg: Msg{Ifindex: 1}, Attribute: Attribute{Kind: "ets"}}, want: ErrNoArg}, ++ {name: "invalid device", obj: &Object{Msg: Msg{}, Attribute: Attribute{Kind: "ets"}}, want: ErrInvalidDev}, ++ {name: "unknown kind", obj: &Object{Msg: Msg{Ifindex: 1}, Attribute: Attribute{Kind: "not-a-qdisc"}}, want: ErrNotImplemented}, ++ } ++ for _, tc := range cases { ++ t.Run(tc.name, func(t *testing.T) { ++ if err := qd.Add(tc.obj); !errors.Is(err, tc.want) { ++ t.Fatalf("Add returned %v, want %v", err, tc.want) ++ } ++ }) ++ } ++ ++ ++ if err := qd.Add(&Object{Msg: Msg{Ifindex: 1}, Attribute: Attribute{Kind: "qfq"}}); err != nil { ++ t.Fatalf("parameterless qfq compatibility broke: %v", err) ++ } ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,5 @@ ++#!/bin/bash ++set -euo pipefail ++ ++ ++go test -vet=off -run '^TestETSQdisc' . diff --git a/tasks/format-code-task-001191/tests/test.sh b/tasks/format-code-task-001191/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..f01a79a01284f34a79b4cf3d6e3883c67a968661 --- /dev/null +++ b/tasks/format-code-task-001191/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +ets_qdisc_integration_test.go +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001191/tests/test_command.sh b/tasks/format-code-task-001191/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001191/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001196/environment/Dockerfile b/tasks/format-code-task-001196/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..a53eac9a99f0a8bd620d07d2bb2436b44cc85e71 --- /dev/null +++ b/tasks/format-code-task-001196/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:c4a76c29376cdfd2bcbfebdba5018b2c86a6fa1f0fbd614341882f419e676c01 diff --git a/tasks/format-code-task-001196/environment/setup/files/blocklist b/tasks/format-code-task-001196/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001196/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001196/environment/setup/setup.sh b/tasks/format-code-task-001196/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001196/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001196/tests/test.patch b/tasks/format-code-task-001196/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..89000fac960141f69aad4e9006d21a7b427ce80f --- /dev/null +++ b/tasks/format-code-task-001196/tests/test.patch @@ -0,0 +1,59 @@ +diff --git a/tests/flytekit/unit/core/test_type_engine.py b/tests/flytekit/unit/core/test_type_engine.py +index cb9512dfee..74628bb415 100644 +--- a/tests/flytekit/unit/core/test_type_engine.py ++++ b/tests/flytekit/unit/core/test_type_engine.py +@@ -28,6 +28,7 @@ + from flytekit.models.literals import Blob, BlobMetadata, Literal, LiteralCollection, LiteralMap, Primitive, Scalar + from flytekit.models.types import LiteralType, SimpleType + from flytekit.types.directory.types import FlyteDirectory ++from flytekit.types.file import JPEGImageFile + from flytekit.types.file.file import FlyteFile, FlyteFilePathTransformer + + +@@ -600,6 +601,24 @@ def test_enum_type(): + } + ), + ), ++ ( ++ {"p1": "s3://tmp/file.jpeg"}, ++ {"p1": JPEGImageFile}, ++ LiteralMap( ++ literals={ ++ "p1": Literal( ++ scalar=Scalar( ++ blob=Blob( ++ metadata=BlobMetadata( ++ type=BlobType(format="jpeg", dimensionality=BlobType.BlobDimensionality.SINGLE) ++ ), ++ uri="s3://tmp/file.jpeg", ++ ) ++ ) ++ ) ++ } ++ ), ++ ), + ], + ) + def test_dict_to_literal_map(python_value, python_types, expected_literal_map): +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,6 @@ ++H4sIAAAAAAAAA+3SPU+EQBAGYGp+xYRQaMHHwoGJiYWFCY2exTVWFz5W2QgsgYXIv3dBcxqjXnOX ++i/F9CnaZJbMTZtxsEFWx5c3oGcfiaxdRtKza13XZsyhgQRCuNMNnLPYDg6KjVfTJ0Ku0IzI6KdVv ++3+07/6Pcj/4r3qttLus6bQq3Lw93x77+hz7b9T9kse7/KvZjg/zDlfCzf97/vKCl8RkvTP7Syk7R ++/fUmubLsZH1747ntNI9GJppLe45bJh/Tiiz7bDkg0QhFjtOmqjz//mwOv+d92CTruyX77sp2UqVs ++QnJq0lsdpPnRe4+VfnsWyht0Ei+XHX8bTzW1XA/rk2i4Lo2c0Tz1DwQAAAAAAAAAAAAAAAAAAAAA ++OKFXHj3maQAoAAA= +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-001196/tests/test.sh b/tasks/format-code-task-001196/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..3704e6c7270b0b2ccac87efe9971624eaad441a4 --- /dev/null +++ b/tasks/format-code-task-001196/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/flytekit/unit/core/test_type_engine.py +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001196/tests/test_command.sh b/tasks/format-code-task-001196/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001196/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001214/environment/Dockerfile b/tasks/format-code-task-001214/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..40764d9d25825bb0103e5e70dd83501000bd4c97 --- /dev/null +++ b/tasks/format-code-task-001214/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:8b68a15edf0a814fc836042e6980755ba5781c700b03d185699de5c91906a31d diff --git a/tasks/format-code-task-001214/environment/setup/files/blocklist b/tasks/format-code-task-001214/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001214/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001214/environment/setup/setup.sh b/tasks/format-code-task-001214/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-001214/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001214/tests/test.patch b/tasks/format-code-task-001214/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..7612abbb4289f7c1833a036c078d4c91fb61490f --- /dev/null +++ b/tasks/format-code-task-001214/tests/test.patch @@ -0,0 +1,113 @@ +diff --git a/usercase-test-coderl/usecase.sh b/usercase-test-coderl/usecase.sh +new file mode 100755 +--- /dev/null ++++ b/usercase-test-coderl/usecase.sh +@@ -0,0 +1,91 @@ ++#!/usr/bin/env bash ++ ++set -u ++export LANG=C LC_ALL=C TZ=UTC ++ ++fail() { echo "FAIL: $*" >&2; exit 1; } ++ ++command -v xvfb-run >/dev/null 2>&1 || fail "xvfb-run is required to initialize wxWidgets in this environment" ++ ++( cd /workspace/repo && make NOGUI=1 NOASM=1 NOTEST=1 ) \ ++ || fail "build" ++ ++BIN=/workspace/repo/Main/truecrypt ++[ -x "$BIN" ] || fail "built binary not found at $BIN" ++ ++TMP=$(mktemp -d); trap 'rm -rf "$TMP"' EXIT ++cd "$TMP" || fail "tmpdir" ++ ++run_tc() { ++ xvfb-run -a "$BIN" "$@" ++} ++ ++ ++EXPECTED_VERSION_FILE="$TMP/expected-version.txt" ++printf 'TrueCrypt 7.1a\n' >"$EXPECTED_VERSION_FILE" ++ ++assert_exact_version_stdout() { ++ cmp -s out "$EXPECTED_VERSION_FILE" || fail "$1 stdout: $(od -An -tx1 -c out)" ++} ++ ++ ++ ++ ++run_tc --version >out 2>err; ec=$? ++[ "$ec" -eq 0 ] || fail "F1 exit $ec; want 0" ++assert_exact_version_stdout F1 ++[ ! -s err ] || fail "F1 unexpected stderr: $(cat err)" ++ ++ ++ ++ ++run_tc --version --create >out 2>err; ec=$? ++[ "$ec" -eq 0 ] || fail "F2 exit $ec; want 0" ++assert_exact_version_stdout F2 ++[ ! -s err ] || fail "F2 unexpected stderr: $(cat err)" ++ ++ ++ ++ ++run_tc --create --version >out 2>err; ec=$? ++[ "$ec" -eq 0 ] || fail "F3 exit $ec; want 0" ++assert_exact_version_stdout F3 ++[ ! -s err ] || fail "F3 unexpected stderr: $(cat err)" ++ ++ ++ ++ ++run_tc --help >out 2>err; ec=$? ++[ "$ec" -eq 0 ] || fail "F4 exit $ec; want 0" ++[ ! -s err ] || fail "F4 unexpected stderr: $(cat err)" ++awk ' ++ /^Commands:$/ { in_commands = 1; next } ++ /^MOUNTED_VOLUME:$/ { in_commands = 0 } ++ in_commands { print } ++' out >commands ++ ++ ++VERSION_HELP_ENTRY="$( ++ awk ' ++ /--version/ { in_entry = 1 } ++ in_entry { print } ++ in_entry && /^[[:space:]]*$/ { exit } ++ ' commands ++)" ++[ -n "$VERSION_HELP_ENTRY" ] || fail "F4 missing --version in Commands" ++printf '%s\n' "$VERSION_HELP_ENTRY" | grep -q -- '--version' \ ++ || fail "F4 missing --version in help entry: $VERSION_HELP_ENTRY" ++printf '%s\n' "$VERSION_HELP_ENTRY" | grep -qF 'Display program version.' \ ++ || fail "F4 missing version description in help entry: $VERSION_HELP_ENTRY" ++ ++ ++ ++ ++ ++run_tc --version --list >out 2>err; ec=$? ++[ "$ec" -eq 0 ] || fail "F5 exit $ec; want 0" ++assert_exact_version_stdout F5 ++[ ! -s err ] || fail "F5 unexpected stderr: $(cat err)" ++ ++echo "PASS" ++exit 0 +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,12 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++exec bash /workspace/repo/usercase-test-coderl/usecase.sh diff --git a/tasks/format-code-task-001214/tests/test.sh b/tasks/format-code-task-001214/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..d4d80bb634b14076ae561be99f395189577b7ac6 --- /dev/null +++ b/tasks/format-code-task-001214/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/usecase.sh +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001214/tests/test_command.sh b/tasks/format-code-task-001214/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-001214/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001222/environment/Dockerfile b/tasks/format-code-task-001222/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..e387e5fb30e527896110efdc3b84ced03ed74e2b --- /dev/null +++ b/tasks/format-code-task-001222/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:20d6735e02ea8f51c745c3a897bd4174e0ebf600be1298e2748994344cf462b2 diff --git a/tasks/format-code-task-001222/environment/setup/files/blocklist b/tasks/format-code-task-001222/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001222/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001222/environment/setup/setup.sh b/tasks/format-code-task-001222/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001222/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001222/tests/test.patch b/tasks/format-code-task-001222/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..4486c56c9b3bca5ea30cdccf39b52296c1f61396 --- /dev/null +++ b/tasks/format-code-task-001222/tests/test.patch @@ -0,0 +1,95 @@ +diff --git a/tests/functional/test_debug.py b/tests/functional/test_debug.py +index ff22fecb..1562be6f 100644 +--- a/tests/functional/test_debug.py ++++ b/tests/functional/test_debug.py +@@ -36,6 +36,7 @@ def create_socket(context): + socket.SOCK_STREAM, + socket.IPPROTO_TCP, + ) ++ context.sock.is_http = True + + + @httprettified +diff --git a/tests/unit/test_httpretty.py b/tests/unit/test_httpretty.py +index 63ba565e..525df6e8 100644 +--- a/tests/unit/test_httpretty.py ++++ b/tests/unit/test_httpretty.py +@@ -26,7 +26,7 @@ + # OTHER DEALINGS IN THE SOFTWARE. + from __future__ import unicode_literals + from sure import expect +-from httpretty import HTTPretty, HTTPrettyError ++from httpretty import HTTPretty, HTTPrettyError, core + from httpretty.core import URIInfo, BaseClass, Entry, FakeSockFile + from httpretty.http import STATUSES + +@@ -53,6 +53,48 @@ def test_httpretty_should_raise_proper_exception_on_inconsistent_length(): + ) + + ++def test_httpretty_should_raise_on_socket_send_when_uri_registered(): ++ """HTTPretty should raise a RuntimeError when the fakesocket is used in ++ an invalid usage. ++ """ ++ import socket ++ HTTPretty.enable() ++ ++ defaults = core.POTENTIAL_HTTP_PORTS[:] ++ core.POTENTIAL_HTTP_PORTS = [80, 443] ++ HTTPretty.register_uri(HTTPretty.GET, ++ 'http://127.0.0.1:5000') ++ expect(core.POTENTIAL_HTTP_PORTS).to.be.equal([80, 443, 5000]) ++ ++ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ++ sock.connect(('127.0.0.1', 5000)) ++ expect(sock.send).when.called_with(b'whatever').to.throw(RuntimeError) ++ sock.close() ++ ++ ++ core.POTENTIAL_HTTP_PORTS = defaults ++ HTTPretty.reset() ++ HTTPretty.disable() ++ ++ ++def test_httpretty_should_not_raise_on_socket_send_when_uri_not_registered(): ++ """HTTPretty should not raise a RuntimeError when the fakesocket is used in ++ an invalid usage. ++ """ ++ import socket ++ HTTPretty.enable() ++ ++ sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0) ++ sock.setblocking(0) ++ expect(sock.sendto).when.called_with(b'whatever', ++ ('127.0.0.1', 53) ++ ).should_not.throw(RuntimeError) ++ ++ sock.close() ++ HTTPretty.reset() ++ HTTPretty.disable() ++ ++ + def test_does_not_have_last_request_by_default(): + 'HTTPretty.last_request is a dummy object by default' + HTTPretty.reset() +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,5 @@ ++H4sIAAAAAAAAA+3S32qDMBQGcK99ijN2bWJC1ccp/smmUBMxR6nQh1900Mlg603LNvb9Lkwg+ZLg ++OaKaulNzNHaW0aOkQZFl2xh8Hre5yrTSujjkSkWpUnmqI8oe9qKdyXM5EkWjc/zdvlvrf5T4qD8b ++z8fa9X1pG+Hb+91xq/46P1zrn4XCpyq0QRFRer8nfO2f1//5SVadlVXp27huaGuCyjSxd9NYG5Ju ++YNkyD6NhXpJ57ZN1f1lzN5ds4mHh1llKegqzkKX14+VkO35vqGtYDAslM10uZM4dk9pFrfNGr4tb ++WLxMNhzvbHkS2xGNqabXXfCn/xkAAAAAAAAAAAAAAAAAAAAAwG/xBq17o7IAKAAA +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-001222/tests/test.sh b/tasks/format-code-task-001222/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..63bbfa78f513c1cb289e64f4fe798cdfcac80c94 --- /dev/null +++ b/tasks/format-code-task-001222/tests/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/functional/test_debug.py +tests/unit/test_httpretty.py +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001222/tests/test_command.sh b/tasks/format-code-task-001222/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001222/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001225/environment/Dockerfile b/tasks/format-code-task-001225/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..a800ca24443cf92f4e1f2fd6e85ab7e109d3bbb3 --- /dev/null +++ b/tasks/format-code-task-001225/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:101f2e6df72026b064e196c30dacaf1a1f4ad05fd8efc923b5686a6ecb417abe diff --git a/tasks/format-code-task-001225/environment/setup/files/blocklist b/tasks/format-code-task-001225/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001225/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001225/environment/setup/setup.sh b/tasks/format-code-task-001225/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001225/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001225/tests/test.patch b/tasks/format-code-task-001225/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..0109c109793491512bb7a6c2e08a5dc7c949840a --- /dev/null +++ b/tasks/format-code-task-001225/tests/test.patch @@ -0,0 +1,92 @@ +diff --git a/test/rules/assertions/requireReturnsCheck.js b/test/rules/assertions/requireReturnsCheck.js +index cb4cd724..70ba6945 100755 +--- a/test/rules/assertions/requireReturnsCheck.js ++++ b/test/rules/assertions/requireReturnsCheck.js +@@ -70,6 +70,22 @@ export default { + message: 'Found more than one @returns declaration.' + } + ] ++ }, ++ { ++ code: ` ++ /** ++ * @returns {String} Foo. ++ */ ++ function quux () { ++ ++ } ++ `, ++ errors: [ ++ { ++ line: 2, ++ message: 'Present JSDoc @returns declaration but not available return expression in function.' ++ } ++ ] + } + ], + valid: [ +@@ -147,7 +163,7 @@ export default { + }, + { + code: ` +- /** ++ /** + * @returns Foo. + * @abstract + */ +@@ -155,6 +171,33 @@ export default { + throw new Error('must be implemented by subclass!'); + } + ` ++ }, ++ { ++ code: ` ++ ++ ++ ++ function quux () { ++ } ++ ` ++ }, ++ { ++ code: ` ++ ++ ++ ++ function quux () { ++ } ++ ` ++ }, ++ { ++ code: ` ++ ++ ++ ++ function quux () { ++ } ++ ` + } + ] + }; +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 00000000..ae16742c +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["npx mocha --require @babel/register --reporter spec test/rules/index.js --grep require-returns-check"] ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++npx mocha --require @babel/register --reporter spec test/rules/index.js --grep require-returns-check ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-001225/tests/test.sh b/tasks/format-code-task-001225/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d9cbb4fbe92823a7e754903fe8ee5d45627c4cc --- /dev/null +++ b/tasks/format-code-task-001225/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test/rules/assertions/requireReturnsCheck.js +test_commands.json +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001225/tests/test_command.sh b/tasks/format-code-task-001225/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001225/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001240/environment/Dockerfile b/tasks/format-code-task-001240/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..0b604f801da94b97bbe2b3fd0d4e25b4cc5508ed --- /dev/null +++ b/tasks/format-code-task-001240/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:c8ebafe12c227ab947f77c03292831a43f3e791c91810728934d10bff3d91a03 diff --git a/tasks/format-code-task-001240/environment/setup/files/blocklist b/tasks/format-code-task-001240/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001240/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001240/environment/setup/setup.sh b/tasks/format-code-task-001240/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-001240/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001240/tests/test.patch b/tasks/format-code-task-001240/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..3cd29c0434ce3c3c365030a0f96f42fff33cdd37 --- /dev/null +++ b/tasks/format-code-task-001240/tests/test.patch @@ -0,0 +1,399 @@ +diff --git a/usercase-test-coderl/projector_entities_test.cc b/usercase-test-coderl/projector_entities_test.cc +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/projector_entities_test.cc +@@ -0,0 +1,353 @@ ++ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++using namespace gz; ++using namespace sim; ++ ++namespace ++{ ++void Fail(const std::string &_message) ++{ ++ std::cerr << _message << std::endl; ++ std::exit(1); ++} ++ ++template ++void CheckEq(const T &_actual, const U &_expected, const std::string &_label) ++{ ++ if (!(_actual == _expected)) ++ { ++ std::ostringstream out; ++ out << _label << ": expected [" << _expected << "], got [" << _actual ++ << "]"; ++ Fail(out.str()); ++ } ++} ++ ++void CheckNear(double _actual, double _expected, double _tolerance, ++ const std::string &_label) ++{ ++ if (std::fabs(_actual - _expected) > _tolerance) ++ { ++ std::ostringstream out; ++ out << _label << ": expected [" << _expected << "], got [" << _actual ++ << "]"; ++ Fail(out.str()); ++ } ++} ++ ++sdf::Projector MakeProjector(const std::string &_name, ++ const math::Pose3d &_pose, double _near, double _far, double _fov, ++ const std::string &_texture, uint32_t _visibility) ++{ ++ sdf::Projector projector; ++ projector.SetName(_name); ++ projector.SetRawPose(_pose); ++ projector.SetNearClip(_near); ++ projector.SetFarClip(_far); ++ projector.SetHorizontalFov(math::Angle(_fov)); ++ projector.SetTexture(_texture); ++ projector.SetVisibilityFlags(_visibility); ++ return projector; ++} ++ ++std::vector ProjectorEntities(EntityComponentManager &_ecm) ++{ ++ std::vector entities; ++ _ecm.Each( ++ [&](const Entity &_entity, const components::Projector *) -> bool ++ { ++ entities.push_back(_entity); ++ return true; ++ }); ++ return entities; ++} ++ ++Entity ProjectorEntityByName(EntityComponentManager &_ecm, ++ const std::string &_name) ++{ ++ Entity found = kNullEntity; ++ _ecm.Each( ++ [&](const Entity &_entity, const components::Projector *) -> bool ++ { ++ const auto *nameComp = _ecm.Component(_entity); ++ if (nameComp && nameComp->Data() == _name) ++ { ++ if (found != kNullEntity) ++ Fail("duplicate projector entity named " + _name); ++ found = _entity; ++ } ++ return true; ++ }); ++ ++ if (found == kNullEntity) ++ Fail("missing projector entity named " + _name); ++ return found; ++} ++ ++void CheckProjectorEntity(EntityComponentManager &_ecm, Entity _entity, ++ const std::string &_name, const math::Pose3d &_pose, double _near, ++ double _far, double _fov, const std::string &_texture, ++ uint32_t _visibility, Entity _parent) ++{ ++ const auto *projectorComp = _ecm.Component(_entity); ++ if (!projectorComp) ++ Fail("missing components::Projector on entity"); ++ ++ const auto *poseComp = _ecm.Component(_entity); ++ if (!poseComp) ++ Fail("missing components::Pose on entity"); ++ ++ const auto *nameComp = _ecm.Component(_entity); ++ if (!nameComp) ++ Fail("missing components::Name on entity"); ++ ++ CheckEq(nameComp->Data(), _name, "components::Name"); ++ CheckEq(poseComp->Data(), _pose, "components::Pose"); ++ ++ const auto &projector = projectorComp->Data(); ++ CheckEq(projector.Name(), _name, "components::Projector.Name"); ++ CheckEq(projector.RawPose(), _pose, "components::Projector.RawPose"); ++ CheckNear(projector.NearClip(), _near, 1e-12, ++ "components::Projector.NearClip"); ++ CheckNear(projector.FarClip(), _far, 1e-12, ++ "components::Projector.FarClip"); ++ CheckNear(projector.HorizontalFov().Radian(), _fov, 1e-12, ++ "components::Projector.HorizontalFov"); ++ CheckEq(projector.Texture(), _texture, "components::Projector.Texture"); ++ CheckEq(projector.VisibilityFlags(), _visibility, ++ "components::Projector.VisibilityFlags"); ++ ++ if (_parent != kNullEntity) ++ { ++ const auto *parentComp = _ecm.Component(_entity); ++ if (!parentComp) ++ Fail("missing components::ParentEntity on child projector"); ++ CheckEq(parentComp->Data(), _parent, "components::ParentEntity"); ++ CheckEq(_ecm.ParentEntity(_entity), _parent, "ECM parent entity"); ++ } ++} ++ ++void CreateOneProjectorInScope() ++{ ++ EntityComponentManager ecm; ++ EventManager evm; ++ SdfEntityCreator creator(ecm, evm); ++ auto projector = MakeProjector("projector", ++ math::Pose3d(1, 2, 3, 0, 0, 0), 2.0, 7.0, 0.5, ++ "path/to/dummy_image.png", 0x01); ++ Entity entity = creator.CreateEntities(&projector); ++ ++ if (entity == kNullEntity) ++ Fail("scoped projector creation returned null entity"); ++ CheckEq(ecm.EntityCount(), static_cast(1), ++ "scoped entity count"); ++} ++ ++void DirectProjectorCreation() ++{ ++ ++ ++ EntityComponentManager ecm; ++ EventManager evm; ++ SdfEntityCreator creator(ecm, evm); ++ ++ CheckEq(ecm.EntityCount(), static_cast(0), ++ "fresh entity count"); ++ ++ auto projector = MakeProjector("projector", ++ math::Pose3d(1, 2, 3, 0, 0, 0), 2.0, 7.0, 0.5, ++ "path/to/dummy_image.png", 0x01); ++ ++ Entity entity = creator.CreateEntities(&projector); ++ ++ if (entity == kNullEntity) ++ Fail("direct projector creation returned null entity"); ++ CheckEq(ecm.EntityCount(), static_cast(1), ++ "entity count after direct projector creation"); ++ CheckProjectorEntity(ecm, entity, "projector", ++ math::Pose3d(1, 2, 3, 0, 0, 0), 2.0, 7.0, 0.5, ++ "path/to/dummy_image.png", 0x01, kNullEntity); ++} ++ ++void LinkWithSingleProjector() ++{ ++ ++ ++ EntityComponentManager ecm; ++ EventManager evm; ++ SdfEntityCreator creator(ecm, evm); ++ ++ sdf::Link link; ++ link.SetName("link"); ++ link.AddProjector(MakeProjector("projector", ++ math::Pose3d(1, 2, 3, 0, 0, 0), 2.0, 7.0, 0.5, ++ "path/to/dummy_image.png", 0x01)); ++ ++ Entity linkEntity = creator.CreateEntities(&link); ++ ++ if (linkEntity == kNullEntity) ++ Fail("single-projector link creation returned null entity"); ++ CheckEq(ecm.EntityCount(), static_cast(2), ++ "entity count after link with one projector"); ++ ++ const auto projectors = ProjectorEntities(ecm); ++ CheckEq(projectors.size(), static_cast(1), ++ "projector entity count under single-projector link"); ++ ++ ++ const Entity projectorEntity = ProjectorEntityByName(ecm, "projector"); ++ CheckProjectorEntity(ecm, projectorEntity, "projector", ++ math::Pose3d(1, 2, 3, 0, 0, 0), 2.0, 7.0, 0.5, ++ "path/to/dummy_image.png", 0x01, linkEntity); ++} ++ ++void LinkWithMultipleProjectors() ++{ ++ ++ ++ EntityComponentManager ecm; ++ EventManager evm; ++ SdfEntityCreator creator(ecm, evm); ++ ++ sdf::Link link; ++ link.SetName("link"); ++ link.AddProjector(MakeProjector("projector_a", ++ math::Pose3d(1, 2, 3, 0, 0, 0), 2.0, 7.0, 0.5, ++ "path/to/dummy_image.png", 0x01)); ++ link.AddProjector(MakeProjector("projector_b", ++ math::Pose3d(4, 5, 6, 0.1, 0.2, 0.3), 3.0, 8.0, 0.75, ++ "path/to/second_image.png", 0x02)); ++ ++ Entity linkEntity = creator.CreateEntities(&link); ++ ++ if (linkEntity == kNullEntity) ++ Fail("multi-projector link creation returned null entity"); ++ CheckEq(ecm.EntityCount(), static_cast(3), ++ "entity count after link with two projectors"); ++ ++ const auto projectors = ProjectorEntities(ecm); ++ CheckEq(projectors.size(), static_cast(2), ++ "projector entity count under multi-projector link"); ++ ++ ++ const Entity projectorA = ProjectorEntityByName(ecm, "projector_a"); ++ const Entity projectorB = ProjectorEntityByName(ecm, "projector_b"); ++ CheckProjectorEntity(ecm, projectorA, "projector_a", ++ math::Pose3d(1, 2, 3, 0, 0, 0), 2.0, 7.0, 0.5, ++ "path/to/dummy_image.png", 0x01, linkEntity); ++ CheckProjectorEntity(ecm, projectorB, "projector_b", ++ math::Pose3d(4, 5, 6, 0.1, 0.2, 0.3), 3.0, 8.0, 0.75, ++ "path/to/second_image.png", 0x02, linkEntity); ++} ++ ++void IndependentCreatorInstances() ++{ ++ ++ ++ EntityComponentManager ecmA; ++ EventManager evmA; ++ SdfEntityCreator creatorA(ecmA, evmA); ++ sdf::Link link; ++ link.SetName("link"); ++ link.AddProjector(MakeProjector("projector_a", ++ math::Pose3d(1, 2, 3, 0, 0, 0), 2.0, 7.0, 0.5, ++ "path/to/dummy_image.png", 0x01)); ++ link.AddProjector(MakeProjector("projector_b", ++ math::Pose3d(4, 5, 6, 0.1, 0.2, 0.3), 3.0, 8.0, 0.75, ++ "path/to/second_image.png", 0x02)); ++ Entity linkEntity = creatorA.CreateEntities(&link); ++ ++ if (linkEntity == kNullEntity) ++ Fail("first instance link creation returned null entity"); ++ ++ EntityComponentManager ecmB; ++ EventManager evmB; ++ SdfEntityCreator creatorB(ecmB, evmB); ++ auto projector = MakeProjector("projector", ++ math::Pose3d(1, 2, 3, 0, 0, 0), 2.0, 7.0, 0.5, ++ "path/to/dummy_image.png", 0x01); ++ Entity projectorEntity = creatorB.CreateEntities(&projector); ++ ++ CheckEq(ecmA.EntityCount(), static_cast(3), ++ "first instance entity count"); ++ CheckEq(ecmB.EntityCount(), static_cast(1), ++ "second instance entity count"); ++ ++ if (projectorEntity == kNullEntity) ++ Fail("second instance projector creation returned null entity"); ++ CheckProjectorEntity(ecmA, ProjectorEntityByName(ecmA, "projector_a"), ++ "projector_a", ++ math::Pose3d(1, 2, 3, 0, 0, 0), 2.0, 7.0, 0.5, ++ "path/to/dummy_image.png", 0x01, linkEntity); ++ CheckProjectorEntity(ecmB, projectorEntity, "projector", ++ math::Pose3d(1, 2, 3, 0, 0, 0), 2.0, 7.0, 0.5, ++ "path/to/dummy_image.png", 0x01, kNullEntity); ++} ++ ++void RepeatedDestructionIsBenign() ++{ ++ ++ ++ EntityComponentManager ecm; ++ EventManager evm; ++ auto creator = std::make_unique(ecm, evm); ++ auto projector = MakeProjector("projector", ++ math::Pose3d(1, 2, 3, 0, 0, 0), 2.0, 7.0, 0.5, ++ "path/to/dummy_image.png", 0x01); ++ Entity entity = creator->CreateEntities(&projector); ++ ++ ++ if (entity == kNullEntity) ++ Fail("projector creation before creator reset returned null entity"); ++ CheckEq(ecm.EntityCount(), static_cast(1), ++ "entity count after creation"); ++ CheckProjectorEntity(ecm, entity, "projector", ++ math::Pose3d(1, 2, 3, 0, 0, 0), 2.0, 7.0, 0.5, ++ "path/to/dummy_image.png", 0x01, kNullEntity); ++ creator.reset(); ++ creator.reset(); ++} ++ ++void LeakFloorForConstructUseDestructCycles() ++{ ++ ++ ++ ++ ++ ++ for (int i = 0; i < 3; ++i) ++ CreateOneProjectorInScope(); ++} ++} ++ ++int main() ++{ ++ DirectProjectorCreation(); ++ LinkWithSingleProjector(); ++ LinkWithMultipleProjectors(); ++ IndependentCreatorInstances(); ++ RepeatedDestructionIsBenign(); ++ LeakFloorForConstructUseDestructCycles(); ++ return 0; ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,36 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++set -euo pipefail ++ ++cd /workspace/repo ++ ++cmake -S . -B build-fixture -DBUILD_TESTING=OFF -DENABLE_GUI=OFF ++cmake --build build-fixture --target gz-sim -j "${JOBS:-2}" ++ ++c++ -std=c++17 \ ++ -I/workspace/repo/include \ ++ -I/workspace/repo/build-fixture/include \ ++ -I/workspace/repo/build-fixture/core/include \ ++ -I/workspace/repo/build-fixture/src \ ++ -I/workspace/repo/build-fixture/gz_msgs_gen \ ++ $(pkg-config --cflags sdformat gz-math gz-common gz-plugin gz-utils \ ++ gz-transport gz-fuel_tools gz-physics gz-rendering) \ ++ /workspace/repo/usercase-test-coderl/projector_entities_test.cc \ ++ -L/workspace/repo/build-fixture/lib \ ++ -Wl,-rpath,/workspace/repo/build-fixture/lib \ ++ -lgz-sim \ ++ $(pkg-config --libs sdformat gz-math gz-common gz-plugin gz-utils \ ++ gz-transport gz-fuel_tools gz-physics gz-rendering) \ ++ -lfmt -lspdlog -lpython3.12 \ ++ -o /workspace/repo/build-fixture/projector_entities_test ++ ++exec /workspace/repo/build-fixture/projector_entities_test diff --git a/tasks/format-code-task-001240/tests/test.sh b/tasks/format-code-task-001240/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..dc0fac35e9780b1e990ae2a7d427a93bba4ecc4e --- /dev/null +++ b/tasks/format-code-task-001240/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/projector_entities_test.cc +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001240/tests/test_command.sh b/tasks/format-code-task-001240/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-001240/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001247/environment/Dockerfile b/tasks/format-code-task-001247/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..ad363e5140e4378e73ae64d5737a742bf49c357a --- /dev/null +++ b/tasks/format-code-task-001247/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:860044ac3465c4b6355ab77c075214ed705d7150088147d8cc88ae0688673e9c diff --git a/tasks/format-code-task-001247/environment/setup/files/blocklist b/tasks/format-code-task-001247/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001247/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001247/environment/setup/setup.sh b/tasks/format-code-task-001247/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001247/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001247/tests/test.patch b/tasks/format-code-task-001247/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..4a9715af3ae5ac2089c1a7a13547d09a8f942911 --- /dev/null +++ b/tasks/format-code-task-001247/tests/test.patch @@ -0,0 +1,81 @@ +diff --git a/tests/test_backends.py b/tests/test_backends.py +index 25e1d3fce..64c4bb5a9 100644 +--- a/tests/test_backends.py ++++ b/tests/test_backends.py +@@ -318,6 +318,27 @@ def test_einsum(self): + gs_result = gs.einsum('...,...i->...i', array_1, array_2) + self.assertAllCloseToNp(gs_result, np_result) + ++ def test_einsum_dtypes(self): ++ np_array_1 = _np.array([[1, 4]]) ++ np_array_2 = _np.array([[2., 3.]]) ++ array_1 = gs.array([[1, 4]]) ++ array_2 = gs.array([[2., 3.]]) ++ ++ np_result = _np.einsum('...i,...i->...', np_array_1, np_array_2) ++ gs_result = gs.einsum('...i,...i->...', array_1, array_2) ++ ++ self.assertAllCloseToNp(gs_result, np_result) ++ ++ np_array_1 = _np.array([[1., 4.], [-1., 5.]]) ++ np_array_2 = _np.array([[2, 3]]) ++ array_1 = gs.array([[1., 4.], [-1., 5.]]) ++ array_2 = gs.array([[2, 3]]) ++ ++ np_result = _np.einsum('...i,...i->...', np_array_1, np_array_2) ++ gs_result = gs.einsum('...i,...i->...', array_1, array_2) ++ ++ self.assertAllCloseToNp(gs_result, np_result) ++ + def test_assignment_with_matrices(self): + np_array = _np.zeros((2, 3, 3)) + gs_array = gs.zeros((2, 3, 3)) +@@ -826,3 +847,27 @@ def test_where(self): + expected = _np.where(np_array == 1, _np.ones(10), np_array) + result = gs.where(gs_array == 1, gs.ones(10), gs_array) + self.assertAllCloseToNp(result, expected) ++ ++ def test_convert_to_wider_dtype(self): ++ gs_list = [gs.array([1, 2]), gs.array([2.2, 3.3], dtype=gs.float32)] ++ gs_result = gs.convert_to_wider_dtype(gs_list) ++ ++ result = [a.dtype == gs.float32 for a in gs_result] ++ ++ self.assertTrue(gs.all(result)) ++ ++ gs_list = [gs.array([1, 2]), gs.array([2.2, 3.3], dtype=gs.float64)] ++ gs_result = gs.convert_to_wider_dtype(gs_list) ++ ++ result = [a.dtype == gs.float64 for a in gs_result] ++ ++ self.assertTrue(gs.all(result)) ++ ++ gs_list = [ ++ gs.array([11.11, 222.2], dtype=gs.float64), ++ gs.array([2.2, 3.3], dtype=gs.float32)] ++ gs_result = gs.convert_to_wider_dtype(gs_list) ++ ++ result = [a.dtype == gs.float64 for a in gs_result] ++ ++ self.assertTrue(gs.all(result)) +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,5 @@ ++H4sIAAAAAAAAA+3STU/DIBwGcM79FHyBvvzrWE8e5lw8GPWw3Zu2ELc4oCm0sd9eVhM1JrrLFqM+ ++vwMQILw9JHW/28tSmSFl55IFhRBTHXyupzaJPMsLCtNmLCOaEzEuznaiD3rnq45z1lnrv5t3bPyX ++St7z98r5srFaV0Ymbnu6PY7lT6J4y5/y0E+zOQnGs9Md4Wv/PP9G8in4WslIPbe28/xm9XC33iw2 ++6/Jqsbxd3V9fml63Y5Ta1qePyurwYt7Fw+HP1DuTtqPfWnPBY81DM6zFD4V7/U911TwpI13Sjjwe ++op++LgAAAAAAAAAAAAAAAAAAAADAn/IC4XAKNgAoAAA= +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-001247/tests/test.sh b/tasks/format-code-task-001247/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..3fdd3cc96edfd60c6d6f3967cf76d9e4e93ebaf2 --- /dev/null +++ b/tasks/format-code-task-001247/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/test_backends.py +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001247/tests/test_command.sh b/tasks/format-code-task-001247/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001247/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001350/environment/Dockerfile b/tasks/format-code-task-001350/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..c1d44b06854f9b12564fe88048c0df71b535f7dc --- /dev/null +++ b/tasks/format-code-task-001350/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:301ce9caa89ecb06354d5c5cac0003bec3e82f910ea0513d39ea566699b3719c diff --git a/tasks/format-code-task-001350/environment/setup/files/blocklist b/tasks/format-code-task-001350/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001350/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001350/environment/setup/setup.sh b/tasks/format-code-task-001350/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-001350/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001350/tests/test.patch b/tasks/format-code-task-001350/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..837c8e08aaa0ca7279dded6bb5161a46bcdd2316 --- /dev/null +++ b/tasks/format-code-task-001350/tests/test.patch @@ -0,0 +1,214 @@ +diff --git a/usercase-test-coderl/usecase.sh b/usercase-test-coderl/usecase.sh +new file mode 100755 +--- /dev/null ++++ b/usercase-test-coderl/usecase.sh +@@ -0,0 +1,192 @@ ++#!/usr/bin/env bash ++ ++set -u ++export LANG=C.UTF-8 LC_ALL=C.UTF-8 TZ=UTC ++ ++ROOT=/workspace/repo ++OS_ARCH="$(go env GOOS)_$(go env GOARCH)" ++ ++export GO111MODULE=off ++ ++export GOPROXY=off ++export GOSUMDB=off ++ ++compiler_targets=( ++ "build/bin/grumpc" ++ "build/pkg/${OS_ARCH}/grumpy.a" ++ "build/lib/python2.7/site-packages/grumpy/__init__.py" ++) ++while IFS= read -r source; do ++ compiler_targets+=("build/lib/python2.7/site-packages/grumpy/compiler/$(basename "$source")") ++done < <(find "$ROOT/compiler" -name '*.py' -not -name '*_test.py' -print) ++while IFS= read -r source; do ++ rel="${source#"$ROOT/third_party/"}" ++ compiler_targets+=("build/lib/python2.7/site-packages/grumpy/$rel") ++done < <(find "$ROOT/third_party/pythonparser" -name '*.py' -print) ++ ++( cd "$ROOT" && make "${compiler_targets[@]}" ) \ ++ || { echo "FAIL: build" >&2; exit 1; } ++ ++BIN="$ROOT/build/bin/grumpc" ++TMP=$(mktemp -d) ++trap 'rm -rf "$TMP"' EXIT ++ ++export GOPATH="$ROOT/build:$TMP/gopath" ++export PYTHONPATH="$ROOT/build/lib/python2.7/site-packages" ++export PATH="$ROOT/build/bin:$PATH" ++ ++mkdir -p "$TMP/gopath/src/__python__" ++cd "$TMP" || exit 1 ++ ++fail() { echo "FAIL: $*" >&2; exit 1; } ++ ++compile_module() { ++ local mod="$1" ++ local source="$2" ++ mkdir -p "$TMP/gopath/src/__python__/$mod" ++ printf '%s\n' "$source" > "$TMP/$mod.py" ++ "$BIN" -modname="$mod" "$TMP/$mod.py" \ ++ > "$TMP/gopath/src/__python__/$mod/module.go" 2> "$TMP/$mod.compile.err" ++ return $? ++} ++ ++write_runner() { ++ local mod="$1" ++ cat > "$TMP/run_$mod.go" < "$TMP/$fixture.compile.out" ++ local ec=$? ++ [ "$ec" -eq 0 ] || fail "$fixture compile exit $ec; stderr: $(cat "$TMP/$mod.compile.err")" ++ [ ! -s "$TMP/$fixture.compile.out" ] || fail "$fixture unexpected compile helper stdout" ++ [ ! -s "$TMP/$mod.compile.err" ] || fail "$fixture unexpected compile stderr: $(cat "$TMP/$mod.compile.err")" ++ [ -s "$TMP/gopath/src/__python__/$mod/module.go" ] || fail "$fixture emitted empty Go source" ++ ++ write_runner "$mod" ++ go run "$TMP/run_$mod.go" > "$TMP/$fixture.run.out" 2> "$TMP/$fixture.run.err" ++ ec=$? ++ [ "$ec" -eq 0 ] || fail "$fixture run exit $ec; stderr: $(cat "$TMP/$fixture.run.err")" ++ [ "$(cat "$TMP/$fixture.run.out")" = "$expected" ] \ ++ || fail "$fixture result: $(cat "$TMP/$fixture.run.out"); want $expected" ++ [ ! -s "$TMP/$fixture.run.err" ] || fail "$fixture unexpected run stderr: $(cat "$TMP/$fixture.run.err")" ++} ++ ++assert_compile_error() { ++ local fixture="$1" ++ local mod="$2" ++ local source="$3" ++ local expected_stderr="$4" ++ ++ compile_module "$mod" "$source" > "$TMP/$fixture.compile.out" ++ local ec=$? ++ [ "$ec" -ne 0 ] || fail "$fixture compile unexpectedly exited 0" ++ ++ [ ! -s "$TMP/$fixture.compile.out" ] || fail "$fixture unexpected compile stdout" ++ ++ [ -s "$TMP/$mod.compile.err" ] \ ++ || fail "$fixture expected compile diagnostic like: $expected_stderr" ++ [ ! -s "$TMP/gopath/src/__python__/$mod/module.go" ] \ ++ || fail "$fixture should not emit partial Go source" ++} ++ ++ ++ ++ ++assert_success_case "F1" "ucpos" \ ++ $'def add(a, b): return a + b\nresult = add(2, 3)' \ ++ "5" ++ ++ ++ ++ ++assert_success_case "F2" "uckw" \ ++ $'def pair(a, b): return (a, b)\nresult = pair(b="bee", a="aye")' \ ++ "('aye', 'bee')" ++ ++ ++ ++ ++assert_success_case "F3" "ucstar" \ ++ $'more = (2, 3)\ndef f(a, b, c): return (a, b, c)\nresult = f(1, *more)' \ ++ "(1, 2, 3)" ++ ++ ++ ++ ++assert_success_case "F4" "uckwargs" \ ++ $'extra = {"y": 2}\ndef f(x, y): return (x, y)\nresult = f(x=1, **extra)' \ ++ "(1, 2)" ++ ++ ++ ++ ++assert_compile_error "F5" "errcallee" \ ++ $'result = ({x for x in (1, 2)})(1)' \ ++ "line 1: node not yet implemented: SetComp" ++ ++ ++ ++ ++assert_compile_error "F6" "errpos" \ ++ $'def consume(x): return x\nresult = consume(1 @ 2)' \ ++ "line 2: binary op not implemented: MatMult" ++ ++ ++ ++ ++assert_compile_error "F7" "errkw" \ ++ $'def consume(x): return x\nresult = consume(x={x for x in (1, 2)})' \ ++ "line 2: node not yet implemented: SetComp" ++ ++ ++ ++ ++assert_compile_error "F8" "errstar" \ ++ $'def consume(x): return x\nresult = consume(*{x for x in (1, 2)})' \ ++ "line 2: node not yet implemented: SetComp" ++ ++ ++ ++ ++assert_compile_error "F9" "errkwargs" \ ++ $'def consume(x): return x\nresult = consume(**{x for x in (1, 2)})' \ ++ "line 2: node not yet implemented: SetComp" ++ ++echo "PASS" ++exit 0 +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,12 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++exec bash /workspace/repo/usercase-test-coderl/usecase.sh diff --git a/tasks/format-code-task-001350/tests/test.sh b/tasks/format-code-task-001350/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..d4d80bb634b14076ae561be99f395189577b7ac6 --- /dev/null +++ b/tasks/format-code-task-001350/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/usecase.sh +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001350/tests/test_command.sh b/tasks/format-code-task-001350/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-001350/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001368/environment/Dockerfile b/tasks/format-code-task-001368/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..2b56c9fbb0f2654620f7a37ddfd4919aac4f0300 --- /dev/null +++ b/tasks/format-code-task-001368/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:e785337806026a1078ee6a46c2251e7b59a46b44cef4a0bf49a08e1ad2db3f62 diff --git a/tasks/format-code-task-001368/environment/setup/files/blocklist b/tasks/format-code-task-001368/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001368/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001368/environment/setup/setup.sh b/tasks/format-code-task-001368/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001368/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001368/tests/test.patch b/tasks/format-code-task-001368/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..8b858a476be4ea7d64fe8150094b5947393661bd --- /dev/null +++ b/tasks/format-code-task-001368/tests/test.patch @@ -0,0 +1,159 @@ +diff --git a/packages/translate/test/index.js b/packages/translate/test/index.js +index 5d4c60bbca..0e668a512e 100644 +--- a/packages/translate/test/index.js ++++ b/packages/translate/test/index.js +@@ -497,6 +497,132 @@ describe('Translate', function() { + }); + }); + ++ describe('input shape preservation (issue #2486)', function() { ++ var OPTIONS = { ++ from: 'en', ++ to: 'es' ++ }; ++ ++ describe('translate', function() { ++ it('should return a string when input is a single string', function(done) { ++ var apiResponse = { ++ data: { ++ translations: [{ translatedText: 'Hola' }] ++ } ++ }; ++ translate.request = function(reqOpts, callback) { ++ callback(null, apiResponse); ++ }; ++ translate.translate('Hello', OPTIONS, function(err, translations) { ++ assert.ifError(err); ++ assert.strictEqual(Array.isArray(translations), false); ++ assert.strictEqual(translations, 'Hola'); ++ done(); ++ }); ++ }); ++ ++ it('should return a single-element array when input is a single-element array', function(done) { ++ var apiResponse = { ++ data: { ++ translations: [{ translatedText: 'Hola' }] ++ } ++ }; ++ translate.request = function(reqOpts, callback) { ++ callback(null, apiResponse); ++ }; ++ translate.translate(['Hello'], OPTIONS, function(err, translations) { ++ assert.ifError(err); ++ assert.strictEqual(Array.isArray(translations), true); ++ assert.deepEqual(translations, ['Hola']); ++ done(); ++ }); ++ }); ++ ++ it('should return an array when input is a multi-element array', function(done) { ++ var apiResponse = { ++ data: { ++ translations: [ ++ { translatedText: 'Hola' }, ++ { translatedText: 'Adios' } ++ ] ++ } ++ }; ++ translate.request = function(reqOpts, callback) { ++ callback(null, apiResponse); ++ }; ++ translate.translate(['Hello', 'Goodbye'], OPTIONS, function(err, translations) { ++ assert.ifError(err); ++ assert.strictEqual(Array.isArray(translations), true); ++ assert.deepEqual(translations, ['Hola', 'Adios']); ++ done(); ++ }); ++ }); ++ }); ++ ++ describe('detect', function() { ++ it('should return a single object when input is a single string', function(done) { ++ var apiResponse = { ++ data: { ++ detections: [ ++ [{ language: 'en', confidence: 1 }] ++ ] ++ } ++ }; ++ translate.request = function(reqOpts, callback) { ++ callback(null, apiResponse); ++ }; ++ translate.detect('Hello', function(err, results) { ++ assert.ifError(err); ++ assert.strictEqual(Array.isArray(results), false); ++ assert.strictEqual(results.language, 'en'); ++ assert.strictEqual(results.input, 'Hello'); ++ done(); ++ }); ++ }); ++ ++ it('should return a single-element array when input is a single-element array', function(done) { ++ var apiResponse = { ++ data: { ++ detections: [ ++ [{ language: 'en', confidence: 1 }] ++ ] ++ } ++ }; ++ translate.request = function(reqOpts, callback) { ++ callback(null, apiResponse); ++ }; ++ translate.detect(['Hello'], function(err, results) { ++ assert.ifError(err); ++ assert.strictEqual(Array.isArray(results), true); ++ assert.strictEqual(results.length, 1); ++ assert.strictEqual(results[0].language, 'en'); ++ assert.strictEqual(results[0].input, 'Hello'); ++ done(); ++ }); ++ }); ++ ++ it('should return an array when input is a multi-element array', function(done) { ++ var apiResponse = { ++ data: { ++ detections: [ ++ [{ language: 'en', confidence: 1 }], ++ [{ language: 'es', confidence: 1 }] ++ ] ++ } ++ }; ++ translate.request = function(reqOpts, callback) { ++ callback(null, apiResponse); ++ }; ++ translate.detect(['Hello', 'Hola'], function(err, results) { ++ assert.ifError(err); ++ assert.strictEqual(Array.isArray(results), true); ++ assert.strictEqual(results.length, 2); ++ done(); ++ }); ++ }); ++ }); ++ }); ++ + describe('request', function() { + describe('OAuth mode', function() { + var request; +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 0000000000..25a35b0cb0 +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["cd packages/translate && ../../node_modules/.bin/mocha test/index.js"] ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++cd packages/translate && ../../node_modules/.bin/mocha test/index.js ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-001368/tests/test.sh b/tasks/format-code-task-001368/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..9916389131a777ac842d36a3442544df933383fa --- /dev/null +++ b/tasks/format-code-task-001368/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +packages/translate/test/index.js +test_commands.json +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001368/tests/test_command.sh b/tasks/format-code-task-001368/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001368/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001411/environment/Dockerfile b/tasks/format-code-task-001411/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..316d3e590fc85af3849dc3ef65e9727fa61a41a1 --- /dev/null +++ b/tasks/format-code-task-001411/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:b90c4fe54c8daf6df044c556f95f08eba4b19450c15d9851345291024bd8eb25 diff --git a/tasks/format-code-task-001411/environment/setup/files/blocklist b/tasks/format-code-task-001411/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001411/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001411/environment/setup/setup.sh b/tasks/format-code-task-001411/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001411/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001411/tests/test.patch b/tasks/format-code-task-001411/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..ffa9678cee4ac02cbd621a6c6d72b2a62fd64a79 --- /dev/null +++ b/tasks/format-code-task-001411/tests/test.patch @@ -0,0 +1,111 @@ +diff --git a/src/js/components/List/__tests__/List-test.tsx b/src/js/components/List/__tests__/List-test.tsx +index 2e66fabf1..46f395e23 100644 +--- a/src/js/components/List/__tests__/List-test.tsx ++++ b/src/js/components/List/__tests__/List-test.tsx +@@ -1199,3 +1199,84 @@ describe('List pinned', () => { + expect(iconStyle.fill).toBe('pink'); + }); + }); ++ ++describe('List onOrder a11y role', () => { ++ test('ul should have role="list" when onOrder is provided', () => { ++ const { container } = render( ++ ++ {}} ++ /> ++ , ++ ); ++ const ul = container.querySelector('ul'); ++ expect(ul).toHaveAttribute('role', 'list'); ++ }); ++ ++ test('ul should have role="listbox" when onClickItem is provided', () => { ++ const { container } = render( ++ ++ {}} ++ /> ++ , ++ ); ++ const ul = container.querySelector('ul'); ++ expect(ul).toHaveAttribute('role', 'listbox'); ++ }); ++ ++ test('ul should have role="list" when neither onOrder nor onClickItem is provided', () => { ++ const { container } = render( ++ ++ ++ , ++ ); ++ const ul = container.querySelector('ul'); ++ expect(ul).toHaveAttribute('role', 'list'); ++ }); ++ ++ test('List with onOrder should have no accessibility violations', async () => { ++ const { container } = render( ++ ++ {}} ++ /> ++ , ++ ); ++ const results = await axe(container); ++ expect(results).toHaveNoViolations(); ++ }); ++ ++ test('aria-activedescendant is set on ul for onOrder when navigating with ArrowDown', () => { ++ const { container, getByText } = render( ++ ++ {}} ++ /> ++ , ++ ); ++ fireEvent.click(getByText('alpha')); ++ fireEvent.mouseOver(getByText('alpha')); ++ fireEvent.keyDown(getByText('alpha'), { ++ key: 'ArrowDown', ++ keyCode: 40, ++ which: 40, ++ }); ++ const ul = container.querySelector('ul'); ++ expect(ul).toHaveAttribute('aria-activedescendant', 'alphaMoveDown'); ++ }); ++}); +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 000000000..fb4753447 +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["npx jest src/js/components/List/__tests__/List-test.tsx -t \"List onOrder a11y role\" --no-coverage"] ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++npx jest src/js/components/List/__tests__/List-test.tsx -t "List onOrder a11y role" --no-coverage ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-001411/tests/test.sh b/tasks/format-code-task-001411/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..3b495de86c544f7fc67c11d8abc3615025db9afa --- /dev/null +++ b/tasks/format-code-task-001411/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +src/js/components/List/__tests__/List-test.tsx +test_commands.json +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001411/tests/test_command.sh b/tasks/format-code-task-001411/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001411/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001416/environment/Dockerfile b/tasks/format-code-task-001416/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..379c00ac6d62d5e500712dee987e76371f7b265f --- /dev/null +++ b/tasks/format-code-task-001416/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:92eaa49956094f2a52a2b798d8364d6f0320620553da672714638600cab3e6e5 diff --git a/tasks/format-code-task-001416/environment/setup/files/blocklist b/tasks/format-code-task-001416/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001416/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001416/environment/setup/setup.sh b/tasks/format-code-task-001416/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-001416/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001416/tests/test.patch b/tasks/format-code-task-001416/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..3f047c81764470e25f4556e22a0b4fda499ba756 --- /dev/null +++ b/tasks/format-code-task-001416/tests/test.patch @@ -0,0 +1,264 @@ +diff --git a/usercase-test-coderl/test_asx_action_adapters.py b/usercase-test-coderl/test_asx_action_adapters.py +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/test_asx_action_adapters.py +@@ -0,0 +1,232 @@ ++import gc ++import tracemalloc ++ ++import numpy as np ++ ++from asx_gym.envs import ( ++ AsxAction, ++ AsxTransaction, ++ BUY_STOCK, ++ HOLD_STOCK, ++ SELL_STOCK, ++ TOP_UP_FUND, ++ WITHDRAW_FUND, ++) ++ ++ ++ ++ ++ ++ ++ ++ ++ ++def _empty_env_action(size=3): ++ return { ++ "company_count": 0, ++ "end_batch": 0, ++ "company_id": np.array([0] * size, dtype=np.int64), ++ "volume": np.array([0.0] * size, dtype=np.float32), ++ "price": np.array([0.0] * size, dtype=np.float32), ++ "stock_operation": np.array([0] * size, dtype=np.int64), ++ } ++ ++ ++def test_transaction_json_formats_all_operation_labels_and_rounds_values(): ++ ++ ++ ++ ++ transactions = [ ++ AsxTransaction("7", BUY_STOCK, 12.345, 6.789), ++ AsxTransaction("7", SELL_STOCK, 12.345, 6.789), ++ AsxTransaction("7", HOLD_STOCK, 12.345, 6.789), ++ AsxTransaction("7", TOP_UP_FUND, 12.345, 6.789), ++ AsxTransaction("7", WITHDRAW_FUND, 12.345, 6.789), ++ AsxTransaction("7", 99, 12.345, 6.789), ++ ] ++ ++ assert [tx.to_json_obj() for tx in transactions] == [ ++ {"company_id": 7, "stock_operation": "buy", "volume": 12.35, "price": 6.79}, ++ {"company_id": 7, "stock_operation": "sell", "volume": 12.35, "price": 6.79}, ++ {"company_id": 7, "stock_operation": "hold", "volume": 12.35, "price": 6.79}, ++ {"company_id": 7, "stock_operation": "top_up", "volume": 12.35, "price": 6.79}, ++ {"company_id": 7, "stock_operation": "withdraw", "volume": 12.35, "price": 6.79}, ++ {"company_id": 7, "stock_operation": "unknown", "volume": 12.35, "price": 6.79}, ++ ] ++ ++ ++def test_action_session_adds_transactions_then_copies_to_env_action_in_order(): ++ ++ ++ ++ ++ action = AsxAction(1) ++ assert action.to_json_obj() == {"end_batch": 1, "transactions": []} ++ ++ action.add_transaction(AsxTransaction(7, BUY_STOCK, 3, 10.5)) ++ assert action.to_json_obj() == { ++ "end_batch": 1, ++ "transactions": [ ++ {"company_id": 7, "stock_operation": "buy", "volume": 3.0, "price": 10.5} ++ ], ++ } ++ ++ action.add_transaction(AsxTransaction(8, SELL_STOCK, 4, 9.25)) ++ assert action.to_json_obj() == { ++ "end_batch": 1, ++ "transactions": [ ++ {"company_id": 7, "stock_operation": "buy", "volume": 3.0, "price": 10.5}, ++ {"company_id": 8, "stock_operation": "sell", "volume": 4.0, "price": 9.25}, ++ ], ++ } ++ ++ env_action = _empty_env_action() ++ returned = action.copy_to_env_action(env_action) ++ ++ assert returned is env_action ++ assert env_action["company_count"] == 2 ++ assert env_action["end_batch"] == 1 ++ assert env_action["company_id"][:2].tolist() == [7, 8] ++ assert env_action["volume"][:2].tolist() == [3.0, 4.0] ++ assert env_action["price"][:2].tolist() == [10.5, 9.25] ++ assert env_action["stock_operation"][:2].tolist() == [1, 2] ++ ++ ++def test_from_env_action_reconstructs_ordered_session_and_json(): ++ ++ ++ ++ ++ env_action = { ++ "company_count": 3, ++ "end_batch": 0, ++ "company_id": np.array([4, 5, 6], dtype=np.int64), ++ "volume": np.array([1.111, 2.222, 3.333], dtype=np.float32), ++ "price": np.array([8.888, 9.999, 10.555], dtype=np.float32), ++ "stock_operation": np.array([HOLD_STOCK, TOP_UP_FUND, WITHDRAW_FUND], dtype=np.int64), ++ } ++ ++ action = AsxAction.from_env_action(env_action) ++ ++ assert action.to_json_obj() == { ++ "end_batch": 0, ++ "transactions": [ ++ {"company_id": 4, "stock_operation": "hold", "volume": 1.11, "price": 8.89}, ++ {"company_id": 5, "stock_operation": "top_up", "volume": 2.22, "price": 10.0}, ++ {"company_id": 6, "stock_operation": "withdraw", "volume": 3.33, "price": 10.56}, ++ ], ++ } ++ ++ ++def test_from_env_action_zero_company_count_yields_empty_session(): ++ ++ ++ ++ ++ env_action = { ++ "company_count": 0, ++ "end_batch": 0, ++ "company_id": np.array([9, 9], dtype=np.int64), ++ "volume": np.array([9.0, 9.0], dtype=np.float32), ++ "price": np.array([9.0, 9.0], dtype=np.float32), ++ "stock_operation": np.array([9, 9], dtype=np.int64), ++ } ++ ++ action = AsxAction.from_env_action(env_action) ++ ++ assert action.to_json_obj() == {"end_batch": 0, "transactions": []} ++ ++ ++def test_separate_asx_actions_do_not_share_transaction_lists(): ++ ++ ++ ++ ++ a = AsxAction(1) ++ b = AsxAction(0) ++ ++ a.add_transaction(AsxTransaction(7, BUY_STOCK, 3, 10.5)) ++ a.add_transaction(AsxTransaction(8, SELL_STOCK, 4, 9.25)) ++ b.add_transaction(AsxTransaction(3, HOLD_STOCK, 1, 2.345)) ++ ++ assert a.to_json_obj() == { ++ "end_batch": 1, ++ "transactions": [ ++ {"company_id": 7, "stock_operation": "buy", "volume": 3.0, "price": 10.5}, ++ {"company_id": 8, "stock_operation": "sell", "volume": 4.0, "price": 9.25}, ++ ], ++ } ++ assert b.to_json_obj() == { ++ "end_batch": 0, ++ "transactions": [ ++ {"company_id": 3, "stock_operation": "hold", "volume": 1.0, "price": 2.35} ++ ], ++ } ++ ++ ++def test_from_env_action_reads_required_indexed_arrays(): ++ ++ ++ ++ ++ env_action = { ++ "company_count": 1, ++ "end_batch": 1, ++ "company_id": np.array([12], dtype=np.int64), ++ "volume": np.array([2.5], dtype=np.float32), ++ "price": np.array([7.25], dtype=np.float32), ++ "stock_operation": np.array([BUY_STOCK], dtype=np.int64), ++ } ++ ++ action = AsxAction.from_env_action(env_action) ++ ++ ++ assert action.to_json_obj() == { ++ "end_batch": 1, ++ "transactions": [ ++ {"company_id": 12, "stock_operation": "buy", "volume": 2.5, "price": 7.25} ++ ], ++ } ++ ++ ++def test_repeated_adapter_sessions_do_not_accumulate_hidden_heap_state(): ++ ++ ++ ++ ++ ++ def exercise_session_once(i): ++ action = AsxAction(i % 2) ++ action.add_transaction(AsxTransaction(7, BUY_STOCK, 3, 10.5)) ++ action.add_transaction(AsxTransaction(8, SELL_STOCK, 4, 9.25)) ++ env_action = { ++ "company_count": 0, ++ "end_batch": 0, ++ "company_id": [0, 0], ++ "volume": [0.0, 0.0], ++ "price": [0.0, 0.0], ++ "stock_operation": [0, 0], ++ } ++ action.copy_to_env_action(env_action) ++ AsxAction.from_env_action(env_action).to_json_obj() ++ ++ for i in range(20): ++ exercise_session_once(i) ++ ++ gc.collect() ++ tracemalloc.start() ++ gc.collect() ++ start_current, _ = tracemalloc.get_traced_memory() ++ ++ for i in range(250): ++ exercise_session_once(i) ++ if i % 25 == 0: ++ gc.collect() ++ ++ gc.collect() ++ end_current, _ = tracemalloc.get_traced_memory() ++ tracemalloc.stop() ++ ++ ++ assert end_current - start_current <= 64 * 1024 +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,22 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++export PIP_DISABLE_PIP_VERSION_CHECK=1 ++export PIP_NO_INDEX=1 ++export PIP_NO_INPUT=1 ++export PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 ++set -e ++cd /workspace/repo ++set -euo pipefail ++ ++cd /workspace/repo ++ ++python -m pip install --no-index --no-build-isolation --root-user-action=ignore -e . pytest >/dev/null ++ ++exec python -m pytest /workspace/repo/usercase-test-coderl/test_asx_action_adapters.py -v diff --git a/tasks/format-code-task-001416/tests/test.sh b/tasks/format-code-task-001416/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0da81f487c4269b3776e11acfa73159dc707c47a --- /dev/null +++ b/tasks/format-code-task-001416/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/test_asx_action_adapters.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001416/tests/test_command.sh b/tasks/format-code-task-001416/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-001416/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001429/environment/Dockerfile b/tasks/format-code-task-001429/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..a87902f3ed019f50731b907e539312b621c2f383 --- /dev/null +++ b/tasks/format-code-task-001429/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:53d107f6786b831301719f8a2d9442963be703191f246e71f4b03d9fe34c1162 diff --git a/tasks/format-code-task-001429/environment/setup/files/blocklist b/tasks/format-code-task-001429/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001429/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001429/environment/setup/setup.sh b/tasks/format-code-task-001429/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001429/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001429/tests/test.patch b/tasks/format-code-task-001429/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..f399fdc75279c3b5976cd2367b69b74c0e7bbf53 --- /dev/null +++ b/tasks/format-code-task-001429/tests/test.patch @@ -0,0 +1,86 @@ +diff --git a/handsontable/src/utils/__tests__/ghostTable.spec.js b/handsontable/src/utils/__tests__/ghostTable.spec.js +index 76f3aee8f0c..98eb041a6d4 100644 +--- a/handsontable/src/utils/__tests__/ghostTable.spec.js ++++ b/handsontable/src/utils/__tests__/ghostTable.spec.js +@@ -297,4 +297,54 @@ describe('GhostTable', () => { + expect(gt.isVertical()).toBe(false); + expect(gt.isHorizontal()).toBe(true); + }); ++ ++ it('should not change the coords of the cell meta after row rendering', () => { ++ const hot = handsontable(hotSettings); ++ ++ gt = new Handsontable.__GhostTable(hot); ++ ++ spyOn(hot, 'getCellMeta').and.returnValue({ ++ row: 3, ++ col: 4, ++ visualRow: 5, ++ visualCol: 6, ++ renderer: jasmine.createSpy('renderer'), ++ }); ++ ++ gt.samples = new Map([[0, { strings: [{ col: 0, value: 'test' }] }]]); ++ gt.createRow(0); ++ ++ const cellMeta = getCellMeta(0, 0); ++ ++ expect(cellMeta.renderer).toHaveBeenCalledTimes(1); ++ expect(cellMeta.row).toBe(3); ++ expect(cellMeta.col).toBe(4); ++ expect(cellMeta.visualRow).toBe(5); ++ expect(cellMeta.visualCol).toBe(6); ++ }); ++ ++ it('should not change the coords of the cell meta after column rendering', () => { ++ const hot = handsontable(hotSettings); ++ ++ gt = new Handsontable.__GhostTable(hot); ++ ++ spyOn(hot, 'getCellMeta').and.returnValue({ ++ row: 3, ++ col: 4, ++ visualRow: 5, ++ visualCol: 6, ++ renderer: jasmine.createSpy('renderer'), ++ }); ++ ++ gt.samples = new Map([[0, { strings: [{ row: 0, value: 'test' }] }]]); ++ gt.createCol(0); ++ ++ const cellMeta = getCellMeta(0, 0); ++ ++ expect(cellMeta.renderer).toHaveBeenCalledTimes(1); ++ expect(cellMeta.row).toBe(3); ++ expect(cellMeta.col).toBe(4); ++ expect(cellMeta.visualRow).toBe(5); ++ expect(cellMeta.visualCol).toBe(6); ++ }); + }); +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,11 @@ ++H4sIAAAAAAAAA+2UTW/TQBCGc/avGFSJtgd/pqZSJHoAKsEBhBCco7U9iZfaa3dnnRKJH8+s2yZp ++KPTSCqHOI0WOdmbeeb2z66gYdFPN0aziyVORMKd5Pj6Z/ef4P82zNEvSJD+ZTpI0zU+zCeRP5miH ++gZyyABPbde5veQ/F/1Oi7fwdkpuXXdsqU0VUP16PB+af5km+mf9J6ud/8iqZTiB5PAt/5pnP/+BF ++XGgTF4rqgNBBiEFQVjAehgKrIDiAc0ODRfjUVQhZAppAlU6vEI4sXg7aYgWLzgKfnF45XehGuzVc ++aVeDqzm55DqWx+OgwlVIHChrMNdiXv6D4Qk0DdCaHLZQYY+mQlNqpBkLG0c38oY0ZxgHvf6BDVif ++ZrVZgjZQo6oaJIK3te1aDFTvwiW/jr4RD9cQXl5ey4WNLtCy1c7AGcTsKjYD52RnL9NgUYalKmuE ++cPF7cMet6Vu46uwF9arEO6YDH9r0DUk33rOvh5/glObF/M4exzVfOGJnqmjQ93jjryR8+/gO3u9E ++9rYbMwQvQMdjQzsYGK/ybGiru92mW81GmeWglgjs+oL2Cm+DdG+54f3dNoWFbhx6L66DzjRrWNYd ++ua/eaEQ9ltF3zuFRwOB0Q/F8PpbN574nf2TMQi/Hpc/K1fxjLfP6cC833moewq1XH5uxj6ga2v4e ++p198Tr1rdaUV9EPfo0O0cLR3VHj7/Fn0qTGVVveOYu4Tbiqill9lDJ9n56xueKl2rZ/tCm3REQb/ +++hILgiAIgiAIgiAIgiAIgiAIgiAIgiAIgvCs+QUfghzSACgAAA== +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-001429/tests/test.sh b/tasks/format-code-task-001429/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..5926b91b13c72ef5c2a587719f256a896929120e --- /dev/null +++ b/tasks/format-code-task-001429/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +handsontable/src/utils/__tests__/ghostTable.spec.js +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001429/tests/test_command.sh b/tasks/format-code-task-001429/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001429/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001442/environment/Dockerfile b/tasks/format-code-task-001442/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..da357d7ab44b75039a107090e6557db283c4efce --- /dev/null +++ b/tasks/format-code-task-001442/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:c394c955c711459d340281ed2f43d6eb097dfdd48c176fcc674b7700cb70bf2a diff --git a/tasks/format-code-task-001442/environment/setup/files/blocklist b/tasks/format-code-task-001442/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001442/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001442/environment/setup/setup.sh b/tasks/format-code-task-001442/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001442/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001442/tests/test.patch b/tasks/format-code-task-001442/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..b4793e384d7d1c4e813e8de6752310f77c3d057f --- /dev/null +++ b/tasks/format-code-task-001442/tests/test.patch @@ -0,0 +1,159 @@ +diff --git a/hclwrite/examples_test.go b/hclwrite/examples_test.go +index 78882efb..f848ce29 100644 +--- a/hclwrite/examples_test.go ++++ b/hclwrite/examples_test.go +@@ -48,9 +48,13 @@ func Example_generateFromScratch() { + // Output: + // string = "foo" + // +- // object = { bar = 5, baz = true, foo = "foo" } +- // bool = false +- // path = env.PATH ++ // object = { ++ // bar = 5 ++ // baz = true ++ // foo = "foo" ++ // } ++ // bool = false ++ // path = env.PATH + // + // foo { + // hello = "world" +diff --git a/hclwrite/generate_test.go b/hclwrite/generate_test.go +index 112ff825..d74a086f 100644 +--- a/hclwrite/generate_test.go ++++ b/hclwrite/generate_test.go +@@ -340,10 +340,14 @@ func TestTokensForValue(t *testing.T) { + Type: hclsyntax.TokenOBrace, + Bytes: []byte(`{`), + }, ++ { ++ Type: hclsyntax.TokenNewline, ++ Bytes: []byte("\n"), ++ }, + { + Type: hclsyntax.TokenIdent, + Bytes: []byte(`foo`), +- SpacesBefore: 1, ++ SpacesBefore: 2, + }, + { + Type: hclsyntax.TokenEqual, +@@ -356,9 +360,12 @@ func TestTokensForValue(t *testing.T) { + SpacesBefore: 1, + }, + { +- Type: hclsyntax.TokenCBrace, +- Bytes: []byte(`}`), +- SpacesBefore: 1, ++ Type: hclsyntax.TokenNewline, ++ Bytes: []byte("\n"), ++ }, ++ { ++ Type: hclsyntax.TokenCBrace, ++ Bytes: []byte(`}`), + }, + }, + }, +@@ -372,10 +379,14 @@ func TestTokensForValue(t *testing.T) { + Type: hclsyntax.TokenOBrace, + Bytes: []byte(`{`), + }, ++ { ++ Type: hclsyntax.TokenNewline, ++ Bytes: []byte("\n"), ++ }, + { + Type: hclsyntax.TokenIdent, + Bytes: []byte(`bar`), +- SpacesBefore: 1, ++ SpacesBefore: 2, + }, + { + Type: hclsyntax.TokenEqual, +@@ -388,13 +399,13 @@ func TestTokensForValue(t *testing.T) { + SpacesBefore: 1, + }, + { +- Type: hclsyntax.TokenComma, +- Bytes: []byte(`,`), ++ Type: hclsyntax.TokenNewline, ++ Bytes: []byte("\n"), + }, + { + Type: hclsyntax.TokenIdent, + Bytes: []byte(`foo`), +- SpacesBefore: 1, ++ SpacesBefore: 2, + }, + { + Type: hclsyntax.TokenEqual, +@@ -407,9 +418,12 @@ func TestTokensForValue(t *testing.T) { + SpacesBefore: 1, + }, + { +- Type: hclsyntax.TokenCBrace, +- Bytes: []byte(`}`), +- SpacesBefore: 1, ++ Type: hclsyntax.TokenNewline, ++ Bytes: []byte("\n"), ++ }, ++ { ++ Type: hclsyntax.TokenCBrace, ++ Bytes: []byte(`}`), + }, + }, + }, +@@ -422,10 +436,14 @@ func TestTokensForValue(t *testing.T) { + Type: hclsyntax.TokenOBrace, + Bytes: []byte(`{`), + }, ++ { ++ Type: hclsyntax.TokenNewline, ++ Bytes: []byte("\n"), ++ }, + { + Type: hclsyntax.TokenOQuote, + Bytes: []byte(`"`), +- SpacesBefore: 1, ++ SpacesBefore: 2, + }, + { + Type: hclsyntax.TokenQuotedLit, +@@ -446,9 +464,12 @@ func TestTokensForValue(t *testing.T) { + SpacesBefore: 1, + }, + { +- Type: hclsyntax.TokenCBrace, +- Bytes: []byte(`}`), +- SpacesBefore: 1, ++ Type: hclsyntax.TokenNewline, ++ Bytes: []byte("\n"), ++ }, ++ { ++ Type: hclsyntax.TokenCBrace, ++ Bytes: []byte(`}`), + }, + }, + }, +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,5 @@ ++H4sIAAAAAAAAA+3RQQrCMBAF0K49xeDe1qipJ7AXUNyWmA5WbBNJU3Xh4Y3dKIK6UUT8bzNDJpAJ ++P161m6rI2eyT6FOGwVTKrgb3teuFHAmRyqlMw3nohIhIfmyjG23jlSOKnLX+2b1X8x8VX/P33Phc ++27pWpoib8n1vvMpfjMU1f5GG/CfpKOQ/fN8Kj/15/rqgLvgVF721pUtLgz3FSamrg9t4TmjgWkP9 ++RZgs7JZNk1m3VFXLp9lR1buK8zUbdspz5mw916HTZb/37Y8BAAAAAAAAAAAAAAAAAAAAAPyBM2+c ++nzcAKAAA +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-001442/tests/test.sh b/tasks/format-code-task-001442/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..576747a14abb8dbac8116c3ef56a4512d42c01cf --- /dev/null +++ b/tasks/format-code-task-001442/tests/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +hclwrite/examples_test.go +hclwrite/generate_test.go +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001442/tests/test_command.sh b/tasks/format-code-task-001442/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001442/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001445/environment/Dockerfile b/tasks/format-code-task-001445/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..3ee12b85e023a310b7ec313bdcadb94f072c9b09 --- /dev/null +++ b/tasks/format-code-task-001445/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:a7d830cfd4f01039cbbc5680889784a06e9624db3cf83800489eb6359cd9216b diff --git a/tasks/format-code-task-001445/environment/setup/files/blocklist b/tasks/format-code-task-001445/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001445/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001445/environment/setup/setup.sh b/tasks/format-code-task-001445/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001445/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001445/tests/test.patch b/tasks/format-code-task-001445/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..9d4dc3aa093bedabe574f89f75d69bae9a8bf439 --- /dev/null +++ b/tasks/format-code-task-001445/tests/test.patch @@ -0,0 +1,81 @@ +diff --git a/client/fingerprint/consul_test.go b/client/fingerprint/consul_test.go +index 10fc8d44b81..e2eecf4385c 100644 +--- a/client/fingerprint/consul_test.go ++++ b/client/fingerprint/consul_test.go +@@ -9,6 +9,7 @@ import ( + + "github.com/hashicorp/nomad/client/config" + "github.com/hashicorp/nomad/nomad/structs" ++ "github.com/stretchr/testify/assert" + ) + + func TestConsulFingerprint(t *testing.T) { +@@ -159,3 +160,44 @@ const mockConsulResponse = ` + } + } + ` ++ ++ ++ ++ ++func TestConsulFingerprint_UnexpectedResponse(t *testing.T) { ++ assert := assert.New(t) ++ fp := NewConsulFingerprint(testLogger()) ++ node := &structs.Node{ ++ Attributes: make(map[string]string), ++ } ++ ++ ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ++ w.Header().Set("Content-Type", "application/json") ++ fmt.Fprintln(w, "{}") ++ })) ++ defer ts.Close() ++ ++ config := config.DefaultConfig() ++ config.ConsulConfig.Addr = strings.TrimPrefix(ts.URL, "http://") ++ ++ ok, err := fp.Fingerprint(config, node) ++ assert.Nil(err) ++ assert.True(ok) ++ ++ attrs := []string{ ++ "consul.server", ++ "consul.version", ++ "consul.revision", ++ "unique.consul.name", ++ "consul.datacenter", ++ } ++ for _, attr := range attrs { ++ if v, ok := node.Attributes[attr]; ok { ++ t.Errorf("unexpected node attribute %q with vlaue %q", attr, v) ++ } ++ } ++ ++ if v, ok := node.Links["consul"]; ok { ++ t.Errorf("Unexpected link to consul: %v", v) ++ } ++} +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,8 @@ ++H4sIAAAAAAAAA+3STY/TMBAG4J7zK0ZlD7tC+XBpEoHUA+KjHEBZLeW8SmInMXU8ke1U7L/HaQWt ++VoIKqSuEmOeS1JOOJ3kdVaNU/F7oXTx7KomXp+n+6j2+7u9ZumAsz/J0mc8SxrJFMoP0ySY6MVpX ++GoCZQXS/e+5c/R8VHfN3wrr7Gvu+1Dyy3eX2OJd/nrFj/izz+S+zF8sZJJcb4df+8/xrDvvgK8GD ++4Bl8Fg7GAdYILHoJ1zuhORrBoVLlViwqKK0VfaUeQAvBLZhRO9kLsA99hcr/Fj3u/ONSH1qw5PlN ++IL4NaBysi7ui2KxiHFzcYuj7/6jcvt58OF2PK6lfXU2rpyMV08K0k5J6Cw0acJ20gIrD9WBE2CMf ++lbA3MBj8Kmp33PfQfwrQbxD0Wy4NhAPMrw6l2Jo6bqXrxiryxz/uStvJGs0wD5SG0Db65yc6/59Y ++Y1/y+TT43aj9iAL8+Wr9O0wtbFD/QY91wRj7VLz98vHdCpsGWtw3gSiulRTaxY3UrTCDkf4eQh8G ++bHz9DWo7qvfHGoQ7CGv0Wa1Y8LcPHCGEEEIIIYQQQgghhBBCCCGEEEIIuajv9eLNTgAoAAA= +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-001445/tests/test.sh b/tasks/format-code-task-001445/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..871ea8d6a653fe818c77e24457b2942923e0457f --- /dev/null +++ b/tasks/format-code-task-001445/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +client/fingerprint/consul_test.go +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001445/tests/test_command.sh b/tasks/format-code-task-001445/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001445/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001473/environment/Dockerfile b/tasks/format-code-task-001473/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..ba1f44bbfcaa9075f680db3f7e00f0602a7db2ef --- /dev/null +++ b/tasks/format-code-task-001473/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:065735a5c0fbd15081233479fb9cdba6e812e2d41b7e29a35df6b9f98f81f766 diff --git a/tasks/format-code-task-001473/environment/setup/files/blocklist b/tasks/format-code-task-001473/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001473/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001473/environment/setup/setup.sh b/tasks/format-code-task-001473/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-001473/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001473/tests/test.patch b/tasks/format-code-task-001473/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..e0b214c63572d35ef755a2bd9c93539b3cf6973c --- /dev/null +++ b/tasks/format-code-task-001473/tests/test.patch @@ -0,0 +1,511 @@ +diff --git a/usercase-test-coderl/plugin_lifecycle.test.js b/usercase-test-coderl/plugin_lifecycle.test.js +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/plugin_lifecycle.test.js +@@ -0,0 +1,481 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++var expect = require('chai').expect; ++var fs = require('fs'); ++var path = require('path'); ++var vm = require('vm'); ++ ++function installWebAudioHarness() { ++ var nextNodeId = 1; ++ var activeConnections = []; ++ ++ function removeConnection(source, target) { ++ for (var i = activeConnections.length - 1; i >= 0; i--) { ++ if (activeConnections[i].source === source && activeConnections[i].target === target) { ++ activeConnections.splice(i, 1); ++ } ++ } ++ } ++ ++ function FakeAudioParam(defaultValue) { ++ this.value = defaultValue; ++ this.events = []; ++ } ++ ++ FakeAudioParam.prototype.setValueAtTime = function(value, time) { ++ this.value = value; ++ this.events.push(['setValueAtTime', value, time]); ++ }; ++ ++ FakeAudioParam.prototype.linearRampToValueAtTime = function(value, time) { ++ this.value = value; ++ this.events.push(['linearRampToValueAtTime', value, time]); ++ }; ++ ++ FakeAudioParam.prototype.exponentialRampToValueAtTime = function(value, time) { ++ this.value = value; ++ this.events.push(['exponentialRampToValueAtTime', value, time]); ++ }; ++ ++ FakeAudioParam.prototype.setTargetAtTime = function(value, time, constant) { ++ this.value = value; ++ this.events.push(['setTargetAtTime', value, time, constant]); ++ }; ++ ++ FakeAudioParam.prototype.cancelScheduledValues = function(time) { ++ this.events.push(['cancelScheduledValues', time]); ++ }; ++ ++ function FakeAudioNode(kind) { ++ this.kind = kind; ++ this.id = nextNodeId++; ++ this.gain = new FakeAudioParam(1); ++ this._outgoing = []; ++ this._incoming = []; ++ } ++ ++ FakeAudioNode.prototype.connect = function(target) { ++ if (!(target instanceof FakeAudioNode)) { ++ throw new TypeError('target must be an AudioNode'); ++ } ++ this._outgoing.push(target); ++ target._incoming.push(this); ++ activeConnections.push({ source: this, target: target }); ++ }; ++ ++ FakeAudioNode.prototype.disconnect = function() { ++ while (this._outgoing.length > 0) { ++ var target = this._outgoing.pop(); ++ var incomingIndex = target._incoming.indexOf(this); ++ if (incomingIndex > -1) { ++ target._incoming.splice(incomingIndex, 1); ++ } ++ removeConnection(this, target); ++ } ++ }; ++ ++ FakeAudioNode.prototype.incomingConnectionCount = function() { ++ return this._incoming.length; ++ }; ++ ++ FakeAudioNode.prototype.outgoingConnectionCount = function() { ++ return this._outgoing.length; ++ }; ++ ++ FakeAudioNode.activeConnectionCount = function() { ++ return activeConnections.length; ++ }; ++ ++ function FakeAudioContext() { ++ this.currentTime = 1.25; ++ this.sampleRate = 44100; ++ this.destination = new FakeAudioNode('Destination'); ++ } ++ ++ FakeAudioContext.prototype.createGain = function() { ++ return new FakeAudioNode('Gain'); ++ }; ++ ++ FakeAudioContext.prototype.createOscillator = function() { ++ var node = new FakeAudioNode('Oscillator'); ++ node.start = function() {}; ++ node.stop = function() {}; ++ return node; ++ }; ++ ++ FakeAudioContext.prototype.createDelay = function() { ++ return new FakeAudioNode('Delay'); ++ }; ++ ++ FakeAudioContext.prototype.createBiquadFilter = function() { ++ return new FakeAudioNode('BiquadFilter'); ++ }; ++ ++ FakeAudioContext.prototype.createDynamicsCompressor = function() { ++ return new FakeAudioNode('DynamicsCompressor'); ++ }; ++ ++ FakeAudioContext.prototype.createConvolver = function() { ++ return new FakeAudioNode('Convolver'); ++ }; ++ ++ FakeAudioContext.prototype.createWaveShaper = function() { ++ return new FakeAudioNode('WaveShaper'); ++ }; ++ ++ FakeAudioContext.prototype.createBufferSource = function() { ++ return new FakeAudioNode('BufferSource'); ++ }; ++ ++ FakeAudioContext.prototype.createAnalyser = function() { ++ return new FakeAudioNode('Analyser'); ++ }; ++ ++ FakeAudioContext.prototype.createPanner = function() { ++ return new FakeAudioNode('Panner'); ++ }; ++ ++ FakeAudioContext.prototype.createPeriodicWave = function() { ++ return { kind: 'PeriodicWave' }; ++ }; ++ ++ FakeAudioContext.prototype.createChannelSplitter = function() { ++ return new FakeAudioNode('ChannelSplitter'); ++ }; ++ ++ FakeAudioContext.prototype.createChannelMerger = function() { ++ return new FakeAudioNode('ChannelMerger'); ++ }; ++ ++ FakeAudioContext.prototype.createBuffer = function() { ++ return { kind: 'Buffer' }; ++ }; ++ ++ global.window = global; ++ global.console = console; ++ global.AudioNode = FakeAudioNode; ++ global.AudioParam = FakeAudioParam; ++ global.AudioContext = FakeAudioContext; ++ delete global.webkitAudioContext; ++ delete global.WX; ++ ++ return FakeAudioNode; ++} ++ ++function loadScript(relativePath) { ++ var filename = path.join('/workspace/repo', relativePath); ++ var code = fs.readFileSync(filename, 'utf8'); ++ vm.runInThisContext(code, { filename: filename }); ++} ++ ++function loadWaax() { ++ var FakeAudioNode = installWebAudioHarness(); ++ loadScript('src/waax.js'); ++ loadScript('src/waax.util.js'); ++ loadScript('src/waax.extension.js'); ++ loadScript('src/waax.core.js'); ++ loadScript('src/plug_ins/Fader/fader.js'); ++ WX.Log.setLevel(3); ++ return { ++ WX: WX, ++ FakeAudioNode: FakeAudioNode ++ }; ++} ++ ++function expectPlainObjectSnapshot(snapshot) { ++ expect(snapshot).to.be.an('object'); ++ expect(snapshot).to.not.equal(null); ++ expect(Object.getPrototypeOf(snapshot)).to.equal(Object.prototype); ++} ++ ++function installProbeParam(plugin, name, defaultValue) { ++ plugin.params[name] = { ++ value: defaultValue, ++ set: function(value, time, rampType) { ++ plugin.params[name].value = value; ++ plugin.events.push([value, time === undefined ? 'undefined' : time, rampType === undefined ? 'undefined' : rampType]); ++ }, ++ get: function() { ++ return plugin.params[name].value; ++ } ++ }; ++} ++ ++function registerProbeFactories(WX) { ++ function ProbeGenerator(preset) { ++ this.events = []; ++ WX.PlugIn.defineType(this, 'Generator'); ++ installProbeParam(this, 'gain', 0.2); ++ WX.PlugIn.initPreset(this, preset); ++ } ++ ++ ProbeGenerator.prototype = { ++ info: { ++ name: 'ProbeGenerator', ++ api_version: '1.0.0-alpha', ++ type: 'Generator' ++ }, ++ defaultPreset: { ++ gain: 0.2 ++ }, ++ $gain: function() {} ++ }; ++ ++ function ProbeProcessor(preset) { ++ this.events = []; ++ WX.PlugIn.defineType(this, 'Processor'); ++ installProbeParam(this, 'gain', 0.4); ++ WX.PlugIn.initPreset(this, preset); ++ } ++ ++ ProbeProcessor.prototype = { ++ info: { ++ name: 'ProbeProcessor', ++ api_version: '1.0.0-alpha', ++ type: 'Processor' ++ }, ++ defaultPreset: { ++ gain: 0.4 ++ }, ++ $gain: function() {} ++ }; ++ ++ function ProbeAnalyzer(preset) { ++ this.events = []; ++ WX.PlugIn.defineType(this, 'Analyzer'); ++ installProbeParam(this, 'gain', 0.6); ++ WX.PlugIn.initPreset(this, preset); ++ } ++ ++ ProbeAnalyzer.prototype = { ++ info: { ++ name: 'ProbeAnalyzer', ++ api_version: '1.0.0-alpha', ++ type: 'Analyzer' ++ }, ++ defaultPreset: { ++ gain: 0.6 ++ }, ++ $gain: function() {} ++ }; ++ ++ WX.PlugIn.extendPrototype(ProbeGenerator, 'Generator'); ++ WX.PlugIn.extendPrototype(ProbeProcessor, 'Processor'); ++ WX.PlugIn.extendPrototype(ProbeAnalyzer, 'Analyzer'); ++ WX.PlugIn.register(ProbeGenerator); ++ WX.PlugIn.register(ProbeProcessor); ++ WX.PlugIn.register(ProbeAnalyzer); ++} ++ ++describe('WAAX plug-in stateful control surface', function() { ++ it('updates Fader parameters immediately and reports unknown parameters as null', function() { ++ ++ ++ ++ ++ var env = loadWaax(); ++ var fader = env.WX.Fader(); ++ ++ ++ expect(fader.get('input')).to.not.equal(null); ++ expect(fader.get('output')).to.not.equal(null); ++ expect(fader.get('notAParam')).to.equal(null); ++ expect(fader.set('input', 0.25)).to.equal(fader); ++ expect(fader.get('input')).to.equal(0.25); ++ expect(fader.set('missing', 0.99)).to.equal(fader); ++ expect(fader.get('missing')).to.equal(null); ++ expect(fader.get('input')).to.equal(0.25); ++ }); ++ ++ it('applies envelope points to a registered processor parameter in order', function() { ++ ++ ++ ++ ++ var env = loadWaax(); ++ registerProbeFactories(env.WX); ++ var processor = env.WX.ProbeProcessor(); ++ ++ ++ expect(processor.get('gain')).to.not.equal(null); ++ processor.events = []; ++ expect(processor.set('gain', [[0.0], [1.0, 0.01, 1], [0.0, 0.5, 2]])).to.equal(processor); ++ expect(processor.get('gain')).to.equal(0); ++ expect(processor.events).to.deep.equal([ ++ [0, 'undefined', 'undefined'], ++ [1, 0.01, 1], ++ [0, 0.5, 2] ++ ]); ++ }); ++ ++ it('sets and snapshots Fader presets as plain parameter objects', function() { ++ ++ ++ ++ ++ var env = loadWaax(); ++ var fader = env.WX.Fader(); ++ ++ ++ var initialPreset = fader.getPreset(); ++ expectPlainObjectSnapshot(initialPreset); ++ expect(initialPreset).to.have.property('input'); ++ expect(initialPreset).to.have.property('output'); ++ ++ expect(function() { ++ fader.setPreset({ input: 0.5, output: 0.75 }); ++ }).to.not.throw(Error); ++ expect(fader.get('input')).to.equal(0.5); ++ expect(fader.get('output')).to.equal(0.75); ++ var appliedPreset = fader.getPreset(); ++ expectPlainObjectSnapshot(appliedPreset); ++ expect(appliedPreset).to.include({ input: 0.5, output: 0.75 }); ++ }); ++ ++ it('routes to plug-ins and native AudioNodes, returns targets, and cut disconnects outgoing patching', function() { ++ ++ ++ ++ ++ var env = loadWaax(); ++ var source = env.WX.Fader(); ++ var processorTarget = env.WX.Fader(); ++ var nativeTarget = env.WX.Gain(); ++ ++ ++ var baselineConnections = env.FakeAudioNode.activeConnectionCount(); ++ expect(nativeTarget.incomingConnectionCount()).to.equal(0); ++ expect(source.to(processorTarget)).to.equal(processorTarget); ++ expect(env.FakeAudioNode.activeConnectionCount()).to.equal(baselineConnections + 1); ++ expect(processorTarget.to(nativeTarget)).to.equal(nativeTarget); ++ expect(nativeTarget.incomingConnectionCount()).to.equal(1); ++ expect(env.FakeAudioNode.activeConnectionCount()).to.equal(baselineConnections + 2); ++ source.cut(); ++ expect(nativeTarget.incomingConnectionCount()).to.equal(1); ++ expect(env.FakeAudioNode.activeConnectionCount()).to.equal(baselineConnections + 1); ++ processorTarget.cut(); ++ expect(nativeTarget.incomingConnectionCount()).to.equal(0); ++ expect(env.FakeAudioNode.activeConnectionCount()).to.equal(baselineConnections); ++ }); ++ ++ it('registered generator, processor, and analyzer factories expose the common surface independently', function() { ++ ++ ++ ++ ++ var env = loadWaax(); ++ registerProbeFactories(env.WX); ++ var generator = env.WX.ProbeGenerator(); ++ var processor = env.WX.ProbeProcessor(); ++ var analyzer = env.WX.ProbeAnalyzer(); ++ var sink = env.WX.Gain(); ++ ++ ++ expect(env.WX.ProbeGenerator).to.be.a('function'); ++ expect(env.WX.ProbeProcessor).to.be.a('function'); ++ expect(env.WX.ProbeAnalyzer).to.be.a('function'); ++ ++ expectPlainObjectSnapshot(generator.getPreset()); ++ expect(generator.getPreset()).to.have.property('gain'); ++ expectPlainObjectSnapshot(processor.getPreset()); ++ expect(processor.getPreset()).to.have.property('gain'); ++ expectPlainObjectSnapshot(analyzer.getPreset()); ++ expect(analyzer.getPreset()).to.have.property('gain'); ++ expect(generator.set('gain', 0.3)).to.equal(generator); ++ expect(processor.set('gain', 0.7)).to.equal(processor); ++ ++ expect(function() { ++ analyzer.setPreset({ gain: 0.8 }); ++ }).to.not.throw(Error); ++ expect(generator.get('gain')).to.equal(0.3); ++ expect(processor.get('gain')).to.equal(0.7); ++ expect(analyzer.get('gain')).to.equal(0.8); ++ expect(generator.to(processor)).to.equal(processor); ++ expect(processor.to(analyzer)).to.equal(analyzer); ++ expect(analyzer.to(sink)).to.equal(sink); ++ expect(sink.incomingConnectionCount()).to.equal(1); ++ generator.cut(); ++ processor.cut(); ++ analyzer.cut(); ++ expect(sink.incomingConnectionCount()).to.equal(0); ++ }); ++ ++ it('reports a WAAX connection error for an invalid routing target', function() { ++ ++ ++ ++ ++ var env = loadWaax(); ++ var fader = env.WX.Fader(); ++ ++ ++ expect(function() { ++ fader.to({ notAnAudioNode: true }); ++ }).to.throw(Error); ++ }); ++ ++ it('keeps two Fader instances state-independent after mutating one', function() { ++ ++ ++ ++ ++ var env = loadWaax(); ++ var a = env.WX.Fader(); ++ var b = env.WX.Fader(); ++ var bBefore = b.getPreset(); ++ expectPlainObjectSnapshot(bBefore); ++ ++ expect(a.set('input', 0.2)).to.equal(a); ++ expect(a.set('output', 0.4)).to.equal(a); ++ ++ var aAfter = a.getPreset(); ++ expectPlainObjectSnapshot(aAfter); ++ expect(aAfter).to.include({ input: 0.2, output: 0.4 }); ++ expect(b.getPreset()).to.deep.equal(bBefore); ++ }); ++ ++ it('allows cut to be called twice and leaves outgoing patching disconnected', function() { ++ ++ ++ ++ ++ var env = loadWaax(); ++ var fader = env.WX.Fader(); ++ var sink = env.WX.Gain(); ++ ++ expect(sink.incomingConnectionCount()).to.equal(0); ++ expect(fader.to(sink)).to.equal(sink); ++ expect(sink.incomingConnectionCount()).to.equal(1); ++ expect(function() { ++ fader.cut(); ++ fader.cut(); ++ }).not.to.throw(Error); ++ expect(sink.incomingConnectionCount()).to.equal(0); ++ }); ++ ++ it('keeps native target incoming connections bounded across repeated construct-use-cut cycles', function() { ++ ++ ++ ++ ++ var env = loadWaax(); ++ var sink = env.WX.Gain(); ++ ++ expect(sink.incomingConnectionCount()).to.equal(0); ++ for (var i = 0; i < 100; i++) { ++ var fader = env.WX.Fader(); ++ expect(fader.to(sink)).to.equal(sink); ++ fader.cut(); ++ } ++ expect(sink.incomingConnectionCount()).to.equal(0); ++ }); ++}); +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,20 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++set -euo pipefail ++cd /workspace/repo ++ ++if [ ! -x ./node_modules/.bin/mocha ]; then ++ echo "Missing local mocha binary at ./node_modules/.bin/mocha; dependencies must be preinstalled before offline test execution." >&2 ++ exit 127 ++fi ++ ++exec ./node_modules/.bin/mocha /workspace/repo/usercase-test-coderl/plugin_lifecycle.test.js --reporter spec diff --git a/tasks/format-code-task-001473/tests/test.sh b/tasks/format-code-task-001473/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..a32fb8452d80d9116ed23ac6b519f2addfec1880 --- /dev/null +++ b/tasks/format-code-task-001473/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/plugin_lifecycle.test.js +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001473/tests/test_command.sh b/tasks/format-code-task-001473/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-001473/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001474/environment/Dockerfile b/tasks/format-code-task-001474/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..c8845a5b3d2f2df760f8a863467ac822fd453c87 --- /dev/null +++ b/tasks/format-code-task-001474/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:622ee7d292700621c23a10d348e0e85917d48a028ec7a5237d51efb6c63856e6 diff --git a/tasks/format-code-task-001474/environment/setup/files/blocklist b/tasks/format-code-task-001474/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001474/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001474/environment/setup/setup.sh b/tasks/format-code-task-001474/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-001474/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001474/tests/test.patch b/tasks/format-code-task-001474/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..ecfa9f29aa57fb3326971086015a0950de4c5617 --- /dev/null +++ b/tasks/format-code-task-001474/tests/test.patch @@ -0,0 +1,353 @@ +diff --git a/usercase-test-coderl/noteclip.test.js b/usercase-test-coderl/noteclip.test.js +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/noteclip.test.js +@@ -0,0 +1,328 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++const assert = require('assert'); ++const fs = require('fs'); ++const path = require('path'); ++const vm = require('vm'); ++ ++const TIMEBASE = path.join(__dirname, '..', 'src', 'waax.timebase.js'); ++ ++function loadWX(randomValues) { ++ let randomIndex = 0; ++ ++ function FixedDate(...args) { ++ if (this instanceof FixedDate) { ++ return args.length ? new Date(...args) : new Date(1600000000000); ++ } ++ return new Date(1600000000000).toString(); ++ } ++ FixedDate.now = () => 4660; ++ FixedDate.UTC = Date.UTC; ++ FixedDate.parse = Date.parse; ++ FixedDate.prototype = Date.prototype; ++ ++ const fixedMath = Object.create(Math); ++ fixedMath.random = () => randomValues[randomIndex++] ?? 0; ++ ++ const context = { ++ Date: FixedDate, ++ Math: fixedMath, ++ requestAnimationFrame: () => 0, ++ WX: { ++ now: 0, ++ clamp: (value, min, max) => Math.min(Math.max(value, min), max), ++ isBoolean: (value) => typeof value === 'boolean', ++ Log: { ++ error: (message) => { ++ throw new Error(message); ++ } ++ } ++ } ++ }; ++ ++ vm.createContext(context); ++ vm.runInContext(fs.readFileSync(TIMEBASE, 'utf8'), context, { ++ filename: 'waax.timebase.js' ++ }); ++ return context.WX; ++} ++ ++function plainArray(values) { ++ return Array.from(values); ++} ++ ++function sortedCopy(values) { ++ return plainArray(values).sort(); ++} ++ ++function assertSameMembers(actual, expected) { ++ assert.deepStrictEqual(sortedCopy(actual), sortedCopy(expected)); ++} ++ ++function assertNoteFields(note, expected) { ++ assert.notStrictEqual(note, null); ++ assert.strictEqual(note.pitch, expected.pitch); ++ assert.strictEqual(note.velocity, expected.velocity); ++ assert.strictEqual(note.start, expected.start); ++ assert.strictEqual(note.duration, expected.duration); ++} ++ ++function assertSameObjects(actual, expected) { ++ assert.ok(Array.isArray(actual)); ++ assert.strictEqual(actual.length, expected.length); ++ for (const item of expected) { ++ assert.ok(actual.includes(item)); ++ } ++} ++ ++function runTest(name, fn) { ++ try { ++ fn(); ++ console.log(`ok - ${name}`); ++ } catch (error) { ++ console.error(`not ok - ${name}`); ++ throw error; ++ } ++} ++ ++runTest('push/get/hasId keep note state under deterministic unique IDs', () => { ++ ++ ++ const WX = loadWX([0, 0.25, 0.5, 0.75]); ++ const clip = WX.NoteClip(); ++ const note = WX.Note(60, 64, 0, 120); ++ ++ assert.strictEqual(clip.getSize(), 0); ++ assert.deepStrictEqual(plainArray(clip.getAllId()), []); ++ ++ const id = clip.push(note); ++ ++ assert.strictEqual(typeof id, 'string'); ++ assert.notStrictEqual(id, ''); ++ assert.strictEqual(clip.getSize(), 1); ++ assert.strictEqual(clip.hasId(id), true); ++ assert.strictEqual(clip.get(id), note); ++ assertNoteFields(clip.get(id), { pitch: 60, velocity: 64, start: 0, duration: 120 }); ++ assertSameMembers(clip.getAllId(), [id]); ++}); ++ ++runTest('push avoids a generated ID collision already present in that clip', () => { ++ ++ ++ const WX = loadWX([ ++ 0, 0.25, 0.5, 0.75, ++ 0, 0.25, 0.5, 0.75, ++ 0.1, 0.2, 0.3, 0.4 ++ ]); ++ const clip = WX.NoteClip(); ++ ++ const firstId = clip.push(WX.Note(1, 2, 3, 4)); ++ const secondId = clip.push(WX.Note(5, 6, 7, 8)); ++ ++ ++ assert.strictEqual(typeof firstId, 'string'); ++ assert.strictEqual(typeof secondId, 'string'); ++ assert.notStrictEqual(firstId, secondId); ++ assert.strictEqual(clip.getSize(), 2); ++ assertSameMembers(clip.getAllId(), [firstId, secondId]); ++ assertNoteFields(clip.get(firstId), { pitch: 1, velocity: 2, start: 3, duration: 4 }); ++ assertNoteFields(clip.get(secondId), { pitch: 5, velocity: 6, start: 7, duration: 8 }); ++}); ++ ++runTest('delete existing and missing IDs returns concrete values and updates state', () => { ++ ++ ++ const WX = loadWX([ ++ 0, 0.25, 0.5, 0.75, ++ 0.1, 0.2, 0.3, 0.4, ++ 0.9, 0.8, 0.7, 0.6 ++ ]); ++ const clip = WX.NoteClip(); ++ const keptIdA = clip.push(WX.Note(60, 64, 0, 120)); ++ const deleteId = clip.push(WX.Note(62, 80, 120, 60)); ++ const keptIdB = clip.push(WX.Note(64, 90, 240, 120)); ++ ++ ++ assert.strictEqual(clip.delete('not-here'), null); ++ assert.strictEqual(clip.getSize(), 3); ++ assertSameMembers(clip.getAllId(), [keptIdA, deleteId, keptIdB]); ++ ++ const deleted = clip.delete(deleteId); ++ assertNoteFields(deleted, { pitch: 62, velocity: 80, start: 120, duration: 60 }); ++ assert.strictEqual(clip.getSize(), 2); ++ assert.strictEqual(clip.hasId(deleteId), false); ++ assert.strictEqual(clip.get(deleteId), null); ++ assertSameMembers(clip.getAllId(), [keptIdA, keptIdB]); ++}); ++ ++runTest('empty is idempotent cleanup and removes all observable note state', () => { ++ ++ ++ const WX = loadWX([ ++ 0, 0.25, 0.5, 0.75, ++ 0.1, 0.2, 0.3, 0.4 ++ ]); ++ const clip = WX.NoteClip(); ++ const id = clip.push(WX.Note(60, 64, 0, 120)); ++ clip.push(WX.Note(62, 80, 120, 60)); ++ ++ ++ assert.strictEqual(typeof id, 'string'); ++ assert.strictEqual(clip.getSize(), 2); ++ ++ clip.empty(); ++ assert.strictEqual(clip.getSize(), 0); ++ assert.deepStrictEqual(plainArray(clip.getAllId()), []); ++ assert.strictEqual(clip.get(id), null); ++ assert.strictEqual(clip.hasId(id), false); ++ assert.strictEqual(clip.findNoteIdAtPosition(60, 0), null); ++ assert.strictEqual(clip.findNotesIdInArea(0, 127, 0, 999), null); ++ assert.strictEqual(clip.scanNotesInTimeSpan(0, 999), null); ++ ++ clip.empty(); ++ assert.strictEqual(clip.getSize(), 0); ++ assert.deepStrictEqual(plainArray(clip.getAllId()), []); ++}); ++ ++runTest('piano-roll point, area, and span selection use inclusive boundaries', () => { ++ ++ ++ const WX = loadWX([ ++ 0, 0.25, 0.5, 0.75, ++ 0.1, 0.2, 0.3, 0.4, ++ 0.9, 0.8, 0.7, 0.6 ++ ]); ++ const clip = WX.NoteClip(); ++ const note60 = WX.Note(60, 64, 0, 120); ++ const note62 = WX.Note(62, 80, 120, 60); ++ const note64 = WX.Note(64, 90, 240, 120); ++ const id60 = clip.push(note60); ++ const id62 = clip.push(note62); ++ const id64 = clip.push(note64); ++ ++ ++ assert.strictEqual(clip.findNoteIdAtPosition(60, 0), id60); ++ assert.strictEqual(clip.findNoteIdAtPosition(60, 120), id60); ++ assert.strictEqual(clip.findNoteIdAtPosition(62, 119), null); ++ assert.strictEqual(clip.findNoteIdAtPosition(62, 120), id62); ++ assert.strictEqual(clip.findNoteIdAtPosition(62, 180), id62); ++ assert.strictEqual(clip.findNoteIdAtPosition(64, 361), null); ++ ++ ++ assertSameMembers(clip.findNotesIdInArea(60, 64, 0, 240), [id60, id62, id64]); ++ assertSameMembers(clip.findNotesIdInArea(61, 63, 100, 200), [id62]); ++ assert.strictEqual(clip.findNotesIdInArea(70, 72, 0, 500), null); ++ ++ ++ assertSameObjects(clip.scanNotesInTimeSpan(0, 120), [note60, note62]); ++ assert.strictEqual(clip.scanNotesInTimeSpan(121, 239), null); ++ assertSameObjects(clip.scanNotesInTimeSpan(200, 300), [note64]); ++}); ++ ++runTest('set updates existing notes through the note API and stores absent IDs', () => { ++ ++ ++ const WX = loadWX([0.11, 0.22, 0.33, 0.44]); ++ const clip = WX.NoteClip(); ++ const original = WX.Note(60, 64, 0, 120); ++ const id = clip.push(original); ++ ++ ++ assert.strictEqual(typeof id, 'string'); ++ assertNoteFields(clip.get(id), { pitch: 60, velocity: 64, start: 0, duration: 120 }); ++ ++ const replacement = WX.Note(65, 70, 240, 80); ++ clip.set(id, replacement); ++ assert.strictEqual(clip.get(id), original); ++ assert.strictEqual(clip.get(id) === replacement, false); ++ assertNoteFields(clip.get(id), { pitch: 65, velocity: 70, start: 240, duration: 80 }); ++ ++ const manual = WX.Note(67, 90, 300, 40); ++ clip.set('manual-id', manual); ++ assert.strictEqual(clip.hasId('manual-id'), true); ++ assert.strictEqual(clip.get('manual-id'), manual); ++ assertNoteFields(clip.get('manual-id'), { pitch: 67, velocity: 90, start: 300, duration: 40 }); ++ assertSameMembers(clip.getAllId(), [id, 'manual-id']); ++}); ++ ++runTest('iterate calls back once per stored note with id, note, and index', () => { ++ ++ ++ const WX = loadWX([0.11, 0.22, 0.33, 0.44]); ++ const clip = WX.NoteClip(); ++ const pushedNote = WX.Note(60, 64, 0, 120); ++ const manualNote = WX.Note(67, 90, 300, 40); ++ const pushedId = clip.push(pushedNote); ++ clip.set('manual-id', manualNote); ++ ++ const seen = []; ++ clip.iterate((id, note, index) => { ++ seen.push([id, note, index]); ++ }); ++ ++ ++ assert.strictEqual(seen.length, 2); ++ assertSameMembers(seen.map((entry) => entry[0]), [pushedId, 'manual-id']); ++ assertSameMembers(seen.map((entry) => entry[2]), [0, 1]); ++ assert.strictEqual(seen.find((entry) => entry[0] === pushedId)[1], pushedNote); ++ assert.strictEqual(seen.find((entry) => entry[0] === 'manual-id')[1], manualNote); ++}); ++ ++runTest('two NoteClip instances keep independent stores and sizes', () => { ++ ++ ++ const WX = loadWX([0.11, 0.22, 0.33, 0.44]); ++ const a = WX.NoteClip(); ++ const b = WX.NoteClip(); ++ ++ const id = a.push(WX.Note(70, 50, 10, 20)); ++ ++ ++ assert.strictEqual(typeof id, 'string'); ++ assert.strictEqual(a.getSize(), 1); ++ assert.strictEqual(b.getSize(), 0); ++ assertSameMembers(a.getAllId(), [id]); ++ assert.deepStrictEqual(plainArray(b.getAllId()), []); ++ assertNoteFields(a.get(id), { pitch: 70, velocity: 50, start: 10, duration: 20 }); ++ assert.strictEqual(b.get(id), null); ++ assert.strictEqual(b.hasId(id), false); ++}); ++ ++runTest('repeated use and cleanup cycles leave public resource counters bounded', () => { ++ ++ ++ const WX = loadWX([]); ++ const clip = WX.NoteClip(); ++ let totalSizeAfterCleanup = 0; ++ let totalIdsAfterCleanup = 0; ++ ++ for (let i = 0; i < 150; i += 1) { ++ clip.set(`cycle-${i}-a`, WX.Note(60, 64, 0, 120)); ++ clip.set(`cycle-${i}-b`, WX.Note(61, 65, 120, 60)); ++ clip.set(`cycle-${i}-c`, WX.Note(62, 66, 240, 30)); ++ assert.strictEqual(clip.getAllId().length, 3); ++ ++ clip.empty(); ++ totalSizeAfterCleanup += clip.getSize(); ++ totalIdsAfterCleanup += clip.getAllId().length; ++ } ++ ++ assert.strictEqual(totalSizeAfterCleanup, 0); ++ assert.strictEqual(totalIdsAfterCleanup, 0); ++ assert.strictEqual(clip.getSize(), 0); ++ assert.deepStrictEqual(plainArray(clip.getAllId()), []); ++}); +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,15 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++set -euo pipefail ++cd /workspace/repo ++ ++exec node /workspace/repo/usercase-test-coderl/noteclip.test.js diff --git a/tasks/format-code-task-001474/tests/test.sh b/tasks/format-code-task-001474/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..9e965b1fd0d8316ebb8acf3f6d61500b98e325d0 --- /dev/null +++ b/tasks/format-code-task-001474/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/noteclip.test.js +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001474/tests/test_command.sh b/tasks/format-code-task-001474/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-001474/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001480/environment/Dockerfile b/tasks/format-code-task-001480/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..604776ad1e9692d1a881cbd522d9a40c16d7451f --- /dev/null +++ b/tasks/format-code-task-001480/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:d9e354d56e0e035c2e83070a794eac5f9751a9558304f5c4c8d533f6ae0e80a0 diff --git a/tasks/format-code-task-001480/environment/setup/files/blocklist b/tasks/format-code-task-001480/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001480/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001480/environment/setup/setup.sh b/tasks/format-code-task-001480/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001480/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001480/tests/test.patch b/tasks/format-code-task-001480/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..5f52523ca924b90293c8d53c3c057f7a02d9d418 --- /dev/null +++ b/tasks/format-code-task-001480/tests/test.patch @@ -0,0 +1,75 @@ +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 00000000000..1aac4937897 +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["python -m pytest tests/components/hassio/test_init.py -k valid_addon -v"] ++} +diff --git a/tests/components/hassio/test_init.py b/tests/components/hassio/test_init.py +index 31ee73013da..0bbd635258c 100644 +--- a/tests/components/hassio/test_init.py ++++ b/tests/components/hassio/test_init.py +@@ -943,3 +943,48 @@ def test_hostname_from_addon_slug() -> None: + hostname_from_addon_slug("core_silabs_multiprotocol") + == "core-silabs-multiprotocol" + ) ++ ++ ++def test_valid_addon_accepts_dash_in_slug() -> None: ++ """Bug case: addon slug with a dash should be accepted (e.g. ccab4aaf_frigate-fa).""" ++ from homeassistant.components.hassio import valid_addon ++ ++ assert valid_addon("ccab4aaf_frigate-fa") == "ccab4aaf_frigate-fa" ++ ++ ++def test_valid_addon_accepts_multiple_dashes() -> None: ++ """Multiple dashes in the addon slug should be accepted.""" ++ from homeassistant.components.hassio import valid_addon ++ ++ assert valid_addon("a-b-c-d") == "a-b-c-d" ++ ++ ++def test_valid_addon_accepts_underscore_only_slug() -> None: ++ """Conventional underscore-only slugs must continue to work (preservation).""" ++ from homeassistant.components.hassio import valid_addon ++ ++ assert valid_addon("core_mosquitto") == "core_mosquitto" ++ ++ ++def test_valid_addon_rejects_space() -> None: ++ """Whitespace remains an invalid addon-slug character.""" ++ from homeassistant.components.hassio import valid_addon ++ ++ with pytest.raises(Invalid): ++ valid_addon("Has Space") ++ ++ ++def test_valid_addon_rejects_special_char() -> None: ++ """Characters outside [-_.A-Za-z0-9] must still be rejected.""" ++ from homeassistant.components.hassio import valid_addon ++ ++ with pytest.raises(Invalid): ++ valid_addon("addon@bad") ++ ++ ++def test_valid_addon_rejects_slash() -> None: ++ """A slash is outside the accepted addon-slug character set.""" ++ from homeassistant.components.hassio import valid_addon ++ ++ with pytest.raises(Invalid): ++ valid_addon("addon/bad") +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++python -m pytest tests/components/hassio/test_init.py -k valid_addon -v ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-001480/tests/test.sh b/tasks/format-code-task-001480/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..25180b7993a12b2d90e6e82d89ffa1f94cedcfd1 --- /dev/null +++ b/tasks/format-code-task-001480/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test_commands.json +tests/components/hassio/test_init.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001480/tests/test_command.sh b/tasks/format-code-task-001480/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001480/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001487/environment/Dockerfile b/tasks/format-code-task-001487/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..bec52a42bd8bea28979fb58ea36989bec2134767 --- /dev/null +++ b/tasks/format-code-task-001487/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:f60e8a747d29de701d35c18544729e20c5fbb5919ec8d32efa31030d6ffc19b2 diff --git a/tasks/format-code-task-001487/environment/setup/files/blocklist b/tasks/format-code-task-001487/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001487/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001487/environment/setup/setup.sh b/tasks/format-code-task-001487/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001487/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001487/tests/test.patch b/tasks/format-code-task-001487/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..fe0a160663b6a0ff4c44d69ef67125ff7398ed0d --- /dev/null +++ b/tasks/format-code-task-001487/tests/test.patch @@ -0,0 +1,95 @@ +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 00000000000..627f75d7a77 +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["python -m pytest tests/components/myuplink/test_number.py -k 'test_native_step_with_scale_value or test_native_step_with_unit_scale or test_min_max_preserved or test_heating_offset_step' -v"] ++} +diff --git a/tests/components/myuplink/test_number.py b/tests/components/myuplink/test_number.py +index ef7b1749782..83de42ad888 100644 +--- a/tests/components/myuplink/test_number.py ++++ b/tests/components/myuplink/test_number.py +@@ -96,3 +96,68 @@ async def test_number_states( + """Test number entity state.""" + + await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id) ++ ++ ++async def test_native_step_with_scale_value( ++ hass: HomeAssistant, ++ mock_myuplink_client: MagicMock, ++ setup_platform: None, ++) -> None: ++ """Test that native step is stepValue * scaleValue. ++ ++ Regression test for issue where step size for room sensor set point ++ was using stepValue without applying scaleValue. For NIBE F2040 the ++ raw stepValue is 5.0 with scaleValue 0.1 → effective step 0.5. ++ ++ In the f730 fixture, parameter 40940 (Degree minutes) has ++ stepValue=1, scaleValue="0.1" so the user-visible step must be 0.1. ++ """ ++ state = hass.states.get("number.gotham_city_degree_minutes") ++ assert state is not None ++ assert state.attributes["step"] == pytest.approx(0.1) ++ ++ ++async def test_native_step_with_unit_scale( ++ hass: HomeAssistant, ++ mock_myuplink_client: MagicMock, ++ setup_platform: None, ++) -> None: ++ """Test that native step matches stepValue when scaleValue is 1. ++ ++ In the f730 fixture, parameter 148072 (start diff additional heat) ++ has stepValue=10, scaleValue="1" → step must be 10.0. ++ """ ++ state = hass.states.get("number.gotham_city_start_diff_additional_heat") ++ assert state is not None ++ assert state.attributes["step"] == pytest.approx(10.0) ++ ++ ++async def test_min_max_preserved( ++ hass: HomeAssistant, ++ mock_myuplink_client: MagicMock, ++ setup_platform: None, ++) -> None: ++ """Test min/max values are preserved. ++ ++ Parameter 148072: minValue=100, maxValue=2000, scaleValue="1". ++ """ ++ state = hass.states.get("number.gotham_city_start_diff_additional_heat") ++ assert state is not None ++ assert state.attributes["min"] == pytest.approx(100.0) ++ assert state.attributes["max"] == pytest.approx(2000.0) ++ ++ ++async def test_heating_offset_step( ++ hass: HomeAssistant, ++ mock_myuplink_client: MagicMock, ++ setup_platform: None, ++) -> None: ++ """Test heating offset entity (47011) step value. ++ ++ Parameter 47011: stepValue=1, scaleValue="1" → step=1.0. ++ """ ++ state = hass.states.get("number.gotham_city_heating_offset_climate_system_1") ++ assert state is not None ++ assert state.attributes["step"] == pytest.approx(1.0) ++ assert state.attributes["min"] == pytest.approx(-10.0) ++ assert state.attributes["max"] == pytest.approx(10.0) +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++python -m pytest tests/components/myuplink/test_number.py -k 'test_native_step_with_scale_value or test_native_step_with_unit_scale or test_min_max_preserved or test_heating_offset_step' -v ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-001487/tests/test.sh b/tasks/format-code-task-001487/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..ef48c2b35c3e97bae3698529e09b3f0376984718 --- /dev/null +++ b/tasks/format-code-task-001487/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test_commands.json +tests/components/myuplink/test_number.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001487/tests/test_command.sh b/tasks/format-code-task-001487/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001487/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001489/environment/Dockerfile b/tasks/format-code-task-001489/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..d17d40dc872823b887d7b4fd092b8891d422cd9d --- /dev/null +++ b/tasks/format-code-task-001489/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:12e42f61ba444629cf6e8aa5953f097aa6e421322692b5588d4153b1cde1180d diff --git a/tasks/format-code-task-001489/environment/setup/files/blocklist b/tasks/format-code-task-001489/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001489/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001489/environment/setup/setup.sh b/tasks/format-code-task-001489/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001489/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001489/tests/test.patch b/tasks/format-code-task-001489/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..08d269a6e1bac2cdbe0d79ed2fde927b29af7418 --- /dev/null +++ b/tasks/format-code-task-001489/tests/test.patch @@ -0,0 +1,580 @@ +diff --git a/tests/components/binary_sensor/test_deconz.py b/tests/components/binary_sensor/test_deconz.py +new file mode 100644 +index 00000000000..573cce0dbc2 +--- /dev/null ++++ b/tests/components/binary_sensor/test_deconz.py +@@ -0,0 +1,77 @@ ++ ++from unittest.mock import Mock, patch ++ ++from homeassistant import config_entries ++from homeassistant.components import deconz ++from homeassistant.components.binary_sensor import deconz as deconz_binary_sensor ++ ++from tests.common import mock_coro_func ++ ++ ++SENSORS = { ++ "1": { ++ "id": "sensor-1-id", ++ "name": "Sensor 1 name", ++ "type": "ZHAPresence", ++ "state": {"presence": False}, ++ "config": {} ++ }, ++ "2": { ++ "id": "sensor-2-id", ++ "name": "Sensor 2 name", ++ "type": "ZHAOpenClose", ++ "state": {"open": True}, ++ "config": {} ++ } ++} ++ ++ ++async def setup_bridge(hass, data): ++ ++ from pydeconz import DeconzSession ++ ++ entry = Mock() ++ entry.data = {'host': '1.2.3.4', 'port': 80, 'api_key': '1234567890ABCDEF'} ++ bridge = DeconzSession(Mock(), Mock(), **entry.data) ++ with patch('pydeconz.DeconzSession.async_get_state', ++ new=mock_coro_func(data)): ++ await bridge.async_load_parameters() ++ ++ hass.data[deconz.DOMAIN] = bridge ++ hass.data[deconz.DATA_DECONZ_ID] = {} ++ ++ config_entry = config_entries.ConfigEntry( ++ 1, deconz.DOMAIN, 'Mock Title', {'host': 'mock-host'}, 'test') ++ hass.config_entries._entries.append(config_entry) ++ await hass.config_entries.async_forward_entry_setup( ++ config_entry, 'binary_sensor') ++ await hass.async_block_till_done() ++ ++ ++async def test_no_binary_sensors(hass): ++ ++ await setup_bridge(hass, {}) ++ ++ assert hass.states.async_all() == [] ++ ++ ++async def test_binary_sensors_added_from_config_entry(hass): ++ ++ await setup_bridge(hass, {"sensors": SENSORS}) ++ ++ assert hass.states.get("binary_sensor.sensor_1_name") is not None ++ assert hass.states.get("binary_sensor.sensor_2_name") is not None ++ assert len(hass.states.async_all()) == 2 ++ ++ ++async def test_legacy_setup_platform_does_not_add_binary_sensors(hass): ++ ++ added = [] ++ ++ async def async_add_devices(devices): ++ added.extend(devices) ++ ++ await deconz_binary_sensor.async_setup_platform( ++ hass, {}, async_add_devices, discovery_info={"host": "mock-host"}) ++ ++ assert added == [] +diff --git a/tests/components/deconz/test_init.py b/tests/components/deconz/test_init.py +index cbc8a373972..64fbe87fd2a 100644 +--- a/tests/components/deconz/test_init.py ++++ b/tests/components/deconz/test_init.py +@@ -1,9 +1,15 @@ + """Test deCONZ component setup process.""" +-from unittest.mock import patch ++import logging ++from unittest.mock import Mock, patch + ++from homeassistant import config_entries + from homeassistant.setup import async_setup_component + from homeassistant.components import deconz + ++from tests.common import mock_coro_func ++ ++ ++_LOGGER = logging.getLogger(__name__) + + async def test_config_with_host_passed_to_config_entry(hass): + """Test that configured options for a host are loaded via config entry.""" +@@ -67,3 +73,81 @@ async def test_config_discovery(hass): + assert await async_setup_component(hass, deconz.DOMAIN, {}) is True + # No flow started + assert len(mock_config_entries.flow.mock_calls) == 0 ++ ++ ++async def test_setup_entry_already_registered_bridge(hass, caplog): ++ """Test setup entry doesn't allow more than one instance of deCONZ.""" ++ hass.data[deconz.DOMAIN] = True ++ entry = Mock() ++ entry.data = {'host': '1.2.3.4', 'port': 80, 'api_key': '1234567890ABCDEF'} ++ ++ with caplog.at_level(logging.ERROR): ++ assert await deconz.async_setup_entry(hass, entry) is False ++ ++ assert caplog.records ++ ++ ++async def test_setup_entry_no_available_bridge(hass): ++ """Test setup entry fails if deCONZ is not available.""" ++ entry = Mock() ++ entry.data = {'host': '1.2.3.4', 'port': 80, 'api_key': '1234567890ABCDEF'} ++ with patch('pydeconz.DeconzSession.async_load_parameters', ++ new=mock_coro_func(False)): ++ assert await deconz.async_setup_entry(hass, entry) is False ++ ++ ++async def test_setup_entry_successful_forwards_supported_platforms(hass): ++ """Test deCONZ setup requests config-entry setup for supported platforms.""" ++ entry = Mock() ++ entry.data = {'host': '1.2.3.4', 'port': 80, 'api_key': '1234567890ABCDEF'} ++ forwarded = [] ++ ++ async def mock_forward_entry_setup(entry_arg, platform): ++ forwarded.append((entry_arg, platform)) ++ return True ++ ++ with patch.object(hass.config_entries, 'async_forward_entry_setup', ++ side_effect=mock_forward_entry_setup), \ ++ patch('homeassistant.helpers.discovery.async_load_platform') \ ++ as mock_discovery_load_platform, \ ++ patch('pydeconz.DeconzSession.async_load_parameters', ++ new=mock_coro_func(True)): ++ assert await deconz.async_setup_entry(hass, entry) is True ++ await hass.async_block_till_done() ++ ++ forwarded_platforms = [platform for entry_arg, platform in forwarded ++ if entry_arg is entry] ++ assert sorted(forwarded_platforms) == [ ++ 'binary_sensor', 'light', 'scene', 'sensor'] ++ assert len(forwarded_platforms) == 4 ++ assert mock_discovery_load_platform.mock_calls == [] ++ ++ ++async def test_setup_entry_can_create_forwarded_entities(hass): ++ """Test deCONZ setup can reach a real forwarded platform.""" ++ data = { ++ "sensors": { ++ "1": { ++ "id": "presence-one-id", ++ "name": "Presence One", ++ "type": "ZHAPresence", ++ "state": {"presence": False}, ++ "config": {} ++ } ++ } ++ } ++ entry = config_entries.ConfigEntry( ++ 1, deconz.DOMAIN, 'Mock Title', ++ {'host': '1.2.3.4', 'port': 80, 'api_key': '1234567890ABCDEF'}, ++ 'test') ++ hass.config_entries._entries.append(entry) ++ ++ with patch('pydeconz.DeconzSession.async_get_state', ++ new=mock_coro_func(data)), \ ++ patch('homeassistant.helpers.discovery.async_load_platform') \ ++ as mock_discovery_load_platform: ++ assert await deconz.async_setup_entry(hass, entry) is True ++ await hass.async_block_till_done() ++ ++ assert hass.states.get("binary_sensor.presence_one") is not None ++ assert mock_discovery_load_platform.mock_calls == [] +diff --git a/tests/components/light/test_deconz.py b/tests/components/light/test_deconz.py +new file mode 100644 +index 00000000000..1b62c05e504 +--- /dev/null ++++ b/tests/components/light/test_deconz.py +@@ -0,0 +1,99 @@ ++ ++from unittest.mock import Mock, patch ++ ++from homeassistant import config_entries ++from homeassistant.components import deconz ++from homeassistant.components import light as light_component ++from homeassistant.components.light import deconz as deconz_light ++from homeassistant import loader ++ ++from tests.common import mock_coro_func ++ ++ ++LIGHTS = { ++ "1": { ++ "id": "Light 1 id", ++ "name": "Light 1 name", ++ "state": {} ++ }, ++ "2": { ++ "id": "Light 2 id", ++ "name": "Light 2 name", ++ "state": {} ++ } ++} ++ ++ ++GROUPS = { ++ "1": { ++ "id": "Group 1 id", ++ "name": "Group 1 name", ++ "state": {}, ++ "action": {}, ++ "scenes": [], ++ "lights": ["1", "2"] ++ }, ++ "2": { ++ "id": "Group 2 id", ++ "name": "Group 2 name", ++ "state": {}, ++ "action": {}, ++ "scenes": [] ++ } ++} ++ ++ ++async def setup_bridge(hass, data): ++ ++ from pydeconz import DeconzSession ++ ++ entry = Mock() ++ entry.data = {'host': '1.2.3.4', 'port': 80, 'api_key': '1234567890ABCDEF'} ++ bridge = DeconzSession(Mock(), Mock(), **entry.data) ++ with patch('pydeconz.DeconzSession.async_get_state', ++ new=mock_coro_func(data)): ++ await bridge.async_load_parameters() ++ ++ hass.data[deconz.DOMAIN] = bridge ++ hass.data[deconz.DATA_DECONZ_ID] = {} ++ ++ config_entry = config_entries.ConfigEntry( ++ 1, deconz.DOMAIN, 'Mock Title', {'host': 'mock-host'}, 'test') ++ hass.config_entries._entries.append(config_entry) ++ loader.set_component('light', light_component) ++ await hass.config_entries.async_forward_entry_setup(config_entry, 'light') ++ await hass.async_block_till_done() ++ ++ ++async def test_no_lights_or_groups(hass): ++ ++ await setup_bridge(hass, {}) ++ ++ assert hass.states.async_all() == [] ++ ++ ++async def test_lights_and_groups_added_from_config_entry(hass): ++ ++ await setup_bridge(hass, {"lights": LIGHTS, "groups": GROUPS}) ++ ++ assert hass.states.get("light.light_1_name") is not None ++ assert hass.states.get("light.light_2_name") is not None ++ assert hass.states.get("light.group_1_name") is not None ++ assert hass.states.get("light.group_2_name") is None ++ assert len([ ++ state for state in hass.states.async_all() ++ if state.entity_id.startswith("light.") ++ ]) == 3 ++ ++ ++async def test_legacy_setup_platform_does_not_add_lights(hass): ++ ++ added = [] ++ ++ async def async_add_devices(devices): ++ added.extend(devices) ++ ++ await deconz_light.async_setup_platform( ++ hass, {}, async_add_devices, discovery_info={"host": "mock-host"}) ++ ++ assert added == [] +diff --git a/tests/components/scene/test_deconz.py b/tests/components/scene/test_deconz.py +new file mode 100644 +index 00000000000..1db5c56dba3 +--- /dev/null ++++ b/tests/components/scene/test_deconz.py +@@ -0,0 +1,72 @@ ++ ++from unittest.mock import Mock, patch ++ ++from homeassistant import config_entries ++from homeassistant.components import deconz ++from homeassistant.components.scene import deconz as deconz_scene ++ ++from tests.common import mock_coro_func ++ ++ ++GROUPS = { ++ "1": { ++ "id": "Group 1 id", ++ "name": "Group 1 name", ++ "state": {}, ++ "action": {}, ++ "scenes": [ ++ {"id": "1", "name": "Scene 1"}, ++ {"id": "2", "name": "Scene 2"} ++ ] ++ } ++} ++ ++ ++async def setup_bridge(hass, data): ++ ++ from pydeconz import DeconzSession ++ ++ entry = Mock() ++ entry.data = {'host': '1.2.3.4', 'port': 80, 'api_key': '1234567890ABCDEF'} ++ bridge = DeconzSession(Mock(), Mock(), **entry.data) ++ with patch('pydeconz.DeconzSession.async_get_state', ++ new=mock_coro_func(data)): ++ await bridge.async_load_parameters() ++ ++ hass.data[deconz.DOMAIN] = bridge ++ hass.data[deconz.DATA_DECONZ_ID] = {} ++ ++ config_entry = config_entries.ConfigEntry( ++ 1, deconz.DOMAIN, 'Mock Title', {'host': 'mock-host'}, 'test') ++ hass.config_entries._entries.append(config_entry) ++ await hass.config_entries.async_forward_entry_setup(config_entry, 'scene') ++ await hass.async_block_till_done() ++ ++ ++async def test_no_scenes(hass): ++ ++ await setup_bridge(hass, {}) ++ ++ assert hass.states.async_all() == [] ++ ++ ++async def test_scenes_added_from_config_entry(hass): ++ ++ await setup_bridge(hass, {"groups": GROUPS}) ++ ++ assert hass.states.get("scene.group_1_name_scene_1") is not None ++ assert hass.states.get("scene.group_1_name_scene_2") is not None ++ assert len(hass.states.async_all()) == 2 ++ ++ ++async def test_legacy_setup_platform_does_not_add_scenes(hass): ++ ++ added = [] ++ ++ async def async_add_devices(devices): ++ added.extend(devices) ++ ++ await deconz_scene.async_setup_platform( ++ hass, {}, async_add_devices, discovery_info={"host": "mock-host"}) ++ ++ assert added == [] +diff --git a/tests/components/sensor/test_deconz.py b/tests/components/sensor/test_deconz.py +new file mode 100644 +index 00000000000..d72dc4a02eb +--- /dev/null ++++ b/tests/components/sensor/test_deconz.py +@@ -0,0 +1,93 @@ ++ ++from unittest.mock import Mock, patch ++ ++from homeassistant import config_entries ++from homeassistant.components import deconz ++from homeassistant.components.sensor import deconz as deconz_sensor ++ ++from tests.common import mock_coro_func ++ ++ ++SENSORS = { ++ "1": { ++ "id": "Sensor 1 id", ++ "name": "Sensor 1 name", ++ "type": "ZHATemperature", ++ "state": {"temperature": 2150}, ++ "config": {} ++ }, ++ "2": { ++ "id": "Sensor 2 id", ++ "name": "Sensor 2 name", ++ "type": "ZHAPresence", ++ "state": {"presence": False}, ++ "config": {} ++ }, ++ "3": { ++ "id": "Sensor 3 id", ++ "name": "Sensor 3 name", ++ "type": "ZHASwitch", ++ "state": {"buttonevent": 1000}, ++ "config": {} ++ }, ++ "4": { ++ "id": "Sensor 4 id", ++ "name": "Sensor 4 name", ++ "type": "ZHASwitch", ++ "state": {"buttonevent": 1000}, ++ "config": {"battery": 100} ++ } ++} ++ ++ ++async def setup_bridge(hass, data): ++ ++ from pydeconz import DeconzSession ++ ++ entry = Mock() ++ entry.data = {'host': '1.2.3.4', 'port': 80, 'api_key': '1234567890ABCDEF'} ++ bridge = DeconzSession(Mock(), Mock(), **entry.data) ++ with patch('pydeconz.DeconzSession.async_get_state', ++ new=mock_coro_func(data)): ++ await bridge.async_load_parameters() ++ ++ hass.data[deconz.DOMAIN] = bridge ++ hass.data[deconz.DATA_DECONZ_ID] = {} ++ ++ config_entry = config_entries.ConfigEntry( ++ 1, deconz.DOMAIN, 'Mock Title', {'host': 'mock-host'}, 'test') ++ hass.config_entries._entries.append(config_entry) ++ await hass.config_entries.async_forward_entry_setup(config_entry, 'sensor') ++ await hass.async_block_till_done() ++ ++ ++async def test_no_sensors(hass): ++ ++ await setup_bridge(hass, {}) ++ ++ assert hass.states.async_all() == [] ++ ++ ++async def test_sensors_added_from_config_entry(hass): ++ ++ await setup_bridge(hass, {"sensors": SENSORS}) ++ ++ assert hass.states.get("sensor.sensor_1_name") is not None ++ assert hass.states.get("sensor.sensor_2_name") is None ++ assert hass.states.get("sensor.sensor_3_name") is None ++ assert hass.states.get("sensor.sensor_3_name_battery_level") is None ++ assert hass.states.get("sensor.sensor_4_name_battery_level") is not None ++ assert len(hass.states.async_all()) == 2 ++ ++ ++async def test_legacy_setup_platform_does_not_add_sensors(hass): ++ ++ added = [] ++ ++ async def async_add_devices(devices): ++ added.extend(devices) ++ ++ await deconz_sensor.async_setup_platform( ++ hass, {}, async_add_devices, discovery_info={"host": "mock-host"}) ++ ++ assert added == [] +diff --git a/tests/components/test_config_entry_forwarding.py b/tests/components/test_config_entry_forwarding.py +new file mode 100644 +index 00000000000..0e1c2fed46a +--- /dev/null ++++ b/tests/components/test_config_entry_forwarding.py +@@ -0,0 +1,48 @@ ++ ++import importlib.machinery ++import sys ++import types ++ ++import pytest ++ ++from homeassistant import config_entries ++from homeassistant.setup import async_setup_component ++ ++ ++pytestmark = pytest.mark.parametrize("entity_domain", ["binary_sensor", "sensor", "scene"]) ++ ++ ++async def test_base_entity_component_forwards_config_entries( ++ hass, monkeypatch, entity_domain): ++ ++ calls = [] ++ integration_domain = "forwarding_probe_{}".format(entity_domain) ++ platform_name = "homeassistant.components.{}.{}".format( ++ entity_domain, integration_domain) ++ ++ platform = types.ModuleType(platform_name) ++ platform.__spec__ = importlib.machinery.ModuleSpec( ++ platform_name, None, origin="fixture-test") ++ ++ async def async_setup_entry(hass_arg, entry_arg, async_add_entities): ++ ++ calls.append((hass_arg, entry_arg, async_add_entities)) ++ return True ++ ++ platform.async_setup_entry = async_setup_entry ++ ++ monkeypatch.setitem(sys.modules, platform_name, platform) ++ ++ assert await async_setup_component(hass, entity_domain, {}) is True ++ ++ entry = config_entries.ConfigEntry( ++ 1, integration_domain, "Forwarding probe", {}, "test") ++ hass.config_entries._entries.append(entry) ++ ++ result = await hass.config_entries.async_forward_entry_setup( ++ entry, entity_domain) ++ ++ assert result is not False ++ assert len(calls) == 1 ++ assert calls[0][0] is hass ++ assert calls[0][1] is entry +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,53 @@ ++#!/bin/bash ++set -uo pipefail ++cd /testbed ++ ++set +u ++if [ ! -x /testbed/.venv/bin/python ]; then ++ python3 -m venv /testbed/.venv ++fi ++source /testbed/.venv/bin/activate ++set -u ++ ++if [ ! -f /testbed/.venv/.stage3_deconz_deps ]; then ++ python -m pip install --upgrade 'pip<24' wheel 'setuptools==57.5.0' ++ python -m pip install \ ++ -e . \ ++ 'Jinja2==2.11.3' \ ++ 'MarkupSafe==2.0.1' \ ++ 'PyDispatcher==2.0.5' \ ++ 'pydeconz==36' \ ++ 'pytest==3.4.2' \ ++ 'pytest-aiohttp==0.3.0' \ ++ 'pytest-timeout==1.2.1' \ ++ 'requests_mock==1.4' \ ++ 'pytest-cov==2.5.1' \ ++ 'pytest-sugar==0.9.1' \ ++ 'asynctest>=0.11.1' \ ++ 'mock-open==1.3.1' ++ touch /testbed/.venv/.stage3_deconz_deps ++fi ++ ++case "${1:-}" in ++ base) ++ python -m pytest tests/components/deconz/test_init.py -v -k \ ++ "test_config_with_host_passed_to_config_entry or test_config_import_from_config_file or test_config_discovery" ++ ;; ++ new) ++ python -m pytest \ ++ tests/components/test_config_entry_forwarding.py \ ++ tests/components/binary_sensor/test_deconz.py \ ++ tests/components/deconz/test_init.py::test_setup_entry_already_registered_bridge \ ++ tests/components/deconz/test_init.py::test_setup_entry_no_available_bridge \ ++ tests/components/deconz/test_init.py::test_setup_entry_successful_forwards_supported_platforms \ ++ tests/components/deconz/test_init.py::test_setup_entry_can_create_forwarded_entities \ ++ tests/components/light/test_deconz.py \ ++ tests/components/scene/test_deconz.py \ ++ tests/components/sensor/test_deconz.py \ ++ -v ++ ;; ++ *) ++ echo "usage: $0 base|new" ++ exit 2 ++ ;; ++esac diff --git a/tasks/format-code-task-001489/tests/test.sh b/tasks/format-code-task-001489/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..d363199c262453a7b5afa67367887d27e7606d2e --- /dev/null +++ b/tasks/format-code-task-001489/tests/test.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/components/binary_sensor/test_deconz.py +tests/components/deconz/test_init.py +tests/components/light/test_deconz.py +tests/components/scene/test_deconz.py +tests/components/sensor/test_deconz.py +tests/components/test_config_entry_forwarding.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001489/tests/test_command.sh b/tasks/format-code-task-001489/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..e8d2f32b64045b5a5a56e0ad5667da87d8e0bc2a --- /dev/null +++ b/tasks/format-code-task-001489/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new \ No newline at end of file diff --git a/tasks/format-code-task-001501/environment/Dockerfile b/tasks/format-code-task-001501/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..cd812fba8a0a4f82cfe4a7f4e4b98f658e6b8d24 --- /dev/null +++ b/tasks/format-code-task-001501/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:d1b6dca7ac387f3b4ae5f094522e769923f90d16ee6eedb4269361eaf7dd5de2 diff --git a/tasks/format-code-task-001501/environment/setup/files/blocklist b/tasks/format-code-task-001501/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001501/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001501/environment/setup/setup.sh b/tasks/format-code-task-001501/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001501/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001501/tests/test.patch b/tasks/format-code-task-001501/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..52f33ee190e965f72f0a27c05b2b1f76c5160b84 --- /dev/null +++ b/tasks/format-code-task-001501/tests/test.patch @@ -0,0 +1,310 @@ +diff --git a/tests/components/climate/test_device_action.py b/tests/components/climate/test_device_action.py +index dc956f0738ce8c..fd5c55489169f5 100644 +--- a/tests/components/climate/test_device_action.py ++++ b/tests/components/climate/test_device_action.py +@@ -30,7 +30,24 @@ def entity_reg(hass): + return mock_registry(hass) + + +-async def test_get_actions(hass, device_reg, entity_reg): ++@pytest.mark.parametrize( ++ "set_state,features_reg,features_state,expected_action_types", ++ [ ++ (False, 0, 0, ["set_hvac_mode"]), ++ (False, const.SUPPORT_PRESET_MODE, 0, ["set_hvac_mode", "set_preset_mode"]), ++ (True, 0, 0, ["set_hvac_mode"]), ++ (True, 0, const.SUPPORT_PRESET_MODE, ["set_hvac_mode", "set_preset_mode"]), ++ ], ++) ++async def test_get_actions( ++ hass, ++ device_reg, ++ entity_reg, ++ set_state, ++ features_reg, ++ features_state, ++ expected_action_types, ++): + """Test we get the expected actions from a climate.""" + config_entry = MockConfigEntry(domain="test", data={}) + config_entry.add_to_hass(hass) +@@ -38,46 +55,30 @@ async def test_get_actions(hass, device_reg, entity_reg): + config_entry_id=config_entry.entry_id, + connections={(device_registry.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")}, + ) +- entity_reg.async_get_or_create(DOMAIN, "test", "5678", device_id=device_entry.id) +- hass.states.async_set("climate.test_5678", const.HVAC_MODE_COOL, {}) +- hass.states.async_set("climate.test_5678", "attributes", {"supported_features": 17}) +- expected_actions = [ +- { +- "domain": DOMAIN, +- "type": "set_hvac_mode", +- "device_id": device_entry.id, +- "entity_id": "climate.test_5678", +- }, +- { +- "domain": DOMAIN, +- "type": "set_preset_mode", +- "device_id": device_entry.id, +- "entity_id": "climate.test_5678", +- }, +- ] +- actions = await async_get_device_automations(hass, "action", device_entry.id) +- assert_lists_same(actions, expected_actions) ++ entity_reg.async_get_or_create( ++ DOMAIN, ++ "test", ++ "5678", ++ device_id=device_entry.id, ++ supported_features=features_reg, ++ ) ++ if set_state: ++ hass.states.async_set( ++ f"{DOMAIN}.test_5678", "attributes", {"supported_features": features_state} ++ ) + ++ expected_actions = [] + +-async def test_get_action_hvac_only(hass, device_reg, entity_reg): +- """Test we get the expected actions from a climate.""" +- config_entry = MockConfigEntry(domain="test", data={}) +- config_entry.add_to_hass(hass) +- device_entry = device_reg.async_get_or_create( +- config_entry_id=config_entry.entry_id, +- connections={(device_registry.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")}, +- ) +- entity_reg.async_get_or_create(DOMAIN, "test", "5678", device_id=device_entry.id) +- hass.states.async_set("climate.test_5678", const.HVAC_MODE_COOL, {}) +- hass.states.async_set("climate.test_5678", "attributes", {"supported_features": 1}) +- expected_actions = [ ++ expected_actions += [ + { + "domain": DOMAIN, +- "type": "set_hvac_mode", ++ "type": action, + "device_id": device_entry.id, +- "entity_id": "climate.test_5678", +- }, ++ "entity_id": f"{DOMAIN}.test_5678", ++ } ++ for action in expected_action_types + ] ++ + actions = await async_get_device_automations(hass, "action", device_entry.id) + assert_lists_same(actions, expected_actions) + +@@ -142,61 +143,153 @@ async def test_action(hass): + assert len(set_preset_mode_calls) == 1 + + +-async def test_capabilities(hass): ++@pytest.mark.parametrize( ++ "set_state,capabilities_reg,capabilities_state,action,expected_capabilities", ++ [ ++ ( ++ False, ++ {const.ATTR_HVAC_MODES: [const.HVAC_MODE_COOL, const.HVAC_MODE_OFF]}, ++ {}, ++ "set_hvac_mode", ++ [ ++ { ++ "name": "hvac_mode", ++ "options": [("cool", "cool"), ("off", "off")], ++ "required": True, ++ "type": "select", ++ } ++ ], ++ ), ++ ( ++ False, ++ {const.ATTR_PRESET_MODES: [const.PRESET_HOME, const.PRESET_AWAY]}, ++ {}, ++ "set_preset_mode", ++ [ ++ { ++ "name": "preset_mode", ++ "options": [("home", "home"), ("away", "away")], ++ "required": True, ++ "type": "select", ++ } ++ ], ++ ), ++ ( ++ True, ++ {}, ++ {const.ATTR_HVAC_MODES: [const.HVAC_MODE_COOL, const.HVAC_MODE_OFF]}, ++ "set_hvac_mode", ++ [ ++ { ++ "name": "hvac_mode", ++ "options": [("cool", "cool"), ("off", "off")], ++ "required": True, ++ "type": "select", ++ } ++ ], ++ ), ++ ( ++ True, ++ {}, ++ {const.ATTR_PRESET_MODES: [const.PRESET_HOME, const.PRESET_AWAY]}, ++ "set_preset_mode", ++ [ ++ { ++ "name": "preset_mode", ++ "options": [("home", "home"), ("away", "away")], ++ "required": True, ++ "type": "select", ++ } ++ ], ++ ), ++ ], ++) ++async def test_capabilities( ++ hass, ++ device_reg, ++ entity_reg, ++ set_state, ++ capabilities_reg, ++ capabilities_state, ++ action, ++ expected_capabilities, ++): + """Test getting capabilities.""" +- hass.states.async_set( +- "climate.entity", +- const.HVAC_MODE_COOL, +- { +- const.ATTR_HVAC_MODES: [const.HVAC_MODE_COOL, const.HVAC_MODE_OFF], +- const.ATTR_PRESET_MODES: [const.PRESET_HOME, const.PRESET_AWAY], +- }, ++ config_entry = MockConfigEntry(domain="test", data={}) ++ config_entry.add_to_hass(hass) ++ device_entry = device_reg.async_get_or_create( ++ config_entry_id=config_entry.entry_id, ++ connections={(device_registry.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")}, + ) ++ entity_reg.async_get_or_create( ++ DOMAIN, ++ "test", ++ "5678", ++ device_id=device_entry.id, ++ capabilities=capabilities_reg, ++ ) ++ if set_state: ++ hass.states.async_set( ++ f"{DOMAIN}.test_5678", ++ const.HVAC_MODE_COOL, ++ capabilities_state, ++ ) + +- # Set HVAC mode + capabilities = await device_action.async_get_action_capabilities( + hass, + { + "domain": DOMAIN, + "device_id": "abcdefgh", +- "entity_id": "climate.entity", +- "type": "set_hvac_mode", ++ "entity_id": f"{DOMAIN}.test_5678", ++ "type": action, + }, + ) + + assert capabilities and "extra_fields" in capabilities + +- assert voluptuous_serialize.convert( +- capabilities["extra_fields"], custom_serializer=cv.custom_serializer +- ) == [ +- { +- "name": "hvac_mode", +- "options": [("cool", "cool"), ("off", "off")], +- "required": True, +- "type": "select", +- } +- ] ++ assert ( ++ voluptuous_serialize.convert( ++ capabilities["extra_fields"], custom_serializer=cv.custom_serializer ++ ) ++ == expected_capabilities ++ ) ++ ++ ++@pytest.mark.parametrize( ++ "action,capability_name", ++ [("set_hvac_mode", "hvac_mode"), ("set_preset_mode", "preset_mode")], ++) ++async def test_capabilities_mising_entity( ++ hass, device_reg, entity_reg, action, capability_name ++): ++ """Test getting capabilities.""" ++ config_entry = MockConfigEntry(domain="test", data={}) ++ config_entry.add_to_hass(hass) + +- # Set preset mode + capabilities = await device_action.async_get_action_capabilities( + hass, + { + "domain": DOMAIN, + "device_id": "abcdefgh", +- "entity_id": "climate.entity", +- "type": "set_preset_mode", ++ "entity_id": f"{DOMAIN}.test_5678", ++ "type": action, + }, + ) + +- assert capabilities and "extra_fields" in capabilities +- +- assert voluptuous_serialize.convert( +- capabilities["extra_fields"], custom_serializer=cv.custom_serializer +- ) == [ ++ expected_capabilities = [ + { +- "name": "preset_mode", +- "options": [("home", "home"), ("away", "away")], ++ "name": capability_name, ++ "options": [], + "required": True, + "type": "select", + } + ] ++ ++ assert capabilities and "extra_fields" in capabilities ++ ++ assert ( ++ voluptuous_serialize.convert( ++ capabilities["extra_fields"], custom_serializer=cv.custom_serializer ++ ) ++ == expected_capabilities ++ ) +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,14 @@ ++H4sIAAAAAAAAA+2Vz2/aMBTHe+aveGMHqFQnBArsUCpN2qTtNm1XVGScB1h17NR2aDPxx+85wAqb ++Oi5U0zR/LjHO++XvyzPJvJIqn6FepxevRY8YD4fNk/j12ayzYT/Lxtf9rEd2WTYcjy9g+GoVHVA5 ++zy3AhTXG/8nu1Pt/lOS5/x6dnwlTFFzniVudL8eJ/vcH49G+/9l4lFH/r0eD/gX0zlfCy/zn/X/7 ++Jp1Lnc65W7VEDs1HMMe81XoL3x6lFyvwBr7UfmU0DJIsgy59ISX3cq4QyIDer6SDT+9hjdZJoy9b ++Oa6Z2/qWjeOg8QwhP5hHvbQ8R3Doq9IboxwsjIV9UKmkr7dxjcqhlFpjDjmWrlXKEqSmbikF7Wf3 ++m9G7NjD2UEn00L9NKXuqK6VCus87c6pOGItQcnHPlwhdzKXndIIr0KaJ3iyaUQDpjKJSwkkOUzKm ++DWss2E+L7WbwB4aQnCrjQLmdWA7MYl+VIyW5B8F1x+9KWVhTgDOVFQg7/Y9lqLlVt5MsGSWDq5t+ ++G9q24gWqpOYF7feSbJhkvd7VDa1Oq9RIRFLReVDnqIWkmrr4JFSVS72EkCw9SJCGUh5Xkvq84msk ++4VyF7rK1tFgCWwP7CJ27bvDabL2mjduGCdiQ6+3ksgMWqSSLBWrvEv/kYQO/ib7V10JTtPNUy+l+ ++d9xeVrrRaNdySRmaVoNGzOmjIq1tpb0s8EjT72gNuSwmJN8gS3ogFzzPbfiZJWNwD4orscKinpDu ++10k2hrmwdeknk0FjcKK0MF9HCh/LFbS5o7MeKzMLXjt59uadoi7r6aasFZ2MnhZZuLslrYXJUZj1 ++NKhMqbxFnG4KI+6ZobzTDWmo5Jwp6XznPIJ7tIUwiga5u1N3Xofhp7KZq5bcHs/Ss/kLcb9WmqYB ++ga7mJb0NcVr7u4QVu8jNtkvDVBkdZEqFkgX3uP0no3hS4IyLMKlJWQN7onSh36byk1GPRGz97ds3 ++EolEIpFIJBKJRCKRSCQSiUQikUgkEolEIpHz8AMZIy4EACgAAA== +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-001501/tests/test.sh b/tasks/format-code-task-001501/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0e0e7eef5a801cdbf713a14deae404800ef21a96 --- /dev/null +++ b/tasks/format-code-task-001501/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/components/climate/test_device_action.py +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001501/tests/test_command.sh b/tasks/format-code-task-001501/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001501/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001506/environment/Dockerfile b/tasks/format-code-task-001506/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..cb6f7e70659f028b440c7e7ff39922f86c8f1f6d --- /dev/null +++ b/tasks/format-code-task-001506/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:e1d14a2733830ef48f2a5583e870cf61a4f445add5fa5e715df7a25a710318ff diff --git a/tasks/format-code-task-001506/environment/setup/files/blocklist b/tasks/format-code-task-001506/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001506/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001506/environment/setup/setup.sh b/tasks/format-code-task-001506/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001506/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001506/tests/test.patch b/tasks/format-code-task-001506/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..baf89ddebeda14759189c6312c6330f6d3a0eafc --- /dev/null +++ b/tasks/format-code-task-001506/tests/test.patch @@ -0,0 +1,259 @@ +diff --git a/tests/components/pi_hole/test_init.py b/tests/components/pi_hole/test_init.py +index 9c336f8bb6d..43bf213fb1c 100644 +--- a/tests/components/pi_hole/test_init.py ++++ b/tests/components/pi_hole/test_init.py +@@ -94,60 +94,6 @@ async def test_setup_minimal_config(hass): + assert hass.states.get("binary_sensor.pi_hole").name == "Pi-Hole" + assert hass.states.get("binary_sensor.pi_hole").state == "off" + +- assert ( +- hass.states.get("binary_sensor.pi_hole_core_update_available").name +- == "Pi-Hole Core Update Available" +- ) +- assert hass.states.get("binary_sensor.pi_hole_core_update_available").state == "on" +- assert ( +- hass.states.get("binary_sensor.pi_hole_core_update_available").attributes[ +- "current_version" +- ] +- == "v5.5" +- ) +- assert ( +- hass.states.get("binary_sensor.pi_hole_core_update_available").attributes[ +- "latest_version" +- ] +- == "v5.6" +- ) +- +- assert ( +- hass.states.get("binary_sensor.pi_hole_ftl_update_available").name +- == "Pi-Hole FTL Update Available" +- ) +- assert hass.states.get("binary_sensor.pi_hole_ftl_update_available").state == "on" +- assert ( +- hass.states.get("binary_sensor.pi_hole_ftl_update_available").attributes[ +- "current_version" +- ] +- == "v5.10" +- ) +- assert ( +- hass.states.get("binary_sensor.pi_hole_ftl_update_available").attributes[ +- "latest_version" +- ] +- == "v5.11" +- ) +- +- assert ( +- hass.states.get("binary_sensor.pi_hole_web_update_available").name +- == "Pi-Hole Web Update Available" +- ) +- assert hass.states.get("binary_sensor.pi_hole_web_update_available").state == "on" +- assert ( +- hass.states.get("binary_sensor.pi_hole_web_update_available").attributes[ +- "current_version" +- ] +- == "v5.7" +- ) +- assert ( +- hass.states.get("binary_sensor.pi_hole_web_update_available").attributes[ +- "latest_version" +- ] +- == "v5.8" +- ) +- + + async def test_setup_name_config(hass): + """Tests component setup with a custom name.""" +diff --git a/tests/components/pi_hole/test_update.py b/tests/components/pi_hole/test_update.py +new file mode 100644 +index 00000000000..c2c3aa0c327 +--- /dev/null ++++ b/tests/components/pi_hole/test_update.py +@@ -0,0 +1,159 @@ ++ ++ ++from homeassistant.components import pi_hole ++from homeassistant.const import STATE_OFF, STATE_ON, STATE_UNKNOWN ++from homeassistant.helpers import entity_registry as er ++from homeassistant.helpers.entity import EntityCategory ++from homeassistant.setup import async_setup_component ++ ++from . import _create_mocked_hole, _patch_config_flow_hole, _patch_init_hole ++ ++ALT_VERSIONS = { ++ "core_update": True, ++ "core_current": "v9.1.0", ++ "core_latest": "v9.1.1", ++ "web_update": True, ++ "web_current": "v10.2.0", ++ "web_latest": "v10.2.3", ++ "FTL_update": True, ++ "FTL_current": "v11.3.0", ++ "FTL_latest": "v11.3.4", ++} ++ ++NO_UPDATE_VERSIONS = { ++ "core_update": False, ++ "core_current": "v9.1.1", ++ "core_latest": "v9.1.1", ++ "web_update": False, ++ "web_current": "v10.2.3", ++ "web_latest": "v10.2.3", ++ "FTL_update": False, ++ "FTL_current": "v11.3.4", ++ "FTL_latest": "v11.3.4", ++} ++ ++ ++async def _setup_pi_hole(hass, versions=ALT_VERSIONS): ++ ++ mocked_hole = _create_mocked_hole() ++ mocked_hole.versions = versions ++ ++ with _patch_config_flow_hole(mocked_hole), _patch_init_hole(mocked_hole): ++ assert await async_setup_component( ++ hass, pi_hole.DOMAIN, {pi_hole.DOMAIN: [{"host": "pi.hole"}]} ++ ) ++ ++ await hass.async_block_till_done() ++ ++ ++def _update_states_by_name(hass): ++ ++ return {state.name: state for state in hass.states.async_all("update")} ++ ++ ++async def test_update_entities_are_created_with_version_metadata(hass): ++ ++ await _setup_pi_hole(hass) ++ ++ states = _update_states_by_name(hass) ++ expected = { ++ "Pi-Hole Core Update Available": ( ++ "v9.1.0", ++ "v9.1.1", ++ "https://github.com/pi-hole/pi-hole/releases/tag/v9.1.1", ++ ), ++ "Pi-Hole Web Update Available": ( ++ "v10.2.0", ++ "v10.2.3", ++ "https://github.com/pi-hole/AdminLTE/releases/tag/v10.2.3", ++ ), ++ "Pi-Hole FTL Update Available": ( ++ "v11.3.0", ++ "v11.3.4", ++ "https://github.com/pi-hole/FTL/releases/tag/v11.3.4", ++ ), ++ } ++ ++ for name, (current_version, latest_version, release_url) in expected.items(): ++ state = states.get(name) ++ assert state is not None ++ assert state.state == STATE_ON ++ assert state.attributes["current_version"] == current_version ++ assert state.attributes["latest_version"] == latest_version ++ assert state.attributes["release_url"] == release_url ++ ++ ++async def test_update_entities_report_no_update_when_versions_match(hass): ++ ++ await _setup_pi_hole(hass, versions=NO_UPDATE_VERSIONS) ++ ++ states = _update_states_by_name(hass) ++ for name in ( ++ "Pi-Hole Core Update Available", ++ "Pi-Hole Web Update Available", ++ "Pi-Hole FTL Update Available", ++ ): ++ state = states.get(name) ++ assert state is not None ++ assert state.state == STATE_OFF ++ ++ ++async def test_update_entities_handle_missing_versions(hass): ++ ++ await _setup_pi_hole(hass, versions=None) ++ ++ states = _update_states_by_name(hass) ++ for name in ( ++ "Pi-Hole Core Update Available", ++ "Pi-Hole Web Update Available", ++ "Pi-Hole FTL Update Available", ++ ): ++ state = states.get(name) ++ assert state is not None ++ assert state.state == STATE_UNKNOWN ++ assert state.attributes.get("current_version") is None ++ assert state.attributes.get("latest_version") is None ++ assert state.attributes.get("release_url") is None ++ ++ ++async def test_update_entities_have_titles_and_diagnostic_category(hass): ++ ++ await _setup_pi_hole(hass) ++ ++ registry = er.async_get(hass) ++ states = _update_states_by_name(hass) ++ expected_titles = { ++ "Pi-Hole Core Update Available": "Pi-hole Core", ++ "Pi-Hole Web Update Available": "Pi-hole Web interface", ++ "Pi-Hole FTL Update Available": "Pi-hole FTL DNS", ++ } ++ ++ for name, title in expected_titles.items(): ++ state = states[name] ++ assert state.attributes["title"] == title ++ entry = registry.async_get(state.entity_id) ++ assert entry is not None ++ assert entry.entity_category == EntityCategory.DIAGNOSTIC ++ ++ ++async def test_legacy_update_binary_sensors_disabled_by_default(hass): ++ ++ await _setup_pi_hole(hass) ++ ++ registry = er.async_get(hass) ++ legacy_entity_ids = ( ++ "binary_sensor.pi_hole_core_update_available", ++ "binary_sensor.pi_hole_web_update_available", ++ "binary_sensor.pi_hole_ftl_update_available", ++ ) ++ ++ for entity_id in legacy_entity_ids: ++ entry = registry.async_get(entity_id) ++ assert entry is not None ++ assert entry.disabled_by == er.RegistryEntryDisabler.INTEGRATION ++ assert hass.states.get(entity_id) is None ++ ++ status_entry = registry.async_get("binary_sensor.pi_hole") ++ assert status_entry is not None ++ assert status_entry.disabled_by is None ++ assert hass.states.get("binary_sensor.pi_hole") is not None +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,24 @@ ++#!/bin/bash ++set -uo pipefail ++cd /testbed ++ ++set +u ++source /testbed/.build_env/.venv/bin/activate ++set -u ++export PYTHONPATH=/testbed ++ ++case "${1:-}" in ++ base) ++ python -m pytest tests/components/pi_hole/test_init.py -x -v ++ ;; ++ new) ++ python -m pytest \ ++ tests/components/pi_hole/test_update.py \ ++ tests/components/pi_hole/test_init.py::test_setup_minimal_config \ ++ -x -v ++ ;; ++ *) ++ echo "usage: $0 base|new" ++ exit 2 ++ ;; ++esac diff --git a/tasks/format-code-task-001506/tests/test.sh b/tasks/format-code-task-001506/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a61c15e4e7f7f50261222aa500debab63b79d3d --- /dev/null +++ b/tasks/format-code-task-001506/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/components/pi_hole/test_init.py +tests/components/pi_hole/test_update.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001506/tests/test_command.sh b/tasks/format-code-task-001506/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..e8d2f32b64045b5a5a56e0ad5667da87d8e0bc2a --- /dev/null +++ b/tasks/format-code-task-001506/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new \ No newline at end of file diff --git a/tasks/format-code-task-001539/environment/Dockerfile b/tasks/format-code-task-001539/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..2cde909b952f7385123913a0dca1836dd35241d3 --- /dev/null +++ b/tasks/format-code-task-001539/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:36becd9eef4f98db18733e5cf9803e3fd5c3aa081a4e38174483241bf3430d09 diff --git a/tasks/format-code-task-001539/environment/setup/files/blocklist b/tasks/format-code-task-001539/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001539/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001539/environment/setup/setup.sh b/tasks/format-code-task-001539/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-001539/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001539/tests/test.patch b/tasks/format-code-task-001539/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..024343c2e0ebdd438bbcb269abb5940a5837a70a --- /dev/null +++ b/tasks/format-code-task-001539/tests/test.patch @@ -0,0 +1,214 @@ +diff --git a/usercase-test-coderl/cached_async_buffer.test.js b/usercase-test-coderl/cached_async_buffer.test.js +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/cached_async_buffer.test.js +@@ -0,0 +1,182 @@ ++import { describe, expect, it } from 'vitest' ++import { cachedAsyncBuffer } from 'hyparquet' ++ ++ ++ ++ ++ ++ ++ ++function bytes(buffer) { ++ return Array.from(new Uint8Array(buffer)) ++} ++ ++function makeAsyncBuffer(byteLength) { ++ const data = Uint8Array.from({ length: byteLength }, (_, index) => index % 256) ++ const calls = [] ++ return { ++ calls, ++ file: { ++ byteLength, ++ slice(start, end) { ++ calls.push([start, end ?? null]) ++ return Promise.resolve(data.buffer.slice(start, end)) ++ }, ++ }, ++ } ++} ++ ++ ++function normalizedCallRange([start, end], byteLength) { ++ const normalizedStart = start < 0 ? byteLength + start : start ++ const normalizedEnd = end ?? byteLength ++ return [normalizedStart, normalizedEnd] ++} ++ ++describe('cachedAsyncBuffer user contract', () => { ++ it('caches the whole source once for files smaller than minSize', async () => { ++ ++ ++ ++ ++ const { file, calls } = makeAsyncBuffer(100) ++ const cached = cachedAsyncBuffer(file, { minSize: 200 }) ++ ++ expect(cached.byteLength).toBe(100) ++ ++ expect(bytes(await cached.slice(0, 10))).toEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) ++ ++ expect(calls).toEqual([[0, 100]]) ++ ++ expect(bytes(await cached.slice(50, 60))).toEqual([50, 51, 52, 53, 54, 55, 56, 57, 58, 59]) ++ expect(calls).toEqual([[0, 100]]) ++ }) ++ ++ it('shares duplicate large-file range promises and reads distinct ranges separately', async () => { ++ ++ ++ ++ ++ const { file, calls } = makeAsyncBuffer(1000) ++ const cached = cachedAsyncBuffer(file, { minSize: 100 }) ++ ++ expect(cached.byteLength).toBe(1000) ++ ++ const first = cached.slice(0, 10) ++ const second = cached.slice(0, 10) ++ ++ ++ expect(calls).toEqual([[0, 10]]) ++ expect(bytes(await first)).toEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) ++ expect(bytes(await second)).toEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) ++ ++ expect(bytes(await cached.slice(10, 20))).toEqual([10, 11, 12, 13, 14, 15, 16, 17, 18, 19]) ++ expect(calls).toEqual([[0, 10], [10, 20]]) ++ }) ++ ++ it('normalizes open-ended ranges to the same large-file cache key', async () => { ++ ++ ++ ++ ++ const { file, calls } = makeAsyncBuffer(1000) ++ const cached = cachedAsyncBuffer(file, { minSize: 100 }) ++ ++ const openEnded = cached.slice(100) ++ const explicitEnd = cached.slice(100, 1000) ++ ++ ++ expect(calls).toHaveLength(1) ++ expect(normalizedCallRange(calls[0], file.byteLength)).toEqual([100, 1000]) ++ expect(bytes(await openEnded).slice(0, 12)).toEqual([100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111]) ++ expect((await explicitEnd).byteLength).toBe(900) ++ }) ++ ++ it('normalizes suffix ranges to the same large-file cache key', async () => { ++ ++ ++ ++ ++ const { file, calls } = makeAsyncBuffer(1000) ++ const cached = cachedAsyncBuffer(file, { minSize: 100 }) ++ ++ const suffix = cached.slice(-10) ++ const explicit = cached.slice(990, 1000) ++ ++ ++ expect(calls).toHaveLength(1) ++ expect(normalizedCallRange(calls[0], file.byteLength)).toEqual([990, 1000]) ++ expect(bytes(await suffix)).toEqual([222, 223, 224, 225, 226, 227, 228, 229, 230, 231]) ++ }) ++ ++ it('throws exact errors for invalid ranges before touching the source', () => { ++ ++ ++ ++ ++ const suffixCase = makeAsyncBuffer(1000) ++ const suffixCached = cachedAsyncBuffer(suffixCase.file, { minSize: 100 }) ++ let suffixError ++ try { ++ suffixCached.slice(-10, 20) ++ } catch (error) { ++ suffixError = error ++ } ++ ++ expect(suffixError).toBeInstanceOf(Error) ++ expect(suffixError.message).toBe('invalid suffix range [-10, 20]') ++ expect(suffixCase.calls).toEqual([]) ++ ++ const emptyCase = makeAsyncBuffer(1000) ++ const emptyCached = cachedAsyncBuffer(emptyCase.file, { minSize: 100 }) ++ let emptyError ++ try { ++ emptyCached.slice(20, 10) ++ } catch (error) { ++ emptyError = error ++ } ++ ++ expect(emptyError).toBeInstanceOf(Error) ++ expect(emptyError.message).toBe('invalid empty range [20, 10]') ++ expect(emptyCase.calls).toEqual([]) ++ }) ++ ++ it('keeps separate wrappers around one source independent', async () => { ++ ++ ++ ++ ++ const { file, calls } = makeAsyncBuffer(1000) ++ const firstWrapper = cachedAsyncBuffer(file, { minSize: 100 }) ++ const secondWrapper = cachedAsyncBuffer(file, { minSize: 100 }) ++ ++ expect(firstWrapper.byteLength).toBe(1000) ++ expect(secondWrapper.byteLength).toBe(1000) ++ expect(bytes(await firstWrapper.slice(0, 10))).toEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) ++ expect(calls).toEqual([[0, 10]]) ++ ++ expect(bytes(await secondWrapper.slice(0, 10))).toEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) ++ expect(calls).toEqual([[0, 10], [0, 10]]) ++ }) ++ ++ it('keeps source calls bounded over repeated cache wrapper cycles', async () => { ++ ++ ++ ++ ++ const { file, calls } = makeAsyncBuffer(1000) ++ ++ for (let index = 0; index < 120; index++) { ++ const cached = cachedAsyncBuffer(file, { minSize: 100 }) ++ const first = cached.slice(0, 10) ++ const second = cached.slice(0, 10) ++ ++ ++ expect(calls).toHaveLength(index + 1) ++ expect(bytes(await first)).toEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) ++ expect(bytes(await second)).toEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) ++ } ++ ++ expect(calls.length).toBe(120) ++ }) ++}) +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,22 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++ ++ ++set -euo pipefail ++cd /workspace/repo ++ ++if [ ! -x /workspace/repo/node_modules/.bin/vitest ]; then ++ echo "Missing local vitest binary at /workspace/repo/node_modules/.bin/vitest" >&2 ++ exit 1 ++fi ++ ++exec /workspace/repo/node_modules/.bin/vitest run /workspace/repo/usercase-test-coderl/cached_async_buffer.test.js diff --git a/tasks/format-code-task-001539/tests/test.sh b/tasks/format-code-task-001539/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0aa9249003d6a36b211bc1e122dd20690913cd18 --- /dev/null +++ b/tasks/format-code-task-001539/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/cached_async_buffer.test.js +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001539/tests/test_command.sh b/tasks/format-code-task-001539/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-001539/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001623/environment/Dockerfile b/tasks/format-code-task-001623/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..bc0c86a4bbee5bfa973422280518a25eb46bd2d1 --- /dev/null +++ b/tasks/format-code-task-001623/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:cf3f0deeac7114e56dcad168cb2b27f60d463d29272200a64d49def058d5b05d diff --git a/tasks/format-code-task-001623/environment/setup/files/blocklist b/tasks/format-code-task-001623/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001623/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001623/environment/setup/setup.sh b/tasks/format-code-task-001623/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001623/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001623/tests/test.patch b/tasks/format-code-task-001623/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..476c89df1087e2a62f8f2e57b5b9b032bcfec2e6 --- /dev/null +++ b/tasks/format-code-task-001623/tests/test.patch @@ -0,0 +1,364 @@ +diff --git a/anyUtil/any_to_float_x_test.go b/anyUtil/any_to_float_x_test.go +index 3d0a55e..8cc7669 100644 +--- a/anyUtil/any_to_float_x_test.go ++++ b/anyUtil/any_to_float_x_test.go +@@ -1,7 +1,6 @@ + package anyUtil + + import ( +- go_easy_utils "github.com/jefferyjob/go-easy-utils/v2" + "math" + "testing" + ) +@@ -30,8 +29,8 @@ func TestAnyToFloat32(t *testing.T) { + {uint32(32), 32, nil}, + {uint64(64), 64, nil}, + {"3.14", 3.14, nil}, +- {math.MaxFloat64, 0, go_easy_utils.ErrValOut}, +- {make(chan int), 0, go_easy_utils.ErrType}, ++ {math.MaxFloat64, 0, ErrValOut}, ++ {make(chan int), 0, ErrType}, + } + + for _, test := range tests { +@@ -79,8 +78,8 @@ func TestAnyToFloat64(t *testing.T) { + {complex128(1 + 2i), 1, nil}, + {&iPtr, 90, nil}, + {(*int)(nil), 0, nil}, +- {"abc", 0, go_easy_utils.ErrSyntax}, +- {[]int{}, 0, go_easy_utils.ErrType}, ++ {"abc", 0, ErrSyntax}, ++ {[]int{}, 0, ErrType}, + } + + for _, test := range tests { +diff --git a/anyUtil/any_to_int_x_test.go b/anyUtil/any_to_int_x_test.go +index 6c75509..e7405d5 100644 +--- a/anyUtil/any_to_int_x_test.go ++++ b/anyUtil/any_to_int_x_test.go +@@ -2,7 +2,6 @@ package anyUtil + + import ( + "errors" +- "github.com/jefferyjob/go-easy-utils/v2" + "math" + "testing" + ) +@@ -32,7 +31,7 @@ func TestAnyToInt(t *testing.T) { + {input: float32(123.45), expected: 123, err: nil}, + {input: float64(123.45), expected: 123, err: nil}, + {input: "123", expected: 123, err: nil}, +- {input: "abc", expected: 0, err: go_easy_utils.ErrSyntax}, ++ {input: "abc", expected: 0, err: ErrSyntax}, + } + + for _, tc := range testCases { +@@ -83,13 +82,13 @@ func TestAnyToInt8(t *testing.T) { + name: "positive integer out of range", + input: 128, + expected: 0, +- err: go_easy_utils.ErrValOut, ++ err: ErrValOut, + }, + { + name: "negative integer out of range", + input: -129, + expected: 0, +- err: go_easy_utils.ErrValOut, ++ err: ErrValOut, + }, + { + name: "float", +@@ -107,13 +106,13 @@ func TestAnyToInt8(t *testing.T) { + name: "string out of range", + input: "128", + expected: 0, +- err: go_easy_utils.ErrValOut, ++ err: ErrValOut, + }, + { + name: "invalid string", + input: "invalid", + expected: 0, +- err: go_easy_utils.ErrSyntax, ++ err: ErrSyntax, + }, + } + +@@ -159,8 +158,8 @@ func TestAnyToInt16(t *testing.T) { + {float32(123.45), 123, nil}, + {float64(123.45), 123, nil}, + {"12345", 12345, nil}, +- {math.MinInt16 - 1, 0, go_easy_utils.ErrValOut}, +- {"not a number", 0, go_easy_utils.ErrSyntax}, ++ {math.MinInt16 - 1, 0, ErrValOut}, ++ {"not a number", 0, ErrSyntax}, + } + + for _, tt := range tests { +@@ -184,13 +183,13 @@ func TestAnyToInt32(t *testing.T) { + }{ + {int(123), 123, nil}, + {int64(2147483647), 2147483647, nil}, +- {int64(2147483648), 0, go_easy_utils.ErrValOut}, ++ {int64(2147483648), 0, ErrValOut}, + {int64(-2147483648), -2147483648, nil}, +- {int64(-2147483649), 0, go_easy_utils.ErrValOut}, ++ {int64(-2147483649), 0, ErrValOut}, + {float64(123.45), 123, nil}, + {"123", 123, nil}, +- {"-2147483649", 0, go_easy_utils.ErrValOut}, +- {struct{}{}, 0, go_easy_utils.ErrType}, ++ {"-2147483649", 0, ErrValOut}, ++ {struct{}{}, 0, ErrType}, + } + + for _, testCase := range testCases { +diff --git a/anyUtil/any_to_uint_x_test.go b/anyUtil/any_to_uint_x_test.go +index ae47560..09f80d7 100644 +--- a/anyUtil/any_to_uint_x_test.go ++++ b/anyUtil/any_to_uint_x_test.go +@@ -1,7 +1,6 @@ + package anyUtil + + import ( +- "github.com/jefferyjob/go-easy-utils/v2" + "reflect" + "testing" + ) +@@ -14,11 +13,11 @@ func TestAnyToUint(t *testing.T) { + err error + }{ + {10, 10, nil}, +- {-5, 0, go_easy_utils.ErrUnsignedInt}, ++ {-5, 0, ErrUnsignedInt}, + {"20", 20, nil}, + {1.5, 1, nil}, + {2.5, 2, nil}, +- {make(chan int), 0, go_easy_utils.ErrType}, ++ {make(chan int), 0, ErrType}, + } + + // Test loop +@@ -39,10 +38,10 @@ func TestAnyToUint8(t *testing.T) { + err error + }{ + {10, 10, nil}, +- {300, 0, go_easy_utils.ErrValOut}, ++ {300, 0, ErrValOut}, + {"20", 20, nil}, + {1.5, 1, nil}, +- {make(chan int), 0, go_easy_utils.ErrType}, ++ {make(chan int), 0, ErrType}, + } + + // Test loop +@@ -63,10 +62,10 @@ func TestAnyToUint16(t *testing.T) { + err error + }{ + {10, 10, nil}, +- {70000, 0, go_easy_utils.ErrValOut}, ++ {70000, 0, ErrValOut}, + {"20", 20, nil}, + {1.5, 1, nil}, +- {make(chan int), 0, go_easy_utils.ErrType}, ++ {make(chan int), 0, ErrType}, + } + + // Test loop +@@ -87,10 +86,10 @@ func TestAnyToUint32(t *testing.T) { + err error + }{ + {10, 10, nil}, +- {5000000000, 0, go_easy_utils.ErrValOut}, ++ {5000000000, 0, ErrValOut}, + {"20", 20, nil}, + {1.5, 1, nil}, +- {make(chan int), 0, go_easy_utils.ErrType}, ++ {make(chan int), 0, ErrType}, + } + + // Test loop +@@ -115,37 +114,37 @@ func TestAnyToUint64(t *testing.T) { + { + name: "Test -float32", + input: float32(-0.1), +- wantError: go_easy_utils.ErrUnsignedInt, ++ wantError: ErrUnsignedInt, + }, + { + name: "Test -float64", + input: float64(-0.2), +- wantError: go_easy_utils.ErrUnsignedInt, ++ wantError: ErrUnsignedInt, + }, + { + name: "Test -int", + input: int(-1), +- wantError: go_easy_utils.ErrUnsignedInt, ++ wantError: ErrUnsignedInt, + }, + { + name: "Test -int8", + input: int8(-2), +- wantError: go_easy_utils.ErrUnsignedInt, ++ wantError: ErrUnsignedInt, + }, + { + name: "Test -int16", + input: int16(-3), +- wantError: go_easy_utils.ErrUnsignedInt, ++ wantError: ErrUnsignedInt, + }, + { + name: "Test -int32", + input: int32(-4), +- wantError: go_easy_utils.ErrUnsignedInt, ++ wantError: ErrUnsignedInt, + }, + { + name: "Test -int64", + input: int64(-5), +- wantError: go_easy_utils.ErrUnsignedInt, ++ wantError: ErrUnsignedInt, + }, + { + name: "Test uint", +@@ -220,7 +219,7 @@ func TestAnyToUint64(t *testing.T) { + { + name: "Test invalid string", + input: "not a number", +- wantError: go_easy_utils.ErrSyntax, ++ wantError: ErrSyntax, + }, + { + name: "Test nil pointer", +@@ -251,12 +250,12 @@ func TestAnyToUint64(t *testing.T) { + { + name: "test -complex", + input: complex(-1, -1), +- wantError: go_easy_utils.ErrUnsignedInt, ++ wantError: ErrUnsignedInt, + }, + { + name: "Test invalid type", + input: make(chan int), +- wantError: go_easy_utils.ErrType, ++ wantError: ErrType, + }, + } + +diff --git a/jsonUtil/to_float_test.go b/jsonUtil/to_float_test.go +index 0db7fb7..c6b4418 100644 +--- a/jsonUtil/to_float_test.go ++++ b/jsonUtil/to_float_test.go +@@ -1,7 +1,6 @@ + package jsonUtil + + import ( +- go_easy_utils "github.com/jefferyjob/go-easy-utils/v2" + "reflect" + "testing" + ) +@@ -44,8 +43,8 @@ func TestToFloat64(t *testing.T) { + {true, 1, nil}, + {false, 0, nil}, + {(*bool)(nil), 0, nil}, +- {make(chan int), 0, go_easy_utils.ErrType}, +- {"abc", 0, go_easy_utils.ErrSyntax}, ++ {make(chan int), 0, ErrType}, ++ {"abc", 0, ErrSyntax}, + } + + for _, tc := range testCases { +@@ -90,7 +89,7 @@ func TestToFloat64Pointer(t *testing.T) { + name: "invalid string input", + input: stringPtr("abc"), + expectedValue: 0, +- expectedError: go_easy_utils.ErrSyntax, ++ expectedError: ErrSyntax, + }, + { + name: "valid string input", +@@ -186,7 +185,7 @@ func TestToFloat64Pointer(t *testing.T) { + name: "unsupported input type", + input: "unsupported", + expectedValue: 0, +- expectedError: go_easy_utils.ErrSyntax, ++ expectedError: ErrSyntax, + }, + } + +diff --git a/jsonUtil/to_int_test.go b/jsonUtil/to_int_test.go +index f349c82..c814b81 100644 +--- a/jsonUtil/to_int_test.go ++++ b/jsonUtil/to_int_test.go +@@ -1,7 +1,6 @@ + package jsonUtil + + import ( +- "github.com/jefferyjob/go-easy-utils/v2" + "testing" + ) + +@@ -31,8 +30,8 @@ func TestToInt64(t *testing.T) { + {complex64(1 + 2i), 1, nil}, + {complex128(1 + 2i), 1, nil}, + {nil, 0, nil}, +- {"not a number", 0, go_easy_utils.ErrSyntax}, +- {make(chan int), 0, go_easy_utils.ErrType}, ++ {"not a number", 0, ErrSyntax}, ++ {make(chan int), 0, ErrType}, + } + + for _, tt := range tests { +diff --git a/jsonUtil/to_uint_test.go b/jsonUtil/to_uint_test.go +index 3660416..778ef59 100644 +--- a/jsonUtil/to_uint_test.go ++++ b/jsonUtil/to_uint_test.go +@@ -1,7 +1,6 @@ + package jsonUtil + + import ( +- "github.com/jefferyjob/go-easy-utils/v2" + "testing" + ) + +@@ -125,7 +124,7 @@ func TestToUint64(t *testing.T) { + { + name: "Test invalid string", + input: "not a number", +- wantError: go_easy_utils.ErrSyntax, ++ wantError: ErrSyntax, + }, + { + name: "Test nil pointer", +@@ -146,7 +145,7 @@ func TestToUint64(t *testing.T) { + { + name: "Test invalid type", + input: make(chan int), +- wantError: go_easy_utils.ErrType, ++ wantError: ErrType, + }, + } + +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,4 @@ ++H4sIAAAAAAAAA+3R3wqCMBTHca99ij3BnJb6JF2L/yhDHegMevumkEVQ3igRfT8X2znswA78ZDZU ++dZGU7cVztqKsOAyn23q9p9oPAxVEvmXn7BHvHBFuttGToTdpJ4TTaW0+zS29/yj5yN+UvUly3TRp ++W8j+tN4fi/lH/py/Guf8faRiR6j1Vnjvz/PPCzEFn5WFe9RiLIX00vZ6MFXtSSltd+51e2/dby8M ++AAAAAAAAAAAAAAAAYHYDEHVxdgAoAAA= +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-001623/tests/test.sh b/tasks/format-code-task-001623/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..1098eaff39a94325045ddbdf9fecf2da6d2e793a --- /dev/null +++ b/tasks/format-code-task-001623/tests/test.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +anyUtil/any_to_float_x_test.go +anyUtil/any_to_int_x_test.go +anyUtil/any_to_uint_x_test.go +jsonUtil/to_float_test.go +jsonUtil/to_int_test.go +jsonUtil/to_uint_test.go +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001623/tests/test_command.sh b/tasks/format-code-task-001623/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001623/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001624/environment/Dockerfile b/tasks/format-code-task-001624/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..2412dad690b6566c3351a43b5d091f72226dcdac --- /dev/null +++ b/tasks/format-code-task-001624/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:e16ad02f483a5ddab8cb09c57cfa2e8bd6dea567f0fafe2c862e41ec82ae5116 diff --git a/tasks/format-code-task-001624/environment/setup/files/blocklist b/tasks/format-code-task-001624/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001624/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001624/environment/setup/setup.sh b/tasks/format-code-task-001624/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001624/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001624/tests/test.patch b/tasks/format-code-task-001624/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..fac9645821b165bf4d10f1d6f71bcde129e3476f --- /dev/null +++ b/tasks/format-code-task-001624/tests/test.patch @@ -0,0 +1,218 @@ +diff --git a/test/source/_posts/2018-01-28-balanced-liquid-blocks-before-excerpt.markdown b/test/source/_posts/2018-01-28-balanced-liquid-blocks-before-excerpt.markdown +new file mode 100644 +index 000000000..0f69c6714 +--- /dev/null ++++ b/test/source/_posts/2018-01-28-balanced-liquid-blocks-before-excerpt.markdown +@@ -0,0 +1,18 @@ ++--- ++layout: post ++excerpt_separator: ++--- ++ ++{% if page.layout == "post" %} ++balanced conditional text ++{% endif %} ++ ++{% capture balanced_excerpt_value %} ++balanced capture text ++{% endcapture %} ++ ++{{ balanced_excerpt_value }} ++ ++ ++ ++after the excerpt +diff --git a/test/source/_posts/2018-01-28-custom-liquid-block-excerpt.markdown b/test/source/_posts/2018-01-28-custom-liquid-block-excerpt.markdown +new file mode 100644 +index 000000000..a628fd621 +--- /dev/null ++++ b/test/source/_posts/2018-01-28-custom-liquid-block-excerpt.markdown +@@ -0,0 +1,16 @@ ++--- ++layout: post ++excerpt_separator: ++--- ++ ++{% excerptcustomalpha7352 %} ++alpha body before separator ++{% endexcerptcustomalpha7352 %} ++ ++{% excerptcustombeta7352 %} ++custom body before separator ++ ++custom body after separator ++{% endexcerptcustombeta7352 %} ++ ++after the excerpt +diff --git a/test/source/_posts/2018-01-28-later-liquid-block-cut-excerpt.markdown b/test/source/_posts/2018-01-28-later-liquid-block-cut-excerpt.markdown +new file mode 100644 +index 000000000..b05ac8585 +--- /dev/null ++++ b/test/source/_posts/2018-01-28-later-liquid-block-cut-excerpt.markdown +@@ -0,0 +1,16 @@ ++--- ++layout: post ++excerpt_separator: ++--- ++ ++{% if page.layout == "post" %} ++earlier closed block rendered ++{% endif %} ++ ++{% unless false %} ++captured before the separator ++ ++captured after the separator ++{% endunless %} ++ ++after the excerpt +diff --git a/test/test_excerpt.rb b/test/test_excerpt.rb +index 24647deca..ef5e12fe2 100644 +--- a/test/test_excerpt.rb ++++ b/test/test_excerpt.rb +@@ -264,4 +264,117 @@ class TestExcerpt < JekyllUnitTest + assert_equal true, @excerpt.is_a?(Jekyll::Excerpt) + end + end ++ ++ context "with multiple Liquid blocks before an excerpt boundary" do ++ setup do ++ clear_dest ++ @site = fixture_site ++ @post = setup_post("2018-01-28-later-liquid-block-cut-excerpt.markdown") ++ @excerpt = @post.data["excerpt"] ++ end ++ ++ should "render when a later block is cut after an earlier closed block" do ++ rendered = nil ++ ++ assert_silent do ++ rendered = do_render(@excerpt) ++ end ++ ++ assert_includes rendered, "earlier closed block rendered" ++ assert_includes rendered, "captured before the separator" ++ refute_match %r!\{%-?\s*unless\b!, rendered ++ refute_match %r!\{%-?\s*endunless\b!, rendered ++ end ++ end ++ ++ context "with balanced Liquid blocks before an excerpt boundary" do ++ setup do ++ clear_dest ++ @site = fixture_site ++ @post = setup_post("2018-01-28-balanced-liquid-blocks-before-excerpt.markdown") ++ @excerpt = @post.data["excerpt"] ++ end ++ ++ should "not break the excerpt when all blocks are already balanced" do ++ rendered = nil ++ ++ assert_silent do ++ rendered = do_render(@excerpt) ++ end ++ ++ assert_includes rendered, "balanced conditional text" ++ assert_includes rendered, "balanced capture text" ++ refute_match %r!\{%-?\s*(?:end)?if\b!, rendered ++ refute_match %r!\{%-?\s*(?:end)?capture\b!, rendered ++ end ++ end ++ ++ class ExcerptCustomBlockBaseFor7352 < Liquid::Block ++ def render(context) ++ "custom-block: #{super.to_s.strip}" ++ end ++ end ++ ++ class ExcerptCustomAlphaFor7352 < ExcerptCustomBlockBaseFor7352 ++ end ++ ++ class ExcerptCustomBetaFor7352 < ExcerptCustomBlockBaseFor7352 ++ end ++ ++ context "with registered custom Liquid block tags" do ++ setup do ++ clear_dest ++ @site = fixture_site ++ ++ Liquid::Template.register_tag( ++ "excerptcustomalpha7352", ++ ExcerptCustomAlphaFor7352 ++ ) ++ Liquid::Template.register_tag( ++ "excerptcustombeta7352", ++ ExcerptCustomBetaFor7352 ++ ) ++ ++ @post = setup_post("2018-01-28-custom-liquid-block-excerpt.markdown") ++ @excerpt = @post.data["excerpt"] ++ end ++ ++ should "render a registered custom block tag when cut by the excerpt separator" do ++ rendered = nil ++ ++ assert_silent do ++ rendered = do_render(@excerpt) ++ end ++ ++ assert_includes rendered, "custom-block: alpha body before separator" ++ assert_includes rendered, "custom-block: custom body before separator" ++ refute_match %r!\{%-?\s*excerptcustom(?:alpha|beta)7352\b!, rendered ++ refute_match %r!\{%-?\s*endexcerptcustom(?:alpha|beta)7352\b!, rendered ++ end ++ end ++ ++ context "when excerpt generation adjusts a cut Liquid block" do ++ should "warn with the affected document, separator, adjustment, and user guidance" do ++ warnings = [] ++ logger = Jekyll.logger ++ ++ logger.stub(:warn, proc { |*args| warnings << args.join(" ") }) do ++ clear_dest ++ @site = fixture_site ++ post = setup_post("2018-01-28-later-liquid-block-cut-excerpt.markdown") ++ do_render(post.data["excerpt"]) ++ end ++ ++ warning_text = warnings.join(" ") ++ ++ assert_includes warning_text, ++ "2018-01-28-later-liquid-block-cut-excerpt.markdown" ++ assert_includes warning_text, "" ++ assert_match %r!\b(?:adjusted|modified|changed)\b!i, warning_text ++ assert_match %r!\bexcerpt_separator\b!, warning_text ++ assert_match %r!\bcustom\s+excerpt\b!i, warning_text ++ assert_match %r!\bfront\s+matter\b!i, warning_text ++ end ++ end ++ + end +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,23 @@ ++#!/bin/bash ++set -uo pipefail ++cd /testbed ++ ++ ++export PATH="$HOME/.rbenv/bin:$PATH" ++eval "$(rbenv init - bash)" ++ ++ ++case "${1:-}" in ++ base) ++ ruby -Ilib -Itest test/test_excerpt.rb \ ++ --exclude '/multiple Liquid blocks before an excerpt boundary|balanced Liquid blocks before an excerpt boundary|registered custom Liquid block tags|excerpt generation adjusts a cut Liquid block/' ++ ;; ++ new) ++ ruby -Ilib -Itest test/test_excerpt.rb \ ++ --name '/later block is cut after an earlier closed block|all blocks are already balanced|registered custom block tag when cut by the excerpt separator|affected document, separator, adjustment, and user guidance/' ++ ;; ++ *) ++ echo "usage: $0 base|new" ++ exit 2 ++ ;; ++esac diff --git a/tasks/format-code-task-001624/tests/test.sh b/tasks/format-code-task-001624/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8399e3e176395b7bcecbd7af8d7506533db594b5 --- /dev/null +++ b/tasks/format-code-task-001624/tests/test.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test/source/_posts/2018-01-28-balanced-liquid-blocks-before-excerpt.markdown +test/source/_posts/2018-01-28-custom-liquid-block-excerpt.markdown +test/source/_posts/2018-01-28-later-liquid-block-cut-excerpt.markdown +test/test_excerpt.rb +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001624/tests/test_command.sh b/tasks/format-code-task-001624/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..e8d2f32b64045b5a5a56e0ad5667da87d8e0bc2a --- /dev/null +++ b/tasks/format-code-task-001624/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new \ No newline at end of file diff --git a/tasks/format-code-task-001641/environment/Dockerfile b/tasks/format-code-task-001641/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..3a22d765eef8dc9188cd0c159ef105a46de46e8a --- /dev/null +++ b/tasks/format-code-task-001641/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:6d21298d694946c28bed838748842b13bd0612b94628d8d0679f3ba7fb024608 diff --git a/tasks/format-code-task-001641/environment/setup/files/blocklist b/tasks/format-code-task-001641/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001641/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001641/environment/setup/setup.sh b/tasks/format-code-task-001641/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-001641/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001641/tests/test.patch b/tasks/format-code-task-001641/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..b5d0875cb46156748f274afc5015e60241546115 --- /dev/null +++ b/tasks/format-code-task-001641/tests/test.patch @@ -0,0 +1,400 @@ +diff --git a/usercase-test-coderl/test_render_table_tag.py b/usercase-test-coderl/test_render_table_tag.py +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/test_render_table_tag.py +@@ -0,0 +1,375 @@ ++import copy ++import json ++import subprocess ++import sys ++from io import StringIO ++ ++import pytest ++from django.conf import settings ++ ++ ++TEMPLATE_SOURCES = { ++ "acceptance/default.html": ( ++ "DEFAULT|path={{ request.path }}|" ++ "columns={% for column in table.columns %}{{ column.name }}:{{ column.header }};{% endfor %}|" ++ "rows={% for row in table.rows %}[{% for column, cell in row.items %}{{ column.name }}={{ cell }};{% endfor %}]{% endfor %}|" ++ "hook={{ table.hook_seen }}" ++ ), ++ "acceptance/override.html": ( ++ "OVERRIDE|rows={% for row in table.rows %}{{ row.record.name }}={{ row.record.score }};{% endfor %}|" ++ "hook={{ table.hook_seen }}" ++ ), ++ "acceptance/fallback.html": ( ++ "FALLBACK|{{ table.attrs.class }}|{% for row in table.rows %}{{ row.record.name }};{% endfor %}" ++ ), ++ "acceptance/context.html": ( ++ "CTX|{% for row in table.rows %}{% for column, cell in row.items %}" ++ "{{ column.name }}={{ cell }};{% endfor %}{% endfor %}|outside={{ outside }}|" ++ "hook={{ table.hook_seen }}" ++ ), ++ "acceptance/queryset.html": ( ++ "QS|columns={% for column in table.columns %}{{ column.name }}:{{ column.header }};{% endfor %}|" ++ "rows={% for row in table.rows %}[{% for column, cell in row.items %}{{ column.name }}={{ cell }};{% endfor %}]{% endfor %}" ++ ), ++} ++ ++ ++if not settings.configured: ++ settings.configure( ++ SECRET_KEY="usercase-render-table", ++ INSTALLED_APPS=["django.contrib.contenttypes", "django_tables2"], ++ DATABASES={"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:"}}, ++ DEFAULT_AUTO_FIELD="django.db.models.AutoField", ++ ROOT_URLCONF=__name__, ++ TEMPLATES=[ ++ { ++ "BACKEND": "django.template.backends.django.DjangoTemplates", ++ "APP_DIRS": False, ++ "OPTIONS": { ++ "loaders": [("django.template.loaders.locmem.Loader", TEMPLATE_SOURCES)], ++ "context_processors": ["django.template.context_processors.request"], ++ }, ++ } ++ ], ++ USE_TZ=True, ++ ) ++ ++import django ++ ++django.setup() ++ ++from django.core.handlers.wsgi import WSGIRequest ++from django.db import connection, models ++from django.template import Context, Template ++from django.test.client import FakePayload ++ ++import django_tables2 as tables ++ ++ ++def build_request(uri="/"): ++ path, _, querystring = uri.partition("?") ++ return WSGIRequest( ++ { ++ "CONTENT_TYPE": "text/html; charset=utf-8", ++ "PATH_INFO": path, ++ "QUERY_STRING": querystring, ++ "REMOTE_ADDR": "127.0.0.1", ++ "REQUEST_METHOD": "GET", ++ "SCRIPT_NAME": "", ++ "SERVER_NAME": "testserver", ++ "SERVER_PORT": "80", ++ "SERVER_PROTOCOL": "HTTP/1.1", ++ "wsgi.version": (1, 0), ++ "wsgi.url_scheme": "http", ++ "wsgi.input": FakePayload(b""), ++ "wsgi.errors": StringIO(), ++ "wsgi.multiprocess": True, ++ "wsgi.multithread": False, ++ "wsgi.run_once": False, ++ } ++ ) ++ ++ ++class HookedScoreTable(tables.Table): ++ name = tables.Column() ++ score = tables.Column() ++ ++ class Meta: ++ template_name = "acceptance/default.html" ++ attrs = {"class": "score-grid"} ++ ++ def before_render(self, request): ++ self.hook_seen = f"{request.method}:{request.path}" ++ ++ ++class ContextColumnTable(tables.Table): ++ name = tables.TemplateColumn("{{ record.name }}+{{ outside }}+{{ request.path }}") ++ ++ class Meta: ++ template_name = "acceptance/context.html" ++ ++ def before_render(self, request): ++ self.hook_seen = request.path ++ ++ ++class StableItem(models.Model): ++ id = models.IntegerField(primary_key=True) ++ name = models.CharField(max_length=20) ++ age = models.IntegerField() ++ ++ class Meta: ++ app_label = "usercase_test_coderl" ++ ordering = ["id"] ++ ++ ++def render_template(source, context): ++ return Template(source).render(context) ++ ++ ++def test_render_table_resolves_context_table_and_uses_configured_template_with_request_and_hook(): ++ ++ ++ ++ ++ table = HookedScoreTable([{"name": "Ada", "score": 7}, {"name": "Bo", "score": 11}]) ++ request = build_request("/scores/?page=2") ++ ++ actual = render_template( ++ "{% load django_tables2 %}{% render_table table %}", ++ Context({"request": request, "table": table}), ++ ) ++ ++ assert ( ++ actual ++ == "DEFAULT|path=/scores/|columns=name:Name;score:Score;|rows=[name=Ada;score=7;][name=Bo;score=11;]|hook=GET:/scores/" ++ ) ++ ++ ++def test_render_table_explicit_string_template_overrides_table_default(): ++ ++ ++ ++ ++ table = HookedScoreTable([{"name": "Cy", "score": 5}]) ++ ++ actual = render_template( ++ '{% load django_tables2 %}{% render_table table "acceptance/override.html" %}', ++ Context({"request": build_request("/override/"), "table": table}), ++ ) ++ ++ assert actual == "OVERRIDE|rows=Cy=5;|hook=GET:/override/" ++ ++ ++def test_render_table_template_argument_resolves_tuple_with_first_existing_template(): ++ ++ ++ ++ ++ table = HookedScoreTable([{"name": "Di", "score": 13}, {"name": "Eve", "score": 17}]) ++ ++ actual = render_template( ++ "{% load django_tables2 %}{% render_table table choices %}", ++ Context( ++ { ++ "request": build_request("/pick/"), ++ "table": table, ++ "choices": ("missing.html", "acceptance/fallback.html"), ++ } ++ ), ++ ) ++ ++ assert actual == "FALLBACK|score-grid|Di;Eve;" ++ ++ ++def test_render_table_template_column_can_use_surrounding_context(): ++ ++ ++ ++ ++ table = ContextColumnTable([{"name": "Nova"}]) ++ ++ actual = render_template( ++ "{% load django_tables2 %}{% render_table table %}", ++ Context({"request": build_request("/ctx/"), "table": table, "outside": "SURROUND"}), ++ ) ++ ++ ++ ++ assert actual.startswith("CTX|") ++ assert "name=Nova+SURROUND+" in actual ++ assert actual.endswith("|hook=/ctx/") ++ ++ ++def test_render_table_queryset_builds_model_table_and_renders_rows(): ++ ++ ++ ++ ++ with connection.schema_editor() as schema: ++ schema.create_model(StableItem) ++ StableItem.objects.bulk_create( ++ [StableItem(id=101, name="Mira", age=31), StableItem(id=202, name="Oren", age=42)] ++ ) ++ ++ actual = render_template( ++ '{% load django_tables2 %}{% render_table qs "acceptance/queryset.html" %}', ++ Context({"request": build_request("/people/"), "qs": StableItem.objects.all()}), ++ ) ++ ++ assert ( ++ actual ++ == "QS|columns=id:Id;name:Name;age:Age;|rows=[id=101;name=Mira;age=31;][id=202;name=Oren;age=42;]" ++ ) ++ ++ ++def test_render_table_invalid_value_raises_specific_value_error(): ++ ++ ++ ++ ++ ++ ++ with pytest.raises(ValueError) as exc_info: ++ render_template( ++ "{% load django_tables2 %}{% render_table table %}", ++ Context({"request": build_request("/bad/"), "table": {"not": "valid"}}), ++ ) ++ message = str(exc_info.value).lower() ++ assert "table" in message ++ assert "queryset" in message ++ assert "dict" in message ++ ++ ++def test_render_table_does_not_replace_caller_context_variable(): ++ ++ ++ ++ ++ table = HookedScoreTable([{"name": "Ivy", "score": 19}]) ++ source = ( ++ '{% load django_tables2 %}{% with "outer" as table %}' ++ "{{ table }}|{% render_table mytable %}|{{ table }}{% endwith %}" ++ ) ++ context = Context({"request": build_request("/preserve/"), "mytable": table}) ++ ++ first = render_template(source, context) ++ second = render_template(source, context) ++ ++ expected = ( ++ "outer|DEFAULT|path=/preserve/|columns=name:Name;score:Score;|" ++ "rows=[name=Ivy;score=19;]|hook=GET:/preserve/|outer" ++ ) ++ assert first == expected ++ assert second == expected ++ ++ ++def test_referential_transparency_same_input_same_output(): ++ table = HookedScoreTable([{"name": "Ada", "score": 7}, {"name": "Bo", "score": 11}]) ++ request = build_request("/scores/?page=2") ++ source = "{% load django_tables2 %}{% render_table table %}" ++ context = Context({"request": request, "table": table}) ++ ++ assert render_template(source, context) == render_template(source, context) ++ ++ ++def test_no_mutation_of_caller_owned_data_or_context_binding(): ++ rows = [{"name": "Ada", "score": 7}, {"name": "Bo", "score": 11}] ++ rows_before = copy.deepcopy(rows) ++ table = HookedScoreTable(rows) ++ context_payload = {"request": build_request("/stable/"), "table": table, "marker": {"keep": [1, 2]}} ++ marker_before = copy.deepcopy(context_payload["marker"]) ++ ++ actual = render_template( ++ "{% load django_tables2 %}{% render_table table %}", ++ Context(context_payload), ++ ) ++ ++ assert actual == ( ++ "DEFAULT|path=/stable/|columns=name:Name;score:Score;|" ++ "rows=[name=Ada;score=7;][name=Bo;score=11;]|hook=GET:/stable/" ++ ) ++ assert rows == rows_before ++ assert context_payload["marker"] == marker_before ++ ++ ++ assert context_payload["table"] is table ++ assert context_payload["request"].path == "/stable/" ++ ++ ++def test_no_global_state_strict_fresh_python_process(): ++ table = HookedScoreTable([{"name": "Ada", "score": 7}, {"name": "Bo", "score": 11}]) ++ source = "{% load django_tables2 %}{% render_table table %}" ++ in_process = render_template( ++ source, ++ Context({"request": build_request("/scores/?page=2"), "table": table}), ++ ) ++ script = r''' ++import json ++from django.conf import settings ++TEMPLATE_SOURCES = { ++ "acceptance/default.html": "DEFAULT|path={{ request.path }}|columns={% for column in table.columns %}{{ column.name }}:{{ column.header }};{% endfor %}|rows={% for row in table.rows %}[{% for column, cell in row.items %}{{ column.name }}={{ cell }};{% endfor %}]{% endfor %}|hook={{ table.hook_seen }}" ++} ++settings.configure( ++ SECRET_KEY="usercase-render-table", ++ INSTALLED_APPS=["django.contrib.contenttypes", "django_tables2"], ++ DATABASES={"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:"}}, ++ DEFAULT_AUTO_FIELD="django.db.models.AutoField", ++ ROOT_URLCONF=__name__, ++ TEMPLATES=[{"BACKEND": "django.template.backends.django.DjangoTemplates", "APP_DIRS": False, "OPTIONS": {"loaders": [("django.template.loaders.locmem.Loader", TEMPLATE_SOURCES)], "context_processors": ["django.template.context_processors.request"]}}], ++ USE_TZ=True, ++) ++import django ++django.setup() ++from io import StringIO ++from django.core.handlers.wsgi import WSGIRequest ++from django.template import Context, Template ++from django.test.client import FakePayload ++import django_tables2 as tables ++def build_request(uri="/"): ++ path, _, querystring = uri.partition("?") ++ return WSGIRequest({"CONTENT_TYPE": "text/html; charset=utf-8", "PATH_INFO": path, "QUERY_STRING": querystring, "REMOTE_ADDR": "127.0.0.1", "REQUEST_METHOD": "GET", "SCRIPT_NAME": "", "SERVER_NAME": "testserver", "SERVER_PORT": "80", "SERVER_PROTOCOL": "HTTP/1.1", "wsgi.version": (1, 0), "wsgi.url_scheme": "http", "wsgi.input": FakePayload(b""), "wsgi.errors": StringIO(), "wsgi.multiprocess": True, "wsgi.multithread": False, "wsgi.run_once": False}) ++class HookedScoreTable(tables.Table): ++ name = tables.Column() ++ score = tables.Column() ++ class Meta: ++ template_name = "acceptance/default.html" ++ attrs = {"class": "score-grid"} ++ def before_render(self, request): ++ self.hook_seen = f"{request.method}:{request.path}" ++table = HookedScoreTable([{"name": "Ada", "score": 7}, {"name": "Bo", "score": 11}]) ++out = Template("{% load django_tables2 %}{% render_table table %}").render(Context({"request": build_request("/scores/?page=2"), "table": table})) ++sys_stdout = json.dumps(out) ++print(sys_stdout) ++''' ++ fresh_process = subprocess.run( ++ [sys.executable, "-c", script], ++ check=True, ++ text=True, ++ stdout=subprocess.PIPE, ++ stderr=subprocess.PIPE, ++ ) ++ ++ assert json.loads(fresh_process.stdout) == in_process ++ assert ( ++ in_process ++ == "DEFAULT|path=/scores/|columns=name:Name;score:Score;|rows=[name=Ada;score=7;][name=Bo;score=11;]|hook=GET:/scores/" ++ ) ++ ++ ++def test_render_table_preserves_behavior_under_changed_cwd(tmp_path, monkeypatch): ++ monkeypatch.chdir(tmp_path) ++ ++ table = HookedScoreTable([{"name": "Ada", "score": 7}]) ++ request = build_request("/side-effects/") ++ actual = render_template( ++ "{% load django_tables2 %}{% render_table table %}", ++ Context({"request": request, "table": table}), ++ ) ++ ++ ++ ++ assert actual == ( ++ "DEFAULT|path=/side-effects/|columns=name:Name;score:Score;|" ++ "rows=[name=Ada;score=7;]|hook=GET:/side-effects/" ++ ) ++ assert request.path == "/side-effects/" +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,15 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++set -euo pipefail ++cd /workspace/repo ++export PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 ++exec /opt/coderl-stage4a-venv/bin/python -m pytest /workspace/repo/usercase-test-coderl/test_render_table_tag.py -v diff --git a/tasks/format-code-task-001641/tests/test.sh b/tasks/format-code-task-001641/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..b578dc4ea8b6aa72de111cba50486a86bd7a4790 --- /dev/null +++ b/tasks/format-code-task-001641/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/test_render_table_tag.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001641/tests/test_command.sh b/tasks/format-code-task-001641/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-001641/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001648/environment/Dockerfile b/tasks/format-code-task-001648/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..a508ddf21436f220963cdde534fd973a42b985f7 --- /dev/null +++ b/tasks/format-code-task-001648/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:11152df97321cb5045e84a1eca8393d2d3fe6950ac15b0c1e8fa3abae4603d69 diff --git a/tasks/format-code-task-001648/environment/setup/files/blocklist b/tasks/format-code-task-001648/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001648/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001648/environment/setup/setup.sh b/tasks/format-code-task-001648/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001648/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001648/tests/test.patch b/tasks/format-code-task-001648/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..a6f3dd3b9a1253d140112f0bedbe01cd07fd42c8 --- /dev/null +++ b/tasks/format-code-task-001648/tests/test.patch @@ -0,0 +1,110 @@ +diff --git a/tests/providers/test_pyfloat_bounds.py b/tests/providers/test_pyfloat_bounds.py +new file mode 100644 +index 00000000..60b52a1d +--- /dev/null ++++ b/tests/providers/test_pyfloat_bounds.py +@@ -0,0 +1,83 @@ ++import sys ++import unittest ++ ++from faker import Faker ++ ++ ++def _int_part_len(value): ++ return len(str(value).lstrip("-").split(".")[0]) ++ ++ ++def _frac_part_len(value): ++ parts = str(value).lstrip("-").split(".") ++ return len(parts[1]) if len(parts) > 1 else 0 ++ ++ ++class TestPyfloatOneSidedBoundWithDigits(unittest.TestCase): ++ ++ ++ ++ ++ def setUp(self): ++ self.fake = Faker() ++ Faker.seed(0) ++ ++ def test_min_value_only_with_digits(self): ++ for _ in range(2000): ++ result = self.fake.pyfloat( ++ min_value=99884.7, max_value=None, left_digits=5, right_digits=2 ++ ) ++ self.assertGreaterEqual(result, 99884.7) ++ self.assertLessEqual(_int_part_len(result), 5) ++ self.assertLessEqual(_frac_part_len(result), 2) ++ ++ def test_max_value_only_with_digits(self): ++ for _ in range(2000): ++ result = self.fake.pyfloat( ++ min_value=None, max_value=11000.3, left_digits=5, right_digits=2 ++ ) ++ self.assertLessEqual(result, 11000.3) ++ self.assertLessEqual(_int_part_len(result), 5) ++ self.assertLessEqual(_frac_part_len(result), 2) ++ ++ def test_negative_max_value_only_with_digits(self): ++ for _ in range(2000): ++ result = self.fake.pyfloat( ++ min_value=None, max_value=-12000.5, left_digits=5, right_digits=2 ++ ) ++ self.assertLessEqual(result, -12000.5) ++ self.assertLessEqual(_int_part_len(result), 5) ++ self.assertLessEqual(_frac_part_len(result), 2) ++ ++ ++class TestPyfloatLargeMaxValue(unittest.TestCase): ++ ++ ++ ++ def setUp(self): ++ self.fake = Faker() ++ Faker.seed(0) ++ ++ def test_large_in_range_max_values(self): ++ max_values = (0, 10, -1000, 1000, 999999, 100000000000001.0, -1000000000000001.0) ++ for max_value in max_values: ++ for _ in range(50): ++ result = self.fake.pyfloat(max_value=max_value) ++ self.assertLessEqual(result, max_value) ++ ++ ++class TestPyfloatOutOfRangeBounds(unittest.TestCase): ++ ++ ++ ++ def setUp(self): ++ self.fake = Faker() ++ Faker.seed(0) ++ ++ def test_min_value_above_representable_range(self): ++ with self.assertRaises(ValueError): ++ self.fake.pyfloat(min_value=10 ** (sys.float_info.dig + 5)) ++ ++ def test_max_value_below_representable_range(self): ++ with self.assertRaises(ValueError): ++ self.fake.pyfloat(max_value=-(10 ** (sys.float_info.dig + 5))) +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,16 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++set -euo pipefail ++HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ++cd /testbed ++ ++ ++ ++ ++python -m pytest tests/providers/test_python.py -q ++ ++ ++python -m pytest tests/providers/test_pyfloat_bounds.py -q diff --git a/tasks/format-code-task-001648/tests/test.sh b/tasks/format-code-task-001648/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..827c530a2f83773d032400bd22fafc46e8a3daeb --- /dev/null +++ b/tasks/format-code-task-001648/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/providers/test_pyfloat_bounds.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001648/tests/test_command.sh b/tasks/format-code-task-001648/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001648/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001670/environment/Dockerfile b/tasks/format-code-task-001670/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..1cd04df96cc1121a0f405946a36d277d1773fef7 --- /dev/null +++ b/tasks/format-code-task-001670/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:21593cd6613f748fa52a2845f2250342fc7c73f36cb1ae96859ec7dbcf589cb2 diff --git a/tasks/format-code-task-001670/environment/setup/files/blocklist b/tasks/format-code-task-001670/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001670/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001670/environment/setup/setup.sh b/tasks/format-code-task-001670/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-001670/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001670/tests/test.patch b/tasks/format-code-task-001670/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..28f21ace3da5fc72a89180d2af6e6e39ba675b90 --- /dev/null +++ b/tasks/format-code-task-001670/tests/test.patch @@ -0,0 +1,394 @@ +diff --git a/usercase-test-coderl/fixtures/probe_unaligned.py b/usercase-test-coderl/fixtures/probe_unaligned.py +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/fixtures/probe_unaligned.py +@@ -0,0 +1,136 @@ ++#!/usr/bin/env python3 ++import contextlib ++import io ++import os ++import random ++import sys ++ ++import numpy as np ++import torch ++ ++REPO_ROOT = "/workspace/repo" ++if REPO_ROOT not in sys.path: ++ sys.path.insert(0, REPO_ROOT) ++ ++from data import create_dataset ++from options.test_options import TestOptions ++from options.train_options import TrainOptions ++ ++ ++def parse_options(kind, args): ++ with contextlib.redirect_stdout(io.StringIO()): ++ if kind == "train": ++ return TrainOptions(" ".join(args)).parse() ++ if kind == "test": ++ opt = TestOptions(" ".join(args)).parse() ++ ++ opt.num_threads = 0 ++ opt.batch_size = 1 ++ opt.serial_batches = True ++ opt.no_flip = True ++ opt.display_id = -1 ++ return opt ++ raise SystemExit("usage: probe_unaligned.py ... -- ") ++ ++ ++def make_loader(kind, args): ++ opt = parse_options(kind, args) ++ with contextlib.redirect_stdout(io.StringIO()): ++ loader = create_dataset(opt) ++ return opt, loader ++ ++ ++def rel(root, path): ++ return os.path.relpath(path, root).replace(os.sep, "/") ++ ++ ++def fmt(values): ++ return ",".join(f"{float(value):.6f}" for value in values) ++ ++ ++def summarize_item(dataset, dataroot, index): ++ item = dataset[index] ++ a = item["A"] ++ b = item["B"] ++ print(f"item{index}.A_path={rel(dataroot, item['A_paths'])}") ++ print(f"item{index}.B_path={rel(dataroot, item['B_paths'])}") ++ print(f"item{index}.A_shape={'x'.join(map(str, a.shape))}") ++ print(f"item{index}.B_shape={'x'.join(map(str, b.shape))}") ++ print(f"item{index}.A_first={fmt(a[:, 0, 0])}") ++ print(f"item{index}.B_first={fmt(b[:, 0, 0])}") ++ print(f"item{index}.A_mean={fmt(a.mean(dim=(1, 2)))}") ++ print(f"item{index}.B_mean={fmt(b.mean(dim=(1, 2)))}") ++ print(f"item{index}.A_red_row0={fmt(a[0, 0, :])}") ++ ++ ++def main(): ++ if "--" not in sys.argv: ++ raise SystemExit("missing -- before tool options") ++ ++ command = sys.argv[1] ++ kind = sys.argv[2] ++ sep = sys.argv.index("--") ++ probe_args = sys.argv[3:sep] ++ tool_args = sys.argv[sep + 1 :] ++ dataroot = tool_args[tool_args.index("--dataroot") + 1] ++ ++ seed = int(os.environ.get("PROBE_SEED", "0")) ++ random.seed(seed) ++ np.random.seed(seed) ++ torch.manual_seed(seed) ++ ++ _, loader = make_loader(kind, tool_args) ++ dataset = loader.dataset ++ ++ if command == "pairs": ++ print(f"len={len(dataset)}") ++ ++ for index in map(int, probe_args): ++ item = dataset[index] ++ print(f"pair{index}={rel(dataroot, item['A_paths'])}|{rel(dataroot, item['B_paths'])}") ++ return ++ ++ if command == "tensor": ++ summarize_item(dataset, dataroot, int(probe_args[0])) ++ return ++ ++ if command == "flip": ++ index = int(probe_args[0]) ++ saw_unflipped = False ++ saw_flipped = False ++ first_item = None ++ for seed in map(int, probe_args[1:]): ++ random.seed(seed) ++ np.random.seed(seed) ++ torch.manual_seed(seed) ++ item = dataset[index] ++ if first_item is None: ++ first_item = item ++ row = fmt(item["A"][0, 0, :]) ++ saw_unflipped = saw_unflipped or row == "-1.000000,-0.498039,0.003922,1.000000" ++ saw_flipped = saw_flipped or row == "1.000000,0.003922,-0.498039,-1.000000" ++ ++ print(f"item{index}.A_path={rel(dataroot, first_item['A_paths'])}") ++ print(f"item{index}.B_path={rel(dataroot, first_item['B_paths'])}") ++ print(f"item{index}.A_shape={'x'.join(map(str, first_item['A'].shape))}") ++ print(f"item{index}.saw_unflipped={str(saw_unflipped).lower()}") ++ print(f"item{index}.saw_flipped={str(saw_flipped).lower()}") ++ return ++ ++ if command == "epoch": ++ index = int(probe_args[0]) ++ for epoch in map(int, probe_args[1:]): ++ dataset.current_epoch = epoch ++ random.seed(seed) ++ np.random.seed(seed) ++ torch.manual_seed(seed) ++ item = dataset[index] ++ a = item["A"] ++ print(f"epoch{epoch}.A_shape={'x'.join(map(str, a.shape))}") ++ return ++ ++ raise SystemExit(f"unknown command: {command}") ++ ++ ++if __name__ == "__main__": ++ main() +diff --git a/usercase-test-coderl/usecase.sh b/usercase-test-coderl/usecase.sh +new file mode 100755 +--- /dev/null ++++ b/usercase-test-coderl/usecase.sh +@@ -0,0 +1,231 @@ ++#!/usr/bin/env bash ++ ++set -u ++export LANG=C.UTF-8 LC_ALL=C.UTF-8 TZ=UTC ++export PYTHONDONTWRITEBYTECODE=1 ++ ++cd /workspace/repo || { echo "FAIL: cd repo" >&2; exit 1; } ++python - <<'PY' >/dev/null 2>&1 ++import PIL ++import torch ++import torchvision ++PY ++if [ "$?" -ne 0 ]; then ++ echo "FAIL: python dependencies PIL, torch, and torchvision are required" >&2 ++ exit 1 ++fi ++ ++BIN="python /workspace/repo/usercase-test-coderl/fixtures/probe_unaligned.py" ++TMP=$(mktemp -d) ++trap 'rm -rf "$TMP"' EXIT ++fail() { echo "FAIL: $*" >&2; exit 1; } ++ ++python - "$TMP" <<'PY' ++from pathlib import Path ++import sys ++ ++import numpy as np ++from PIL import Image ++ ++root = Path(sys.argv[1]) ++ ++ ++def ensure(path): ++ path.mkdir(parents=True, exist_ok=True) ++ ++ ++def rgb(path, color, size=(4, 4)): ++ Image.new("RGB", size, color).save(path) ++ ++ ++def gray(path, value, size=(4, 4)): ++ Image.new("L", size, value).save(path) ++ ++ ++def gradient(path, size=(8, 8)): ++ arr = np.zeros((size[1], size[0], 3), dtype=np.uint8) ++ for y in range(size[1]): ++ for x in range(size[0]): ++ arr[y, x] = [(x * 32 + y * 4) % 256, (x * 16 + y * 8) % 256, (x * 8 + y * 16) % 256] ++ Image.fromarray(arr, "RGB").save(path) ++ ++ ++def row_image(path): ++ arr = np.zeros((4, 4, 3), dtype=np.uint8) ++ vals = [0, 64, 128, 255] ++ for y in range(4): ++ for x, value in enumerate(vals): ++ arr[y, x] = [value, 10 + y, 20] ++ Image.fromarray(arr, "RGB").save(path) ++ ++ ++for name in [ ++ "serial_a_short/trainA", "serial_a_short/trainB", ++ "serial_b_short/trainA", "serial_b_short/trainB", ++ "random/trainA", "random/trainB", ++ "test_direct/testA", "test_direct/testB", ++ "test_fallback/valA", "test_fallback/valB", ++ "tensor/trainA", "tensor/trainB", ++ "flip/trainA", "flip/trainB", ++ "epoch/trainA", "epoch/trainB", ++ "missing_b/trainA", "missing_a/trainB", ++]: ++ ensure(root / name) ++ ++for i, color in enumerate([(10, 20, 30), (40, 50, 60)]): ++ rgb(root / f"serial_a_short/trainA/a{i}.png", color) ++for i, color in enumerate([(70, 80, 90), (100, 110, 120), (130, 140, 150)]): ++ rgb(root / f"serial_a_short/trainB/b{i}.png", color) ++ ++for i, color in enumerate([(11, 21, 31), (41, 51, 61), (71, 81, 91)]): ++ rgb(root / f"serial_b_short/trainA/a{i}.png", color) ++rgb(root / "serial_b_short/trainB/b0.png", (101, 111, 121)) ++ ++for i, color in enumerate([(12, 22, 32), (42, 52, 62), (72, 82, 92)]): ++ rgb(root / f"random/trainA/a{i}.png", color) ++for i, color in enumerate([(102, 112, 122), (132, 142, 152), (162, 172, 182)]): ++ rgb(root / f"random/trainB/b{i}.png", color) ++ ++rgb(root / "test_direct/testA/a0.png", (1, 2, 3)) ++rgb(root / "test_direct/testB/b0.png", (4, 5, 6)) ++rgb(root / "test_fallback/valA/va0.png", (7, 8, 9)) ++rgb(root / "test_fallback/valB/vb0.png", (10, 11, 12)) ++ ++gray(root / "tensor/trainA/gray_a.png", 64) ++rgb(root / "tensor/trainB/rgb_b.png", (10, 20, 30)) ++row_image(root / "flip/trainA/row_a.png") ++rgb(root / "flip/trainB/b.png", (0, 0, 0)) ++gradient(root / "epoch/trainA/grad_a.png") ++rgb(root / "epoch/trainB/b.png", (128, 64, 32), size=(8, 8)) ++ ++rgb(root / "missing_b/trainA/a.png", (1, 1, 1)) ++rgb(root / "missing_a/trainB/b.png", (2, 2, 2)) ++PY ++ ++cd "$TMP" || fail "cd tmp" ++ ++COMMON="--dataset_mode unaligned --gpu_ids -1 --num_threads 0 --batch_size 1 --max_dataset_size 100 --checkpoints_dir $TMP/checkpoints --name acc --preprocess none --no_flip" ++ ++ ++ ++ ++$BIN pairs train 0 1 2 -- $COMMON --dataroot "$TMP/serial_a_short" --phase train --serial_batches >out 2>err; ec=$? ++ ++EXPECTED='len=3 ++pair0=trainA/a0.png|trainB/b0.png ++pair1=trainA/a1.png|trainB/b1.png ++pair2=trainA/a0.png|trainB/b2.png' ++[ "$ec" -eq 0 ] || fail "F1 exit $ec; want 0" ++[ "$(cat out)" = "$EXPECTED" ] || fail "F1 stdout: $(cat out)" ++[ ! -s err ] || fail "F1 unexpected stderr: $(cat err)" ++ ++ ++ ++ ++$BIN pairs train 0 1 2 -- $COMMON --dataroot "$TMP/serial_b_short" --phase train --serial_batches >out 2>err; ec=$? ++ ++EXPECTED='len=3 ++pair0=trainA/a0.png|trainB/b0.png ++pair1=trainA/a1.png|trainB/b0.png ++pair2=trainA/a2.png|trainB/b0.png' ++[ "$ec" -eq 0 ] || fail "F2 exit $ec; want 0" ++[ "$(cat out)" = "$EXPECTED" ] || fail "F2 stdout: $(cat out)" ++[ ! -s err ] || fail "F2 unexpected stderr: $(cat err)" ++ ++ ++ ++ ++ ++PROBE_SEED=5 $BIN pairs train 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -- --dataset_mode unaligned --gpu_ids -1 --num_threads 0 --batch_size 1 --max_dataset_size 100 --checkpoints_dir "$TMP/checkpoints" --name acc --preprocess none --no_flip --dataroot "$TMP/random" --phase train >out 2>err; ec=$? ++[ "$ec" -eq 0 ] || fail "F3 exit $ec; want 0" ++grep -qx 'len=3' out || fail "F3 length missing: $(cat out)" ++PAIR_COUNT=$(grep -Ec '^pair1=trainA/a1\.png\|trainB/b[0-2]\.png$' out) ++[ "$PAIR_COUNT" -eq 24 ] || fail "F3 A index or B folder mismatch: $(cat out)" ++UNIQUE_B=$(sed -n 's#^pair1=trainA/a1\.png|trainB/\(b[0-2]\.png\)$#\1#p' out | sort -u | wc -l) ++[ "$UNIQUE_B" -gt 1 ] || fail "F3 B side did not vary across samples: $(cat out)" ++[ ! -s err ] || fail "F3 unexpected stderr: $(cat err)" ++ ++ ++ ++ ++$BIN pairs test 0 -- --dataset_mode unaligned --gpu_ids -1 --num_threads 0 --batch_size 1 --max_dataset_size 100 --checkpoints_dir "$TMP/checkpoints" --name acc --preprocess none --no_flip --dataroot "$TMP/test_direct" --phase test >out 2>err; ec=$? ++ ++EXPECTED='len=1 ++pair0=testA/a0.png|testB/b0.png' ++[ "$ec" -eq 0 ] || fail "F4 exit $ec; want 0" ++[ "$(cat out)" = "$EXPECTED" ] || fail "F4 stdout: $(cat out)" ++[ ! -s err ] || fail "F4 unexpected stderr: $(cat err)" ++ ++ ++ ++ ++$BIN pairs test 0 -- --dataset_mode unaligned --gpu_ids -1 --num_threads 0 --batch_size 1 --max_dataset_size 100 --checkpoints_dir "$TMP/checkpoints" --name acc --preprocess none --no_flip --dataroot "$TMP/test_fallback" --phase test >out 2>err; ec=$? ++ ++EXPECTED='len=1 ++pair0=valA/va0.png|valB/vb0.png' ++[ "$ec" -eq 0 ] || fail "F5 exit $ec; want 0" ++[ "$(cat out)" = "$EXPECTED" ] || fail "F5 stdout: $(cat out)" ++[ ! -s err ] || fail "F5 unexpected stderr: $(cat err)" ++ ++ ++ ++ ++$BIN tensor train 0 -- $COMMON --dataroot "$TMP/tensor" --phase train --serial_batches >out 2>err; ec=$? ++EXPECTED='item0.A_path=trainA/gray_a.png ++item0.B_path=trainB/rgb_b.png ++item0.A_shape=3x4x4 ++item0.B_shape=3x4x4 ++item0.A_first=-0.498039,-0.498039,-0.498039 ++item0.B_first=-0.921569,-0.843137,-0.764706 ++item0.A_mean=-0.498039,-0.498039,-0.498039 ++item0.B_mean=-0.921569,-0.843137,-0.764706 ++item0.A_red_row0=-0.498039,-0.498039,-0.498039,-0.498039' ++[ "$ec" -eq 0 ] || fail "F6 exit $ec; want 0" ++[ "$(cat out)" = "$EXPECTED" ] || fail "F6 stdout: $(cat out)" ++[ ! -s err ] || fail "F6 unexpected stderr: $(cat err)" ++ ++ ++ ++ ++ ++PROBE_SEED=0 $BIN flip train 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 -- --dataset_mode unaligned --gpu_ids -1 --num_threads 0 --batch_size 1 --max_dataset_size 100 --checkpoints_dir "$TMP/checkpoints" --name acc --preprocess none --dataroot "$TMP/flip" --phase train --serial_batches >out 2>err; ec=$? ++EXPECTED='item0.A_path=trainA/row_a.png ++item0.B_path=trainB/b.png ++item0.A_shape=3x4x4 ++item0.saw_unflipped=true ++item0.saw_flipped=true' ++[ "$ec" -eq 0 ] || fail "F7 exit $ec; want 0" ++[ "$(cat out)" = "$EXPECTED" ] || fail "F7 stdout: $(cat out)" ++[ ! -s err ] || fail "F7 unexpected stderr: $(cat err)" ++ ++ ++ ++ ++PROBE_SEED=3 $BIN epoch train 0 1 2 -- --dataset_mode unaligned --gpu_ids -1 --num_threads 0 --batch_size 1 --max_dataset_size 100 --checkpoints_dir "$TMP/checkpoints" --name acc --preprocess scale_width --load_size 8 --crop_size 4 --no_flip --dataroot "$TMP/epoch" --phase train --serial_batches --n_epochs 1 >out 2>err; ec=$? ++ ++EXPECTED='epoch1.A_shape=3x8x8 ++epoch2.A_shape=3x4x4' ++[ "$ec" -eq 0 ] || fail "F8 exit $ec; want 0" ++[ "$(cat out)" = "$EXPECTED" ] || fail "F8 stdout: $(cat out)" ++[ ! -s err ] || fail "F8 unexpected stderr: $(cat err)" ++ ++ ++ ++ ++$BIN pairs train 0 -- $COMMON --dataroot "$TMP/missing_b" --phase train --serial_batches >out 2>err; ec=$? ++[ "$ec" -ne 0 ] || fail "F9 exit $ec; want non-zero" ++[ ! -s out ] || fail "F9 stdout should be empty: $(cat out)" ++ ++grep -q 'trainB' err || fail "F9 stderr missing trainB directory context: $(cat err)" ++ ++ ++ ++ ++$BIN pairs train 0 -- $COMMON --dataroot "$TMP/missing_a" --phase train --serial_batches >out 2>err; ec=$? ++[ "$ec" -ne 0 ] || fail "F10 exit $ec; want non-zero" ++[ ! -s out ] || fail "F10 stdout should be empty: $(cat out)" ++ ++grep -q 'trainA' err || fail "F10 stderr missing trainA directory context: $(cat err)" ++ ++echo "PASS" ++exit 0 +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,12 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++exec bash /workspace/repo/usercase-test-coderl/usecase.sh diff --git a/tasks/format-code-task-001670/tests/test.sh b/tasks/format-code-task-001670/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..6cb00307a5afcbc29e70cfc584ec3424b6cf93f5 --- /dev/null +++ b/tasks/format-code-task-001670/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/fixtures/probe_unaligned.py +usercase-test-coderl/usecase.sh +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001670/tests/test_command.sh b/tasks/format-code-task-001670/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-001670/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001677/environment/Dockerfile b/tasks/format-code-task-001677/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..ee80afd1bf9996cd4f74923f2672918df648ec43 --- /dev/null +++ b/tasks/format-code-task-001677/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:2b8a1d9ce9d1a3124bbd1c0f627f1c0c5b6c86af9be757e1fe74a5af8b0e3574 diff --git a/tasks/format-code-task-001677/environment/setup/files/blocklist b/tasks/format-code-task-001677/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001677/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001677/environment/setup/setup.sh b/tasks/format-code-task-001677/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-001677/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001677/tests/test.patch b/tasks/format-code-task-001677/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..d8dd8280f0d09d284e0d42e3b9a246ae85c28cc7 --- /dev/null +++ b/tasks/format-code-task-001677/tests/test.patch @@ -0,0 +1,402 @@ +diff --git a/usercase-test-coderl/pool.test.js b/usercase-test-coderl/pool.test.js +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/pool.test.js +@@ -0,0 +1,370 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++"use strict"; ++ ++const assert = require("assert"); ++const Module = require("module"); ++ ++if (typeof navigator === "undefined") { ++ global.navigator = {userAgent: "", hardwareConcurrency: 4}; ++} ++ ++const originalLoad = Module._load; ++Module._load = function(request, parent, isMain) { ++ if (request.indexOf("ffmpeg.js/ffmpeg-worker-webm") !== -1) { ++ return "mock-worker-url"; ++ } ++ return originalLoad.apply(this, arguments); ++}; ++ ++require("babel-core/register"); ++ ++class FakeWorker { ++ constructor(url) { ++ this.url = url; ++ this.posted = []; ++ this.terminateCount = 0; ++ FakeWorker.instances.push(this); ++ FakeWorker.active.push(this); ++ } ++ ++ postMessage(message, transfer) { ++ this.posted.push({ ++ message, ++ transferLength: transfer ? transfer.length : 0, ++ }); ++ } ++ ++ terminate() { ++ this.terminateCount += 1; ++ const index = FakeWorker.active.indexOf(this); ++ if (index !== -1) { ++ FakeWorker.active.splice(index, 1); ++ } ++ } ++ ++ emit(data) { ++ this.onmessage({data}); ++ } ++} ++ ++FakeWorker.instances = []; ++FakeWorker.active = []; ++global.Worker = FakeWorker; ++ ++const {Pool} = require("../src/ffmpeg"); ++ ++function resetWorkers() { ++ FakeWorker.instances.length = 0; ++ FakeWorker.active.length = 0; ++} ++ ++function workerAt(index) { ++ return FakeWorker.instances[index]; ++} ++ ++function simplifyFiles(files) { ++ return files.map(file => ({ ++ name: file.name, ++ data: Array.from(file.data), ++ })); ++} ++ ++function simplifyMemfs(files) { ++ return (files || []).map(file => ({ ++ name: file.name, ++ data: file.data, ++ })); ++} ++ ++function assertRunPosted(worker, expectedArguments, expectedMEMFS, expectedWORKERFS) { ++ assert.strictEqual(worker.posted.length, 1); ++ const posted = worker.posted[0]; ++ const message = posted.message; ++ ++ assert.strictEqual(message.type, "run"); ++ assert.deepStrictEqual(message.arguments, expectedArguments); ++ ++ assert.deepStrictEqual(simplifyMemfs(message.MEMFS), expectedMEMFS); ++ ++ const workerfsMounts = (message.mounts || []).filter(mount => mount.type === "WORKERFS"); ++ if (expectedWORKERFS.length === 0) { ++ assert.strictEqual(workerfsMounts.length, 0); ++ } else { ++ assert.strictEqual(workerfsMounts.length, 1); ++ ++ assert.deepStrictEqual(workerfsMounts[0].opts && workerfsMounts[0].opts.blobs, expectedWORKERFS); ++ } ++} ++ ++async function assertRejectsWithError(promise, message) { ++ try { ++ await promise; ++ } catch (err) { ++ assert.strictEqual(err.constructor, Error); ++ assert.strictEqual(err.message, message); ++ return; ++ } ++ assert.fail("expected promise to reject"); ++} ++ ++const tests = []; ++function test(name, fn) { ++ tests.push({name, fn}); ++} ++ ++test("successful jobs use fresh workers, emit per-job logs, and resolve MEMFS", async function() { ++ ++ ++ resetWorkers(); ++ const pool = new Pool(); ++ const firstLogs = []; ++ const secondLogs = []; ++ const sourceData = new Uint8Array([1, 2, 3]); ++ const keepData = new Uint8Array([4, 5]); ++ const blobInput = {name: "clip.webm", path: "clip.webm"}; ++ ++ assert.strictEqual(FakeWorker.instances.length, 0); ++ assert.strictEqual(FakeWorker.active.length, 0); ++ ++ const firstJob = pool.spawnJob({ ++ params: ["-i", "in.webm", "-pass", "1", "1.webm"], ++ onLog: line => firstLogs.push(line), ++ MEMFS: [{name: "in.webm", data: sourceData}], ++ WORKERFS: [blobInput], ++ }); ++ const secondJob = pool.spawnJob({ ++ params: ["-i", "1.webm", "-c", "copy", "out.webm"], ++ onLog: line => secondLogs.push(line), ++ MEMFS: [{name: "font.ttf", data: keepData}], ++ }); ++ ++ assert.strictEqual(FakeWorker.instances.length, 2); ++ assert.strictEqual(FakeWorker.active.length, 2); ++ ++ assert.ok(workerAt(0).url); ++ assert.ok(workerAt(1).url); ++ assert.deepStrictEqual(firstLogs, []); ++ assert.deepStrictEqual(secondLogs, []); ++ ++ workerAt(1).emit({type: "ready"}); ++ ++ assertRunPosted( ++ workerAt(1), ++ ["-i", "1.webm", "-c", "copy", "out.webm"], ++ [{name: "font.ttf", data: keepData}], ++ [] ++ ); ++ ++ workerAt(0).emit({type: "ready"}); ++ ++ assertRunPosted( ++ workerAt(0), ++ ["-i", "in.webm", "-pass", "1", "1.webm"], ++ [{name: "in.webm", data: sourceData}], ++ [blobInput] ++ ); ++ ++ workerAt(0).emit({type: "stdout", data: "first stdout"}); ++ workerAt(1).emit({type: "stderr", data: "second stderr"}); ++ workerAt(0).emit({type: "stderr", data: "first stderr"}); ++ workerAt(1).emit({type: "stdout", data: "second stdout"}); ++ assert.deepStrictEqual(firstLogs, ["first stdout", "first stderr"]); ++ assert.deepStrictEqual(secondLogs, ["second stderr", "second stdout"]); ++ ++ workerAt(1).emit({ ++ type: "done", ++ data: {MEMFS: [{name: "out.webm", data: new Uint8Array([8, 9, 10])}]}, ++ }); ++ assert.strictEqual(FakeWorker.active.length, 1); ++ assert.strictEqual(workerAt(1).terminateCount, 1); ++ ++ workerAt(0).emit({ ++ type: "done", ++ data: {MEMFS: [{name: "1.webm", data: new Uint8Array([6, 7])}]}, ++ }); ++ ++ assert.deepStrictEqual(simplifyFiles(await firstJob), [{ ++ name: "1.webm", ++ data: [6, 7], ++ }]); ++ assert.deepStrictEqual(simplifyFiles(await secondJob), [{ ++ name: "out.webm", ++ data: [8, 9, 10], ++ }]); ++ assert.strictEqual(FakeWorker.active.length, 0); ++ assert.strictEqual(workerAt(0).terminateCount, 1); ++ assert.strictEqual(workerAt(1).terminateCount, 1); ++}); ++ ++test("optional MEMFS and WORKERFS default to empty worker inputs", async function() { ++ ++ ++ resetWorkers(); ++ const pool = new Pool(); ++ const logs = []; ++ ++ const job = pool.spawnJob({ ++ params: ["-version"], ++ onLog: line => logs.push(line), ++ }); ++ assert.strictEqual(FakeWorker.instances.length, 1); ++ ++ workerAt(0).emit({type: "ready"}); ++ ++ assertRunPosted(workerAt(0), ["-version"], [], []); ++ ++ workerAt(0).emit({type: "stdout", data: "ffmpeg version"}); ++ ++ workerAt(0).emit({type: "done", data: {MEMFS: []}}); ++ ++ assert.deepStrictEqual(await job, []); ++ assert.deepStrictEqual(logs, ["ffmpeg version"]); ++ assert.strictEqual(FakeWorker.active.length, 0); ++ assert.strictEqual(workerAt(0).terminateCount, 1); ++}); ++ ++test("worker error messages reject with Error carrying worker data", async function() { ++ ++ ++ resetWorkers(); ++ const pool = new Pool(); ++ const job = pool.spawnJob({ ++ params: ["-i", "bad.webm"], ++ onLog: function() {}, ++ }); ++ ++ workerAt(0).emit({type: "ready"}); ++ workerAt(0).emit({type: "error", data: "boom"}); ++ ++ await assertRejectsWithError(job, "boom"); ++ assert.strictEqual(FakeWorker.active.length, 0); ++ assert.strictEqual(workerAt(0).terminateCount, 1); ++}); ++ ++test("non-zero exit rejects with the concrete process exit message", async function() { ++ ++ ++ resetWorkers(); ++ const pool = new Pool(); ++ const job = pool.spawnJob({ ++ params: ["-i", "bad.webm"], ++ onLog: function() {}, ++ }); ++ ++ workerAt(0).emit({type: "ready"}); ++ workerAt(0).emit({type: "exit", data: 7}); ++ ++ await assertRejectsWithError(job, "Process exited with 7"); ++ assert.strictEqual(FakeWorker.active.length, 0); ++ assert.strictEqual(workerAt(0).terminateCount, 1); ++}); ++ ++test("bad first worker message rejects before run is posted", async function() { ++ ++ ++ resetWorkers(); ++ const pool = new Pool(); ++ const job = pool.spawnJob({ ++ params: ["-i", "input.webm"], ++ onLog: function() {}, ++ }); ++ ++ workerAt(0).emit({type: "stdout", data: "too early"}); ++ ++ ++ let rejected = false; ++ try { ++ await job; ++ } catch (err) { ++ rejected = true; ++ assert.strictEqual(err.constructor, Error); ++ assert.match(err.message, /bad|worker|message/i); ++ } ++ assert.strictEqual(rejected, true); ++ assert.deepStrictEqual(workerAt(0).posted, []); ++ assert.strictEqual(FakeWorker.active.length, 0); ++ assert.strictEqual(workerAt(0).terminateCount, 1); ++}); ++ ++test("destroy terminates in-flight workers and is idempotent", function() { ++ ++ ++ resetWorkers(); ++ const pool = new Pool(); ++ ++ pool.spawnJob({params: ["first"], onLog: function() {}}); ++ pool.spawnJob({params: ["second"], onLog: function() {}}); ++ assert.strictEqual(FakeWorker.active.length, 2); ++ assert.strictEqual(workerAt(0).terminateCount, 0); ++ assert.strictEqual(workerAt(1).terminateCount, 0); ++ ++ pool.destroy(); ++ assert.strictEqual(FakeWorker.active.length, 0); ++ assert.strictEqual(workerAt(0).terminateCount, 1); ++ assert.strictEqual(workerAt(1).terminateCount, 1); ++ ++ pool.destroy(); ++ assert.strictEqual(FakeWorker.active.length, 0); ++ assert.strictEqual(workerAt(0).terminateCount, 1); ++ assert.strictEqual(workerAt(1).terminateCount, 1); ++}); ++ ++test("two pools own and destroy only their own in-flight workers", function() { ++ ++ ++ resetWorkers(); ++ const a = new Pool(); ++ const b = new Pool(); ++ ++ a.spawnJob({params: ["a.webm"], onLog: function() {}}); ++ b.spawnJob({params: ["b.webm"], onLog: function() {}}); ++ assert.strictEqual(FakeWorker.instances.length, 2); ++ assert.strictEqual(FakeWorker.active.length, 2); ++ ++ a.destroy(); ++ assert.strictEqual(FakeWorker.active.length, 1); ++ assert.strictEqual(workerAt(0).terminateCount, 1); ++ assert.strictEqual(workerAt(1).terminateCount, 0); ++ ++ b.destroy(); ++ assert.strictEqual(FakeWorker.active.length, 0); ++ assert.strictEqual(workerAt(0).terminateCount, 1); ++ assert.strictEqual(workerAt(1).terminateCount, 1); ++}); ++ ++test("construct use cleanup cycles keep active worker resources bounded", function() { ++ ++ ++ resetWorkers(); ++ ++ for (let i = 0; i < 100; i += 1) { ++ const pool = new Pool(); ++ pool.spawnJob({params: ["cycle", String(i)], onLog: function() {}}); ++ assert.strictEqual(FakeWorker.active.length, 1); ++ pool.destroy(); ++ assert.strictEqual(FakeWorker.active.length, 0); ++ } ++ ++ assert.strictEqual(FakeWorker.instances.length, 100); ++ assert.strictEqual(FakeWorker.active.length, 0); ++}); ++ ++(async function run() { ++ for (const entry of tests) { ++ await entry.fn(); ++ console.log("ok - " + entry.name); ++ } ++ console.log("1.." + tests.length); ++})().catch(err => { ++ console.error(err && err.stack || err); ++ process.exit(1); ++}); +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,22 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++set -euo pipefail ++cd /workspace/repo ++ ++ ++if [ ! -f node_modules/babel-core/register.js ] || ++ [ ! -f node_modules/ffmpeg.js/ffmpeg-worker-webm.js ]; then ++ echo "offline dependencies are missing from /workspace/repo/node_modules" >&2 ++ exit 1 ++fi ++ ++exec node /workspace/repo/usercase-test-coderl/pool.test.js diff --git a/tasks/format-code-task-001677/tests/test.sh b/tasks/format-code-task-001677/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0812d2824b7a5de0fa317bae1e103f29baa662a5 --- /dev/null +++ b/tasks/format-code-task-001677/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/pool.test.js +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001677/tests/test_command.sh b/tasks/format-code-task-001677/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-001677/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001679/environment/Dockerfile b/tasks/format-code-task-001679/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..e23e57be5eed0a2616b14c2726be57351acd3f53 --- /dev/null +++ b/tasks/format-code-task-001679/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:486f62c1ee8118ae0301fef141b365ed12da074322355045574d3c9849d35544 diff --git a/tasks/format-code-task-001679/environment/setup/files/blocklist b/tasks/format-code-task-001679/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001679/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001679/environment/setup/setup.sh b/tasks/format-code-task-001679/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-001679/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001679/tests/test.patch b/tasks/format-code-task-001679/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..453c8d862b3bdf49e7e0ab816f5701899f775496 --- /dev/null +++ b/tasks/format-code-task-001679/tests/test.patch @@ -0,0 +1,325 @@ +diff --git a/usercase-test-coderl/fixtures/jpegtran b/usercase-test-coderl/fixtures/jpegtran +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/fixtures/jpegtran +@@ -0,0 +1,39 @@ ++#!/usr/bin/env bash ++set -e ++ ++if [ -n "${OPT_LOG:-}" ]; then ++ printf 'jpegtran' >> "$OPT_LOG" ++ for arg in "$@"; do ++ case "$arg" in ++ "$PWD"/*) printf '\t.%s' "${arg#"$PWD"}" >> "$OPT_LOG" ;; ++ *) printf '\t%s' "$arg" >> "$OPT_LOG" ;; ++ esac ++ done ++ printf '\n' >> "$OPT_LOG" ++fi ++ ++ ++if [ "${JPEGTRAN_FAIL:-0}" = "1" ]; then ++ echo "jpegtran fixture failure" >&2 ++ exit 37 ++fi ++ ++out= ++input= ++while [ "$#" -gt 0 ]; do ++ case "$1" in ++ -outfile) ++ out=$2 ++ shift 2 ++ ;; ++ -*) ++ shift ++ ;; ++ *) ++ input=$1 ++ shift ++ ;; ++ esac ++done ++ ++printf 'JPEG_OPT:%s' "$(cat "$input")" > "$out" +diff --git a/usercase-test-coderl/fixtures/optipng b/usercase-test-coderl/fixtures/optipng +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/fixtures/optipng +@@ -0,0 +1,40 @@ ++#!/usr/bin/env bash ++set -e ++ ++if [ -n "${OPT_LOG:-}" ]; then ++ printf 'optipng' >> "$OPT_LOG" ++ for arg in "$@"; do ++ case "$arg" in ++ "$PWD"/*) printf '\t.%s' "${arg#"$PWD"}" >> "$OPT_LOG" ;; ++ *) printf '\t%s' "$arg" >> "$OPT_LOG" ;; ++ esac ++ done ++ printf '\n' >> "$OPT_LOG" ++fi ++ ++ ++if [ "${OPTIPNG_FAIL:-0}" = "1" ]; then ++ echo "optipng fixture failure" >&2 ++ exit 43 ++fi ++ ++out= ++input= ++while [ "$#" -gt 0 ]; do ++ case "$1" in ++ -out) ++ out=$2 ++ shift 2 ++ ;; ++ -*) ++ shift ++ ;; ++ *) ++ input=$1 ++ shift ++ ;; ++ esac ++done ++ ++printf 'PNG_OPT:%s' "$(cat "$input")" > "$out" ++printf 'backup' > "$out.bak" +diff --git a/usercase-test-coderl/usecase.sh b/usercase-test-coderl/usecase.sh +new file mode 100755 +--- /dev/null ++++ b/usercase-test-coderl/usecase.sh +@@ -0,0 +1,214 @@ ++#!/usr/bin/env bash ++ ++set -u ++export LANG=C LC_ALL=C TZ=UTC ++ ++ ++( cd /workspace/repo && node - <<'NODE' ++const pkg = require('./package.json'); ++const deps = Object.keys(pkg.dependencies || {}); ++for (const dep of deps) { ++ require.resolve(dep, { paths: [process.cwd()] }); ++} ++NODE ++) || { echo "FAIL: build" >&2; exit 1; } ++ ++BIN=/workspace/repo/nodefront.js ++FIXTURES=/workspace/repo/usercase-test-coderl/fixtures ++chmod +x "$FIXTURES/jpegtran" "$FIXTURES/optipng" ++ ++TMP=$(mktemp -d); trap 'rm -rf "$TMP"' EXIT ++fail() { echo "FAIL: $*" >&2; exit 1; } ++ ++assert_file() { ++ file=$1 ++ expected=$2 ++ [ -f "$file" ] || fail "missing file $file" ++ actual=$(cat "$file") ++ [ "$actual" = "$expected" ] || fail "$file content: $actual" ++} ++ ++assert_line() { ++ line=$1 ++ file=$2 ++ grep -Fx -- "$line" "$file" >/dev/null || fail "missing line: $line" ++} ++ ++assert_optimizer_input() { ++ optimizer=$1 ++ input=$2 ++ file=$3 ++ ++ awk -v optimizer="$optimizer" -v input="$input" ' ++ function normalize(path) { ++ sub(/^\.\//, "", path) ++ return path ++ } ++ $1 == optimizer { ++ for (i = 2; i <= NF; i++) { ++ if (normalize($i) == input) { ++ found = 1 ++ } ++ } ++ } ++ END { exit(found ? 0 : 1) } ++ ' "$file" || fail "missing $optimizer call for $input" ++} ++ ++assert_forced_output() { ++ input=$1 ++ expected=$2 ++ stdout_file=$3 ++ shift 3 ++ for candidate in "$@"; do ++ if [ -f "$candidate" ]; then ++ assert_file "$candidate" "$expected" ++ assert_line "Optimized $input to $candidate." "$stdout_file" ++ return ++ fi ++ done ++ fail "missing optimized output for $input" ++} ++ ++ ++ ++ ++work=$TMP/help ++mkdir -p "$work" ++cd "$work" ++"$BIN" minify --help >out 2>err; ec=$? ++[ "$ec" -eq 0 ] || fail "F_help exit $ec; want 0" ++ ++images_help=$(awk '/-i, --images/ {capture=1} capture && /^ -[a-z], --/ && $0 !~ /-i, --images/ {exit} capture {print}' out) ++[ -n "$images_help" ] || fail "F_help missing -i, --images help" ++printf '%s\n' "$images_help" | grep -Ei -- 'optimi[sz]e' >/dev/null \ ++ || fail "F_help -i, --images does not describe optimization" ++printf '%s\n' "$images_help" | grep -Ei -- 'jpe?g' >/dev/null \ ++ || fail "F_help -i, --images missing JPEG" ++printf '%s\n' "$images_help" | grep -Ei -- 'png' >/dev/null \ ++ || fail "F_help -i, --images missing PNG" ++ ++type_help=$(awk '/-t, --type/ {capture=1} capture && /^ -[a-z], --/ && $0 !~ /-t, --type/ {exit} capture {print}' out) ++[ -n "$type_help" ] || fail "F_help missing --type help" ++printf '%s\n' "$type_help" | grep -F -- "jpg" >/dev/null || fail "F_help --type missing jpg" ++printf '%s\n' "$type_help" | grep -F -- "jpeg" >/dev/null || fail "F_help --type missing jpeg" ++printf '%s\n' "$type_help" | grep -F -- "png" >/dev/null || fail "F_help --type missing png" ++ ++[ -s out ] || fail "F_help missing stdout" ++ ++ ++ ++ ++work=$TMP/images-long ++mkdir -p "$work" ++cd "$work" ++printf 'JPG_A' > photo.jpg ++printf 'JPEG_B' > banner.jpeg ++printf 'PNG_C' > icon.png ++OPT_LOG=$work/optimizer.log PATH="$FIXTURES:$PATH" "$BIN" minify --images >out 2>err; ec=$? ++[ "$ec" -eq 0 ] || fail "F_images exit $ec; want 0" ++assert_line "Optimized banner.jpeg to banner.min.jpeg." out ++assert_line "Optimized icon.png to icon.min.png." out ++assert_line "Optimized photo.jpg to photo.min.jpg." out ++[ "$(grep -c '^Optimized ' out)" -eq 3 ] || fail "F_images optimized line count: $(cat out)" ++assert_file banner.min.jpeg "JPEG_OPT:JPEG_B" ++assert_file icon.min.png "PNG_OPT:PNG_C" ++assert_file photo.min.jpg "JPEG_OPT:JPG_A" ++ ++[ -s out ] || fail "F_images missing stdout" ++assert_optimizer_input jpegtran banner.jpeg optimizer.log ++assert_optimizer_input optipng icon.png optimizer.log ++assert_optimizer_input jpegtran photo.jpg optimizer.log ++ ++ ++ ++ ++work=$TMP/images-short ++mkdir -p "$work" ++cd "$work" ++printf 'ALIAS_PNG' > alias.png ++OPT_LOG=$work/optimizer.log PATH="$FIXTURES:$PATH" "$BIN" minify -i >out 2>err; ec=$? ++[ "$ec" -eq 0 ] || fail "F_alias exit $ec; want 0" ++ ++assert_line "Optimized alias.png to alias.min.png." out ++[ "$(grep -c '^Optimized ' out)" -eq 1 ] || fail "F_alias optimized line count: $(cat out)" ++ ++[ -s out ] || fail "F_alias missing stdout" ++assert_file alias.min.png "PNG_OPT:ALIAS_PNG" ++assert_optimizer_input optipng alias.png optimizer.log ++ ++ ++ ++ ++work=$TMP/plain-jpg ++mkdir -p "$work/images" ++cd "$work" ++printf 'PLAIN_JPG' > images/photo.jpg ++OPT_LOG=$work/optimizer.log PATH="$FIXTURES:$PATH" "$BIN" minify -p images/photo.jpg -t jpg >out 2>err; ec=$? ++[ "$ec" -eq 0 ] || fail "F_plain_jpg exit $ec; want 0" ++ ++[ -s out ] || fail "F_plain_jpg missing stdout" ++ ++assert_forced_output images/photo.jpg "JPEG_OPT:PLAIN_JPG" out images/photo.jpg.min.jpg images/photo.min.jpg ++assert_optimizer_input jpegtran images/photo.jpg optimizer.log ++ ++ ++ ++ ++work=$TMP/plain-png ++mkdir -p "$work/images" ++cd "$work" ++printf 'PLAIN_PNG' > images/icon.png ++OPT_LOG=$work/optimizer.log PATH="$FIXTURES:$PATH" "$BIN" minify -p images/icon.png -t png >out 2>err; ec=$? ++[ "$ec" -eq 0 ] || fail "F_plain_png exit $ec; want 0" ++ ++[ -s out ] || fail "F_plain_png missing stdout" ++ ++assert_forced_output images/icon.png "PNG_OPT:PLAIN_PNG" out images/icon.png.min.png images/icon.min.png ++assert_optimizer_input optipng images/icon.png optimizer.log ++ ++ ++ ++ ++work=$TMP/plain-jpeg ++mkdir -p "$work" ++cd "$work" ++printf 'FORCED_JPEG' > raw-image ++OPT_LOG=$work/optimizer.log PATH="$FIXTURES:$PATH" "$BIN" minify -p raw-image -t jpeg >out 2>err; ec=$? ++[ "$ec" -eq 0 ] || fail "F_plain_jpeg exit $ec; want 0" ++ ++assert_line "Optimized raw-image to raw-image.min.jpeg." out ++[ "$(grep -c '^Optimized ' out)" -eq 1 ] || fail "F_plain_jpeg optimized line count: $(cat out)" ++ ++[ -s out ] || fail "F_plain_jpeg missing stdout" ++assert_file raw-image.min.jpeg "JPEG_OPT:FORCED_JPEG" ++assert_optimizer_input jpegtran raw-image optimizer.log ++ ++ ++ ++ ++work=$TMP/jpeg-error ++mkdir -p "$work" ++cd "$work" ++printf 'BAD_JPEG' > broken.jpg ++OPT_LOG=$work/optimizer.log JPEGTRAN_FAIL=1 PATH="$FIXTURES:$PATH" "$BIN" minify -p broken.jpg -t jpg >out 2>err; ec=$? ++[ "$ec" -ne 0 ] || fail "F_jpeg_error exit 0; want non-zero" ++! grep -F -- "Optimized broken.jpg" out >/dev/null || fail "F_jpeg_error printed success" ++ ++assert_optimizer_input jpegtran broken.jpg optimizer.log ++ ++ ++ ++ ++work=$TMP/png-error ++mkdir -p "$work" ++cd "$work" ++printf 'BAD_PNG' > broken.png ++OPT_LOG=$work/optimizer.log OPTIPNG_FAIL=1 PATH="$FIXTURES:$PATH" "$BIN" minify -p broken.png -t png >out 2>err; ec=$? ++[ "$ec" -ne 0 ] || fail "F_png_error exit 0; want non-zero" ++! grep -F -- "Optimized broken.png" out >/dev/null || fail "F_png_error printed success" ++ ++assert_optimizer_input optipng broken.png optimizer.log ++ ++echo "PASS" ++exit 0 +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,12 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++exec bash /workspace/repo/usercase-test-coderl/usecase.sh diff --git a/tasks/format-code-task-001679/tests/test.sh b/tasks/format-code-task-001679/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..b2a996866479de1260a5d74d45226a497335b711 --- /dev/null +++ b/tasks/format-code-task-001679/tests/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/fixtures/jpegtran +usercase-test-coderl/fixtures/optipng +usercase-test-coderl/usecase.sh +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001679/tests/test_command.sh b/tasks/format-code-task-001679/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-001679/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001683/environment/Dockerfile b/tasks/format-code-task-001683/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..457e7b85dc99b753380664374e9dc8787f61d229 --- /dev/null +++ b/tasks/format-code-task-001683/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:e845f7eae747d6c7cb3aa61645ccc46763aa718ca38eb1de73c6e7286b02e6a0 diff --git a/tasks/format-code-task-001683/environment/setup/files/blocklist b/tasks/format-code-task-001683/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001683/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001683/environment/setup/setup.sh b/tasks/format-code-task-001683/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001683/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001683/tests/test.patch b/tasks/format-code-task-001683/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..57197a39bbc1ffb1e52f12b68d95873764caff2d --- /dev/null +++ b/tasks/format-code-task-001683/tests/test.patch @@ -0,0 +1,272 @@ +diff --git a/tests/test_oauth2proxy_auth.py b/tests/test_oauth2proxy_auth.py +new file mode 100644 +index 00000000..0af4f6e4 +--- /dev/null ++++ b/tests/test_oauth2proxy_auth.py +@@ -0,0 +1,241 @@ ++ ++import pytest ++ ++from tests.fixtures.client import client, test_app # noqa ++ ++ ++def _base_env(**overrides): ++ env = {"AUTH_TYPE": "oauth2proxy"} ++ env.update(overrides) ++ return env ++ ++ ++@pytest.mark.parametrize( ++ "test_app", ++ [_base_env()], ++ indirect=True, ++) ++def test_admin_group_can_write(db_session, client, test_app): ++ ++ headers = { ++ "x-forwarded-email": "admin@example.com", ++ "x-forwarded-groups": "admin", ++ } ++ ++ response = client.get("/auth/users", headers=headers) ++ assert response.status_code == 200 ++ ++ response = client.post( ++ "/auth/users", ++ headers=headers, ++ json={"email": "someone@example.com", "role": "admin"}, ++ ) ++ assert response.status_code == 200 ++ ++ ++@pytest.mark.parametrize( ++ "test_app", ++ [_base_env()], ++ indirect=True, ++) ++def test_noc_group_is_read_only(db_session, client, test_app): ++ ++ headers = { ++ "x-forwarded-email": "noc@example.com", ++ "x-forwarded-groups": "noc", ++ } ++ response = client.get("/auth/users", headers=headers) ++ assert response.status_code == 200 ++ ++ response = client.post( ++ "/auth/users", ++ headers=headers, ++ json={"email": "someone@example.com", "role": "noc"}, ++ ) ++ assert response.status_code == 403 ++ ++ ++@pytest.mark.parametrize( ++ "test_app", ++ [_base_env()], ++ indirect=True, ++) ++def test_missing_user_header_unauthorized(db_session, client, test_app): ++ ++ response = client.get( ++ "/auth/users", ++ headers={"x-forwarded-groups": "admin"}, ++ ) ++ assert response.status_code == 401 ++ ++ ++@pytest.mark.parametrize( ++ "test_app", ++ [_base_env()], ++ indirect=True, ++) ++def test_missing_groups_header_unauthorized(db_session, client, test_app): ++ ++ response = client.get( ++ "/auth/users", ++ headers={"x-forwarded-email": "admin@example.com"}, ++ ) ++ assert response.status_code == 401 ++ ++ ++@pytest.mark.parametrize( ++ "test_app", ++ [_base_env()], ++ indirect=True, ++) ++def test_unknown_group_forbidden(db_session, client, test_app): ++ ++ response = client.get( ++ "/auth/users", ++ headers={ ++ "x-forwarded-email": "nobody@example.com", ++ "x-forwarded-groups": "some-random-group,another-group", ++ }, ++ ) ++ assert response.status_code == 403 ++ ++ ++@pytest.mark.parametrize( ++ "test_app", ++ [_base_env()], ++ indirect=True, ++) ++def test_role_precedence_admin_over_noc(db_session, client, test_app): ++ ++ headers = { ++ "x-forwarded-email": "multi@example.com", ++ "x-forwarded-groups": "noc,admin", ++ } ++ ++ response = client.post( ++ "/auth/users", ++ headers=headers, ++ json={"email": "someone@example.com", "role": "admin"}, ++ ) ++ assert response.status_code == 200 ++ ++ ++ headers["x-forwarded-groups"] = "admin,noc" ++ response = client.post( ++ "/auth/users", ++ headers=headers, ++ json={"email": "someone2@example.com", "role": "admin"}, ++ ) ++ assert response.status_code == 200 ++ ++ ++@pytest.mark.parametrize( ++ "test_app", ++ [_base_env(KEEP_OAUTH2_PROXY_USER_HEADER="x-user", KEEP_OAUTH2_PROXY_ROLE_HEADER="x-groups")], ++ indirect=True, ++) ++def test_configurable_headers(db_session, client, test_app): ++ ++ ++ response = client.get( ++ "/auth/users", ++ headers={ ++ "x-forwarded-email": "admin@example.com", ++ "x-forwarded-groups": "admin", ++ }, ++ ) ++ assert response.status_code == 401 ++ ++ ++ response = client.get( ++ "/auth/users", ++ headers={ ++ "x-user": "admin@example.com", ++ "x-groups": "admin", ++ }, ++ ) ++ assert response.status_code == 200 ++ ++ ++@pytest.mark.parametrize( ++ "test_app", ++ [ ++ _base_env( ++ KEEP_OAUTH2_PROXY_ADMIN_ROLE="team-platform@example.com", ++ KEEP_OAUTH2_PROXY_NOC_ROLE="dept-engineering@example.com", ++ KEEP_OAUTH2_PROXY_WEBHOOK_ROLE="svc-webhook@example.com", ++ ) ++ ], ++ indirect=True, ++) ++def test_custom_group_to_role_mapping(db_session, client, test_app): ++ ++ ++ response = client.post( ++ "/auth/users", ++ headers={ ++ "x-forwarded-email": "lead@example.com", ++ "x-forwarded-groups": "all@example.com,team-platform@example.com", ++ }, ++ json={"email": "someone@example.com", "role": "admin"}, ++ ) ++ assert response.status_code == 200 ++ ++ ++ headers = { ++ "x-forwarded-email": "eng@example.com", ++ "x-forwarded-groups": "dept-engineering@example.com", ++ } ++ response = client.get("/auth/users", headers=headers) ++ assert response.status_code == 200 ++ response = client.post( ++ "/auth/users", ++ headers=headers, ++ json={"email": "someone@example.com", "role": "noc"}, ++ ) ++ assert response.status_code == 403 ++ ++ ++ response = client.post( ++ "/auth/users", ++ headers={ ++ "x-forwarded-email": "both@example.com", ++ "x-forwarded-groups": "dept-engineering@example.com,team-platform@example.com", ++ }, ++ json={"email": "someone@example.com", "role": "admin"}, ++ ) ++ assert response.status_code == 200 ++ ++ ++@pytest.mark.parametrize( ++ "test_app", ++ [_base_env()], ++ indirect=True, ++) ++def test_auto_create_user_enabled_by_default(db_session, client, test_app): ++ ++ headers = { ++ "x-forwarded-email": "newuser@example.com", ++ "x-forwarded-groups": "admin", ++ } ++ response = client.get("/auth/users", headers=headers) ++ assert response.status_code == 200 ++ emails = [u["email"] for u in response.json()] ++ assert "newuser@example.com" in emails ++ ++ ++@pytest.mark.parametrize( ++ "test_app", ++ [_base_env(KEEP_OAUTH2_PROXY_AUTO_CREATE_USER="false")], ++ indirect=True, ++) ++def test_auto_create_user_disabled(db_session, client, test_app): ++ ++ headers = { ++ "x-forwarded-email": "ghost@example.com", ++ "x-forwarded-groups": "admin", ++ } ++ response = client.get("/auth/users", headers=headers) ++ assert response.status_code == 200 ++ emails = [u["email"] for u in response.json()] ++ assert "ghost@example.com" not in emails +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,20 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++set -euo pipefail ++HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ++cd /testbed ++ ++ ++ ++ ++ ++ ++ ++ ++python -m pytest tests/test_auth.py -q -k "not keycloak" ++ ++ ++python -m pytest tests/test_oauth2proxy_auth.py -q diff --git a/tasks/format-code-task-001683/tests/test.sh b/tasks/format-code-task-001683/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..47084a4dee13c0ceac6918e66ad89499ad6bfa7c --- /dev/null +++ b/tasks/format-code-task-001683/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/test_oauth2proxy_auth.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001683/tests/test_command.sh b/tasks/format-code-task-001683/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001683/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001684/environment/Dockerfile b/tasks/format-code-task-001684/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..7f8cd74da6ea151daaddb5ce6a7298bf5ff2f33b --- /dev/null +++ b/tasks/format-code-task-001684/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:8a1933ffe2778f549a5dce578dc88bd92edff8472a3286e6bdd38eddd749ba55 diff --git a/tasks/format-code-task-001684/environment/setup/files/blocklist b/tasks/format-code-task-001684/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001684/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001684/environment/setup/setup.sh b/tasks/format-code-task-001684/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-001684/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001684/tests/test.patch b/tasks/format-code-task-001684/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..fcbfd3352399e4426f74b0e64ec11de8a53ed61c --- /dev/null +++ b/tasks/format-code-task-001684/tests/test.patch @@ -0,0 +1,259 @@ +diff --git a/usercase-test-coderl/usecase.sh b/usercase-test-coderl/usecase.sh +new file mode 100755 +--- /dev/null ++++ b/usercase-test-coderl/usecase.sh +@@ -0,0 +1,230 @@ ++#!/usr/bin/env bash ++ ++set -u ++export LANG=C.UTF-8 LC_ALL=C.UTF-8 TZ=UTC PYTHONHASHSEED=0 ++ ++REPO=/workspace/repo ++TMP=$(mktemp -d) ++trap 'rm -rf "$TMP"' EXIT ++ ++fail() { ++ echo "FAIL: $*" >&2 ++ exit 1 ++} ++ ++if ! ( cd "$REPO" && python -m py_compile data_gen/gen_bone_data.py && python - <<'PY' ++import numpy ++import tqdm ++PY ++); then ++ fail "build" ++fi ++ ++make_runroot() { ++ local name="$1" ++ local root="$TMP/$name" ++ mkdir -p "$root/data" ++ cp -a "$REPO/data_gen" "$root/data_gen" || fail "$name: copy data_gen" ++ printf '%s\n' "$root" ++} ++ ++write_joint() { ++ local root="$1" ++ local rel="$2" ++ local n="$3" ++ local c="$4" ++ local t="$5" ++ local v="$6" ++ local m="$7" ++ local factor="$8" ++ local offset="$9" ++ python - "$root" "$rel" "$n" "$c" "$t" "$v" "$m" "$factor" "$offset" <<'PY' ++import os ++import sys ++import numpy as np ++ ++root, rel = sys.argv[1], sys.argv[2] ++N, C, T, V, M = map(int, sys.argv[3:8]) ++factor = float(sys.argv[8]) ++offset = float(sys.argv[9]) ++path = os.path.join(root, 'data', rel) ++os.makedirs(os.path.dirname(path), exist_ok=True) ++data = np.zeros((N, C, T, V, M), dtype=np.float32) ++for n in range(N): ++ for c in range(C): ++ for t in range(T): ++ for v in range(V): ++ for m in range(M): ++ data[n, c, t, v, m] = ( ++ offset + n * 100000 + c * 1000 + t * 100 + v * factor + m * 10 ++ ) ++np.save(path, data) ++PY ++} ++ ++run_generator() { ++ local root="$1" ++ shift ++ ( cd "$root/data_gen" && python gen_bone_data.py "$@" >"$root/out" 2>"$root/err" ) ++ return $? ++} ++ ++assert_sorted_stdout() { ++ local root="$1" ++ local expected="$2" ++ local actual ++ actual=$(sort "$root/out") ++ [ "$actual" = "$expected" ] || fail "stdout mismatch: got [$actual]" ++} ++ ++assert_no_traceback() { ++ local root="$1" ++ ! grep -q 'Traceback' "$root/err" || fail "unexpected traceback in stderr" ++} ++ ++check_array() { ++ local path="$1" ++ local shape="$2" ++ local dtype="$3" ++ local digest="$4" ++ local label="$5" ++ python - "$path" "$shape" "$dtype" "$digest" "$label" <<'PY' || exit 1 ++import ast ++import hashlib ++import sys ++import numpy as np ++ ++path, shape_text, dtype, expected_digest, label = sys.argv[1:6] ++try: ++ arr = np.load(path, mmap_mode='r') ++except Exception as exc: ++ print(f"FAIL: {label}: cannot load output: {exc}", file=sys.stderr) ++ sys.exit(1) ++ ++expected_shape = tuple(ast.literal_eval(shape_text)) ++if tuple(arr.shape) != expected_shape: ++ print(f"FAIL: {label}: shape {tuple(arr.shape)}; want {expected_shape}", file=sys.stderr) ++ sys.exit(1) ++if str(arr.dtype) != dtype: ++ print(f"FAIL: {label}: dtype {arr.dtype}; want {dtype}", file=sys.stderr) ++ sys.exit(1) ++ ++actual_digest = hashlib.sha256(np.ascontiguousarray(arr).view(np.uint8)).hexdigest() ++if actual_digest != expected_digest: ++ print(f"FAIL: {label}: data sha256 {actual_digest}; want {expected_digest}", file=sys.stderr) ++ sys.exit(1) ++PY ++} ++ ++ ++ ++ ++root=$(make_runroot f1_ntu) ++write_joint "$root" ntu/xview/train_data_joint.npy 1 3 2 25 1 1 10000 ++write_joint "$root" ntu/xview/val_data_joint.npy 1 3 2 25 1 2 20000 ++write_joint "$root" ntu/xsub/train_data_joint.npy 1 3 2 25 1 3 30000 ++write_joint "$root" ntu/xsub/val_data_joint.npy 1 3 2 25 1 4 40000 ++run_generator "$root" --dataset ntu ++ec=$? ++[ "$ec" -eq 0 ] || fail "F1 exit $ec; want 0" ++assert_sorted_stdout "$root" "ntu/xsub train ++ntu/xsub val ++ntu/xview train ++ntu/xview val" ++assert_no_traceback "$root" ++check_array "$root/data/ntu/xview/train_data_bone.npy" "(1, 3, 2, 25, 1)" float32 9fdf43bc36ff489c4e495f8a30a627416fbb652f469df201c464338d37a97bcd "F1 ntu/xview train" ++check_array "$root/data/ntu/xview/val_data_bone.npy" "(1, 3, 2, 25, 1)" float32 62cb64778fc82314501e192ad5d25636aba06c7535660bbb8555c14400606302 "F1 ntu/xview val" ++check_array "$root/data/ntu/xsub/train_data_bone.npy" "(1, 3, 2, 25, 1)" float32 bde6b05b1038c39ce48cb72841ecf9181b4e4bd08d2e3bd75d8f401b393ee2e1 "F1 ntu/xsub train" ++check_array "$root/data/ntu/xsub/val_data_bone.npy" "(1, 3, 2, 25, 1)" float32 e64afc2b31d6eaf40c79095d311c6e039572dab27364fadb087c9da8a564a156 "F1 ntu/xsub val" ++[ ! -e "$root/data/kinetics/train_data_bone.npy" ] || fail "F1 unexpectedly processed kinetics" ++ ++ ++ ++ ++root=$(make_runroot f2_ntu120) ++write_joint "$root" ntu120/xset/train_data_joint.npy 1 3 1 25 2 5 50000 ++write_joint "$root" ntu120/xset/val_data_joint.npy 1 3 1 25 2 6 60000 ++write_joint "$root" ntu120/xsub/train_data_joint.npy 1 3 1 25 2 7 70000 ++write_joint "$root" ntu120/xsub/val_data_joint.npy 1 3 1 25 2 8 80000 ++run_generator "$root" --dataset ntu120 ++ec=$? ++[ "$ec" -eq 0 ] || fail "F2 exit $ec; want 0" ++assert_sorted_stdout "$root" "ntu120/xset train ++ntu120/xset val ++ntu120/xsub train ++ntu120/xsub val" ++assert_no_traceback "$root" ++check_array "$root/data/ntu120/xset/train_data_bone.npy" "(1, 3, 1, 25, 2)" float32 14f392d868c15213514e7fb6423473775e97608b78516ebeff431ba00ab3f968 "F2 ntu120/xset train" ++check_array "$root/data/ntu120/xset/val_data_bone.npy" "(1, 3, 1, 25, 2)" float32 b479cd4c8a746216958ba4700da53e8d140115599710f4ddfb8ea9e1b58b638d "F2 ntu120/xset val" ++check_array "$root/data/ntu120/xsub/train_data_bone.npy" "(1, 3, 1, 25, 2)" float32 196271f5201bf465167294ce6e73cc28dfe81643dcb4bb6f2017eed6eb252639 "F2 ntu120/xsub train" ++check_array "$root/data/ntu120/xsub/val_data_bone.npy" "(1, 3, 1, 25, 2)" float32 5bbd0df044676cf1d1e20adc323c35a743881bda21688f95fad7fdc69e317451 "F2 ntu120/xsub val" ++ ++ ++ ++ ++root=$(make_runroot f3_kinetics) ++write_joint "$root" kinetics/train_data_joint.npy 2 3 1 18 2 11 110000 ++write_joint "$root" kinetics/val_data_joint.npy 2 3 1 18 2 12 120000 ++run_generator "$root" --dataset kinetics ++ec=$? ++[ "$ec" -eq 0 ] || fail "F3 exit $ec; want 0" ++assert_sorted_stdout "$root" "kinetics train ++kinetics val" ++assert_no_traceback "$root" ++check_array "$root/data/kinetics/train_data_bone.npy" "(2, 3, 1, 18, 2)" float32 e9118aae7dfe1972c4f271454e76cb1a3ad7968474214734fc8d51e64755f38a "F3 kinetics train" ++check_array "$root/data/kinetics/val_data_bone.npy" "(2, 3, 1, 18, 2)" float32 3af830403cc6e19ed38e231285d119f51555967dd859cb53b0fd6363f6eefce4 "F3 kinetics val" ++ ++ ++ ++ ++root=$(make_runroot f4_processing_errors) ++write_joint "$root" ntu/xview/val_data_joint.npy 1 3 1 24 1 20 200000 ++write_joint "$root" ntu/xsub/train_data_joint.npy 1 3 1 25 1 21 210000 ++write_joint "$root" ntu/xsub/val_data_joint.npy 1 3 1 25 1 22 220000 ++run_generator "$root" --dataset ntu ++ec=$? ++[ "$ec" -eq 0 ] || fail "F4 exit $ec; want 0 despite per-file errors" ++grep -q '^Run into error:' "$root/out" || fail "F4 missing error report" ++[ "$(grep -c '^Run into error:' "$root/out")" -eq 2 ] || fail "F4 should report two processing errors" ++grep -q '^Skipping (ntu/xview val)$' "$root/out" || fail "F4 missing invalid-shape skip" ++grep -q '^Skipping (ntu/xview train)$' "$root/out" || fail "F4 missing missing-file skip" ++grep -q '^ntu/xsub val$' "$root/out" || fail "F4 did not continue to ntu/xsub val" ++grep -q '^ntu/xsub train$' "$root/out" || fail "F4 did not continue to ntu/xsub train" ++assert_no_traceback "$root" ++check_array "$root/data/ntu/xsub/train_data_bone.npy" "(1, 3, 1, 25, 1)" float32 2c3c69ea85195077a9fc01929056b38b6e74df0675ac978401fa7dbb70e8203e "F4 ntu/xsub train" ++check_array "$root/data/ntu/xsub/val_data_bone.npy" "(1, 3, 1, 25, 1)" float32 63e2e0a99c2f76fd641b77e7c3baa2a4e520ed682cbc13b3eb3c587b30134710 "F4 ntu/xsub val" ++[ ! -e "$root/data/ntu/xview/train_data_bone.npy" ] || fail "F4 should not create output for missing train input" ++ ++ ++ ++ ++root=$(make_runroot f5_missing_dataset) ++run_generator "$root" ++ec=$? ++ ++[ "$ec" -ne 0 ] || fail "F5 exit $ec; want non-zero argparse failure" ++[ ! -s "$root/out" ] || fail "F5 stdout should be empty" ++ ++grep -qi '^usage:' "$root/err" || fail "F5 stderr should contain argparse usage: $(cat "$root/err")" ++grep -q -- '--dataset' "$root/err" || fail "F5 stderr should mention --dataset: $(cat "$root/err")" ++grep -qi 'required' "$root/err" || fail "F5 stderr should report a required argument: $(cat "$root/err")" ++ ++ ++ ++ ++root=$(make_runroot f6_invalid_dataset) ++run_generator "$root" --dataset bogus ++ec=$? ++ ++[ "$ec" -ne 0 ] || fail "F6 exit $ec; want non-zero argparse failure" ++[ ! -s "$root/out" ] || fail "F6 stdout should be empty" ++ ++grep -qi '^usage:' "$root/err" || fail "F6 stderr should contain argparse usage: $(cat "$root/err")" ++grep -q -- '--dataset' "$root/err" || fail "F6 stderr should mention --dataset: $(cat "$root/err")" ++grep -q 'bogus' "$root/err" || fail "F6 stderr should mention invalid value: $(cat "$root/err")" ++grep -Eq '(^|[^[:alnum:]_])ntu([^[:alnum:]_]|$)' "$root/err" || fail "F6 stderr should mention allowed choice ntu: $(cat "$root/err")" ++grep -q 'ntu120' "$root/err" || fail "F6 stderr should mention allowed choice ntu120: $(cat "$root/err")" ++grep -q 'kinetics' "$root/err" || fail "F6 stderr should mention allowed choice kinetics: $(cat "$root/err")" ++ ++echo "PASS" ++exit 0 +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,19 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++ ++ ++export PIP_NO_INDEX=1 ++export PIP_DISABLE_PIP_VERSION_CHECK=1 ++export PYTHONNOUSERSITE=1 ++export PYTHON=/usr/local/bin/python ++export PATH="/usr/local/bin:${PATH}" ++set -e ++cd /workspace/repo ++exec bash /workspace/repo/usercase-test-coderl/usecase.sh diff --git a/tasks/format-code-task-001684/tests/test.sh b/tasks/format-code-task-001684/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..d4d80bb634b14076ae561be99f395189577b7ac6 --- /dev/null +++ b/tasks/format-code-task-001684/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/usecase.sh +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001684/tests/test_command.sh b/tasks/format-code-task-001684/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-001684/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001733/environment/Dockerfile b/tasks/format-code-task-001733/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..13dfd4e5045c165c6d414341dc33452b7f94efcb --- /dev/null +++ b/tasks/format-code-task-001733/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:d80710ee6f4048b74165a24d127207b6c0115f7d684ba9f74a2ae79d30b16aae diff --git a/tasks/format-code-task-001733/environment/setup/files/blocklist b/tasks/format-code-task-001733/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001733/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001733/environment/setup/setup.sh b/tasks/format-code-task-001733/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001733/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001733/tests/test.patch b/tasks/format-code-task-001733/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..cd4a73dc40b05ef009bc7c61a0d64b4f55d47831 --- /dev/null +++ b/tasks/format-code-task-001733/tests/test.patch @@ -0,0 +1,270 @@ +diff --git a/pkg/csi/service/wcp/controller_snapshot_test.go b/pkg/csi/service/wcp/controller_snapshot_test.go +new file mode 100644 +index 00000000..03ac6b06 +--- /dev/null ++++ b/pkg/csi/service/wcp/controller_snapshot_test.go +@@ -0,0 +1,239 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++package wcp ++ ++import ( ++ "strings" ++ "testing" ++ ++ "github.com/container-storage-interface/spec/lib/go/csi" ++ "github.com/google/uuid" ++ "github.com/vmware/govmomi/pbm" ++ "google.golang.org/grpc/codes" ++ "google.golang.org/grpc/status" ++ ++ "sigs.k8s.io/vsphere-csi-driver/v2/pkg/csi/service/common" ++) ++ ++ ++ ++func createBlockVolumeForSnapshotTest(t *testing.T, ct *controllerTest) (string, func()) { ++ params := make(map[string]string) ++ storagePolicyName := "vSAN Default Storage Policy" ++ pc, err := pbm.NewClient(ctx, ct.vcenter.Client.Client) ++ if err != nil { ++ t.Fatal(err) ++ } ++ profileID, err := pc.ProfileIDByName(ctx, storagePolicyName) ++ if err != nil { ++ t.Fatal(err) ++ } ++ params[common.AttributeStoragePolicyID] = profileID ++ ++ capabilities := []*csi.VolumeCapability{ ++ { ++ AccessMode: &csi.VolumeCapability_AccessMode{ ++ Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER, ++ }, ++ }, ++ } ++ reqCreate := &csi.CreateVolumeRequest{ ++ Name: testVolumeName + "-" + uuid.New().String(), ++ CapacityRange: &csi.CapacityRange{ ++ RequiredBytes: 1 * common.GbInBytes, ++ }, ++ Parameters: params, ++ VolumeCapabilities: capabilities, ++ AccessibilityRequirements: &csi.TopologyRequirement{ ++ Requisite: []*csi.Topology{}, ++ Preferred: []*csi.Topology{}, ++ }, ++ } ++ ++ getCandidateDatastores = getFakeDatastores ++ respCreate, err := ct.controller.CreateVolume(ctx, reqCreate) ++ if err != nil { ++ t.Fatal(err) ++ } ++ volID := respCreate.Volume.VolumeId ++ ++ cleanup := func() { ++ _, err := ct.controller.DeleteVolume(ctx, &csi.DeleteVolumeRequest{VolumeId: volID}) ++ if err != nil { ++ t.Logf("failed to cleanup volume %s: %v", volID, err) ++ } ++ } ++ return volID, cleanup ++} ++ ++ ++ ++func TestWCPCreateDeleteSnapshotLifecycle(t *testing.T) { ++ ct := getControllerTest(t) ++ ct.config.Snapshot.GlobalMaxSnapshotsPerBlockVolume = 3 ++ ++ volID, cleanup := createBlockVolumeForSnapshotTest(t, ct) ++ defer cleanup() ++ ++ reqCreateSnapshot := &csi.CreateSnapshotRequest{ ++ SourceVolumeId: volID, ++ Name: "snapshot-" + uuid.New().String(), ++ } ++ respCreateSnapshot, err := ct.controller.CreateSnapshot(ctx, reqCreateSnapshot) ++ if err != nil { ++ t.Fatalf("CreateSnapshot failed: %v", err) ++ } ++ if respCreateSnapshot == nil || respCreateSnapshot.Snapshot == nil { ++ t.Fatalf("CreateSnapshot returned an empty response") ++ } ++ snap := respCreateSnapshot.Snapshot ++ ++ ++ if !strings.HasPrefix(snap.SnapshotId, volID+common.VSphereCSISnapshotIdDelimiter) { ++ t.Fatalf("unexpected SnapshotId %q, expected it to start with %q", ++ snap.SnapshotId, volID+common.VSphereCSISnapshotIdDelimiter) ++ } ++ parsedVolID, parsedSnapID, err := common.ParseCSISnapshotID(snap.SnapshotId) ++ if err != nil { ++ t.Fatalf("returned SnapshotId %q is not parseable: %v", snap.SnapshotId, err) ++ } ++ if parsedVolID != volID { ++ t.Fatalf("SnapshotId encodes volume %q, expected %q", parsedVolID, volID) ++ } ++ if parsedSnapID == "" { ++ t.Fatalf("SnapshotId %q does not contain a CNS snapshot id", snap.SnapshotId) ++ } ++ ++ if snap.SourceVolumeId != volID { ++ t.Fatalf("SourceVolumeId = %q, expected %q", snap.SourceVolumeId, volID) ++ } ++ if snap.SizeBytes != 1*common.GbInBytes { ++ t.Fatalf("snapshot SizeBytes = %d, expected %d", snap.SizeBytes, 1*common.GbInBytes) ++ } ++ if !snap.ReadyToUse { ++ t.Fatalf("snapshot ReadyToUse = false, expected true") ++ } ++ if snap.CreationTime == nil { ++ t.Fatalf("snapshot CreationTime is nil") ++ } ++ ++ ++ snapList, _, err := common.QueryVolumeSnapshotsByVolumeID(ctx, ct.controller.manager.VolumeManager, ++ volID, common.QuerySnapshotLimit) ++ if err != nil { ++ t.Fatalf("failed to query snapshots for volume %s: %v", volID, err) ++ } ++ if len(snapList) != 1 { ++ t.Fatalf("expected 1 snapshot on volume %s, found %d", volID, len(snapList)) ++ } ++ ++ ++ respDeleteSnapshot, err := ct.controller.DeleteSnapshot(ctx, ++ &csi.DeleteSnapshotRequest{SnapshotId: snap.SnapshotId}) ++ if err != nil { ++ t.Fatalf("DeleteSnapshot failed: %v", err) ++ } ++ if respDeleteSnapshot == nil { ++ t.Fatalf("DeleteSnapshot returned a nil response") ++ } ++ ++ ++ snapList, _, err = common.QueryVolumeSnapshotsByVolumeID(ctx, ct.controller.manager.VolumeManager, ++ volID, common.QuerySnapshotLimit) ++ if err != nil { ++ t.Fatalf("failed to query snapshots for volume %s after deletion: %v", volID, err) ++ } ++ if len(snapList) != 0 { ++ t.Fatalf("expected 0 snapshots on volume %s after deletion, found %d", volID, len(snapList)) ++ } ++} ++ ++ ++ ++func TestWCPCreateSnapshotValidation(t *testing.T) { ++ ct := getControllerTest(t) ++ ct.config.Snapshot.GlobalMaxSnapshotsPerBlockVolume = 3 ++ ++ ++ if _, err := ct.controller.CreateSnapshot(ctx, &csi.CreateSnapshotRequest{ ++ Name: "snapshot-" + uuid.New().String(), ++ }); err == nil { ++ t.Fatalf("expected error for CreateSnapshot without a source volume id") ++ } ++ ++ ++ volID, cleanup := createBlockVolumeForSnapshotTest(t, ct) ++ defer cleanup() ++ if _, err := ct.controller.CreateSnapshot(ctx, &csi.CreateSnapshotRequest{ ++ SourceVolumeId: volID, ++ }); err == nil { ++ t.Fatalf("expected error for CreateSnapshot without a snapshot name") ++ } ++} ++ ++ ++ ++func TestWCPCreateSnapshotMigratedVolume(t *testing.T) { ++ ct := getControllerTest(t) ++ ct.config.Snapshot.GlobalMaxSnapshotsPerBlockVolume = 3 ++ ++ _, err := ct.controller.CreateSnapshot(ctx, &csi.CreateSnapshotRequest{ ++ SourceVolumeId: "[datastore] path/volume.vmdk", ++ Name: "snapshot-" + uuid.New().String(), ++ }) ++ if err == nil { ++ t.Fatalf("expected error when snapshotting a migrated vSphere volume") ++ } ++ if status.Code(err) != codes.Unimplemented { ++ t.Fatalf("expected Unimplemented for migrated vSphere volume, got %v", status.Code(err)) ++ } ++} ++ ++ ++ ++func TestWCPCreateSnapshotMaxLimit(t *testing.T) { ++ ct := getControllerTest(t) ++ ct.config.Snapshot.GlobalMaxSnapshotsPerBlockVolume = 1 ++ ++ volID, cleanup := createBlockVolumeForSnapshotTest(t, ct) ++ defer cleanup() ++ ++ ++ respCreateSnapshot, err := ct.controller.CreateSnapshot(ctx, &csi.CreateSnapshotRequest{ ++ SourceVolumeId: volID, ++ Name: "snapshot-" + uuid.New().String(), ++ }) ++ if err != nil { ++ t.Fatalf("first CreateSnapshot failed: %v", err) ++ } ++ firstSnapID := respCreateSnapshot.Snapshot.SnapshotId ++ defer func() { ++ _, _ = ct.controller.DeleteSnapshot(ctx, &csi.DeleteSnapshotRequest{SnapshotId: firstSnapID}) ++ }() ++ ++ ++ _, err = ct.controller.CreateSnapshot(ctx, &csi.CreateSnapshotRequest{ ++ SourceVolumeId: volID, ++ Name: "snapshot-" + uuid.New().String(), ++ }) ++ if err == nil { ++ t.Fatalf("expected error when exceeding the maximum number of snapshots per volume") ++ } ++ if status.Code(err) != codes.FailedPrecondition { ++ t.Fatalf("expected FailedPrecondition when exceeding the snapshot maximum, got %v", status.Code(err)) ++ } ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,20 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++set -euo pipefail ++HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ++cd /testbed ++ ++ ++ ++ ++ ++ ++ ++ ++go test ./pkg/csi/service/wcp/ -run 'TestWCPCreateVolumeWithStoragePolicy|TestWCPCreateVolumeWithZonalLabelPresentButNoStorageTopoType' -count=1 ++ ++ ++go test ./pkg/csi/service/wcp/ -run 'TestWCPCreateDeleteSnapshotLifecycle|TestWCPCreateSnapshotValidation|TestWCPCreateSnapshotMigratedVolume|TestWCPCreateSnapshotMaxLimit' -count=1 diff --git a/tasks/format-code-task-001733/tests/test.sh b/tasks/format-code-task-001733/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..82f2189bd75f82d55896c2f8788ea123ee70a3fb --- /dev/null +++ b/tasks/format-code-task-001733/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +pkg/csi/service/wcp/controller_snapshot_test.go +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001733/tests/test_command.sh b/tasks/format-code-task-001733/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001733/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001734/environment/Dockerfile b/tasks/format-code-task-001734/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..735d1945ca9f3d215c5ac635f8e09f3b8700f2a0 --- /dev/null +++ b/tasks/format-code-task-001734/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:6e0e867b92113170b0114063dd8624e13b720a12e1881f3758e3e096c13c9476 diff --git a/tasks/format-code-task-001734/environment/setup/files/blocklist b/tasks/format-code-task-001734/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001734/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001734/environment/setup/setup.sh b/tasks/format-code-task-001734/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001734/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001734/tests/test.patch b/tasks/format-code-task-001734/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..dc70af3df373cea2fb2b1fecad39df0607acb420 --- /dev/null +++ b/tasks/format-code-task-001734/tests/test.patch @@ -0,0 +1,818 @@ +diff --git a/pkg/csi/service/cns/controller_test.go b/pkg/csi/service/cns/controller_test.go +index 38306a959b..e0f196ae0b 100644 +--- a/pkg/csi/service/cns/controller_test.go ++++ b/pkg/csi/service/cns/controller_test.go +@@ -18,20 +18,16 @@ package cns + + import ( + "context" +- "crypto/tls" + "fmt" +- "log" + "os" + "sync" + "testing" + + "github.com/container-storage-interface/spec/lib/go/csi" +- cnssim "github.com/vmware/govmomi/cns/simulator" + cnstypes "github.com/vmware/govmomi/cns/types" + "github.com/vmware/govmomi/find" + "github.com/vmware/govmomi/object" + "github.com/vmware/govmomi/pbm" +- pbmsim "github.com/vmware/govmomi/pbm/simulator" + "github.com/vmware/govmomi/property" + "github.com/vmware/govmomi/simulator" + "github.com/vmware/govmomi/vim25" +@@ -53,63 +49,6 @@ const ( + testClusterName = "test-cluster" + ) + +-// configFromSim starts a vcsim instance and returns config for use against the vcsim instance. +-// The vcsim instance is configured with an empty tls.Config. +-func configFromSim() (*config.Config, func()) { +- return configFromSimWithTLS(new(tls.Config), true) +-} +- +-// configFromSimWithTLS starts a vcsim instance and returns config for use against the vcsim instance. +-// The vcsim instance is configured with a tls.Config. The returned client +-// config can be configured to allow/decline insecure connections. +-func configFromSimWithTLS(tlsConfig *tls.Config, insecureAllowed bool) (*config.Config, func()) { +- cfg := &config.Config{} +- model := simulator.VPX() +- defer model.Remove() +- +- err := model.Create() +- if err != nil { +- log.Fatal(err) +- } +- +- model.Service.TLS = tlsConfig +- s := model.Service.NewServer() +- +- // CNS Service simulator +- model.Service.RegisterSDK(cnssim.New()) +- +- // PBM Service simulator +- model.Service.RegisterSDK(pbmsim.New()) +- cfg.Global.InsecureFlag = insecureAllowed +- +- cfg.Global.VCenterIP = s.URL.Hostname() +- cfg.Global.VCenterPort = s.URL.Port() +- cfg.Global.User = s.URL.User.Username() +- cfg.Global.Password, _ = s.URL.User.Password() +- cfg.Global.Datacenters = "DC0" +- cfg.VirtualCenter = make(map[string]*config.VirtualCenterConfig) +- cfg.VirtualCenter[s.URL.Hostname()] = &config.VirtualCenterConfig{ +- User: cfg.Global.User, +- Password: cfg.Global.Password, +- VCenterPort: cfg.Global.VCenterPort, +- InsecureFlag: cfg.Global.InsecureFlag, +- Datacenters: cfg.Global.Datacenters, +- } +- +- return cfg, func() { +- s.Close() +- model.Remove() +- } +-} +- +-func configFromEnvOrSim() (*config.Config, func()) { +- cfg := &config.Config{} +- if err := config.FromEnv(cfg); err != nil { +- return configFromSim() +- } +- return cfg, func() {} +-} +- + type FakeNodeManager struct { + client *vim25.Client + sharedDatastoreURL string +@@ -208,7 +147,7 @@ var ( + + func getControllerTest(t *testing.T) *controllerTest { + onceForControllerTest.Do(func() { +- config, _ := configFromEnvOrSim() ++ config, _ := config.FromEnvOrSim() + + // CNS based CSI requires a valid cluster name + config.Global.ClusterID = testClusterName +diff --git a/pkg/syncer/syncer_test.go b/pkg/syncer/syncer_test.go +new file mode 100644 +index 0000000000..e7d77dff9b +--- /dev/null ++++ b/pkg/syncer/syncer_test.go +@@ -0,0 +1,693 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++package syncer ++ ++import ( ++ "context" ++ "fmt" ++ "os" ++ "testing" ++ ++ "github.com/davecgh/go-spew/spew" ++ "github.com/vmware/govmomi/simulator" ++ ++ cnstypes "github.com/vmware/govmomi/cns/types" ++ vimtypes "github.com/vmware/govmomi/vim25/types" ++ v1 "k8s.io/api/core/v1" ++ "k8s.io/apimachinery/pkg/api/resource" ++ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ++ clientset "k8s.io/client-go/kubernetes" ++ testclient "k8s.io/client-go/kubernetes/fake" ++ ++ "sigs.k8s.io/vsphere-csi-driver/pkg/common/cns-lib/volume" ++ cnsvsphere "sigs.k8s.io/vsphere-csi-driver/pkg/common/cns-lib/vsphere" ++ cnsconfig "sigs.k8s.io/vsphere-csi-driver/pkg/common/config" ++ "sigs.k8s.io/vsphere-csi-driver/pkg/csi/service" ++ k8s "sigs.k8s.io/vsphere-csi-driver/pkg/kubernetes" ++) ++ ++const ( ++ testVolumeName = "test-pv" ++ testPVCName = "test-pvc" ++ testPodName = "test-pod" ++ testClusterName = "test-cluster" ++ gbInMb = 1024 ++ testVolumeType = "BLOCK" ++ testPVCLabelName = "test-PVC-label" ++ testPVCLabelValue = "test-PVC-value" ++ testPVLabelName = "test-PV-label" ++ testPVLabelValue = "test-PV-value" ++ testPodLabelName = "test-Pod-label" ++ testPodLabelValue = "test-Pod-value" ++ newTestPVLabelValue = "new-test-PV-value" ++ newTestPVCLabelValue = "new-test-PVC-value" ++ PVC = "PERSISTENT_VOLUME_CLAIM" ++ PV = "PERSISTENT_VOLUME" ++ POD = "POD" ++ testNamespace = "default" ++) ++ ++var ( ++ config *cnsconfig.Config ++ ctx context.Context ++ cnsVCenterConfig *cnsvsphere.VirtualCenterConfig ++ err error ++ virtualCenterManager cnsvsphere.VirtualCenterManager ++ virtualCenter *cnsvsphere.VirtualCenter ++ metadataSyncer *MetadataSyncInformer ++ k8sclient clientset.Interface ++ dc []*cnsvsphere.Datacenter ++ volumeManager volume.Manager ++ dsList []vimtypes.ManagedObjectReference ++) ++ ++func TestSyncerWorkflows(t *testing.T) { ++ t.Log("TestSyncerWorkflows: start") ++ var cleanup func() ++ config, cleanup = cnsconfig.FromEnvOrSim() ++ defer cleanup() ++ ++ ++ config.Global.ClusterID = testClusterName ++ ++ ++ var cancel func() ++ ctx, cancel = context.WithCancel(context.Background()) ++ defer cancel() ++ ++ ++ cnsVCenterConfig, err = cnsvsphere.GetVirtualCenterConfig(config) ++ if err != nil { ++ t.Errorf("Failed to get virtualCenter. err=%v", err) ++ t.Fatal(err) ++ } ++ ++ virtualCenterManager = cnsvsphere.GetVirtualCenterManager() ++ ++ virtualCenter, err = virtualCenterManager.RegisterVirtualCenter(cnsVCenterConfig) ++ if err != nil { ++ t.Fatal(err) ++ } ++ ++ err = virtualCenter.ConnectCNS(ctx) ++ defer virtualCenter.DisconnectCNS(ctx) ++ if err != nil { ++ t.Fatal(err) ++ } ++ ++ volumeManager = volume.GetManager(virtualCenter) ++ ++ ++ metadataSyncer = &MetadataSyncInformer{ ++ cfg: config, ++ vcconfig: cnsVCenterConfig, ++ virtualcentermanager: virtualCenterManager, ++ vcenter: virtualCenter, ++ } ++ ++ ++ ++ ++ k8sclient = testclient.NewSimpleClientset() ++ ++ metadataSyncer.k8sInformerManager = k8s.NewInformer(k8sclient) ++ metadataSyncer.pvLister = metadataSyncer.k8sInformerManager.GetPVLister() ++ metadataSyncer.pvcLister = metadataSyncer.k8sInformerManager.GetPVCLister() ++ metadataSyncer.k8sInformerManager.Listen() ++ ++ ++ cnsCreationMap = make(map[string]bool) ++ cnsDeletionMap = make(map[string]bool) ++ ++ runMetadataSyncerTest(t) ++ runFullSyncTest(t) ++ t.Log("TestSyncerWorkflows: end") ++} ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++func runMetadataSyncerTest(t *testing.T) { ++ t.Log("Begin MetadataSyncer Test") ++ ++ ++ createSpec, err := getCnsCreateSpec(t) ++ if err != nil { ++ t.Fatal(err) ++ } ++ volumeID, err := volumeManager.CreateVolume(&createSpec) ++ if err != nil { ++ t.Fatal(err) ++ } ++ ++ ++ queryFilter := cnstypes.CnsQueryFilter{ ++ VolumeIds: []cnstypes.CnsVolumeId{ ++ { ++ Id: volumeID.Id, ++ }, ++ }, ++ } ++ ++ ++ queryResult, err := metadataSyncer.vcenter.CnsClient.QueryVolume(ctx, queryFilter) ++ if err != nil { ++ t.Fatal(err) ++ } ++ if len(queryResult.Volumes) == 0 || queryResult.Volumes[0].VolumeId.Id != volumeID.Id { ++ t.Fatalf("Failed to find the newly created volume with ID: %s", volumeID) ++ } ++ ++ ++ newLabel := make(map[string]string) ++ newLabel[testPVLabelName] = testPVLabelValue ++ ++ ++ oldPv := getPersistentVolumeSpec(volumeID.Id, v1.PersistentVolumeReclaimRetain, nil, v1.VolumeAvailable, "") ++ newPv := getPersistentVolumeSpec(volumeID.Id, v1.PersistentVolumeReclaimRetain, newLabel, v1.VolumeAvailable, "") ++ ++ pvUpdated(oldPv, newPv, metadataSyncer) ++ ++ ++ if queryResult, err = metadataSyncer.vcenter.CnsClient.QueryVolume(ctx, queryFilter); err != nil { ++ t.Fatal(err) ++ } ++ if err = verifyUpdateOperation(queryResult, volumeID.Id, PV, newPv.Name, testPVLabelValue); err != nil { ++ t.Fatal(err) ++ } ++ ++ ++ err = volumeManager.DeleteVolume(volumeID.Id, false) ++ if err != nil { ++ t.Fatal(err) ++ } ++ ++ ++ pv := getPersistentVolumeSpec(volumeID.Id, v1.PersistentVolumeReclaimRetain, nil, v1.VolumeAvailable, "") ++ if pv, err = k8sclient.CoreV1().PersistentVolumes().Create(pv); err != nil { ++ t.Fatal(err) ++ } ++ ++ ++ ++ oldPv = getPersistentVolumeSpec(volumeID.Id, v1.PersistentVolumeReclaimRetain, nil, v1.VolumePending, "") ++ newPv = getPersistentVolumeSpec(volumeID.Id, v1.PersistentVolumeReclaimRetain, newLabel, v1.VolumeAvailable, "") ++ ++ pvUpdated(oldPv, newPv, metadataSyncer) ++ ++ ++ if queryResult, err = metadataSyncer.vcenter.CnsClient.QueryVolume(ctx, queryFilter); err != nil { ++ t.Fatal(err) ++ } ++ if err = verifyUpdateOperation(queryResult, volumeID.Id, PV, newPv.Name, testPVLabelValue); err != nil { ++ t.Fatal(err) ++ } ++ ++ ++ namespace := testNamespace ++ newPVCLabel := make(map[string]string) ++ newPVCLabel[testPVCLabelName] = testPVCLabelValue ++ pvc := getPersistentVolumeClaimSpec(namespace, nil, pv.Name) ++ if pvc, err = k8sclient.CoreV1().PersistentVolumeClaims(namespace).Create(pvc); err != nil { ++ t.Fatal(err) ++ } ++ ++ ++ oldPvc := getPersistentVolumeClaimSpec(testNamespace, nil, pv.Name) ++ newPvc := getPersistentVolumeClaimSpec(testNamespace, newPVCLabel, pv.Name) ++ pvcUpdated(oldPvc, newPvc, metadataSyncer) ++ ++ ++ if queryResult, err = metadataSyncer.vcenter.CnsClient.QueryVolume(ctx, queryFilter); err != nil { ++ t.Fatal(err) ++ } ++ if err = verifyUpdateOperation(queryResult, volumeID.Id, PVC, newPvc.Name, testPVCLabelValue); err != nil { ++ t.Fatal(err) ++ } ++ ++ ++ pod := getPodSpec(pvc.Name, v1.PodRunning) ++ if pod, err = k8sclient.CoreV1().Pods(namespace).Create(pod); err != nil { ++ t.Fatal(err) ++ } ++ ++ ++ oldPod := getPodSpec(pvc.Name, v1.PodPending) ++ newPod := getPodSpec(pvc.Name, v1.PodRunning) ++ podUpdated(oldPod, newPod, metadataSyncer) ++ ++ ++ if queryResult, err = metadataSyncer.vcenter.CnsClient.QueryVolume(ctx, queryFilter); err != nil { ++ t.Fatal(err) ++ } ++ if err = verifyUpdateOperation(queryResult, volumeID.Id, POD, newPod.Name, ""); err != nil { ++ t.Fatal(err) ++ } ++ ++ ++ podDeleted(newPod, metadataSyncer) ++ if queryResult, err = metadataSyncer.vcenter.CnsClient.QueryVolume(ctx, queryFilter); err != nil { ++ t.Fatal(err) ++ } ++ if err = verifyDeleteOperation(queryResult, volumeID.Id, POD); err != nil { ++ t.Fatal(err) ++ } ++ ++ ++ pvcDeleted(newPvc, metadataSyncer) ++ if queryResult, err = metadataSyncer.vcenter.CnsClient.QueryVolume(ctx, queryFilter); err != nil { ++ t.Fatal(err) ++ } ++ if err = verifyDeleteOperation(queryResult, volumeID.Id, PVC); err != nil { ++ t.Fatal(err) ++ } ++ ++ ++ pvDeleted(newPv, metadataSyncer) ++ if queryResult, err = metadataSyncer.vcenter.CnsClient.QueryVolume(ctx, queryFilter); err != nil { ++ t.Fatal(err) ++ } ++ if err = verifyDeleteOperation(queryResult, volumeID.Id, PV); err != nil { ++ t.Fatal(err) ++ } ++ ++ ++ if err = k8sclient.CoreV1().Pods(namespace).Delete(pod.Name, nil); err != nil { ++ t.Fatal(err) ++ } ++ if err = k8sclient.CoreV1().PersistentVolumeClaims(namespace).Delete(pvc.Name, nil); err != nil { ++ t.Fatal(err) ++ } ++ if err = k8sclient.CoreV1().PersistentVolumes().Delete(pv.Name, nil); err != nil { ++ t.Fatal(err) ++ } ++ ++ t.Log("End MetadataSyncer Test") ++ ++} ++ ++ ++ ++ ++ ++ ++ ++ ++ ++func runFullSyncTest(t *testing.T) { ++ t.Log("Begin FullSync test") ++ ++ ++ createSpec, err := getCnsCreateSpec(t) ++ if err != nil { ++ t.Fatal(err) ++ } ++ volumeID, err := volumeManager.CreateVolume(&createSpec) ++ if err != nil { ++ t.Errorf("Failed to create volume. Error: %+v", err) ++ t.Fatal(err) ++ return ++ } ++ ++ ++ queryFilter := cnstypes.CnsQueryFilter{ ++ VolumeIds: []cnstypes.CnsVolumeId{ ++ { ++ Id: volumeID.Id, ++ }, ++ }, ++ } ++ ++ ++ queryResult, err := metadataSyncer.vcenter.CnsClient.QueryVolume(ctx, queryFilter) ++ if err != nil { ++ t.Fatal(err) ++ } ++ if len(queryResult.Volumes) != 1 && queryResult.Volumes[0].VolumeId.Id != volumeID.Id { ++ t.Fatalf("Failed to find the newly created volume with ID: %s", volumeID) ++ } ++ ++ ++ ++ triggerFullSync(k8sclient, metadataSyncer) ++ triggerFullSync(k8sclient, metadataSyncer) ++ ++ ++ queryResult, err = metadataSyncer.vcenter.CnsClient.QueryVolume(ctx, queryFilter) ++ if err != nil { ++ t.Fatal(err) ++ } ++ if len(queryResult.Volumes) != 0 { ++ t.Fatalf("Full sync failed to remove volume") ++ } ++ ++ ++ ++ ++ ++ pvLabel := make(map[string]string) ++ pvLabel[testPVLabelName] = testPVLabelValue ++ pv := getPersistentVolumeSpec(volumeID.Id, v1.PersistentVolumeReclaimRetain, pvLabel, v1.VolumeAvailable, "") ++ if pv, err = k8sclient.CoreV1().PersistentVolumes().Create(pv); err != nil { ++ t.Fatal(err) ++ } ++ ++ ++ pvcLabel := make(map[string]string) ++ pvcLabel[testPVCLabelName] = testPVCLabelValue ++ pvc := getPersistentVolumeClaimSpec(testNamespace, pvcLabel, pv.Name) ++ if pvc, err = k8sclient.CoreV1().PersistentVolumeClaims(testNamespace).Create(pvc); err != nil { ++ t.Fatal(err) ++ } ++ ++ ++ pv = getPersistentVolumeSpec(volumeID.Id, v1.PersistentVolumeReclaimRetain, pvLabel, v1.VolumeBound, pvc.Name) ++ if pv, err = k8sclient.CoreV1().PersistentVolumes().Update(pv); err != nil { ++ t.Fatal(err) ++ } ++ ++ triggerFullSync(k8sclient, metadataSyncer) ++ triggerFullSync(k8sclient, metadataSyncer) ++ ++ ++ ++ ++ ++ newPVLabel := make(map[string]string) ++ newPVLabel[testPVLabelName] = newTestPVLabelValue ++ pv.Labels = newPVLabel ++ if pv, err = k8sclient.CoreV1().PersistentVolumes().Update(pv); err != nil { ++ t.Fatal(err) ++ } ++ ++ triggerFullSync(k8sclient, metadataSyncer) ++ ++ ++ if queryResult, err = metadataSyncer.vcenter.CnsClient.QueryVolume(ctx, queryFilter); err != nil { ++ t.Fatal(err) ++ } ++ if err = verifyUpdateOperation(queryResult, volumeID.Id, PV, pv.Name, newTestPVLabelValue); err != nil { ++ t.Fatal(err) ++ } ++ ++ ++ newPVCLabel := make(map[string]string) ++ newPVCLabel[testPVCLabelName] = newTestPVCLabelValue ++ pvc.Labels = newPVCLabel ++ if pvc, err = k8sclient.CoreV1().PersistentVolumeClaims(testNamespace).Update(pvc); err != nil { ++ t.Fatal(err) ++ } ++ ++ triggerFullSync(k8sclient, metadataSyncer) ++ ++ ++ if queryResult, err = metadataSyncer.vcenter.CnsClient.QueryVolume(ctx, queryFilter); err != nil { ++ t.Fatal(err) ++ } ++ if err = verifyUpdateOperation(queryResult, volumeID.Id, PVC, pvc.Name, newTestPVCLabelValue); err != nil { ++ t.Fatal(err) ++ } ++ ++ ++ ++ ++ ++ pod := getPodSpec(pvc.Name, v1.PodRunning) ++ if pod, err = k8sclient.CoreV1().Pods(testNamespace).Create(pod); err != nil { ++ t.Fatal(err) ++ } ++ ++ triggerFullSync(k8sclient, metadataSyncer) ++ ++ ++ if queryResult, err = metadataSyncer.vcenter.CnsClient.QueryVolume(ctx, queryFilter); err != nil { ++ t.Fatal(err) ++ } ++ if err = verifyUpdateOperation(queryResult, volumeID.Id, POD, pod.Name, ""); err != nil { ++ t.Fatal(err) ++ } ++ ++ ++ if err = k8sclient.CoreV1().PersistentVolumes().Delete(pv.Name, nil); err != nil { ++ t.Fatal(err) ++ } ++ if err = k8sclient.CoreV1().PersistentVolumeClaims(testNamespace).Delete(pvc.Name, nil); err != nil { ++ t.Fatal(err) ++ } ++ if err = k8sclient.CoreV1().Pods(testNamespace).Delete(pod.Name, nil); err != nil { ++ t.Fatal(err) ++ } ++ ++ ++ if err = volumeManager.DeleteVolume(volumeID.Id, true); err != nil { ++ t.Logf("Failed to delete volume %v from CNS", volumeID.Id) ++ } ++ t.Log("End FullSync test") ++} ++ ++ ++ ++func verifyDeleteOperation(queryResult *cnstypes.CnsQueryResult, volumeID string, resourceType string) error { ++ if len(queryResult.Volumes) == 0 && resourceType == PV { ++ return nil ++ } ++ entityMetadata := queryResult.Volumes[0].Metadata.EntityMetadata ++ for _, metadata := range entityMetadata { ++ if len(metadata.GetCnsEntityMetadata().Labels) == 0 { ++ continue ++ } ++ queryLabel := metadata.GetCnsEntityMetadata().Labels[0].Key ++ queryValue := metadata.GetCnsEntityMetadata().Labels[0].Value ++ if resourceType == PV && queryLabel == testPVLabelName && queryValue == testPVLabelValue { ++ return fmt.Errorf("delete operation failed for volume Id %s and resource type %s ", volumeID, resourceType) ++ } ++ if resourceType == PVC && queryLabel == testPVCLabelName && queryValue == testPVCLabelValue { ++ return fmt.Errorf("delete operation failed for volume Id %s and resource type %s ", volumeID, resourceType) ++ } ++ if resourceType == POD && queryLabel == testPodLabelName && queryValue == testPodLabelValue { ++ return fmt.Errorf("delete operation failed for volume Id %s and resource type %s ", volumeID, resourceType) ++ } ++ } ++ return nil ++} ++ ++ ++ ++func verifyUpdateOperation(queryResult *cnstypes.CnsQueryResult, volumeID string, resourceType string, resourceName string, resourceNewLabel string) error { ++ if len(queryResult.Volumes) == 0 || len(queryResult.Volumes[0].Metadata.EntityMetadata) == 0 { ++ return fmt.Errorf("update operation failed for volume Id %s for resource type %s with queryResult: %v", volumeID, resourceType, spew.Sdump(queryResult)) ++ } ++ entityMetadata := queryResult.Volumes[0].Metadata.EntityMetadata ++ for _, baseMetadata := range entityMetadata { ++ metadata := interface{}(baseMetadata).(*cnstypes.CnsKubernetesEntityMetadata) ++ if resourceType == POD && metadata.EntityType == POD && metadata.EntityName == resourceName && len(metadata.Labels) == 0 { ++ return nil ++ } ++ if len(metadata.Labels) == 0 { ++ return fmt.Errorf("update operation failed for volume Id %s and resource type %s queryResult: %v", volumeID, metadata.EntityType, spew.Sdump(queryResult)) ++ } ++ queryLabel := metadata.Labels[0].Key ++ queryValue := metadata.Labels[0].Value ++ if resourceType == PVC && metadata.EntityType == PVC && metadata.EntityName == resourceName && queryLabel == testPVCLabelName && queryValue == resourceNewLabel { ++ return nil ++ } ++ if resourceType == PV && metadata.EntityType == PV && metadata.EntityName == resourceName && queryLabel == testPVLabelName && queryValue == resourceNewLabel { ++ return nil ++ } ++ } ++ return fmt.Errorf("update operation failed for volume Id: %s for resource type %s with queryResult: %v", volumeID, resourceType, spew.Sdump(queryResult)) ++} ++ ++ ++func getCnsCreateSpec(t *testing.T) (cnstypes.CnsVolumeCreateSpec, error) { ++ var sharedDatastore string ++ if v := os.Getenv("VSPHERE_DATASTORE_URL"); v != "" { ++ sharedDatastore = v ++ } else { ++ sharedDatastore = simulator.Map.Any("Datastore").(*simulator.Datastore).Info.GetDatastoreInfo().Url ++ } ++ dc, err = virtualCenter.GetDatacenters(ctx) ++ if err != nil || len(dc) == 0 { ++ t.Errorf("Failed to get datacenter for the path: %s. Error: %v", cnsVCenterConfig.DatacenterPaths[0], err) ++ return cnstypes.CnsVolumeCreateSpec{}, err ++ } ++ ++ datastoreObj, err := dc[0].GetDatastoreByURL(ctx, sharedDatastore) ++ if err != nil { ++ t.Errorf("Failed to get datastore with URL: %s. Error: %v", sharedDatastore, err) ++ return cnstypes.CnsVolumeCreateSpec{}, err ++ } ++ dsList = append(dsList, datastoreObj.Reference()) ++ return cnstypes.CnsVolumeCreateSpec{ ++ DynamicData: vimtypes.DynamicData{}, ++ Name: testVolumeName, ++ VolumeType: testVolumeType, ++ Datastores: dsList, ++ Metadata: cnstypes.CnsVolumeMetadata{ ++ DynamicData: vimtypes.DynamicData{}, ++ ContainerCluster: cnstypes.CnsContainerCluster{ ++ ClusterType: string(cnstypes.CnsClusterTypeKubernetes), ++ ClusterId: config.Global.ClusterID, ++ VSphereUser: config.VirtualCenter[cnsVCenterConfig.Host].User, ++ }, ++ }, ++ BackingObjectDetails: &cnstypes.CnsBackingObjectDetails{ ++ CapacityInMb: gbInMb, ++ }, ++ }, nil ++} ++ ++ ++func getPersistentVolumeSpec(volumeHandle string, persistentVolumeReclaimPolicy v1.PersistentVolumeReclaimPolicy, labels map[string]string, phase v1.PersistentVolumePhase, claimRefName string) *v1.PersistentVolume { ++ var pv *v1.PersistentVolume ++ var claimRef *v1.ObjectReference ++ if claimRefName != "" { ++ claimRef = &v1.ObjectReference{ ++ Name: claimRefName, ++ } ++ } ++ pv = &v1.PersistentVolume{ ++ ObjectMeta: metav1.ObjectMeta{ ++ Name: testVolumeName, ++ }, ++ Spec: v1.PersistentVolumeSpec{ ++ Capacity: v1.ResourceList{ ++ v1.ResourceName(v1.ResourceStorage): resource.MustParse("2Gi"), ++ }, ++ PersistentVolumeSource: v1.PersistentVolumeSource{ ++ CSI: &v1.CSIPersistentVolumeSource{ ++ Driver: service.Name, ++ VolumeHandle: volumeHandle, ++ }, ++ }, ++ AccessModes: []v1.PersistentVolumeAccessMode{ ++ v1.ReadWriteOnce, ++ }, ++ ClaimRef: claimRef, ++ PersistentVolumeReclaimPolicy: persistentVolumeReclaimPolicy, ++ }, ++ Status: v1.PersistentVolumeStatus{}, ++ } ++ if labels != nil { ++ pv.Labels = labels ++ } ++ if &phase != nil { ++ pv.Status.Phase = phase ++ } ++ return pv ++} ++ ++ ++func getPersistentVolumeClaimSpec(namespace string, labels map[string]string, pvName string) *v1.PersistentVolumeClaim { ++ var ( ++ pvc *v1.PersistentVolumeClaim ++ ) ++ sc := "" ++ pvc = &v1.PersistentVolumeClaim{ ++ ObjectMeta: metav1.ObjectMeta{ ++ Name: testPVCName, ++ Namespace: namespace, ++ }, ++ Spec: v1.PersistentVolumeClaimSpec{ ++ AccessModes: []v1.PersistentVolumeAccessMode{ ++ v1.ReadWriteOnce, ++ }, ++ Resources: v1.ResourceRequirements{ ++ Requests: v1.ResourceList{ ++ v1.ResourceName(v1.ResourceStorage): resource.MustParse("2Gi"), ++ }, ++ }, ++ VolumeName: pvName, ++ StorageClassName: &sc, ++ }, ++ Status: v1.PersistentVolumeClaimStatus{ ++ Phase: "Bound", ++ }, ++ } ++ if labels != nil { ++ pvc.Labels = labels ++ pvc.Spec.Selector = &metav1.LabelSelector{MatchLabels: labels} ++ } ++ ++ return pvc ++} ++ ++ ++func getPodSpec(pvcName string, phase v1.PodPhase) *v1.Pod { ++ var pod *v1.Pod ++ podVolume := []v1.Volume{ ++ { ++ Name: testVolumeName, ++ VolumeSource: v1.VolumeSource{ ++ PersistentVolumeClaim: &v1.PersistentVolumeClaimVolumeSource{ ++ ClaimName: pvcName, ++ }, ++ }, ++ }, ++ } ++ ++ podContainer := []v1.Container{ ++ { ++ Name: "my-frontend", ++ Image: "busybox", ++ Command: []string{ ++ "sleep", ++ "1000000", ++ }, ++ VolumeMounts: []v1.VolumeMount{ ++ { ++ Name: testVolumeName, ++ ReadOnly: false, ++ MountPath: "/data", ++ }, ++ }, ++ }, ++ } ++ pod = &v1.Pod{ ++ ObjectMeta: metav1.ObjectMeta{ ++ Name: testPodName, ++ Namespace: testNamespace, ++ }, ++ Spec: v1.PodSpec{ ++ Volumes: podVolume, ++ Containers: podContainer, ++ }, ++ Status: v1.PodStatus{ ++ Phase: phase, ++ }, ++ } ++ return pod ++} +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,5 @@ ++H4sIAAAAAAAAA+3R0WrDIBQGYK/7FOcFEj3JTK/6LCU1kslWHXoS6NsvC6Ubg603LWPb/4Gcgwoe +++evDFJ6HvY+zVvdiFltr17r4XNeebWMattuWO2WYO9Mqsneb6IOpSJ+JVE5Jvrt37fyXqt/zF19k ++79Lx2MehLo+3e+Na/tw2l/yXteT/0DErMrcb4Wv/PH830Br8wQ+bMdFbS9VMlUtTlB1TJf1YdiGK ++H3MvIcVqikGo1i9Po3Yl6OLzHJzXLpbzbjlF5/Pmp38GAAAAAAAAAAAAAAAAAAAAAPD3vQLCFG9v ++ACgAAA== +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-001734/tests/test.sh b/tasks/format-code-task-001734/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..a8004ac868590ea3e5cfe5f94c9e26bbc394ea62 --- /dev/null +++ b/tasks/format-code-task-001734/tests/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +pkg/csi/service/cns/controller_test.go +pkg/syncer/syncer_test.go +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001734/tests/test_command.sh b/tasks/format-code-task-001734/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001734/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001813/environment/Dockerfile b/tasks/format-code-task-001813/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..1d2612516c4b324a452e5dee7108c9e8af9cdf44 --- /dev/null +++ b/tasks/format-code-task-001813/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:4baf7b08aa79e6d8eb975f67ecfc633372b8a4f33088a350b63e3a3045c34965 diff --git a/tasks/format-code-task-001813/environment/setup/files/blocklist b/tasks/format-code-task-001813/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001813/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001813/environment/setup/setup.sh b/tasks/format-code-task-001813/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-001813/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001813/tests/test.patch b/tasks/format-code-task-001813/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..97bae0421e7fc05a9b7877c2a130f13e127a1407 --- /dev/null +++ b/tasks/format-code-task-001813/tests/test.patch @@ -0,0 +1,186 @@ +diff --git a/usercase-test-coderl/test_readable_percentiles.py b/usercase-test-coderl/test_readable_percentiles.py +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/test_readable_percentiles.py +@@ -0,0 +1,158 @@ ++ ++ ++ ++ ++ ++ ++from __future__ import annotations ++ ++import copy ++import json ++import os ++import socket ++import subprocess ++import sys ++ ++import pytest ++ ++os.environ.setdefault("LOCUST_SKIP_MONKEY_PATCH", "1") ++ ++from locust.stats import get_readable_percentiles ++ ++ ++def test_empty_percentile_list_returns_empty_list(): ++ ++ ++ ++ ++ percentiles: list[float] = [] ++ ++ actual = get_readable_percentiles(percentiles) ++ ++ assert actual == [] ++ ++ ++def test_common_report_percentiles_use_whole_number_labels(): ++ ++ ++ ++ ++ percentiles = [0.5, 0.66, 0.75, 0.8, 0.95, 1.0] ++ ++ actual = get_readable_percentiles(percentiles) ++ ++ assert actual == ["50%", "66%", "75%", "80%", "95%", "100%"] ++ ++ ++def test_high_precision_percentiles_keep_non_integer_precision(): ++ ++ ++ ++ ++ percentiles = [0.999, 0.9999, 0.666666] ++ ++ actual = get_readable_percentiles(percentiles) ++ ++ assert actual == ["99.9%", "99.99%", "66.6666%"] ++ ++ ++def test_fractional_percentage_is_rounded_to_six_decimal_places(): ++ ++ ++ ++ ++ percentiles = [0.123456789] ++ ++ actual = get_readable_percentiles(percentiles) ++ ++ assert actual == ["12.345679%"] ++ ++ ++def test_lower_bound_fraction_uses_integer_label(): ++ ++ ++ ++ ++ percentiles = [0.0] ++ ++ actual = get_readable_percentiles(percentiles) ++ ++ assert actual == ["0%"] ++ ++ ++def test_non_numeric_item_raises_type_error(): ++ ++ ++ ++ ++ with pytest.raises(TypeError): ++ get_readable_percentiles([None]) ++ ++ ++def test_referential_transparency_for_repeated_calls(): ++ percentiles = [0.5, 0.123456789, 1.0] ++ ++ first = get_readable_percentiles(percentiles) ++ second = get_readable_percentiles(percentiles) ++ ++ assert first == ["50%", "12.345679%", "100%"] ++ assert second == ["50%", "12.345679%", "100%"] ++ assert first == second ++ ++ ++def test_returns_new_list_and_does_not_mutate_input(): ++ percentiles = [0.5, 0.9999, 0.123456789] ++ original = copy.deepcopy(percentiles) ++ ++ actual = get_readable_percentiles(percentiles) ++ ++ assert actual == ["50%", "99.99%", "12.345679%"] ++ assert percentiles == original ++ assert actual is not percentiles ++ ++ ++def test_same_input_matches_fresh_process_result(): ++ percentiles = [0.999, 0.9999, 0.666666] ++ ++ in_process = get_readable_percentiles(percentiles) ++ script = """ ++import json ++import os ++import sys ++os.environ.setdefault("LOCUST_SKIP_MONKEY_PATCH", "1") ++sys.path.insert(0, "/workspace/repo") ++from locust.stats import get_readable_percentiles ++sys.stdout.write(json.dumps(get_readable_percentiles([0.999, 0.9999, 0.666666]))) ++""" ++ completed = subprocess.run( ++ [sys.executable, "-c", script], ++ check=True, ++ capture_output=True, ++ text=True, ++ env={**os.environ, "LOCUST_SKIP_MONKEY_PATCH": "1"}, ++ ) ++ fresh_process = json.loads(completed.stdout) ++ ++ assert in_process == ["99.9%", "99.99%", "66.6666%"] ++ assert fresh_process == ["99.9%", "99.99%", "66.6666%"] ++ assert in_process == fresh_process ++ ++ ++def test_no_filesystem_or_network_side_effects(tmp_path, monkeypatch): ++ def blocked_open(*args, **kwargs): ++ raise AssertionError("filesystem access is not declared for this helper") ++ ++ def blocked_socket(*args, **kwargs): ++ raise AssertionError("network access is not declared for this helper") ++ ++ monkeypatch.chdir(tmp_path) ++ monkeypatch.setattr("builtins.open", blocked_open) ++ monkeypatch.setattr(socket, "socket", blocked_socket) ++ before = sorted(path.relative_to(tmp_path).as_posix() for path in tmp_path.rglob("*")) ++ ++ actual = get_readable_percentiles([0.66, 0.123456789]) ++ ++ after = sorted(path.relative_to(tmp_path).as_posix() for path in tmp_path.rglob("*")) ++ assert actual == ["66%", "12.345679%"] ++ assert before == [] ++ assert after == [] +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,18 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++set -euo pipefail ++ ++cd /workspace/repo ++export LOCUST_SKIP_MONKEY_PATCH=1 ++export PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 ++export PYTHONNOUSERSITE=1 ++exec /workspace/repo/.venv/bin/python -m pytest /workspace/repo/usercase-test-coderl/test_readable_percentiles.py -v diff --git a/tasks/format-code-task-001813/tests/test.sh b/tasks/format-code-task-001813/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..30b8d109a3b10104ccf7700b945038ca752dc9df --- /dev/null +++ b/tasks/format-code-task-001813/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/test_readable_percentiles.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001813/tests/test_command.sh b/tasks/format-code-task-001813/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-001813/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001825/environment/Dockerfile b/tasks/format-code-task-001825/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..841670ac2717686212080f3e5ccbe6fff12d67c0 --- /dev/null +++ b/tasks/format-code-task-001825/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:3a44da841b9dc87e01af39d1e7c2e9341f01d89e60745fba403c40d7057e5a22 diff --git a/tasks/format-code-task-001825/environment/setup/files/blocklist b/tasks/format-code-task-001825/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001825/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001825/environment/setup/setup.sh b/tasks/format-code-task-001825/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001825/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001825/tests/test.patch b/tasks/format-code-task-001825/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..2e03939f86ea59c3db7cb5b33db225bade530d1f --- /dev/null +++ b/tasks/format-code-task-001825/tests/test.patch @@ -0,0 +1,150 @@ +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 00000000..cbc3a766 +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["python -m pytest tests/integration_tests/test_mlflow.py -v -k \"external_run or no_external_run\""] ++} +diff --git a/tests/integration_tests/test_mlflow.py b/tests/integration_tests/test_mlflow.py +index 9a5d3c81..0287bd14 100644 +--- a/tests/integration_tests/test_mlflow.py ++++ b/tests/integration_tests/test_mlflow.py +@@ -144,3 +144,123 @@ def test_export_mlflow_local(tmpdir): + output_path = os.path.join(tmpdir, "data/results/mlflow") + export_mlflow(model_path, output_path) + assert set(os.listdir(output_path)) == {"MLmodel", "model", "conda.yaml"} ++ ++ ++def _ensure_no_active_run(): ++ while mlflow.active_run() is not None: ++ mlflow.end_run() ++ ++ ++def test_external_run_preserved_after_train_end(tmpdir): ++ """User starts mlflow run before calling Ludwig; the run must survive on_train_end.""" ++ mlflow_uri = f"file://{tmpdir}/mlruns" ++ mlflow.set_tracking_uri(mlflow_uri) ++ _ensure_no_active_run() ++ ++ external_exp_id = mlflow.create_experiment("external_titanic") ++ external_run = mlflow.start_run(experiment_id=external_exp_id, run_name="external_run_name") ++ external_run_id = external_run.info.run_id ++ ++ try: ++ callback = MlflowCallback(log_artifacts=False) ++ callback.on_train_init( ++ base_config={}, ++ experiment_name="ignored_name", ++ output_directory=str(tmpdir), ++ resume_directory=None, ++ ) ++ callback.on_train_end(str(tmpdir)) ++ ++ active = mlflow.active_run() ++ assert active is not None, "External MLflow run was ended by callback" ++ assert active.info.run_id == external_run_id, ( ++ "External MLflow run id changed after train: expected " ++ f"{external_run_id}, got {active.info.run_id}" ++ ) ++ finally: ++ _ensure_no_active_run() ++ ++ ++def test_external_run_adopted_by_callback(tmpdir): ++ """Callback should adopt the externally-started run rather than start a new one.""" ++ mlflow_uri = f"file://{tmpdir}/mlruns" ++ mlflow.set_tracking_uri(mlflow_uri) ++ _ensure_no_active_run() ++ ++ mlflow.set_experiment("titanic") ++ external_run = mlflow.start_run(run_name="my_test_run") ++ external_run_id = external_run.info.run_id ++ ++ try: ++ callback = MlflowCallback(log_artifacts=False) ++ callback.on_train_init( ++ base_config={}, ++ experiment_name="titanic", ++ output_directory=str(tmpdir), ++ resume_directory=None, ++ ) ++ ++ assert callback.run is not None ++ assert callback.run.info.run_id == external_run_id, ( ++ "Callback should adopt external run rather than start a new one" ++ ) ++ finally: ++ _ensure_no_active_run() ++ ++ ++def test_no_external_run_callback_creates_and_ends_run(tmpdir): ++ """When no external run exists, callback creates its own and ends it at on_train_end.""" ++ mlflow_uri = f"file://{tmpdir}/mlruns" ++ mlflow.set_tracking_uri(mlflow_uri) ++ _ensure_no_active_run() ++ ++ callback = MlflowCallback(log_artifacts=False) ++ callback.on_train_init( ++ base_config={}, ++ experiment_name="my_fresh_exp", ++ output_directory=str(tmpdir), ++ resume_directory=None, ++ ) ++ ++ assert callback.run is not None, "Callback should have started its own run" ++ assert callback.experiment_id is not None ++ own_run_id = callback.run.info.run_id ++ ++ callback.on_train_end(str(tmpdir)) ++ ++ assert mlflow.active_run() is None, ( ++ "Callback should have ended its own run since no external run was present" ++ ) ++ ++ ++ finished_run = mlflow.get_run(own_run_id) ++ assert finished_run.info.status == "FINISHED" ++ ++ ++def test_external_run_status_remains_active(tmpdir): ++ """After train end, the external run's status must NOT be FINISHED.""" ++ mlflow_uri = f"file://{tmpdir}/mlruns" ++ mlflow.set_tracking_uri(mlflow_uri) ++ _ensure_no_active_run() ++ ++ external_exp_id = mlflow.create_experiment("status_check_exp") ++ external_run = mlflow.start_run(experiment_id=external_exp_id, run_name="status_check_run") ++ external_run_id = external_run.info.run_id ++ ++ try: ++ callback = MlflowCallback(log_artifacts=False) ++ callback.on_train_init( ++ base_config={}, ++ experiment_name="something", ++ output_directory=str(tmpdir), ++ resume_directory=None, ++ ) ++ callback.on_train_end(str(tmpdir)) ++ ++ ++ run = mlflow.get_run(external_run_id) ++ assert run.info.status == "RUNNING", ( ++ f"External run should still be RUNNING; got status={run.info.status}" ++ ) ++ finally: ++ _ensure_no_active_run() +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++python -m pytest tests/integration_tests/test_mlflow.py -v -k "external_run or no_external_run" ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-001825/tests/test.sh b/tasks/format-code-task-001825/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..ca449f1cbd252d8ddacd88e254b989ee46f647a4 --- /dev/null +++ b/tasks/format-code-task-001825/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test_commands.json +tests/integration_tests/test_mlflow.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001825/tests/test_command.sh b/tasks/format-code-task-001825/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001825/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001849/environment/Dockerfile b/tasks/format-code-task-001849/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..7476f9e2bf1e54438ac16e1ca943117298ef3db6 --- /dev/null +++ b/tasks/format-code-task-001849/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:76b1d2497c1d6163d275aa114ae77947ab14c91ebead2a67c56b4c020399b465 diff --git a/tasks/format-code-task-001849/environment/setup/files/blocklist b/tasks/format-code-task-001849/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001849/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001849/environment/setup/setup.sh b/tasks/format-code-task-001849/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-001849/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001849/tests/test.patch b/tasks/format-code-task-001849/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..9fe9e3524d5c7a03d6890a64be96f1b9275e6f92 --- /dev/null +++ b/tasks/format-code-task-001849/tests/test.patch @@ -0,0 +1,482 @@ +diff --git a/usercase-test-coderl/fixtures/compile-file-inline-script.fun b/usercase-test-coderl/fixtures/compile-file-inline-script.fun +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/fixtures/compile-file-inline-script.fun +@@ -0,0 +1,3 @@ ++bar = 10 ++ ++
bar
+diff --git a/usercase-test-coderl/inline_script.test.js b/usercase-test-coderl/inline_script.test.js +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/inline_script.test.js +@@ -0,0 +1,298 @@ ++ ++ ++ ++const assert = require('assert'); ++const path = require('path'); ++const vm = require('vm'); ++ ++const compiler = require('/workspace/repo/src/compiler'); ++ ++const FIXTURES = '/workspace/repo/usercase-test-coderl/fixtures'; ++const OPTIONS = { minify: false, 'normalize.css': false }; ++ ++const SOURCES = { ++ topLevel: ++ 'foo = 1\n' + ++ '\n' + ++ '
foo
', ++ xmlHook: ++ '
', ++ functionBody: ++ 'make = function() { }\n' + ++ '
make()
', ++}; ++ ++const INLINE_SNIPPETS = { ++ topLevel: 'fooVariable.mutate("set", [fun.expressions.Number(2)])', ++ xmlHook: 'fun.emit(hookName, fun.expressions.Text("ready"))', ++ functionBody: 'yieldValue(fun.expressions.Text("ok"))', ++ compileFile: 'barVariable.mutate("set", [fun.expressions.Number(11)])', ++}; ++ ++async function testCompileCodeTopLevelScriptMutatesBoundVariable() { ++ ++ ++ const html = await compileCode(SOURCES.topLevel, cloneOptions()); ++ assertFullHtmlDocument(html); ++ assertInlineScriptGenerated(html, INLINE_SNIPPETS.topLevel, ['fooVariable']); ++ assert.strictEqual(renderedText(html, 'out'), '2'); ++} ++ ++async function testCompileCodeNestedXmlScriptGetsCurrentHookName() { ++ ++ ++ const html = await compileCode(SOURCES.xmlHook, cloneOptions()); ++ assertFullHtmlDocument(html); ++ assertInlineScriptGenerated(html, INLINE_SNIPPETS.xmlHook, ['hookName']); ++ assert.strictEqual(renderedText(html, 'out'), 'ready'); ++} ++ ++async function testCompileCodeFunctionBodyScriptCanYieldValue() { ++ ++ ++ const html = await compileCode(SOURCES.functionBody, cloneOptions()); ++ assertFullHtmlDocument(html); ++ assertInlineScriptGenerated(html, INLINE_SNIPPETS.functionBody, []); ++ assert.strictEqual(renderedText(html, 'out'), 'ok'); ++} ++ ++async function testCompileFileSupportsInlineScriptBlocks() { ++ ++ ++ const sourceFile = path.join(FIXTURES, 'compile-file-inline-script.fun'); ++ const html = await compileFile(sourceFile, cloneOptions()); ++ assertFullHtmlDocument(html); ++ assertInlineScriptGenerated(html, INLINE_SNIPPETS.compileFile, ['barVariable']); ++ assert.strictEqual(renderedText(html, 'out'), '11'); ++} ++ ++async function testCompileCodeSuccessCallbackReceivesNullAndHtmlString() { ++ ++ const result = await compileCodeResult(SOURCES.topLevel, cloneOptions()); ++ assert.strictEqual(result.err, null); ++ assert.strictEqual(typeof result.html, 'string'); ++ assertFullHtmlDocument(result.html); ++} ++ ++function cloneOptions() { ++ return JSON.parse(JSON.stringify(OPTIONS)); ++} ++ ++function compileCode(source, opts) { ++ return compileCodeResult(source, opts).then((result) => { ++ if (result.err) { ++ throw result.err; ++ } ++ assert.strictEqual(result.err, null); ++ return result.html; ++ }); ++} ++ ++function compileCodeResult(source, opts) { ++ return new Promise((resolve) => { ++ compiler.compileCode(source, opts, (err, html) => { ++ resolve({ err: err || null, html: html == null ? null : html }); ++ }); ++ }); ++} ++ ++function compileFile(sourceFilePath, opts) { ++ return new Promise((resolve, reject) => { ++ compiler.compileFile(sourceFilePath, opts, (err, html) => { ++ if (err) { ++ reject(err); ++ } else { ++ assert.strictEqual(err, null); ++ resolve(html); ++ } ++ }); ++ }); ++} ++ ++function assertFullHtmlDocument(html) { ++ ++ assert.strictEqual(typeof html, 'string'); ++ assert.match(html, //i); ++ assert.match(html, //i); ++ assert.match(html, //i); ++ assert.match(html, //i); ++} ++ ++function assertInlineScriptGenerated(html, inlineJavaScript, localNames) { ++ const script = extractApplicationScript(html); ++ ++ assertJavaScriptContains(script, inlineJavaScript); ++ assertInlineJavaScriptInIife(script, inlineJavaScript); ++ for (const localName of localNames) { ++ assertLocalNameAvailable(script, localName); ++ } ++} ++ ++function assertJavaScriptContains(script, fragment) { ++ assert.ok( ++ compactJavaScript(script).indexOf(compactJavaScript(fragment)) !== -1, ++ 'generated application script should preserve inline JavaScript: ' + fragment ++ ); ++} ++ ++function assertInlineJavaScriptInIife(script, fragment) { ++ const compactScript = compactJavaScript(script); ++ const fragmentIndex = compactScript.indexOf(compactJavaScript(fragment)); ++ assert.notStrictEqual(fragmentIndex, -1); ++ ++ const before = compactScript.slice(0, fragmentIndex); ++ const after = compactScript.slice(fragmentIndex); ++ assert.ok( ++ before.lastIndexOf('(function') !== -1 || before.lastIndexOf('!function') !== -1, ++ 'inline JavaScript should be inside an immediately executed function' ++ ); ++ assert.ok( ++ /\}\)\(/.test(after), ++ 'inline JavaScript function wrapper should be immediately invoked' ++ ); ++} ++ ++function assertLocalNameAvailable(script, localName) { ++ const name = escapeRegExp(localName); ++ const declaration = new RegExp( ++ '\\b(?:var|let|const)\\b[\\s\\S]*\\b' + name + '\\b\\s*=' + ++ '|\\bfunction\\b[^\\(]*\\([^\\)]*\\b' + name + '\\b' ++ ); ++ assert.ok(declaration.test(script), 'generated application script should expose local ' + localName); ++} ++ ++function compactJavaScript(value) { ++ return String(value).replace(/\s+/g, ''); ++} ++ ++function escapeRegExp(value) { ++ return String(value).replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); ++} ++ ++function renderedText(html, id) { ++ const document = new FakeDocument(); ++ vm.runInNewContext(extractApplicationScript(html), { ++ document: document, ++ console: console, ++ setTimeout: setTimeout, ++ clearTimeout: clearTimeout, ++ }, { timeout: 1000 }); ++ const el = document.getElementById(id); ++ assert.notStrictEqual(el, null); ++ return el.textContent; ++} ++ ++function extractApplicationScript(html) { ++ ++ const bodyMatch = html.match(/]*>([\s\S]*?)<\/body>/i); ++ assert.notStrictEqual(bodyMatch, null); ++ const scripts = []; ++ const re = /]*>([\s\S]*?)<\/script>/gi; ++ let match; ++ while ((match = re.exec(bodyMatch[1]))) { ++ scripts.push(match[1]); ++ } ++ assert.ok(scripts.length > 0, 'full HTML document should include a generated application script'); ++ return scripts[scripts.length - 1]; ++} ++ ++class FakeTextNode { ++ constructor(value) { ++ this.nodeType = 3; ++ this.nodeValue = String(value); ++ this.parentNode = null; ++ } ++ ++ get textContent() { ++ return this.nodeValue; ++ } ++} ++ ++class FakeElement { ++ constructor(tagName, ownerDocument) { ++ this.tagName = tagName; ++ this.ownerDocument = ownerDocument; ++ this.childNodes = []; ++ this.attributes = {}; ++ this.style = {}; ++ this.className = ''; ++ this.parentNode = null; ++ } ++ ++ appendChild(node) { ++ node.parentNode = this; ++ this.childNodes.push(node); ++ return node; ++ } ++ ++ insertBefore(node, referenceNode) { ++ node.parentNode = this; ++ const index = this.childNodes.indexOf(referenceNode); ++ if (index === -1) { ++ this.childNodes.push(node); ++ } else { ++ this.childNodes.splice(index, 0, node); ++ } ++ return node; ++ } ++ ++ setAttribute(key, value) { ++ const stringValue = String(value); ++ this.attributes[key] = stringValue; ++ if (key === 'id') { ++ this.ownerDocument.byId[stringValue] = this; ++ } ++ if (key === 'class' || key === 'className') { ++ this.className = stringValue; ++ } ++ } ++ ++ get innerHTML() { ++ return this.textContent; ++ } ++ ++ set innerHTML(value) { ++ this.childNodes = value ? [new FakeTextNode(value)] : []; ++ } ++ ++ get textContent() { ++ return this.childNodes.map((node) => node.textContent).join(''); ++ } ++} ++ ++class FakeDocument { ++ constructor() { ++ this.byId = {}; ++ this.body = new FakeElement('body', this); ++ } ++ ++ createElement(tagName) { ++ return new FakeElement(tagName, this); ++ } ++ ++ createTextNode(value) { ++ return new FakeTextNode(value); ++ } ++ ++ getElementById(id) { ++ return this.byId[id] || null; ++ } ++} ++ ++const tests = [ ++ testCompileCodeTopLevelScriptMutatesBoundVariable, ++ testCompileCodeNestedXmlScriptGetsCurrentHookName, ++ testCompileCodeFunctionBodyScriptCanYieldValue, ++ testCompileFileSupportsInlineScriptBlocks, ++ testCompileCodeSuccessCallbackReceivesNullAndHtmlString, ++]; ++ ++(async function run() { ++ for (const testFn of tests) { ++ await testFn(); ++ process.stdout.write('ok ' + testFn.name + '\n'); ++ } ++})().catch((err) => { ++ console.error(err && err.stack ? err.stack : err); ++ process.exit(1); ++}); +diff --git a/usercase-test-coderl/offline_network_guard.js b/usercase-test-coderl/offline_network_guard.js +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/offline_network_guard.js +@@ -0,0 +1,146 @@ ++ ++ ++(function installOfflineNetworkGuard() { ++ const localHosts = new Set([ ++ '', ++ '0.0.0.0', ++ '127.0.0.1', ++ '::', ++ '::1', ++ 'localhost', ++ ]); ++ ++ function normalizeHost(host) { ++ if (host == null) { ++ return ''; ++ } ++ return String(host).replace(/^\[/, '').replace(/\]$/, '').toLowerCase(); ++ } ++ ++ function isLocalHost(host) { ++ const normalized = normalizeHost(host); ++ if (localHosts.has(normalized)) { ++ return true; ++ } ++ return /^127\./.test(normalized); ++ } ++ ++ function block(api, host) { ++ throw new Error('isolated offline guard blocked ' + api + ' to ' + host); ++ } ++ ++ function assertLocal(api, host) { ++ const normalized = normalizeHost(host); ++ if (!isLocalHost(normalized)) { ++ block(api, normalized); ++ } ++ } ++ ++ function hostFromOptions(options) { ++ if (!options || typeof options !== 'object') { ++ return ''; ++ } ++ return options.hostname || options.host || ''; ++ } ++ ++ function hostFromUrl(value) { ++ if (typeof value !== 'string') { ++ return hostFromOptions(value); ++ } ++ if (!/^[a-z][a-z0-9+.-]*:\/\//i.test(value)) { ++ return ''; ++ } ++ return new URL(value).hostname; ++ } ++ ++ function hostFromNetArgs(args) { ++ const first = args[0]; ++ if (typeof first === 'object') { ++ return hostFromOptions(first); ++ } ++ if (typeof first === 'string') { ++ return ''; ++ } ++ if (typeof args[1] === 'string') { ++ return args[1]; ++ } ++ return ''; ++ } ++ ++ function hostFromHttpArgs(args) { ++ const first = args[0]; ++ const second = args[1]; ++ if (first instanceof URL) { ++ return first.hostname; ++ } ++ if (typeof first === 'string') { ++ return hostFromUrl(first); ++ } ++ if (typeof second === 'object') { ++ return hostFromOptions(second); ++ } ++ return hostFromOptions(first); ++ } ++ ++ const net = require('net'); ++ const originalConnect = net.connect; ++ const originalCreateConnection = net.createConnection; ++ const originalSocketConnect = net.Socket.prototype.connect; ++ ++ net.connect = function guardedNetConnect() { ++ assertLocal('net.connect', hostFromNetArgs(arguments)); ++ return originalConnect.apply(this, arguments); ++ }; ++ ++ net.createConnection = function guardedNetCreateConnection() { ++ assertLocal('net.createConnection', hostFromNetArgs(arguments)); ++ return originalCreateConnection.apply(this, arguments); ++ }; ++ ++ net.Socket.prototype.connect = function guardedSocketConnect() { ++ assertLocal('net.Socket.connect', hostFromNetArgs(arguments)); ++ return originalSocketConnect.apply(this, arguments); ++ }; ++ ++ function guardHttpModule(moduleName) { ++ const mod = require(moduleName); ++ const originalRequest = mod.request; ++ const originalGet = mod.get; ++ ++ mod.request = function guardedRequest() { ++ assertLocal(moduleName + '.request', hostFromHttpArgs(arguments)); ++ return originalRequest.apply(this, arguments); ++ }; ++ ++ mod.get = function guardedGet() { ++ assertLocal(moduleName + '.get', hostFromHttpArgs(arguments)); ++ return originalGet.apply(this, arguments); ++ }; ++ } ++ ++ guardHttpModule('http'); ++ guardHttpModule('https'); ++ ++ const dns = require('dns'); ++ for (const name of ['lookup', 'resolve', 'resolve4', 'resolve6', 'resolveAny', 'resolveCname', 'resolveMx', 'resolveNs', 'resolveSrv', 'resolveTxt']) { ++ if (typeof dns[name] !== 'function') { ++ continue; ++ } ++ const original = dns[name]; ++ dns[name] = function guardedDns(hostname) { ++ assertLocal('dns.' + name, hostname); ++ return original.apply(this, arguments); ++ }; ++ } ++ ++ if (typeof globalThis.fetch === 'function') { ++ const originalFetch = globalThis.fetch; ++ globalThis.fetch = function guardedFetch(resource) { ++ const host = resource && typeof resource === 'object' && resource.url ++ ? hostFromUrl(resource.url) ++ : hostFromUrl(resource); ++ assertLocal('fetch', host); ++ return originalFetch.apply(this, arguments); ++ }; ++ } ++})(); +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,15 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export NODE_OPTIONS="${NODE_OPTIONS} --require=/workspace/repo/usercase-test-coderl/offline_network_guard.js" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++set -euo pipefail ++cd /workspace/repo ++exec node /workspace/repo/usercase-test-coderl/inline_script.test.js diff --git a/tasks/format-code-task-001849/tests/test.sh b/tasks/format-code-task-001849/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..5fdadaaf8ed41c54444ebf252bb13f4fd03fa5ab --- /dev/null +++ b/tasks/format-code-task-001849/tests/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/fixtures/compile-file-inline-script.fun +usercase-test-coderl/inline_script.test.js +usercase-test-coderl/offline_network_guard.js +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001849/tests/test_command.sh b/tasks/format-code-task-001849/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-001849/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001871/environment/Dockerfile b/tasks/format-code-task-001871/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..dfedde9cd1f8a967531e6bd882d7e3d9114a2201 --- /dev/null +++ b/tasks/format-code-task-001871/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:1e80f930ba4ba4c104ecb81c86350000a678aa57fa94d78768935d905b069f3a diff --git a/tasks/format-code-task-001871/environment/setup/files/blocklist b/tasks/format-code-task-001871/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001871/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001871/environment/setup/setup.sh b/tasks/format-code-task-001871/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001871/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001871/tests/test.patch b/tasks/format-code-task-001871/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..e23212b491be7fdddcf33fc28cf8c10e90fbdaab --- /dev/null +++ b/tasks/format-code-task-001871/tests/test.patch @@ -0,0 +1,165 @@ +diff --git a/runewidth_fullwidth_hidden_test.go b/runewidth_fullwidth_hidden_test.go +new file mode 100644 +index 0000000..2b9058b +--- /dev/null ++++ b/runewidth_fullwidth_hidden_test.go +@@ -0,0 +1,40 @@ ++package runewidth ++ ++import "testing" ++ ++func TestFullwidthRunesHaveWidthTwo(t *testing.T) { ++ ranges := []struct { ++ name string ++ lo rune ++ hi rune ++ }{ ++ {"ideographic space", '\u3000', '\u3000'}, ++ {"fullwidth ASCII and punctuation", 0xFF01, 0xFF60}, ++ {"fullwidth signs", 0xFFE0, 0xFFE6}, ++ } ++ for _, rg := range ranges { ++ for r := rg.lo; r <= rg.hi; r++ { ++ if got := RuneWidth(r); got != 2 { ++ t.Fatalf("%s: RuneWidth(%U) = %d, want 2", rg.name, r, got) ++ } ++ } ++ } ++ if got := StringWidth("\u3000"); got != 2 { ++ t.Fatalf("StringWidth(%q) = %d, want 2", "\u3000", got) ++ } ++} ++ ++func TestFullwidthStringWidthAggregatesPerRune(t *testing.T) { ++ tests := []struct { ++ s string ++ want int ++ }{ ++ {"\u3000!?A", 8}, ++ {"#$z", 6}, ++ } ++ for _, tt := range tests { ++ if got := StringWidth(tt.s); got != tt.want { ++ t.Fatalf("StringWidth(%q) = %d, want %d", tt.s, got, tt.want) ++ } ++ } ++} +diff --git a/script/generate_fullwidth_hidden_test.go b/script/generate_fullwidth_hidden_test.go +new file mode 100644 +index 0000000..74149ad +--- /dev/null ++++ b/script/generate_fullwidth_hidden_test.go +@@ -0,0 +1,73 @@ ++package main ++ ++import ( ++ "bytes" ++ "regexp" ++ "strconv" ++ "strings" ++ "testing" ++) ++ ++func TestGeneratedWidthDataIncludesFullwidthRecords(t *testing.T) { ++ fixture := strings.NewReader(strings.Join([]string{ ++ "3000;F # IDEOGRAPHIC SPACE", ++ "3001;W # IDEOGRAPHIC COMMA", ++ "FF01..FF03;F # FULLWIDTH EXCLAMATION MARK..FULLWIDTH NUMBER SIGN", ++ "FFE0..FFE1;F # FULLWIDTH CENT SIGN..FULLWIDTH POUND SIGN", ++ "0041;Na # LATIN CAPITAL LETTER A", ++ "", ++ }, "\n")) ++ ++ var out bytes.Buffer ++ if err := eastasian(&out, fixture); err != nil { ++ t.Fatalf("eastasian returned error: %v", err) ++ } ++ ++ ranges := parseGeneratedRanges(t, out.String()) ++ for _, r := range []rune{0x3000, 0x3001, 0xFF01, 0xFF03, 0xFFE0, 0xFFE1} { ++ if !rangesContain(ranges, r) { ++ t.Fatalf("generated width data does not include %U as double-width; output:\n%s", r, out.String()) ++ } ++ } ++ if rangesContain(ranges, 0x0041) { ++ t.Fatalf("generated width data unexpectedly includes narrow rune U+0041; output:\n%s", out.String()) ++ } ++} ++ ++type generatedRange struct { ++ lo rune ++ hi rune ++} ++ ++func parseGeneratedRanges(t *testing.T, generated string) []generatedRange { ++ t.Helper() ++ ++ re := regexp.MustCompile(`\{\s*0x([0-9a-fA-F]+)\s*,\s*0x([0-9a-fA-F]+)\s*\}`) ++ matches := re.FindAllStringSubmatch(generated, -1) ++ if len(matches) == 0 { ++ t.Fatalf("no generated ranges found in output:\n%s", generated) ++ } ++ ++ ranges := make([]generatedRange, 0, len(matches)) ++ for _, m := range matches { ++ lo, err := strconv.ParseInt(m[1], 16, 32) ++ if err != nil { ++ t.Fatalf("failed to parse generated range lower bound %q: %v", m[1], err) ++ } ++ hi, err := strconv.ParseInt(m[2], 16, 32) ++ if err != nil { ++ t.Fatalf("failed to parse generated range upper bound %q: %v", m[2], err) ++ } ++ ranges = append(ranges, generatedRange{lo: rune(lo), hi: rune(hi)}) ++ } ++ return ranges ++} ++ ++func rangesContain(ranges []generatedRange, r rune) bool { ++ for _, rg := range ranges { ++ if rg.lo <= r && r <= rg.hi { ++ return true ++ } ++ } ++ return false ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,35 @@ ++#!/bin/bash ++set -uo pipefail ++cd /testbed ++ ++ ++ ++ ++ ++case "${1:-}" in ++ base) ++ base_tests='^(TestIsEastAsian|TestIsEastAsianLCCTYPE|TestIsEastAsianLANG|TestSorted|TestRuneWidth|TestIsAmbiguousWidth|TestStringWidth|TestStringWidthInvalid|TestTruncateSmaller|TestTruncate|TestTruncateFit|TestTruncateJustFit|TestWrap|TestTruncateNoNeeded|TestIsNeutralWidth|TestFillLeft|TestFillLeftFit|TestFillRight|TestFillRightFit|TestEnv|TestZeroWidthJointer)$' ++ go test -v -run "$base_tests" . ++ root_rc=$? ++ go test -v -run '^$' ./script ++ script_rc=$? ++ if [ "$root_rc" -ne 0 ]; then ++ exit "$root_rc" ++ fi ++ exit "$script_rc" ++ ;; ++ new) ++ go test -v -run 'TestFullwidthRunesHaveWidthTwo|TestFullwidthStringWidthAggregatesPerRune' . ++ root_rc=$? ++ go test -v -run 'TestGeneratedWidthDataIncludesFullwidthRecords' ./script ++ script_rc=$? ++ if [ "$root_rc" -ne 0 ]; then ++ exit "$root_rc" ++ fi ++ exit "$script_rc" ++ ;; ++ *) ++ echo "usage: $0 base|new" ++ exit 2 ++ ;; ++esac diff --git a/tasks/format-code-task-001871/tests/test.sh b/tasks/format-code-task-001871/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0ada578bff8b1a7e54a180060a0364b7764b03ee --- /dev/null +++ b/tasks/format-code-task-001871/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +runewidth_fullwidth_hidden_test.go +script/generate_fullwidth_hidden_test.go +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001871/tests/test_command.sh b/tasks/format-code-task-001871/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..e8d2f32b64045b5a5a56e0ad5667da87d8e0bc2a --- /dev/null +++ b/tasks/format-code-task-001871/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new \ No newline at end of file diff --git a/tasks/format-code-task-001876/environment/Dockerfile b/tasks/format-code-task-001876/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..70c2ee41a0e840c6378dc41e48e6e9e325f4a3b9 --- /dev/null +++ b/tasks/format-code-task-001876/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:b0576d9d9488d1413efeced11fa76b9d653a5f599a75963a987f996653c3cf94 diff --git a/tasks/format-code-task-001876/environment/setup/files/blocklist b/tasks/format-code-task-001876/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001876/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001876/environment/setup/setup.sh b/tasks/format-code-task-001876/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001876/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001876/tests/test.patch b/tasks/format-code-task-001876/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..371db2720a7f131bdac2f63785139c78d6498573 --- /dev/null +++ b/tasks/format-code-task-001876/tests/test.patch @@ -0,0 +1,248 @@ +diff --git a/test/test_pin_increments.py b/test/test_pin_increments.py +new file mode 100644 +index 0000000..b9e4d0e +--- /dev/null ++++ b/test/test_pin_increments.py +@@ -0,0 +1,220 @@ ++# -*- coding: utf-8 -*- ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++from __future__ import absolute_import ++from __future__ import unicode_literals ++ ++import os ++import datetime as dt ++ ++import pytest ++from click.testing import CliRunner ++ ++from bumpver import cli ++from bumpver import v2version ++ ++ ++ENV = { ++ 'GIT_AUTHOR_NAME' : "bumpver_tester", ++ 'GIT_COMMITTER_NAME' : "bumpver_tester", ++ 'GIT_AUTHOR_EMAIL' : "bumpver_tester@nowhere.com", ++ 'GIT_COMMITTER_EMAIL': "bumpver_tester@nowhere.com", ++ 'HGUSER' : "bumpver_tester", ++ 'PATH' : os.environ['PATH'], ++} ++ ++ ++ ++ ++ ++ ++PINNED_DATE = dt.date(2022, 11, 5) ++ ++ ++def test_v2_incr_pin_increments_with_patch(): ++ ++ ++ ++ ++ ++ new_version = v2version.incr( ++ "2022.11.2", ++ "YYYY.MM.INC1[-PATCH]", ++ patch=True, ++ pin_date=True, ++ pin_increments=True, ++ maybe_date=PINNED_DATE, ++ ) ++ assert new_version == "2022.11.2-1" ++ ++ ++def test_v2_incr_pin_increments_existing_patch(): ++ ++ new_version = v2version.incr( ++ "2022.11.2-1", ++ "YYYY.MM.INC1[-PATCH]", ++ patch=True, ++ pin_date=True, ++ pin_increments=True, ++ maybe_date=PINNED_DATE, ++ ) ++ assert new_version == "2022.11.2-2" ++ ++ ++def test_v2_incr_default_without_pin_increments_unchanged(): ++ ++ ++ ++ ++ ++ new_version = v2version.incr( ++ "2022.11.2", ++ "YYYY.MM.INC1[-PATCH]", ++ patch=True, ++ pin_date=True, ++ maybe_date=PINNED_DATE, ++ ) ++ assert new_version == "2022.11.3" ++ ++ ++def test_v2_incr_pin_increments_with_inc0(): ++ ++ new_version = v2version.incr( ++ "2022.11.0", ++ "YYYY.MM.INC0[-PATCH]", ++ patch=True, ++ pin_date=True, ++ pin_increments=True, ++ maybe_date=PINNED_DATE, ++ ) ++ assert new_version == "2022.11.0-1" ++ ++ ++def test_v2_incr_inc0_default_increments(): ++ ++ new_version = v2version.incr( ++ "2022.11.0", ++ "YYYY.MM.INC0[-PATCH]", ++ patch=True, ++ pin_date=True, ++ maybe_date=PINNED_DATE, ++ ) ++ assert new_version == "2022.11.1" ++ ++ ++def test_v2_incr_pin_increments_no_bump_returns_none(): ++ ++ new_version = v2version.incr( ++ "2022.11.2", ++ "YYYY.MM.INC1[-PATCH]", ++ pin_date=True, ++ pin_increments=True, ++ maybe_date=PINNED_DATE, ++ ) ++ assert new_version is None ++ ++ ++def test_v2_incr_pin_increments_semver_unchanged(): ++ ++ ++ ++ pinned = v2version.incr( ++ "0.1.4b1", ++ "MAJOR.MINOR.PATCH[PYTAGNUM]", ++ patch=True, ++ pin_increments=True, ++ ) ++ default = v2version.incr( ++ "0.1.4b1", ++ "MAJOR.MINOR.PATCH[PYTAGNUM]", ++ patch=True, ++ ) ++ assert pinned == "0.1.5b0" ++ assert default == "0.1.5b0" ++ ++ ++ ++ ++ ++ ++ ++@pytest.fixture ++def runner(tmpdir): ++ r = CliRunner(env=ENV) ++ orig_cwd = os.getcwd() ++ os.chdir(str(tmpdir)) ++ yield r ++ os.chdir(orig_cwd) ++ ++ ++def test_cli_pin_increments_flag_exists(runner): ++ ++ result = runner.invoke(cli.cli, ['test', '--help']) ++ assert result.exit_code == 0 ++ assert "--pin-increments" in result.output ++ ++ ++def test_cli_test_patch_pin_increments(runner): ++ ++ result = runner.invoke( ++ cli.cli, ++ [ ++ 'test', ++ '--pin-date', ++ '--pin-increments', ++ '--patch', ++ '-vv', ++ '2022.11.2', ++ 'YYYY.MM.INC1[-PATCH]', ++ ], ++ ) ++ assert result.exit_code == 0 ++ assert "New Version: 2022.11.2-1" in result.output ++ ++ ++def test_cli_test_patch_without_pin_increments_default(runner): ++ ++ ++ ++ ++ result = runner.invoke( ++ cli.cli, ++ [ ++ 'test', ++ '--pin-date', ++ '--patch', ++ '-vv', ++ '2022.11.2', ++ 'YYYY.MM.INC1[-PATCH]', ++ ], ++ ) ++ assert result.exit_code == 0 ++ assert "New Version: 2022.11.3" in result.output ++ assert "2022.11.2-1" not in result.output ++ ++ ++def test_cli_test_patch_pin_increments_existing_patch(runner): ++ ++ result = runner.invoke( ++ cli.cli, ++ [ ++ 'test', ++ '--pin-date', ++ '--pin-increments', ++ '--patch', ++ '-vv', ++ '2022.11.2-1', ++ 'YYYY.MM.INC1[-PATCH]', ++ ], ++ ) ++ assert result.exit_code == 0 ++ assert "New Version: 2022.11.2-2" in result.output +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 0000000..5ce4d8d +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["PYTHONPATH=src python -m pytest test/test_pin_increments.py -v"] ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++PYTHONPATH=src python -m pytest test/test_pin_increments.py -v ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-001876/tests/test.sh b/tasks/format-code-task-001876/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..d09eb85766a33c1260ab1734be458dc40b4b5871 --- /dev/null +++ b/tasks/format-code-task-001876/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test/test_pin_increments.py +test_commands.json +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001876/tests/test_command.sh b/tasks/format-code-task-001876/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001876/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001882/environment/Dockerfile b/tasks/format-code-task-001882/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..a887346b8075443b84169b681a5ff2188cb1aa02 --- /dev/null +++ b/tasks/format-code-task-001882/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:58847f5c1b4a32a2da340aaca0f8c447f664c3b59c6c4d568576854392dbf105 diff --git a/tasks/format-code-task-001882/environment/setup/files/blocklist b/tasks/format-code-task-001882/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001882/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001882/environment/setup/setup.sh b/tasks/format-code-task-001882/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001882/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001882/tests/test.patch b/tasks/format-code-task-001882/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..efbbbf459b2b4f5afc6aabd61ba987e3cc9f06e3 --- /dev/null +++ b/tasks/format-code-task-001882/tests/test.patch @@ -0,0 +1,80 @@ +diff --git a/packages/mdx/test/index.test.js b/packages/mdx/test/index.test.js +index a5a1241d..477f304a 100644 +--- a/packages/mdx/test/index.test.js ++++ b/packages/mdx/test/index.test.js +@@ -419,3 +419,53 @@ test('Should handle layout props', () => { + MDXContent.isMDXComponent = true;" + `) + }) ++ ++// The issue requests that the component name be "quoted clearly" in the ++// undefined-component warning, with `Component 'Image' was not imported...` ++// given as an example. We treat any visible quoting/delimiting around the ++// name (single quote, backtick, escaped double quote, or JSON.stringify) ++// as satisfying the user-facing expectation. ++const QUOTED_NAME_RE = new RegExp( ++ 'Component (?:' + ++ // 'name' -> "Component '" + name + "'" ++ "'\" \\+ name \\+ \"'" + ++ '|' + ++ // `name` -> "Component `" + name + "`" ++ '`" \\+ name \\+ "`' + ++ '|' + ++ // "name" via escaped double-quote literal -> "Component \"" + name + "\"" ++ '\\\\"" \\+ name \\+ "\\\\"' + ++ '|' + ++ ++ '" \\+ JSON\\.stringify\\(name\\) \\+ "' + ++ ') was not imported, exported, or provided by MDXProvider as global scope' ++) ++ ++test('Should quote component name in shortcode warning message', async () => { ++ const result = await mdx('# Hello World') ++ ++ ++ ++ expect(result).toMatch(QUOTED_NAME_RE) ++}) ++ ++test('Should NOT emit unquoted component name in shortcode warning', async () => { ++ const result = await mdx('# Hello World') ++ ++ ++ ++ expect(result).not.toMatch( ++ /"Component " \+ name \+ " was not imported/ ++ ) ++}) ++ ++test('Should quote name in warning when MDX uses an unknown component', async () => { ++ ++ ++ ++ const result = await mdx('\n') ++ ++ expect(result).toContain('makeShortcode("Image")') ++ expect(result).toMatch(QUOTED_NAME_RE) ++ expect(result).not.toMatch(/"Component " \+ name \+ " was not imported/) ++}) +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 00000000..1f20ab29 +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["npx jest packages/mdx/test/index.test.js -t warning"] ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++npx jest packages/mdx/test/index.test.js -t warning ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-001882/tests/test.sh b/tasks/format-code-task-001882/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..97d3e60055b95906f62a66cf804c50d5798817da --- /dev/null +++ b/tasks/format-code-task-001882/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +packages/mdx/test/index.test.js +test_commands.json +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001882/tests/test_command.sh b/tasks/format-code-task-001882/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001882/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001957/tests/test.patch b/tasks/format-code-task-001957/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..f0417d542c286a65ef7e22d8c9c1e5522eb65ba6 --- /dev/null +++ b/tasks/format-code-task-001957/tests/test.patch @@ -0,0 +1,424 @@ +diff --git a/usercase-test-coderl/facet_mounting_helpers.test.ts b/usercase-test-coderl/facet_mounting_helpers.test.ts +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/facet_mounting_helpers.test.ts +@@ -0,0 +1,397 @@ ++import React from 'react' ++import { act, cleanup, render } from '@react-facet/dom-fiber-testing-library' ++import { ++ createFacet, ++ Map, ++ Mount, ++ NO_VALUE, ++ Times, ++ Unwrap, ++ useFacetEffect, ++ useFacetMap, ++ With, ++} from '@react-facet/core' ++import type { Facet } from '@react-facet/core' ++ ++const renderMountText = (initialValue: boolean, condition?: boolean) => { ++ const display = createFacet({ initialValue }) ++ const props = condition === undefined ? { when: display } : { when: display, condition } ++ ++ const result = render(React.createElement(Mount, props, React.createElement('div', null, 'Hello'))) ++ return result.container.textContent ++} ++ ++const renderTimesText = (countValue: number | typeof NO_VALUE) => { ++ const count = createFacet({ initialValue: countValue }) ++ const result = render( ++ React.createElement(Times, { count }, (index: number) => React.createElement('span', null, String(index))), ++ ) ++ return result.container.textContent ++} ++ ++describe('facet-aware React component helpers', () => { ++ afterEach(() => { ++ cleanup() ++ }) ++ ++ test('public helper exports are available from @react-facet/core', () => { ++ ++ ++ ++ ++ ++ expect(Mount).toBeDefined() ++ expect(Map).toBeDefined() ++ expect(With).toBeDefined() ++ expect(Unwrap).toBeDefined() ++ expect(Times).toBeDefined() ++ }) ++ ++ test('Mount renders the child when the boolean facet is true', () => { ++ ++ ++ ++ ++ expect(renderMountText(true)).toBe('Hello') ++ }) ++ ++ test('Mount renders nothing when the boolean facet is false by default', () => { ++ ++ ++ ++ ++ expect(renderMountText(false)).toBe('') ++ }) ++ ++ test('Mount with condition false renders for false and unmounts after true', () => { ++ ++ ++ ++ ++ const display = createFacet({ initialValue: false }) ++ const result = render( ++ React.createElement( ++ Mount, ++ { when: display, condition: false }, ++ React.createElement('div', null, 'Empty list message'), ++ ), ++ ) ++ ++ expect(result.container.textContent).toBe('Empty list message') ++ ++ act(() => { ++ display.set(true) ++ }) ++ ++ expect(result.container.textContent).toBe('') ++ }) ++ ++ test('Unwrap calls the render prop with a concrete string value', () => { ++ ++ ++ ++ ++ const calls: string[] = [] ++ const data = createFacet({ initialValue: 'Foo' }) ++ const result = render( ++ React.createElement(Unwrap, { data }, (value: string) => { ++ calls.push(value) ++ return React.createElement('span', null, `value:${value}`) ++ }), ++ ) ++ ++ expect(calls).toEqual(['Foo']) ++ expect(result.container.textContent).toBe('value:Foo') ++ }) ++ ++ test('Unwrap treats undefined and null as concrete values', () => { ++ ++ ++ ++ ++ const undefinedCalls: Array = [] ++ const nullCalls: Array = [] ++ const undefinedFacet = createFacet({ initialValue: undefined }) ++ const nullFacet = createFacet({ initialValue: null }) ++ ++ const undefinedResult = render( ++ React.createElement(Unwrap, { data: undefinedFacet }, (value: string | undefined) => { ++ undefinedCalls.push(value) ++ return React.createElement('span', null, `undefined:${String(value)}`) ++ }), ++ ) ++ const nullResult = render( ++ React.createElement(Unwrap, { data: nullFacet }, (value: string | null) => { ++ nullCalls.push(value) ++ return React.createElement('span', null, `null:${String(value)}`) ++ }), ++ ) ++ ++ expect(undefinedCalls).toEqual([undefined]) ++ expect(nullCalls).toEqual([null]) ++ expect(undefinedResult.container.textContent).toBe('undefined:undefined') ++ expect(nullResult.container.textContent).toBe('null:null') ++ }) ++ ++ test('Unwrap renders nothing and does not call children for NO_VALUE', () => { ++ ++ ++ ++ ++ const child = jest.fn(() => React.createElement('span', null, 'hidden')) ++ const data = createFacet({ initialValue: NO_VALUE }) ++ const result = render(React.createElement(Unwrap, { data }, child)) ++ ++ expect(child).toHaveBeenCalledTimes(0) ++ expect(result.container.textContent).toBe('') ++ }) ++ ++ test('With renders a non-null object through a refined facet', () => { ++ ++ ++ ++ ++ const userFacet = createFacet({ initialValue: { user: 'Zelda' } }) ++ const calls: string[] = [] ++ ++ const Content = ({ data }: { data: Facet<{ user: string }> }) => { ++ useFacetEffect( ++ (value) => { ++ calls.push(value.user) ++ }, ++ [], ++ [data], ++ ) ++ return React.createElement('span', null, React.createElement('fast-text', { text: useFacetMap(({ user }) => user, [], [data]) })) ++ } ++ ++ const result = render(React.createElement(With, { data: userFacet }, (data) => React.createElement(Content, { data }))) ++ ++ ++ expect(calls).toContain('Zelda') ++ expect(result.container.textContent).toBe('Zelda') ++ }) ++ ++ test('With renders nothing for null, undefined, and NO_VALUE', () => { ++ ++ ++ ++ ++ const nullChild = jest.fn(() => React.createElement('span', null, 'null child')) ++ const undefinedChild = jest.fn(() => React.createElement('span', null, 'undefined child')) ++ const noValueChild = jest.fn(() => React.createElement('span', null, 'no value child')) ++ ++ const nullResult = render(React.createElement(With, { data: createFacet({ initialValue: null }) }, nullChild)) ++ const undefinedResult = render( ++ React.createElement(With, { data: createFacet({ initialValue: undefined }) }, undefinedChild), ++ ) ++ const noValueResult = render( ++ React.createElement(With, { data: createFacet({ initialValue: NO_VALUE }) }, noValueChild), ++ ) ++ ++ expect(nullChild).toHaveBeenCalledTimes(0) ++ expect(undefinedChild).toHaveBeenCalledTimes(0) ++ expect(noValueChild).toHaveBeenCalledTimes(0) ++ expect(nullResult.container.textContent).toBe('') ++ expect(undefinedResult.container.textContent).toBe('') ++ expect(noValueResult.container.textContent).toBe('') ++ }) ++ ++ test('With unmounts the child subtree after the facet changes to null', () => { ++ ++ ++ ++ ++ const data = createFacet({ initialValue: 'mounted data' }) ++ const result = render( ++ React.createElement(With, { data }, (nonNullFacet: Facet) => ++ React.createElement('span', null, React.createElement('fast-text', { text: nonNullFacet })), ++ ), ++ ) ++ ++ expect(result.container.textContent).toBe('mounted data') ++ ++ act(() => { ++ data.set(null) ++ }) ++ ++ expect(result.container.textContent).toBe('') ++ }) ++ ++ test('Map renders five items with per-index value, index, and total length', () => { ++ ++ ++ ++ ++ type Item = { label: string } ++ const items = createFacet({ ++ initialValue: [{ label: 'A' }, { label: 'B' }, { label: 'C' }, { label: 'D' }, { label: 'E' }], ++ }) ++ ++ const ItemView = ({ item, index, length }: { item: Facet; index: number; length: number }) => ++ React.createElement( ++ 'span', ++ null, ++ React.createElement('fast-text', { text: useFacetMap(({ label }) => `${index}/${length}:${label};`, [], [item]) }), ++ ) ++ ++ const result = render( ++ React.createElement(Map, { array: items }, (item: Facet, index: number, length: number) => ++ React.createElement(ItemView, { item, index, length }), ++ ), ++ ) ++ ++ expect(result.container.textContent).toBe('0/5:A;1/5:B;2/5:C;3/5:D;4/5:E;') ++ }) ++ ++ test('Map updates mounted item count after shrinking from five objects to two', () => { ++ ++ ++ ++ ++ type Item = { value: string } ++ const items = createFacet({ ++ initialValue: [{ value: 'one' }, { value: 'two' }, { value: 'three' }, { value: 'four' }, { value: 'five' }], ++ }) ++ ++ const ItemView = ({ item, index }: { item: Facet; index: number }) => ++ React.createElement( ++ 'span', ++ null, ++ React.createElement('fast-text', { text: useFacetMap(({ value }) => `${index}:${value}|`, [], [item]) }), ++ ) ++ ++ const result = render( ++ React.createElement(Map, { array: items }, (item: Facet, index: number) => ++ React.createElement(ItemView, { item, index }), ++ ), ++ ) ++ expect(result.container.textContent).toBe('0:one|1:two|2:three|3:four|4:five|') ++ ++ act(() => { ++ items.set([{ value: 'one' }, { value: 'two' }]) ++ }) ++ ++ expect(result.container.textContent).toBe('0:one|1:two|') ++ }) ++ ++ test('Map updates mounted item count after growing from one object to three', () => { ++ ++ ++ ++ ++ type Item = { value: string } ++ const items = createFacet({ initialValue: [{ value: 'red' }] }) ++ const result = render( ++ React.createElement(Map, { array: items }, (_item: Facet, index: number, length: number) => ++ React.createElement('span', null, `${index + 1}-of-${length};`), ++ ), ++ ) ++ expect(result.container.textContent).toBe('1-of-1;') ++ ++ act(() => { ++ items.set([{ value: 'red' }, { value: 'green' }, { value: 'blue' }]) ++ }) ++ ++ expect(result.container.textContent).toBe('1-of-3;2-of-3;3-of-3;') ++ }) ++ ++ test('Map equalityCheck suppresses unchanged item facet notifications and reports changed positions', () => { ++ ++ ++ ++ ++ type Item = { value: string } ++ const items = createFacet({ ++ initialValue: [{ value: 'a' }, { value: 'b' }, { value: 'c' }, { value: 'd' }, { value: 'e' }], ++ }) ++ const observed = jest.fn() ++ const equalityCheck = () => { ++ let previous: string | undefined ++ return (current: Item) => { ++ if (current.value === previous) return true ++ previous = current.value ++ return false ++ } ++ } ++ const ItemObserver = ({ item }: { item: Facet }) => { ++ useFacetEffect(observed, [], [item]) ++ return null ++ } ++ ++ render( ++ React.createElement(Map, { array: items, equalityCheck }, (item: Facet) => ++ React.createElement(ItemObserver, { item }), ++ ), ++ ) ++ ++ expect(observed.mock.calls.map(([value]) => value.value)).toEqual(['a', 'b', 'c', 'd', 'e']) ++ ++ observed.mockClear() ++ act(() => { ++ items.set([{ value: 'changed' }, { value: 'b' }, { value: 'c' }, { value: 'd' }, { value: 'e' }]) ++ }) ++ ++ expect(observed.mock.calls).toEqual([[{ value: 'changed' }]]) ++ }) ++ ++ test('Times renders indexes from zero to count minus one with the total count', () => { ++ ++ ++ ++ ++ const count = createFacet({ initialValue: 3 }) ++ const calls: Array<[number, number]> = [] ++ const result = render( ++ React.createElement(Times, { count }, (index: number, total: number) => { ++ calls.push([index, total]) ++ return React.createElement('span', null, String(index)) ++ }), ++ ) ++ ++ expect(calls).toEqual([ ++ [0, 3], ++ [1, 3], ++ [2, 3], ++ ]) ++ expect(result.container.textContent).toBe('012') ++ }) ++ ++ test('Times renders nothing before the count facet has a concrete number', () => { ++ ++ ++ ++ ++ expect(renderTimesText(NO_VALUE)).toBe('') ++ }) ++ ++ test('Mount true behavior remains the spec-mandated render behavior', () => { ++ ++ expect(renderMountText(true)).toBe('Hello') ++ }) ++ ++ test('Map passes caller-owned array items through item facets', () => { ++ const input = [{ value: 'alpha' }, { value: 'beta' }] ++ const items = createFacet({ initialValue: input }) ++ ++ const result = render( ++ React.createElement(Map, { array: items }, (item: Facet<{ value: string }>) => ++ React.createElement('span', null, React.createElement('fast-text', { text: useFacetMap(({ value }) => value, [], [item]) })), ++ ), ++ ) ++ ++ ++ expect(result.container.textContent).toBe('alphabeta') ++ }) ++ ++ test('Mount renders according to the current boolean facet value', () => { ++ ++ expect(renderMountText(true)).toBe('Hello') ++ expect(renderMountText(false)).toBe('') ++ }) ++ ++ test('Times renders indexes after the count facet has a concrete number', () => { ++ ++ expect(renderTimesText(2)).toBe('01') ++ }) ++ }) +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,17 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++set -euo pipefail ++cd /workspace/repo ++exec node ./node_modules/jest/bin/jest.js \ ++ --config '{"rootDir":"/workspace/repo","testEnvironment":"jsdom","testEnvironmentOptions":{"url":"http://localhost"},"moduleFileExtensions":["tsx","js","ts"],"setupFilesAfterEnv":["/workspace/repo/jest.setupTestFrameworkScriptFile.js"],"transform":{"^.+\\.[jt]sx?$":["babel-jest",{"rootMode":"upward"}]},"testPathIgnorePatterns":["/node_modules/","/dist/"]}' \ ++ --runTestsByPath /workspace/repo/usercase-test-coderl/facet_mounting_helpers.test.ts \ ++ --runInBand diff --git a/tasks/format-code-task-001959/environment/Dockerfile b/tasks/format-code-task-001959/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..1790b2f8dc58cf20c219fa5b4142d563d4e6e35a --- /dev/null +++ b/tasks/format-code-task-001959/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:a9ac510175048c8bcab4e443903263abe8d0afa24a1e806fe74ee06f5840fa63 diff --git a/tasks/format-code-task-001959/environment/setup/files/blocklist b/tasks/format-code-task-001959/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001959/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001959/environment/setup/setup.sh b/tasks/format-code-task-001959/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-001959/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001959/tests/test.patch b/tasks/format-code-task-001959/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..3ace2813b721c1005ad6956bbf07c1ad873526da --- /dev/null +++ b/tasks/format-code-task-001959/tests/test.patch @@ -0,0 +1,228 @@ +diff --git a/usercase-test-coderl/duration_iso.test.js b/usercase-test-coderl/duration_iso.test.js +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/duration_iso.test.js +@@ -0,0 +1,196 @@ ++const assert = require('assert'); ++ ++const moment = require('/workspace/repo/build/umd/moment.js'); ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++function test(name, fn) { ++ try { ++ fn(); ++ console.log('ok - ' + name); ++ } catch (err) { ++ console.error('not ok - ' + name); ++ throw err; ++ } ++} ++ ++function parseIsoDurationComponents(isoString) { ++ const match = /^([+-])?P(?:([+-]?\d+(?:\.\d+)?)Y)?(?:([+-]?\d+(?:\.\d+)?)M)?(?:([+-]?\d+(?:\.\d+)?)D)?(?:T(?:([+-]?\d+(?:\.\d+)?)H)?(?:([+-]?\d+(?:\.\d+)?)M)?(?:([+-]?\d+(?:\.\d+)?)S)?)?$/.exec( ++ isoString ++ ); ++ ++ assert.ok(match, 'expected an ISO 8601 duration string, got ' + isoString); ++ ++ const globalSign = match[1] === '-' ? -1 : 1; ++ return { ++ years: match[2] === undefined ? 0 : globalSign * Number(match[2]), ++ months: match[3] === undefined ? 0 : globalSign * Number(match[3]), ++ days: match[4] === undefined ? 0 : globalSign * Number(match[4]), ++ hours: match[5] === undefined ? 0 : globalSign * Number(match[5]), ++ minutes: match[6] === undefined ? 0 : globalSign * Number(match[6]), ++ seconds: match[7] === undefined ? 0 : globalSign * Number(match[7]), ++ }; ++} ++ ++test('serializes zero and positive day-time buckets as ISO durations', function () { ++ ++ ++ assert.strictEqual(moment.duration(0).toISOString(), 'P0D'); ++ assert.strictEqual( ++ moment ++ .duration({ ++ days: 1, ++ hours: 2, ++ minutes: 3, ++ seconds: 4, ++ milliseconds: 5, ++ }) ++ .toISOString(), ++ 'P1DT2H3M4.005S' ++ ); ++}); ++ ++test('keeps month buckets separate from day and time buckets', function () { ++ ++ ++ assert.strictEqual( ++ moment.duration({ months: 14 }).toISOString(), ++ 'P1Y2M' ++ ); ++ assert.strictEqual( ++ moment.duration({ months: 16, days: 40, seconds: 86465 }).toISOString(), ++ 'P1Y4M40DT24H1M5S' ++ ); ++}); ++ ++test('preserves independent sign rules for mixed internal buckets', function () { ++ ++ ++ ++ assert.deepStrictEqual( ++ parseIsoDurationComponents( ++ moment.duration({ years: -1, hours: 1 }).toISOString() ++ ), ++ { years: -1, months: 0, days: 0, hours: 1, minutes: 0, seconds: 0 } ++ ); ++ ++ assert.deepStrictEqual( ++ parseIsoDurationComponents( ++ moment.duration({ years: -1, days: 2 }).toISOString() ++ ), ++ { years: -1, months: 0, days: 2, hours: 0, minutes: 0, seconds: 0 } ++ ); ++ ++ assert.deepStrictEqual( ++ parseIsoDurationComponents( ++ moment ++ .duration({ years: -1, hours: 1, seconds: -1 }) ++ .toISOString() ++ ), ++ { years: -1, months: 0, days: 0, hours: 0, minutes: 59, seconds: 59 } ++ ); ++ ++ assert.deepStrictEqual( ++ parseIsoDurationComponents( ++ moment ++ .duration({ ++ months: 2, ++ days: -3, ++ hours: 4, ++ minutes: -5, ++ milliseconds: 6, ++ }) ++ .toISOString() ++ ), ++ { ++ years: 0, ++ months: 2, ++ days: -3, ++ hours: 3, ++ minutes: 55, ++ seconds: 0.006, ++ } ++ ); ++}); ++ ++test('returns localized invalid-date text for invalid durations', function () { ++ ++ ++ const invalid = moment.duration.invalid(); ++ const invalidDateText = invalid.localeData().invalidDate(); ++ ++ ++ assert.strictEqual(invalidDateText, 'Invalid date'); ++ assert.strictEqual(invalid.toISOString(), invalidDateText); ++ assert.strictEqual(invalid.toString(), invalidDateText); ++ assert.strictEqual(invalid.toJSON(), invalidDateText); ++}); ++ ++test('toString, implicit String, and toJSON expose the same ISO value', function () { ++ ++ ++ const duration = moment.duration({ ++ days: 1, ++ hours: 2, ++ minutes: 3, ++ seconds: 4, ++ milliseconds: 5, ++ }); ++ ++ assert.strictEqual(duration.toISOString(), 'P1DT2H3M4.005S'); ++ assert.strictEqual(duration.toString(), 'P1DT2H3M4.005S'); ++ assert.strictEqual(String(duration), 'P1DT2H3M4.005S'); ++ assert.strictEqual(duration.toJSON(), 'P1DT2H3M4.005S'); ++ assert.strictEqual( ++ JSON.stringify({ elapsed: duration }), ++ '{"elapsed":"P1DT2H3M4.005S"}' ++ ); ++}); ++ ++test('toIsoString delegates to the serializer and emits its deprecation warning', function () { ++ ++ ++ const oldSuppress = moment.suppressDeprecationWarnings; ++ const oldHandler = moment.deprecationHandler; ++ const warnings = []; ++ ++ moment.suppressDeprecationWarnings = true; ++ moment.deprecationHandler = function (name, msg) { ++ warnings.push({ name: name, msg: msg }); ++ }; ++ ++ try { ++ assert.strictEqual( ++ moment.duration({ months: 14 }).toIsoString(), ++ 'P1Y2M' ++ ); ++ ++ assert.strictEqual(warnings.length, 1); ++ assert.strictEqual(typeof warnings[0].msg, 'string'); ++ assert.ok(warnings[0].msg.indexOf('toIsoString()') !== -1); ++ assert.ok(warnings[0].msg.indexOf('toISOString()') !== -1); ++ } finally { ++ moment.suppressDeprecationWarnings = oldSuppress; ++ moment.deprecationHandler = oldHandler; ++ } ++}); ++ ++test('duration instances keep their own serialized state after one is mutated', function () { ++ ++ ++ const a = moment.duration({ months: 14 }); ++ const b = moment.duration(0); ++ ++ assert.strictEqual(a.toISOString(), 'P1Y2M'); ++ assert.strictEqual(b.toISOString(), 'P0D'); ++ a.add({ days: 1, hours: 2 }); ++ assert.strictEqual(a.toISOString(), 'P1Y2M1DT2H'); ++ assert.strictEqual(b.toISOString(), 'P0D'); ++}); +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,22 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++set -euo pipefail ++ ++cd /workspace/repo ++ ++if [ ! -x node_modules/.bin/grunt ]; then ++ echo "node_modules is missing the local grunt binary required for offline test execution" >&2 ++ exit 1 ++fi ++ ++./node_modules/.bin/grunt transpile-raw ++node /workspace/repo/usercase-test-coderl/duration_iso.test.js diff --git a/tasks/format-code-task-001959/tests/test.sh b/tasks/format-code-task-001959/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..18731fe9cb7373b59acec96620b4ce4fd0abc06e --- /dev/null +++ b/tasks/format-code-task-001959/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/duration_iso.test.js +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001959/tests/test_command.sh b/tasks/format-code-task-001959/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-001959/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001961/environment/Dockerfile b/tasks/format-code-task-001961/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..c7eb9653df09967df3a675f49a3dfe889261e44e --- /dev/null +++ b/tasks/format-code-task-001961/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:88d26ce6334027461d7a704817d3694efc2fc9764ff7b9fbe1aa8c29580a2162 diff --git a/tasks/format-code-task-001961/environment/setup/files/blocklist b/tasks/format-code-task-001961/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001961/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001961/environment/setup/setup.sh b/tasks/format-code-task-001961/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001961/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001961/tests/test.patch b/tasks/format-code-task-001961/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..fc4097388ea8e139d8a6419e6fca565621b9e5d2 --- /dev/null +++ b/tasks/format-code-task-001961/tests/test.patch @@ -0,0 +1,56 @@ +diff --git a/src/libbson/tests/test-bson.c b/src/libbson/tests/test-bson.c +index f2b91d23701..d16395d563c 100644 +--- a/src/libbson/tests/test-bson.c ++++ b/src/libbson/tests/test-bson.c +@@ -1119,6 +1119,18 @@ test_bson_validate_dbpointer (void) + } + + ++static void ++test_bson_validate_with_error_and_offset (void) ++{ ++ size_t err_offset = 12345; ++ bson_error_t err = {67890}; ++ bson_t bson = {0}; ++ ASSERT (!bson_validate_with_error_and_offset (&bson, BSON_VALIDATE_NONE, &err_offset, &err)); ++ ASSERT_CMPSIZE_T (err_offset, ==, 0); ++ ASSERT_CMPUINT32 (err.domain, !=, 67890); ++} ++ ++ + static void + test_bson_validate (void) + { +@@ -3227,6 +3239,7 @@ test_bson_install (TestSuite *suite) + TestSuite_Add (suite, "/bson/validate/dbref", test_bson_validate_dbref); + TestSuite_Add (suite, "/bson/validate/bool", test_bson_validate_bool); + TestSuite_Add (suite, "/bson/validate/dbpointer", test_bson_validate_dbpointer); ++ TestSuite_Add (suite, "/bson/validate/with_error_and_offset", test_bson_validate_with_error_and_offset); + TestSuite_Add (suite, "/bson/new_1mm", test_bson_new_1mm); + TestSuite_Add (suite, "/bson/init_1mm", test_bson_init_1mm); + TestSuite_Add (suite, "/bson/build_child", test_bson_build_child); +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,9 @@ ++H4sIAAAAAAAAA+3SW2+bMBQAYJ75FUfdpHaTuGWBPuUBAp2iURIN+tBpEuLiEG9gVzZU278fcVo1 ++S7N1D62maed7wHB84djHZjnQts4Ju7W0l2KPzl1XtaPDVr077sSeeK537k0023E8Z6qB+2IZ7Rlk ++XwgATXDe/27cU/3/KPOh/j2RfV7xritYbcrN8/3jifo79ru9+tvTsf5Tz/E0sJ8vhV/7z+tf1aAK ++X5Ja11/BnLM1bQZB9KorvhIwUjDBCEB95equwGcdwAijxA/iKM+iNEtny+Tn6OUyeb+cPwqnmZ8t ++joTTeLa8uDgI+kejib9aXT+Of0qz8Eg0XgSz4CoJ4yi865lf+h+iPLhaxGGeXa+iWUjKodluPVCb ++6zcEtucBJWWF+H5/DMZu6/vHYBjjxWlIr4YbLS07zhpegfHl5PUZuxG8enOyXffjwKBoWzVMAhe0 ++GVfuKWtgLXgHUlTWOLmUnKlCSPU0tt9mNU7PNkQSKAQBQRoqeyJIDQOriVC5Wmoi3Aiypt+AsocN ++yIH2RDetvZytu5/tMrUOE2/hdLfc21P9b99LhBBCCCGEEEIIIYQQQgghhBBCCCH0Z34AxuABOAAo ++AAA= +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-001961/tests/test.sh b/tasks/format-code-task-001961/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..2ee0622f31456f50b9ec4ca0ddae1e58095d1905 --- /dev/null +++ b/tasks/format-code-task-001961/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +src/libbson/tests/test-bson.c +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001961/tests/test_command.sh b/tasks/format-code-task-001961/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001961/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001966/environment/Dockerfile b/tasks/format-code-task-001966/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..21db7ca0d04ba5f4716996afd41c03528c31aa66 --- /dev/null +++ b/tasks/format-code-task-001966/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:c8925b2877539bc760f059c2961fa48284b457063444e464fcd37f84955bd1ba diff --git a/tasks/format-code-task-001966/environment/setup/files/blocklist b/tasks/format-code-task-001966/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001966/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001966/environment/setup/setup.sh b/tasks/format-code-task-001966/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-001966/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001966/tests/test.patch b/tasks/format-code-task-001966/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..9db7597d932a71a0ea5bba91c6a0898e463117af --- /dev/null +++ b/tasks/format-code-task-001966/tests/test.patch @@ -0,0 +1,247 @@ +diff --git a/usercase-test-coderl/test_string_query_operators.py b/usercase-test-coderl/test_string_query_operators.py +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/test_string_query_operators.py +@@ -0,0 +1,220 @@ ++ ++ ++ ++ ++ ++ ++import mongomock ++ ++from mongoengine import ( ++ ConnectionFailure, ++ DictField, ++ Document, ++ Q, ++ StringField, ++ connect, ++ disconnect, ++) ++ ++ ++class Person(Document): ++ name = StringField() ++ info = DictField() ++ ++ meta = {"collection": "usercase_string_operator_people"} ++ ++ ++def setup_function(): ++ disconnect() ++ connect( ++ "usercase_string_operator_db", ++ alias="default", ++ mongo_client_class=mongomock.MongoClient, ++ ) ++ Person.drop_collection() ++ ++ ++def teardown_function(): ++ try: ++ Person.drop_collection() ++ except ConnectionFailure: ++ pass ++ finally: ++ disconnect() ++ ++ ++def seed_people(): ++ Person(name="Guido van Rossum", info={"title": "test"}).save() ++ Person(name="Ada [.'Geek Lovelace", info={"title": "Test"}).save() ++ ++ ++def test_contains_icontains_first_results_are_stateful_after_saves(): ++ ++ ++ ++ ++ assert Person.objects.count() == 0 ++ ++ seed_people() ++ ++ contains_hit = Person.objects(name__contains="van").first() ++ contains_case_miss = Person.objects(name__contains="Van").first() ++ icontains_hit = Person.objects(name__icontains="Van").first() ++ ++ assert Person.objects.count() == 2 ++ assert contains_hit.name == "Guido van Rossum" ++ assert contains_case_miss is None ++ assert icontains_hit.name == "Guido van Rossum" ++ ++ ++def test_chained_filter_supports_prefix_and_suffix_operators(): ++ ++ ++ ++ ++ seed_people() ++ ++ chained = Person.objects.filter(name__startswith="Guido").filter( ++ name__endswith="Rossum" ++ ) ++ prefix_only = Person.objects.filter(name__startswith="van") ++ suffix_only = Person.objects.filter(name__endswith="Guido") ++ ++ assert chained.count() == 1 ++ assert chained.first().name == "Guido van Rossum" ++ assert prefix_only.count() == 0 ++ assert suffix_only.count() == 0 ++ ++ ++def test_case_insensitive_prefix_suffix_and_exact_boundaries(): ++ ++ ++ ++ ++ seed_people() ++ ++ assert Person.objects(name__istartswith="guido").count() == 1 ++ assert Person.objects(name__iendswith="rossum").count() == 1 ++ assert Person.objects(name__exact="Guido van Rossum").count() == 1 ++ assert Person.objects(name__iexact="gUIDO VAN rOSSUM").count() == 1 ++ assert Person.objects(name__exact="Guido").count() == 0 ++ ++ ++def test_wholeword_and_iwholeword_match_only_word_boundaries(): ++ ++ ++ ++ ++ seed_people() ++ ++ assert Person.objects(name__wholeword="Guido").count() == 1 ++ assert Person.objects(name__wholeword="Rossu").count() == 0 ++ assert Person.objects(name__iwholeword="rOSSUM").count() == 1 ++ ++ ++def test_regex_and_iregex_use_supplied_pattern(): ++ ++ ++ ++ ++ seed_people() ++ ++ assert Person.objects(name__regex="van R.*").count() == 1 ++ assert Person.objects(name__regex="guido.*rossum").count() == 0 ++ assert Person.objects(name__iregex="guido.*rossum").count() == 1 ++ ++ ++def test_literal_string_operators_escape_user_text(): ++ ++ ++ ++ ++ seed_people() ++ ++ match = Person.objects(name__icontains="[.'Geek").first() ++ ++ ++ assert match is not None ++ assert "[.'Geek" in match.name ++ assert Person.objects(name__contains="[.'geek").count() == 0 ++ ++ ++def test_q_expression_and_dict_field_string_operator_support(): ++ ++ ++ ++ ++ seed_people() ++ ++ assert Person.objects(Q(name__icontains="VAN")).count() == 1 ++ assert Person.objects(Q(name__icontains="missing")).count() == 0 ++ assert Person.objects(info__title__exact="test").count() == 1 ++ assert Person.objects(info__title__exact="Test").count() == 1 ++ assert Person.objects(info__title__exact="tes").count() == 0 ++ ++ ++def test_first_execution_with_contains_returns_matching_document(): ++ ++ ++ ++ ++ seed_people() ++ ++ match = Person.objects(name__contains="van").first() ++ ++ ++ assert match is not None ++ assert match.name == "Guido van Rossum" ++ ++ ++def test_count_execution_with_icontains_filters_case_insensitively(): ++ ++ ++ ++ ++ seed_people() ++ ++ ++ assert Person.objects(name__icontains="VAN").count() == 1 ++ assert Person.objects(name__icontains="missing").count() == 0 ++ ++ ++def test_dict_field_accepts_multiple_string_operators(): ++ ++ ++ ++ ++ seed_people() ++ ++ ++ assert Person.objects(info__title__contains="es").count() == 2 ++ assert Person.objects(info__title__icontains="TE").count() == 2 ++ assert Person.objects(info__title__startswith="te").count() == 1 ++ assert Person.objects(info__title__endswith="st").count() == 2 ++ ++ ++def test_repeated_queries_cover_string_operator_family(): ++ ++ ++ ++ ++ seed_people() ++ ++ ++ cases = [ ++ (Person.objects(name__contains="van"), 1), ++ (Person.objects(name__icontains="VAN"), 1), ++ (Person.objects(name__startswith="Guido"), 1), ++ (Person.objects(name__istartswith="ada"), 1), ++ (Person.objects(name__endswith="Rossum"), 1), ++ (Person.objects(name__iendswith="lovelace"), 1), ++ (Person.objects(name__exact="Guido van Rossum"), 1), ++ (Person.objects(name__iexact="ADA [.'GEEK LOVELACE"), 1), ++ (Person.objects(name__wholeword="Geek"), 1), ++ (Person.objects(name__iwholeword="rossum"), 1), ++ (Person.objects(name__regex=r"Guido\s+van"), 1), ++ (Person.objects(name__iregex=r"ada\s+\["), 1), ++ ] ++ ++ for queryset, expected_count in cases: ++ assert queryset.count() == expected_count +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,17 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++set -euo pipefail ++cd /workspace/repo ++ ++export PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 ++ ++exec /opt/usercase-stage4a-venv/bin/python -m pytest /workspace/repo/usercase-test-coderl/test_string_query_operators.py -v diff --git a/tasks/format-code-task-001966/tests/test.sh b/tasks/format-code-task-001966/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7ebe8ff946fc8a5702c83b5b539087dbed5921b6 --- /dev/null +++ b/tasks/format-code-task-001966/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/test_string_query_operators.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001966/tests/test_command.sh b/tasks/format-code-task-001966/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-001966/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-001992/environment/Dockerfile b/tasks/format-code-task-001992/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..62fc4976f253234939daf5e7fee42d53c1b9270b --- /dev/null +++ b/tasks/format-code-task-001992/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:bf0e1156b727d520b3a3fc4a36d1710399482c3a78276f9edd55672db84d2dac diff --git a/tasks/format-code-task-001992/environment/setup/files/blocklist b/tasks/format-code-task-001992/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001992/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001992/environment/setup/setup.sh b/tasks/format-code-task-001992/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001992/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001992/tests/test.patch b/tasks/format-code-task-001992/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..14251dab075f5bfd04ff3363c38002c1805d4fea --- /dev/null +++ b/tasks/format-code-task-001992/tests/test.patch @@ -0,0 +1,231 @@ +diff --git a/integration_tests/test_drawing_matplotlib_backend.py b/integration_tests/test_drawing_matplotlib_backend.py +index b269f6de0..6279bd0e8 100644 +--- a/integration_tests/test_drawing_matplotlib_backend.py ++++ b/integration_tests/test_drawing_matplotlib_backend.py +@@ -5,7 +5,9 @@ import pytest + + plt = pytest.importorskip('matplotlib.pyplot') + ++from ezdxf.addons.drawing.properties import Properties + from ezdxf.addons.drawing.matplotlib import MatplotlibBackend ++from ezdxf.math import Matrix44 + + + @pytest.fixture() +@@ -16,3 +18,29 @@ def backend(): + + def test_get_text_width(backend): + assert backend.get_text_line_width(' abc', 100) > backend.get_text_line_width('abc', 100) ++ ++ ++def test_get_text_width_whitespace_only_is_zero(backend): ++ assert backend.get_text_line_width('abc', 100) > 0 ++ assert backend.get_text_line_width(' ', 100) == 0 ++ assert backend.get_text_line_width('\t \t', 100) == 0 ++ ++ ++class _TextEntity: ++ def dxftype(self): ++ return 'TEXT' ++ ++ ++def test_draw_text_ignores_whitespace_only_text(backend): ++ entity = _TextEntity() ++ properties = Properties() ++ transform = Matrix44() ++ backend.enter_entity(entity, properties) ++ ++ before = len(backend.ax.patches) ++ backend.draw_text(' \t ', transform, properties, cap_height=1.0) ++ assert len(backend.ax.patches) == before ++ ++ backend.draw_text(' visible ', transform, properties, cap_height=1.0) ++ assert len(backend.ax.patches) == before + 1 ++ backend.exit_entity(entity) +diff --git a/integration_tests/test_drawing_pyqt5_backend.py b/integration_tests/test_drawing_pyqt5_backend.py +index ccabc1672..66c573b42 100644 +--- a/integration_tests/test_drawing_pyqt5_backend.py ++++ b/integration_tests/test_drawing_pyqt5_backend.py +@@ -5,7 +5,9 @@ import pytest + + qc = pytest.importorskip('PyQt5.QtCore') + from PyQt5 import QtWidgets as qw ++from ezdxf.addons.drawing.properties import Properties + from ezdxf.addons.drawing.pyqt import PyQtBackend ++from ezdxf.math import Matrix44 + + _app = None + +@@ -20,3 +22,27 @@ def backend(): + + def test_get_text_width(backend): + assert backend.get_text_line_width(' abc', 100) > backend.get_text_line_width('abc', 100) ++ ++ ++def test_get_text_width_whitespace_only_is_zero(backend): ++ assert backend.get_text_line_width('abc', 100) > 0 ++ assert backend.get_text_line_width(' ', 100) == 0 ++ assert backend.get_text_line_width('\t \t', 100) == 0 ++ ++ entity = _TextEntity() ++ properties = Properties() ++ transform = Matrix44() ++ backend.enter_entity(entity, properties) ++ ++ before = len(backend.scene.items()) ++ backend.draw_text(' \t ', transform, properties, cap_height=1.0) ++ assert len(backend.scene.items()) == before ++ ++ backend.draw_text(' visible ', transform, properties, cap_height=1.0) ++ assert len(backend.scene.items()) == before + 1 ++ backend.exit_entity(entity) ++ ++ ++class _TextEntity: ++ def dxftype(self): ++ return 'TEXT' +diff --git a/tests/test_06_math/test_630_bezier4p.py b/tests/test_06_math/test_630_bezier4p.py +index 3db27b15e..3d089252d 100644 +--- a/tests/test_06_math/test_630_bezier4p.py ++++ b/tests/test_06_math/test_630_bezier4p.py +@@ -128,6 +128,20 @@ def test_rational_spline_from_complex_elliptic_arc(): + assert curves[1].control_points[-1].isclose(ellipse.end_point) + + ++def test_approximate_rejects_non_positive_segments(): ++ curve = Bezier4P([(0, 0), (0, 1), (1, 1), (1, 0)]) ++ with pytest.raises(ValueError): ++ list(curve.approximate(0)) ++ with pytest.raises(ValueError): ++ list(curve.approximate(-1)) ++ ++ ++def test_approximate_positive_segments_unchanged(): ++ curve = Bezier4P([(0, 0), (0, 1), (1, 1), (1, 0)]) ++ assert list(curve.approximate(1)) == [(0, 0), (1, 0)] ++ assert list(curve.approximate(2)) == [(0, 0), (0.5, 0.75), (1, 0)] ++ ++ + def test_reverse(): + curve = Bezier4P(DEFPOINTS2D) + vertices = list(curve.approximate(10)) +diff --git a/tests/test_08_addons/test_811_drawing_frontend.py b/tests/test_08_addons/test_811_drawing_frontend.py +index 92f87f9cd..23260dc3d 100644 +--- a/tests/test_08_addons/test_811_drawing_frontend.py ++++ b/tests/test_08_addons/test_811_drawing_frontend.py +@@ -9,6 +9,7 @@ from ezdxf.addons.drawing.text import FontMeasurements + from ezdxf.addons.drawing.type_hints import Radians + from ezdxf.drawing import Drawing + from ezdxf.entities import DXFGraphic ++from ezdxf.entities.insert import Insert + from ezdxf.render.forms import cube + from ezdxf.render import Path + from ezdxf.math import Vector, Matrix44 +@@ -65,6 +66,15 @@ class PathBackend(BasicBackend): + self.collector.append(('path', path, properties)) + + ++class LoggingFrontend(Frontend): ++ def __init__(self, ctx: RenderContext, out: Backend): ++ super().__init__(ctx, out) ++ self.messages = [] ++ ++ def log_message(self, message: str): ++ self.messages.append(message) ++ ++ + @pytest.fixture + def doc(): + d = ezdxf.new() +@@ -211,6 +221,37 @@ def test_polyline_3d_path(msp, path_backend): + assert unique_types(result) == {'path'} + + ++def test_insert_virtual_entity_skip_is_logged_only_for_skipped_virtual_entities(monkeypatch): ++ doc = ezdxf.new() ++ block = doc.blocks.new('SKIP_LOG_BLOCK') ++ block.add_line((0, 0), (1, 0)) ++ msp = doc.modelspace() ++ control_insert = msp.add_blockref('SKIP_LOG_BLOCK', (0, 0)) ++ skipped_insert = msp.add_blockref('SKIP_LOG_BLOCK', (2, 0)) ++ skipped_entity = block.add_line((0, 1), (1, 1)) ++ original_virtual_entities = Insert.virtual_entities ++ ++ def virtual_entities_with_one_skip(insert, *args, **kwargs): ++ callback = kwargs.get('skipped_entity_callback') ++ if insert is skipped_insert and callback is not None: ++ callback(skipped_entity, 'synthetic skipped virtual entity') ++ yield from original_virtual_entities(insert, *args, **kwargs) ++ ++ monkeypatch.setattr(Insert, 'virtual_entities', virtual_entities_with_one_skip) ++ ++ control_backend = BasicBackend() ++ control_frontend = LoggingFrontend(RenderContext(doc), control_backend) ++ control_frontend.draw_entities([control_insert]) ++ assert control_frontend.messages == [] ++ assert any(record[0] == 'line' for record in control_backend.collector) ++ ++ skipped_backend = BasicBackend() ++ skipped_frontend = LoggingFrontend(RenderContext(doc), skipped_backend) ++ skipped_frontend.draw_entities([skipped_insert]) ++ assert len(skipped_frontend.messages) == 1 ++ assert any(record[0] == 'line' for record in skipped_backend.collector) ++ ++ + def test_2d_arc_basic(msp, basic): + msp.add_circle((0, 0), radius=2) + msp.add_arc((0, 0), radius=2, start_angle=30, end_angle=60, +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,49 @@ ++#!/bin/bash ++set -uo pipefail ++ ++cd /testbed ++set +u ++source /root/ezdxf_venv/bin/activate ++set -u ++pip install -e . --no-deps --no-input 2>/dev/null ++ ++case "${1:-}" in ++ base) ++ QT_QPA_PLATFORM=offscreen xvfb-run -a python3 -m pytest \ ++ tests/test_06_math/test_630_bezier4p.py \ ++ tests/test_08_addons/test_811_drawing_frontend.py \ ++ integration_tests/test_drawing_matplotlib_backend.py \ ++ -k 'not approximate_rejects_non_positive_segments and not approximate_positive_segments_unchanged and not insert_virtual_entity_skip_is_logged_only_for_skipped_virtual_entities and not get_text_width_whitespace_only_is_zero and not draw_text_ignores_whitespace_only_text' \ ++ -v ++ base_non_pyqt=$? ++ QT_QPA_PLATFORM=offscreen xvfb-run -a python3 -m pytest \ ++ integration_tests/test_drawing_pyqt5_backend.py \ ++ -k 'not get_text_width_whitespace_only_is_zero' \ ++ -v ++ base_pyqt=$? ++ if [ "$base_non_pyqt" -ne 0 ] || [ "$base_pyqt" -ne 0 ]; then ++ exit 1 ++ fi ++ ;; ++ new) ++ QT_QPA_PLATFORM=offscreen xvfb-run -a python3 -m pytest \ ++ tests/test_06_math/test_630_bezier4p.py::test_approximate_rejects_non_positive_segments \ ++ tests/test_06_math/test_630_bezier4p.py::test_approximate_positive_segments_unchanged \ ++ tests/test_08_addons/test_811_drawing_frontend.py::test_insert_virtual_entity_skip_is_logged_only_for_skipped_virtual_entities \ ++ integration_tests/test_drawing_matplotlib_backend.py::test_get_text_width_whitespace_only_is_zero \ ++ integration_tests/test_drawing_matplotlib_backend.py::test_draw_text_ignores_whitespace_only_text \ ++ -v ++ new_non_pyqt=$? ++ QT_QPA_PLATFORM=offscreen xvfb-run -a python3 -m pytest \ ++ integration_tests/test_drawing_pyqt5_backend.py::test_get_text_width_whitespace_only_is_zero \ ++ -v ++ new_pyqt=$? ++ if [ "$new_non_pyqt" -ne 0 ] || [ "$new_pyqt" -ne 0 ]; then ++ exit 1 ++ fi ++ ;; ++ *) ++ echo "usage: $0 base|new" ++ exit 2 ++ ;; ++esac diff --git a/tasks/format-code-task-001992/tests/test.sh b/tasks/format-code-task-001992/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..4ce0e5c44c06d44c1f4bf16bdf4d73f88c3b0f08 --- /dev/null +++ b/tasks/format-code-task-001992/tests/test.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +integration_tests/test_drawing_matplotlib_backend.py +integration_tests/test_drawing_pyqt5_backend.py +tests/test_06_math/test_630_bezier4p.py +tests/test_08_addons/test_811_drawing_frontend.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001992/tests/test_command.sh b/tasks/format-code-task-001992/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..e8d2f32b64045b5a5a56e0ad5667da87d8e0bc2a --- /dev/null +++ b/tasks/format-code-task-001992/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new \ No newline at end of file diff --git a/tasks/format-code-task-001995/environment/Dockerfile b/tasks/format-code-task-001995/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..ec11d017cf299a7f50ce7138c57a982c0579c8be --- /dev/null +++ b/tasks/format-code-task-001995/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:5812e2fbfec8a17ef0661851632bd315a533b01af74d041daa54c60d338930b2 diff --git a/tasks/format-code-task-001995/environment/setup/files/blocklist b/tasks/format-code-task-001995/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-001995/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-001995/environment/setup/setup.sh b/tasks/format-code-task-001995/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-001995/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-001995/tests/test.patch b/tasks/format-code-task-001995/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..65bfab904a1108fffe5f848d645936247d086846 --- /dev/null +++ b/tasks/format-code-task-001995/tests/test.patch @@ -0,0 +1,272 @@ +diff --git a/test/junit-report.test.js b/test/junit-report.test.js +new file mode 100644 +index 0000000..aa495a9 +--- /dev/null ++++ b/test/junit-report.test.js +@@ -0,0 +1,244 @@ ++/* eslint-env mocha */ ++const chai = require('chai') ++chai.should() ++const fs = require('fs') ++const os = require('os') ++const path = require('path') ++const sax = require('sax') ++const generateReport = require('../lib/cucumber-junit-report') ++ ++const outDir = path.join(os.tmpdir(), 'nwc-junit-report-test') ++ ++let counter = 0 ++function generate (featureOutput, options) { ++ counter += 1 ++ const output = path.join(outDir, `report-${counter}.xml`) ++ generateReport(Object.assign({ output }, options), featureOutput) ++ return parse(fs.readFileSync(output, 'utf8')) ++} ++ ++ ++ ++function parse (xml) { ++ const parser = sax.parser(true) ++ const suites = [] ++ let suite ++ let testCase ++ parser.onopentag = (node) => { ++ const attrs = node.attributes ++ switch (node.name) { ++ case 'testsuite': ++ suite = { name: attrs.name, cases: [] } ++ suites.push(suite) ++ break ++ case 'testcase': ++ testCase = { ++ classname: attrs.classname, ++ name: attrs.name, ++ failure: null, ++ error: null, ++ skipped: false ++ } ++ suite.cases.push(testCase) ++ break ++ case 'failure': ++ testCase.failure = attrs.message || '' ++ break ++ case 'error': ++ testCase.error = attrs.message || '' ++ break ++ case 'skipped': ++ testCase.skipped = true ++ break ++ } ++ } ++ parser.write(xml).close() ++ return { suites } ++} ++ ++function step (name, status, errorMessage) { ++ return { ++ keyword: 'Given ', ++ name, ++ match: { location: 'steps.js:1' }, ++ result: errorMessage ? { status, error_message: errorMessage } : { status } ++ } ++} ++ ++function scenario (name, steps) { ++ return { name, type: 'scenario', steps } ++} ++ ++function feature (name, scenarios) { ++ return { name, elements: scenarios } ++} ++ ++describe('JUnit report generation', () => { ++ it('emits one suite per feature and one case per scenario with default naming', () => { ++ const report = generate([ ++ feature('addition', [ ++ scenario('small numbers', [step('a', 'passed')]), ++ scenario('big numbers', [step('b', 'passed')]) ++ ]), ++ feature('subtraction', [ ++ scenario('small numbers', [step('c', 'passed')]) ++ ]) ++ ]) ++ ++ report.suites.length.should.equal(2) ++ report.suites[0].name.should.equal('Feature: addition') ++ report.suites[1].name.should.equal('Feature: subtraction') ++ ++ report.suites[0].cases.length.should.equal(2) ++ report.suites[0].cases[0].classname.should.equal('Feature: addition') ++ report.suites[0].cases[0].name.should.equal('Scenario: small numbers') ++ report.suites[0].cases[1].name.should.equal('Scenario: big numbers') ++ report.suites[1].cases[0].classname.should.equal('Feature: subtraction') ++ report.suites[1].cases[0].name.should.equal('Scenario: small numbers') ++ }) ++ ++ it('honors configurable name prefixes', () => { ++ const report = generate([ ++ feature('addition', [scenario('small numbers', [step('a', 'passed')])]) ++ ], { ++ suiteNamePrefix: 'F> ', ++ classNamePrefix: 'C> ', ++ scenarioNamePrefix: 'S> ' ++ }) ++ ++ report.suites[0].name.should.equal('F> addition') ++ report.suites[0].cases[0].classname.should.equal('C> addition') ++ report.suites[0].cases[0].name.should.equal('S> small numbers') ++ }) ++ ++ it('emits an empty suite for a feature without scenarios', () => { ++ const report = generate([feature('empty', [])]) ++ ++ report.suites.length.should.equal(1) ++ report.suites[0].name.should.equal('Feature: empty') ++ report.suites[0].cases.length.should.equal(0) ++ }) ++ ++ it('marks a passing scenario clean', () => { ++ const report = generate([ ++ feature('f', [scenario('all good', [step('a', 'passed'), step('b', 'passed')])]) ++ ]) ++ ++ const c = report.suites[0].cases[0] ++ chai.expect(c.failure).to.equal(null) ++ chai.expect(c.error).to.equal(null) ++ c.skipped.should.equal(false) ++ }) ++ ++ it('records a scenario with a failed step as a failure naming the step and its error', () => { ++ const report = generate([ ++ feature('f', [ ++ scenario('boom', [ ++ step('a', 'passed'), ++ step('explode', 'failed', 'expected 8 but got 9') ++ ]) ++ ]) ++ ]) ++ ++ const c = report.suites[0].cases[0] ++ c.failure.should.be.a('string') ++ c.failure.should.contain('explode') ++ c.failure.should.contain('expected 8 but got 9') ++ chai.expect(c.error).to.equal(null) ++ c.skipped.should.equal(false) ++ }) ++ ++ it('mentions every failing step in the failure message', () => { ++ const report = generate([ ++ feature('f', [ ++ scenario('multi', [ ++ step('first bad', 'failed', 'first error'), ++ step('second bad', 'failed', 'second error') ++ ]) ++ ]) ++ ]) ++ ++ const c = report.suites[0].cases[0] ++ c.failure.should.contain('first bad') ++ c.failure.should.contain('first error') ++ c.failure.should.contain('second bad') ++ c.failure.should.contain('second error') ++ }) ++ ++ it('records a scenario with an ambiguous step as an error naming the step', () => { ++ const report = generate([ ++ feature('f', [ ++ scenario('amb', [step('a', 'passed'), step('which one', 'ambiguous')]) ++ ]) ++ ]) ++ ++ const c = report.suites[0].cases[0] ++ c.error.should.be.a('string') ++ c.error.should.contain('which one') ++ chai.expect(c.failure).to.equal(null) ++ c.skipped.should.equal(false) ++ }) ++ ++ it('records a scenario with an undefined step as skipped', () => { ++ const report = generate([ ++ feature('f', [scenario('undef', [step('a', 'passed'), step('b', 'undefined')])]) ++ ]) ++ ++ const c = report.suites[0].cases[0] ++ c.skipped.should.equal(true) ++ chai.expect(c.failure).to.equal(null) ++ chai.expect(c.error).to.equal(null) ++ }) ++ ++ it('records a scenario with a pending step as skipped', () => { ++ const report = generate([ ++ feature('f', [scenario('pend', [step('a', 'passed'), step('b', 'pending')])]) ++ ]) ++ ++ const c = report.suites[0].cases[0] ++ c.skipped.should.equal(true) ++ chai.expect(c.failure).to.equal(null) ++ chai.expect(c.error).to.equal(null) ++ }) ++ ++ it('lets a failure outrank an undefined step in the same scenario', () => { ++ const report = generate([ ++ feature('f', [ ++ scenario('mixed', [ ++ step('bad', 'failed', 'kaboom'), ++ step('missing', 'undefined') ++ ]) ++ ]) ++ ]) ++ ++ const c = report.suites[0].cases[0] ++ c.failure.should.be.a('string') ++ c.skipped.should.equal(false) ++ chai.expect(c.error).to.equal(null) ++ }) ++ ++ it('lets an ambiguous step outrank a pending step when no step failed', () => { ++ const report = generate([ ++ feature('f', [ ++ scenario('mixed', [ ++ step('which one', 'ambiguous'), ++ step('later', 'pending') ++ ]) ++ ]) ++ ]) ++ ++ const c = report.suites[0].cases[0] ++ c.error.should.be.a('string') ++ c.skipped.should.equal(false) ++ chai.expect(c.failure).to.equal(null) ++ }) ++ ++ it('produces a self-contained document per invocation', () => { ++ generate([feature('first', [scenario('s1', [step('a', 'passed')])])]) ++ const second = generate([feature('second', [scenario('s2', [step('b', 'passed')])])]) ++ ++ second.suites.length.should.equal(1) ++ second.suites[0].name.should.equal('Feature: second') ++ second.suites.map((s) => s.name).should.not.contain('Feature: first') ++ }) ++}) +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,17 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++set -euo pipefail ++HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ++cd /testbed ++ ++ ++ ++ ++ ++./node_modules/.bin/eslint lib resources ++ ++ ++./node_modules/.bin/mocha test/junit-report.test.js diff --git a/tasks/format-code-task-001995/tests/test.sh b/tasks/format-code-task-001995/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..c7332c9d6fbcb50affc36b04922b73e208e69014 --- /dev/null +++ b/tasks/format-code-task-001995/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test/junit-report.test.js +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-001995/tests/test_command.sh b/tasks/format-code-task-001995/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-001995/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002001/environment/Dockerfile b/tasks/format-code-task-002001/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..354019f3c88db90fb1dd527dc9e01dcdeca3aeab --- /dev/null +++ b/tasks/format-code-task-002001/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:d7ea8aae4b1b6410a428a74a41fa840397e8b23cc85de03bafd2c14f3dc578dd diff --git a/tasks/format-code-task-002001/environment/setup/files/blocklist b/tasks/format-code-task-002001/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002001/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002001/environment/setup/setup.sh b/tasks/format-code-task-002001/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002001/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002001/tests/test.patch b/tasks/format-code-task-002001/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..8224b0473a65eb4620c916d14c7306a71ce40654 --- /dev/null +++ b/tasks/format-code-task-002001/tests/test.patch @@ -0,0 +1,59 @@ +diff --git a/interp/interp_test.go b/interp/interp_test.go +index a9e0788ea..7695cd94c 100644 +--- a/interp/interp_test.go ++++ b/interp/interp_test.go +@@ -1269,6 +1269,28 @@ var fileCases = []struct { + "exit status 1", + }, + ++ ++ { ++ "a=1; echo $a; unset a; echo $a", ++ "1\n\n", ++ }, ++ { ++ "a() { echo func; }; a; unset -f a; a", ++ "func\n\"a\": executable file not found in $PATH\nexit status 127 #JUSTERR", ++ }, ++ { ++ "a=1; a() { echo func; }; unset -f a; echo $a", ++ "1\n", ++ }, ++ { ++ "a=1; a() { echo func; }; unset -v a; a; echo $a", ++ "func\n\n", ++ }, ++ { ++ "a=1; a() { echo func; }; a; echo $a; unset a; a; echo $a; unset a; a", ++ "func\n1\nfunc\n\n\"a\": executable file not found in $PATH\nexit status 127 #JUSTERR", ++ }, ++ + // IFS + {`echo -n "$IFS"`, " \t\n"}, + {`a="x:y:z"; IFS=:; echo $a`, "x y z\n"}, +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,10 @@ ++H4sIAAAAAAAAA+2UX2vbMBTF8+xPcddB2RiyYq9JYCOFwcr2sNJRNhiMURzpJha1JU+S0wT64Scb ++N8m2/KHQUsbu78VG9+royEdyPKlVIa9Qz3nvsegHRqNR+wz8+Wzfk0GaJMM0fZ2GvvDWH/Zg8GiO ++NqidzyxAzxrj9/Udqv+jxOv8PTp/JUxZZlrGLn+4NQ7kn4z6g1X+6UmT/8kwDfn3H87Cbv7z/IWE ++NvgJyggXlbEePlx8fvfl45g3O+Yzsx5OkuT84v3XT2djM51G0XM406622E0AtywLpa8BF8p5F6kp ++fIdnwMICnRJ3VvByLjMdC8FdDj/egs9RRwDltVQWWLW9NzQUGpibrrzu1IymasPZgoPECrVELRQ6 ++yMJYZdGh9qB0Z3yX05kpMj2LjZ3xBRd2WXlz0PHmnNA0Ux5EYTQCY8GIzyGB3PvKveE81PJ6EocL ++1826W+OQiXvrerTlHtWmfG9Nt3R7JEP19yCa2GqHtjscEH4xEL4fCm/sXTA3VvlsUmCk5Lr/lEuc ++c10XBaSnxwnc3kIznkkJrFy1RSIvTRi5hOyV/bYytj7aG/WbnWeHKx2+RdXYvqx1Kx6cOdBGs2ZK ++uzK8aLXYJHMoux6LP+uwmVXjy8jVwNabYAKOtl8uOD6G7ferqYR6owF/ewySptZ+nACbH0VP/RMh ++CIIgCIIgCIIgCIIgCIIgCIIgCIIgCOJJ+QVtP0jeACgAAA== +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-002001/tests/test.sh b/tasks/format-code-task-002001/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0bca910c073c61d8d620131913cfff5174dd17ea --- /dev/null +++ b/tasks/format-code-task-002001/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +interp/interp_test.go +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002001/tests/test_command.sh b/tasks/format-code-task-002001/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002001/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002008/environment/Dockerfile b/tasks/format-code-task-002008/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..c2e9bddd52a2396062236622ba8adba83d715df9 --- /dev/null +++ b/tasks/format-code-task-002008/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:af7b60e433ca58d738f6d453489aba5ee40389a93dbe25dcb3bc0b961308e34f diff --git a/tasks/format-code-task-002008/environment/setup/files/blocklist b/tasks/format-code-task-002008/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002008/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002008/environment/setup/setup.sh b/tasks/format-code-task-002008/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002008/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002008/tests/test.patch b/tasks/format-code-task-002008/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..aedc3531fbb3b714724bb745e6864827d927de66 --- /dev/null +++ b/tasks/format-code-task-002008/tests/test.patch @@ -0,0 +1,141 @@ +diff --git a/src/functions.feature.test.js b/src/functions.feature.test.js +new file mode 100644 +index 0000000..8b07f89 +--- /dev/null ++++ b/src/functions.feature.test.js +@@ -0,0 +1,126 @@ ++import { call } from 'redux-saga/effects' ++import 'whatwg-fetch' ++ ++import ReduxSagaFirebase from './index' ++ ++describe('functions HTTP invocation extensions', () => { ++ const rsf = new ReduxSagaFirebase({ ++ options: { authDomain: 'demo-project.firebaseapp.com' } ++ }) ++ rsf.region = 'europe-west1' ++ ++ afterEach(() => { ++ expect.hasAssertions() ++ }) ++ ++ it('encodes function query keys and values without changing insertion order', () => { ++ const iterator = rsf.functions.call('lookup', { ++ 'user name': 'Ada/Lovelace', ++ filter: 'a&b' ++ }) ++ ++ expect(iterator.next().value).toEqual(call( ++ fetch, ++ 'https://europe-west1-demo-project.cloudfunctions.net/lookup?user%20name=Ada%2FLovelace&filter=a%26b' ++ )) ++ }) ++ ++ it('keeps the legacy GET effect shape and parses JSON media types with parameters', () => { ++ const iterator = rsf.functions.call('lookup', { q: 'safe' }) ++ const request = iterator.next().value ++ ++ expect(request).toEqual(call( ++ fetch, ++ 'https://europe-west1-demo-project.cloudfunctions.net/lookup?q=safe' ++ )) ++ ++ const response = { ++ ok: true, ++ headers: { get: jest.fn(() => 'Application/JSON; charset=utf-8') }, ++ json: jest.fn() ++ } ++ expect(iterator.next(response).value).toEqual(call([response, response.json])) ++ expect(iterator.next({ found: true })).toEqual({ ++ done: true, ++ value: { found: true } ++ }) ++ }) ++ ++ it('supports POST JSON requests and supplies a default content type', () => { ++ const iterator = rsf.functions.call( ++ 'create', ++ { name: 'Ada', active: true }, ++ { method: 'POST', headers: { Authorization: 'Bearer token' } } ++ ) ++ const request = iterator.next().value ++ ++ expect(request).toEqual(call( ++ fetch, ++ 'https://europe-west1-demo-project.cloudfunctions.net/create', ++ { ++ method: 'POST', ++ headers: { ++ Authorization: 'Bearer token', ++ 'Content-Type': 'application/json' ++ }, ++ body: '{"name":"Ada","active":true}' ++ } ++ )) ++ }) ++ ++ it('preserves an explicitly supplied content type for POST requests', () => { ++ const iterator = rsf.functions.call( ++ 'create', ++ { name: 'Ada' }, ++ { method: 'POST', headers: { 'content-type': 'application/vnd.api+json' } } ++ ) ++ ++ expect(iterator.next().value).toEqual(call( ++ fetch, ++ 'https://europe-west1-demo-project.cloudfunctions.net/create', ++ { ++ method: 'POST', ++ headers: { 'content-type': 'application/vnd.api+json' }, ++ body: '{"name":"Ada"}' ++ } ++ )) ++ }) ++ ++ it('parses +json responses through json()', () => { ++ const iterator = rsf.functions.call('lookup') ++ iterator.next() ++ const response = { ++ ok: true, ++ headers: { get: jest.fn(() => 'application/problem+json') }, ++ json: jest.fn() ++ } ++ expect(iterator.next(response).value).toEqual(call([response, response.json])) ++ }) ++ ++ it('falls back to text when a successful response has no content type', () => { ++ const iterator = rsf.functions.call('lookup') ++ iterator.next() ++ const response = { ++ ok: true, ++ headers: { get: jest.fn(() => null) }, ++ text: jest.fn() ++ } ++ expect(iterator.next(response).value).toEqual(call([response, response.text])) ++ }) ++ ++ it('throws the non-ok response before attempting to decode it', () => { ++ const iterator = rsf.functions.call('lookup') ++ iterator.next() ++ const response = { ok: false, headers: { get: jest.fn() }, json: jest.fn() } ++ ++ let thrown ++ try { ++ iterator.next(response) ++ } catch (error) { ++ thrown = error ++ } ++ expect(thrown).toBe(response) ++ expect(response.headers.get).not.toHaveBeenCalled() ++ expect(response.json).not.toHaveBeenCalled() ++ }) ++}) +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,4 @@ ++#!/bin/bash ++set -euo pipefail ++ ++npm test -- --runInBand src/functions.feature.test.js src/functions.test.js src/index.test.js diff --git a/tasks/format-code-task-002008/tests/test.sh b/tasks/format-code-task-002008/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0b9ca689a398b0d7296923baff771254bcb9dc02 --- /dev/null +++ b/tasks/format-code-task-002008/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +src/functions.feature.test.js +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002008/tests/test_command.sh b/tasks/format-code-task-002008/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002008/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002030/environment/Dockerfile b/tasks/format-code-task-002030/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..e16da778ecc5349e037709c4d0cbe0121561e555 --- /dev/null +++ b/tasks/format-code-task-002030/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:695a5573df7ff737939031f9f06f865cb5480a03ad3d725cf64aee0b12e0ee8b diff --git a/tasks/format-code-task-002030/environment/setup/files/blocklist b/tasks/format-code-task-002030/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002030/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002030/environment/setup/setup.sh b/tasks/format-code-task-002030/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002030/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002030/tests/test.patch b/tasks/format-code-task-002030/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..ced7ff7188c2966f64bc3eeca9e7d3f731b663d0 --- /dev/null +++ b/tasks/format-code-task-002030/tests/test.patch @@ -0,0 +1,123 @@ +diff --git a/test/helpers/cypherTestHelpers.js b/test/helpers/cypherTestHelpers.js +index 2d6e0409..f339e831 100644 +--- a/test/helpers/cypherTestHelpers.js ++++ b/test/helpers/cypherTestHelpers.js +@@ -19,7 +19,7 @@ export function cypherTestRunner( + const testMovieSchema = + testSchema + + ` +-type MutationB { ++type Mutation { + CreateGenre(name: String): Genre @cypher(statement: "CREATE (g:Genre) SET g.name = $name RETURN g") + CreateMovie(movieId: ID, title: String, year: Int, plot: String, poster: String, imdbRating: Float): Movie + CreateState(name: String!): State +@@ -69,7 +69,7 @@ type MutationB { + computedIntList: checkCypherQuery, + customWithArguments: checkCypherQuery + }, +- MutationB: { ++ Mutation: { + CreateGenre: checkCypherMutation, + CreateMovie: checkCypherMutation, + CreateState: checkCypherMutation, +@@ -182,7 +182,7 @@ export function augmentedSchemaCypherTestRunner( + computedIntList: checkCypherQuery, + customWithArguments: checkCypherQuery + }, +- MutationB: { ++ Mutation: { + CreateMovie: checkCypherMutation, + CreateState: checkCypherMutation, + CreateTemporalNode: checkCypherMutation, +diff --git a/test/helpers/testSchema.js b/test/helpers/testSchema.js +index 65747cac..6c9c585f 100644 +--- a/test/helpers/testSchema.js ++++ b/test/helpers/testSchema.js +@@ -220,7 +220,7 @@ export const testSchema = /* GraphQL */ ` + CasedType: [CasedType] + } + +- type MutationB { ++ type Mutation { + currentUserId: String + @cypher(statement: "RETURN $cypherParams.currentUserId") + computedObjectWithCypherParams: currentUserId +@@ -302,7 +302,7 @@ export const testSchema = /* GraphQL */ ` + + schema { + query: QueryA +- mutation: MutationB ++ mutation: Mutation + subscription: SubscriptionC + } + `; +diff --git a/test/unit/augmentSchemaTest.test.js b/test/unit/augmentSchemaTest.test.js +index 21abfd4e..c9c6f804 100644 +--- a/test/unit/augmentSchemaTest.test.js ++++ b/test/unit/augmentSchemaTest.test.js +@@ -1118,7 +1118,7 @@ test.cb('Test augmented schema', t => { + _id: String + } + +- type MutationB { ++ type Mutation { + currentUserId: String + @cypher(statement: "RETURN $cypherParams.currentUserId") + computedObjectWithCypherParams: currentUserId +@@ -1722,7 +1722,7 @@ test.cb('Test augmented schema', t => { + + schema { + query: QueryA +- mutation: MutationB ++ mutation: Mutation + subscription: SubscriptionC + } + `; +@@ -1749,6 +1749,7 @@ const compareSchema = ({ test, sourceSchema = {}, expectedSchema = {} }) => { + def => def.kind === Kind.SCHEMA_DEFINITION + ); + } else { ++ const name = definition.name.value; + augmented = augmentedDefinitions.find(augmentedDefinition => { + if (augmentedDefinition.name) { + if (definition.name.value === augmentedDefinition.name.value) { +diff --git a/test/unit/configTest.test.js b/test/unit/configTest.test.js +index f4897f71..07a6bf09 100644 +--- a/test/unit/configTest.test.js ++++ b/test/unit/configTest.test.js +@@ -239,3 +239,15 @@ test.cb( + t.end(); + } + ); ++ ++test.cb('Config - default configuration persistence', t => { ++ const schema = makeAugmentedSchema({ ++ typeDefs, ++ config: { ++ temporal: false ++ } ++ }); ++ t.is(printSchema(schema).includes('Query'), true); ++ t.is(printSchema(schema).includes('Mutation'), true); ++ t.end(); ++}); +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,4 @@ ++H4sIAAAAAAAAA+3R0U7DIBTGca73FLzAKHTDPojeL7TFrcbSpdDGx5f1QqeJ7maLUf+/mwMcEg75 ++VD11z+3Oh7kQt6KzytqlZp/rsja2NOXG6HJrhDbGVlpIe7OJzkwxuVFKMQ5D+u7epf4vpd7zTz6m ++XTP0vQutiofrvXEpf7Op3vLP0ef8t3faCqmvN8LX/nn+TSuX4GvfrsLxRbrZydO+mEKXCjftex/S ++fXPwvXvIx+rUU0/x7E4zhMdu/6G5Xs9+rIfoVz/9PQAAAAAAAAAAAAAAAOBPewXZBBPjACgAAA== +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-002030/tests/test.sh b/tasks/format-code-task-002030/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..177ca70f12f0cb9bfefc91077ef3ed885fbb9772 --- /dev/null +++ b/tasks/format-code-task-002030/tests/test.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test/helpers/cypherTestHelpers.js +test/helpers/testSchema.js +test/unit/augmentSchemaTest.test.js +test/unit/configTest.test.js +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002030/tests/test_command.sh b/tasks/format-code-task-002030/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002030/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002037/environment/Dockerfile b/tasks/format-code-task-002037/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..73dea6989bb39696d3b31ef3c1052dde46b4eac4 --- /dev/null +++ b/tasks/format-code-task-002037/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:9c344261b9b87ae0ee548d56f772b17f0ee9d8673020f17a5eb80d2c7c3c0863 diff --git a/tasks/format-code-task-002037/environment/setup/files/blocklist b/tasks/format-code-task-002037/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002037/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002037/environment/setup/setup.sh b/tasks/format-code-task-002037/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002037/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002037/tests/test.patch b/tasks/format-code-task-002037/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..0299c0293a413165c67610708d86a05511cb4d64 --- /dev/null +++ b/tasks/format-code-task-002037/tests/test.patch @@ -0,0 +1,109 @@ +diff --git a/netbox/tenancy/tests/test_filtersets.py b/netbox/tenancy/tests/test_filtersets.py +index e427c90ce42..d7337396e04 100644 +--- a/netbox/tenancy/tests/test_filtersets.py ++++ b/netbox/tenancy/tests/test_filtersets.py +@@ -1,5 +1,7 @@ ++from django.contrib.contenttypes.models import ContentType + from django.test import TestCase + ++from dcim.models import Manufacturer, Site + from tenancy.filtersets import * + from tenancy.models import * + from utilities.testing import ChangeLoggedFilterSetTests +@@ -192,3 +194,72 @@ def test_group(self): + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + params = {'group': [group[0].slug, group[1].slug]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) ++ ++ ++class ContactAssignmentTestCase(TestCase, ChangeLoggedFilterSetTests): ++ queryset = ContactAssignment.objects.all() ++ filterset = ContactAssignmentFilterSet ++ ++ @classmethod ++ def setUpTestData(cls): ++ ++ manufacturer = Manufacturer.objects.create(name='Manufacturer 1', slug='manufacturer-1') ++ sites = ( ++ Site(name='Site 1', slug='site-1'), ++ Site(name='Site 2', slug='site-2'), ++ Site(name='Site 3', slug='site-3'), ++ ) ++ Site.objects.bulk_create(sites) ++ ++ contact_groups = ( ++ ContactGroup(name='Contact Group 1', slug='contact-group-1'), ++ ContactGroup(name='Contact Group 2', slug='contact-group-2'), ++ ContactGroup(name='Contact Group 3', slug='contact-group-3'), ++ ) ++ for contactgroup in contact_groups: ++ contactgroup.save() ++ ++ contact_roles = ( ++ ContactRole(name='Contact Role 1', slug='contact-role-1'), ++ ContactRole(name='Contact Role 2', slug='contact-role-2'), ++ ContactRole(name='Contact Role 3', slug='contact-role-3'), ++ ) ++ ContactRole.objects.bulk_create(contact_roles) ++ ++ contacts = ( ++ Contact(name='Contact 1', group=contact_groups[0]), ++ Contact(name='Contact 2', group=contact_groups[1]), ++ Contact(name='Contact 3', group=contact_groups[2]), ++ ) ++ Contact.objects.bulk_create(contacts) ++ ++ assignments = ( ++ ContactAssignment(object=sites[0], contact=contacts[0], role=contact_roles[0]), ++ ContactAssignment(object=sites[1], contact=contacts[1], role=contact_roles[1]), ++ ContactAssignment(object=sites[2], contact=contacts[2], role=contact_roles[2]), ++ ContactAssignment(object=manufacturer, contact=contacts[2], role=contact_roles[2]), ++ ) ++ ContactAssignment.objects.bulk_create(assignments) ++ ++ def test_content_type(self): ++ params = {'content_type_id': ContentType.objects.get_by_natural_key('dcim', 'site')} ++ self.assertEqual(self.filterset(params, self.queryset).qs.count(), 3) ++ ++ def test_contact(self): ++ contacts = Contact.objects.all()[:2] ++ params = {'contact_id': [contacts[0].pk, contacts[1].pk]} ++ self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) ++ ++ def test_group(self): ++ group = ContactGroup.objects.all()[:2] ++ params = {'group_id': [group[0].pk, group[1].pk]} ++ self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) ++ params = {'group': [group[0].slug, group[1].slug]} ++ self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) ++ ++ def test_role(self): ++ role = ContactRole.objects.all()[:2] ++ params = {'role_id': [role[0].pk, role[1].pk]} ++ self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) ++ params = {'role': [role[0].slug, role[1].slug]} ++ self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,8 @@ ++H4sIAAAAAAAAA+3SS0vEMBAA4J77K0Y8bx+7dj0prKLiZRd8gLeSprPdQHeyJGmx4o83raIiPi4u ++os53SEOTSTKZREWj6jJHauNgWxJvP8uGr/f2O/TTbJym08lknO0Hie8l0wCyrZ3olcY6YQACo7X7 ++bN5X479U9FJ/h9blUq/XgsrIrr5vj6/qn2Xpc/1T30/SvWm6F0DyfUf42D+v/+5OXCiKC2FXoSxh ++eAQFlmG4C5f+YhxYNK2SaEEtgbQDURsUZQemIVJUhZsql66Wtb9HNJBOYS0UgR1ix4dxiW1MTV3D ++/T0402BosFR21K/qp49GpcC1JnWH0Pk93gvwJ5lJp1rhEFr/TkOrGyMR4r4icdT/GlIQT5P6gIuG ++wK0Q/CkqdNAnZV+nFxO6Qt+G85Oro8VNfryYn56fXV/Mrs4X84PHsUhqWqqqMcIpTXkf6NOFTedW ++miY+SxIVRptuWNw3JEh20bDT0OZLVfsbsegsjNpx+NOFZowxxhhjjDHGGGOMMcYYY4wxxhhjf9ID ++PyGJ+gAoAAA= +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-002037/tests/test.sh b/tasks/format-code-task-002037/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..ea622762b855b90be3741020764cfe0f456770c2 --- /dev/null +++ b/tasks/format-code-task-002037/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +netbox/tenancy/tests/test_filtersets.py +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002037/tests/test_command.sh b/tasks/format-code-task-002037/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002037/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002039/environment/Dockerfile b/tasks/format-code-task-002039/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..39925c363b69a7df3e286d44443724fa51b993f8 --- /dev/null +++ b/tasks/format-code-task-002039/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:f3fcf30e60138de24538e46f0fdf5b9a422da4eb15da1e229c28ee962c6c2c34 diff --git a/tasks/format-code-task-002039/environment/setup/files/blocklist b/tasks/format-code-task-002039/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002039/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002039/environment/setup/setup.sh b/tasks/format-code-task-002039/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002039/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002039/tests/test.patch b/tasks/format-code-task-002039/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..eebe220af80bf90c878957b560ca6d41e282169c --- /dev/null +++ b/tasks/format-code-task-002039/tests/test.patch @@ -0,0 +1,41 @@ +diff --git a/common/src/test/java/io/netty/util/RecyclerTest.java b/common/src/test/java/io/netty/util/RecyclerTest.java +index 5369c12e21a9..8eaef8d324d4 100644 +--- a/common/src/test/java/io/netty/util/RecyclerTest.java ++++ b/common/src/test/java/io/netty/util/RecyclerTest.java +@@ -185,9 +185,8 @@ public void run() { + thread.start(); + thread.join(); + +- // As we use a ratioMask of 2 we should see o2 as the first object that could recycled from a different thread. +- assertSame(recycler.get(), o2); +- assertNotSame(recycler.get(), o); ++ assertSame(recycler.get(), o); ++ assertNotSame(recycler.get(), o2); + } + + @Test +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,9 @@ ++H4sIAAAAAAAAA+3VQW/TMBQA4JzzK6wcuNmJ06SdqqW7DNCksQMN0m6Vm7irwbFL7Kbdv8exICto ++UNA6JsT7LrEcv/esPrshy62Q9YKrLg6eS+JM8tw/nR+ffkzzlKZ05IZZkFCaj/MA5c+2owNbY1mL ++UNBqbX+17tj7fxR56L/h1gp1Zxa6420rak72jTxFjb7B4yz7af/zhH7tfzoZUTdPx24uQMkpih/z ++n/f//MI1GbmGG6FVEVGSRIirStfuJBTRh/INPosuZuH5t8OB3HJlimht7WYaxw3ruCJsw6o1J7q9 ++i+evy/Lq5u08dplcrhANfOB0b8QQvNvtyG7kw9IkofHtu+u5y9MwLJTriqr4d/FGTI1/fa0rZv12 ++f28XB0ke0ycxj2XZm3q4FNhnIm4qcr/GMD0LX7qBT3Rw/y03dlHppmGqJmZ9uhrH/v+zdDLc/0nW ++3/9snFK4/39DVSPf+CWvw5p32OyErdboI+sYohSls1c0bDqF/I2UEuGNRP06q7U0CF+aT2JTung3 ++xkvmQnGja46wGdLGxz4xCH9+qNMH+SL9QdTKVehnCqGJcrH3ZGuFJO95dV9J3pZ+8eWKCXm1utF+ ++H8WKScOfsBu/lZduCwAAAAAAAAAAAAAAAAAAAAAAAPBHvgByBp0QACgAAA== +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-002039/tests/test.sh b/tasks/format-code-task-002039/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..5b9e6df5962af478771ef2990332cf32b459fdb0 --- /dev/null +++ b/tasks/format-code-task-002039/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +common/src/test/java/io/netty/util/RecyclerTest.java +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002039/tests/test_command.sh b/tasks/format-code-task-002039/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002039/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002052/environment/Dockerfile b/tasks/format-code-task-002052/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..ecab88af137e4a6d730f5f85e9c11d867bc92c84 --- /dev/null +++ b/tasks/format-code-task-002052/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:1aa8bbe31df939d40fa918b6c9acb4cbecbefa9c29cb2659b19561e29daff165 diff --git a/tasks/format-code-task-002052/environment/setup/files/blocklist b/tasks/format-code-task-002052/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002052/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002052/environment/setup/setup.sh b/tasks/format-code-task-002052/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002052/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002052/tests/test.patch b/tasks/format-code-task-002052/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..104bde4a863d26658b8ef17351ae8a9a96272b32 --- /dev/null +++ b/tasks/format-code-task-002052/tests/test.patch @@ -0,0 +1,161 @@ +diff --git a/nilearn/plotting/tests/test_surf_plotting.py b/nilearn/plotting/tests/test_surf_plotting.py +index 10acf04f2..eca05bfb6 100644 +--- a/nilearn/plotting/tests/test_surf_plotting.py ++++ b/nilearn/plotting/tests/test_surf_plotting.py +@@ -825,3 +825,134 @@ def test_plot_surf_contours_error(): + ValueError, + match='Levels, labels, and colors argument need to be either the same length or None.'): + plot_surf_contours(mesh, parcellation, levels=[1, 2], colors=['r'], labels=['1', '2']) ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++def _title_on_axes(ax, title): ++ """True if the title text is rendered on the given axes via either ++ `set_title` (axes.get_title) or `text2D`/`text` (axes.texts).""" ++ if ax.get_title() == title: ++ return True ++ for txt in ax.texts: ++ if txt.get_text() == title: ++ return True ++ return False ++ ++ ++def _suptitle_text(fig): ++ """Return the figure's current suptitle text, or None.""" ++ if fig._suptitle is None: ++ return None ++ return fig._suptitle.get_text() ++ ++ ++def test_plot_surf_title_on_axes_no_axes_provided(): ++ """plot_surf(title=...) without `axes`: the title must be visible on ++ the figure -- either on the axes or as the figure's suptitle (both ++ are valid in this no-subplot scenario).""" ++ mesh = generate_surf() ++ display = plot_surf(mesh, title='Test title', engine='matplotlib') ++ assert ( ++ _title_on_axes(display.axes[0], 'Test title') ++ or _suptitle_text(display) == 'Test title' ++ ) ++ plt.close('all') ++ ++ ++def test_plot_surf_stat_map_title_on_axes_no_axes_provided(): ++ """plot_surf_stat_map(title=...) without `axes`: the title must be ++ visible somewhere on the figure.""" ++ mesh = generate_surf() ++ rng = np.random.RandomState(42) ++ data = 10 * rng.standard_normal(size=mesh[0].shape[0]) ++ display = plot_surf_stat_map(mesh, stat_map=data, title='Stat map title') ++ assert ( ++ _title_on_axes(display.axes[0], 'Stat map title') ++ or _suptitle_text(display) == 'Stat map title' ++ ) ++ plt.close('all') ++ ++ ++def test_plot_surf_stat_map_subplots_each_axes_has_own_title(): ++ """Issue scenario: two subplots each given their own title via ++ `plot_surf_stat_map(..., title=..., axes=...)`. Each subplot's ++ axes must carry its own title (either as get_title or in axes.texts), ++ and the figure suptitle must not carry either of those titles -- ++ otherwise the second call would clobber the first via suptitle. ++ Distinct titles per subplot guard against coincidental-correctness.""" ++ mesh = generate_surf() ++ rng = np.random.RandomState(42) ++ data = 10 * rng.standard_normal(size=mesh[0].shape[0]) ++ fig, axes = plt.subplots(nrows=1, ncols=2, ++ subplot_kw={'projection': '3d'}) ++ plot_surf_stat_map(mesh, stat_map=data, ++ title='a subplot', axes=axes[0]) ++ plot_surf_stat_map(mesh, stat_map=data, ++ title='an other subplot', axes=axes[1]) ++ assert _title_on_axes(axes[0], 'a subplot') ++ assert _title_on_axes(axes[1], 'an other subplot') ++ sup = _suptitle_text(fig) ++ assert sup != 'a subplot' ++ assert sup != 'an other subplot' ++ plt.close('all') ++ ++ ++def test_plot_surf_stat_map_title_on_axes_when_axes_provided(): ++ """plot_surf_stat_map(title=..., axes=ax): the title must appear on ++ the provided axes and not as the figure's suptitle.""" ++ mesh = generate_surf() ++ rng = np.random.RandomState(42) ++ data = 10 * rng.standard_normal(size=mesh[0].shape[0]) ++ fig, ax = plt.subplots(subplot_kw={'projection': '3d'}) ++ plot_surf_stat_map(mesh, stat_map=data, ++ title='single subplot title', axes=ax) ++ assert _title_on_axes(ax, 'single subplot title') ++ assert _suptitle_text(fig) != 'single subplot title' ++ plt.close('all') ++ ++ ++def test_plot_surf_roi_title_on_axes_when_axes_provided(): ++ """plot_surf_roi(title=..., axes=ax): the title must appear on the ++ provided axes and not as the figure's suptitle.""" ++ mesh = generate_surf() ++ roi_map = np.zeros(mesh[0].shape[0]) ++ roi_map[:10] = 1 ++ fig, ax = plt.subplots(subplot_kw={'projection': '3d'}) ++ plot_surf_roi(mesh, roi_map=roi_map, ++ title='roi axes title', axes=ax) ++ assert _title_on_axes(ax, 'roi axes title') ++ assert _suptitle_text(fig) != 'roi axes title' ++ plt.close('all') ++ ++ ++def test_plot_surf_contours_title_on_axes_when_axes_provided(): ++ """plot_surf_contours(title=..., axes=ax, legend=True): the title ++ must appear on the provided axes and not as the figure's suptitle. ++ This guards against partial fixes that only patch plot_surf and ++ leave plot_surf_contours still calling figure.suptitle.""" ++ mesh = generate_surf() ++ parcellation = np.zeros((mesh[0].shape[0],)) ++ parcellation[mesh[1][3]] = 1 ++ parcellation[mesh[1][5]] = 2 ++ fig, ax = plt.subplots(subplot_kw={'projection': '3d'}) ++ display = plot_surf_contours(mesh, parcellation, levels=[1, 2], ++ labels=['1', '2'], colors=['r', 'g'], ++ legend=True, title='contours title', ++ axes=ax) ++ assert _title_on_axes(ax, 'contours title') ++ assert _suptitle_text(display) != 'contours title' ++ plt.close('all') +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 000000000..7daa0b866 +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["python -m pytest nilearn/plotting/tests/test_surf_plotting.py -k \"title_on_axes or subplots_each_axes_has_own_title\" -v"] ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++python -m pytest nilearn/plotting/tests/test_surf_plotting.py -k "title_on_axes or subplots_each_axes_has_own_title" -v ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-002052/tests/test.sh b/tasks/format-code-task-002052/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..09941ba0fe0f191caadae9c7ac4fea7bd6013623 --- /dev/null +++ b/tasks/format-code-task-002052/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +nilearn/plotting/tests/test_surf_plotting.py +test_commands.json +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002052/tests/test_command.sh b/tasks/format-code-task-002052/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002052/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002055/environment/Dockerfile b/tasks/format-code-task-002055/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..862e1d4c2541c8f91e662b5949c37bf6a7baa6f8 --- /dev/null +++ b/tasks/format-code-task-002055/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:542c8b1f589ba08ccba50ad9e2e82163ab9427aca91d427c09f70dd0d91291de diff --git a/tasks/format-code-task-002055/environment/setup/files/blocklist b/tasks/format-code-task-002055/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002055/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002055/environment/setup/setup.sh b/tasks/format-code-task-002055/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002055/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002055/tests/test.patch b/tasks/format-code-task-002055/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..834728b42f4a343d26f09349f21d91e46475cc82 --- /dev/null +++ b/tasks/format-code-task-002055/tests/test.patch @@ -0,0 +1,242 @@ +diff --git a/tests/factories/test_urlscan.py b/tests/factories/test_urlscan.py +new file mode 100644 +index 0000000..cddba84 +--- /dev/null ++++ b/tests/factories/test_urlscan.py +@@ -0,0 +1,214 @@ ++import json ++import re ++from urllib.parse import unquote ++ ++import httpx ++import pytest ++ ++from app.factories.urlscan import UrlscanVerdictFactory ++ ++ ++ ++ ++ ++SCANS = { ++ "http://malware-one.example/": { ++ "uuid": "uuid-mal-1", ++ "malicious": True, ++ "score": 100, ++ }, ++ "http://malware-two.example/": { ++ "uuid": "uuid-mal-2", ++ "malicious": True, ++ "score": 80, ++ }, ++ "http://benign.example/": { ++ "uuid": "uuid-ben", ++ "malicious": False, ++ "score": 0, ++ }, ++ "http://no-results.example/": None, ++ "http://search-error.example/": "ERROR", ++ "http://result-error.example/": "RESULT_ERROR", ++} ++ ++ ++def _response(request, status_code, payload): ++ return httpx.Response( ++ status_code, request=request, content=json.dumps(payload).encode() ++ ) ++ ++ ++def _make_fake_get(): ++ ++ ++ ++ ++ ++ seen_headers = [] ++ ++ async def fake_get(self, url, *, params=None, headers=None, **kwargs): ++ seen_headers.append(headers or {}) ++ ++ full = str(url) ++ if params: ++ ++ full += "?" + "&".join(f"{k}={v}" for k, v in params.items()) ++ decoded = unquote(full) ++ ++ request = httpx.Request("GET", str(url)) ++ ++ if "/search" in decoded: ++ for target, scan in SCANS.items(): ++ if target in decoded: ++ if scan == "ERROR": ++ return _response(request, 429, {}) ++ if scan is None: ++ return _response(request, 200, {"results": [], "total": 0}) ++ return _response( ++ request, ++ 200, ++ { ++ "results": [ ++ { ++ "_id": scan["uuid"], ++ "task": {"uuid": scan["uuid"], "url": target}, ++ } ++ ], ++ "total": 1, ++ }, ++ ) ++ return _response(request, 200, {"results": [], "total": 0}) ++ ++ if "/result/" in decoded: ++ match = re.search(r"/result/([^/?]+)", decoded) ++ uuid = match.group(1) if match else "" ++ for target, scan in SCANS.items(): ++ if isinstance(scan, dict) and scan["uuid"] == uuid: ++ return _response( ++ request, ++ 200, ++ { ++ "task": {"uuid": scan["uuid"], "url": target}, ++ "verdicts": { ++ "overall": { ++ "malicious": scan["malicious"], ++ "score": scan["score"], ++ } ++ }, ++ }, ++ ) ++ if scan == "RESULT_ERROR": ++ return _response(request, 500, {}) ++ return _response(request, 404, {}) ++ ++ return _response(request, 404, {}) ++ ++ fake_get.seen_headers = seen_headers ++ return fake_get ++ ++ ++@pytest.fixture ++def fake_urlscan(monkeypatch): ++ fake_get = _make_fake_get() ++ monkeypatch.setattr(httpx.AsyncClient, "get", fake_get) ++ return fake_get ++ ++ ++@pytest.mark.asyncio ++async def test_no_urls_is_benign(fake_urlscan): ++ verdict = await UrlscanVerdictFactory.from_urls([]) ++ ++ assert verdict.name == "urlscan.io" ++ assert verdict.malicious is False ++ assert verdict.score is None ++ assert len(verdict.details) == 1 ++ ++ ++@pytest.mark.asyncio ++async def test_benign_urls(fake_urlscan): ++ verdict = await UrlscanVerdictFactory.from_urls( ++ ["http://benign.example/", "http://no-results.example/"] ++ ) ++ ++ assert verdict.name == "urlscan.io" ++ assert verdict.malicious is False ++ assert verdict.score is None ++ assert len(verdict.details) == 1 ++ ++ ++@pytest.mark.asyncio ++async def test_single_malicious_url(fake_urlscan): ++ verdict = await UrlscanVerdictFactory.from_urls(["http://malware-one.example/"]) ++ ++ assert verdict.name == "urlscan.io" ++ assert verdict.malicious is True ++ assert verdict.score == 100 ++ assert len(verdict.details) == 1 ++ ++ detail = verdict.details[0] ++ assert detail.key == "http://malware-one.example/" ++ assert detail.score == 100 ++ assert "http://malware-one.example/" in detail.description ++ assert "https://urlscan.io/result/uuid-mal-1" in detail.description ++ ++ ++@pytest.mark.asyncio ++async def test_mixed_urls_reports_only_malicious(fake_urlscan): ++ verdict = await UrlscanVerdictFactory.from_urls( ++ [ ++ "http://benign.example/", ++ "http://malware-one.example/", ++ "http://malware-two.example/", ++ "http://no-results.example/", ++ ] ++ ) ++ ++ assert verdict.malicious is True ++ assert verdict.score == 100 ++ assert len(verdict.details) == 2 ++ ++ keys = {detail.key for detail in verdict.details} ++ assert keys == {"http://malware-one.example/", "http://malware-two.example/"} ++ ++ by_key = {detail.key: detail for detail in verdict.details} ++ assert by_key["http://malware-one.example/"].score == 100 ++ assert by_key["http://malware-two.example/"].score == 80 ++ ++ ++@pytest.mark.asyncio ++async def test_http_errors_are_swallowed(fake_urlscan): ++ verdict = await UrlscanVerdictFactory.from_urls( ++ [ ++ "http://search-error.example/", ++ "http://result-error.example/", ++ "http://malware-one.example/", ++ ] ++ ) ++ ++ ++ assert verdict.malicious is True ++ assert verdict.score == 100 ++ assert len(verdict.details) == 1 ++ assert verdict.details[0].key == "http://malware-one.example/" ++ ++ ++@pytest.mark.asyncio ++async def test_all_errors_is_benign(fake_urlscan): ++ verdict = await UrlscanVerdictFactory.from_urls( ++ ["http://search-error.example/", "http://result-error.example/"] ++ ) ++ ++ assert verdict.malicious is False ++ assert verdict.score is None ++ assert len(verdict.details) == 1 ++ ++ ++@pytest.mark.asyncio ++async def test_requests_send_api_key_header(fake_urlscan): ++ await UrlscanVerdictFactory.from_urls(["http://malware-one.example/"]) ++ ++ assert len(fake_urlscan.seen_headers) >= 1 ++ for headers in fake_urlscan.seen_headers: ++ lowered = {str(k).lower(): v for k, v in dict(headers).items()} ++ assert "api-key" in lowered +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,17 @@ ++#!/usr/bin/env bash ++ ++ ++set -euo pipefail ++HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ++cd /testbed ++ ++ ++ ++PYTEST="/testbed/.venv/bin/python -m pytest -o addopts= -p no:randomly -q" ++ ++ ++$PYTEST tests/factories/test_eml.py tests/factories/test_oleid.py \ ++ tests/services/test_oleid.py tests/schemas/test_payload.py ++ ++ ++$PYTEST tests/factories/test_urlscan.py diff --git a/tasks/format-code-task-002055/tests/test.sh b/tasks/format-code-task-002055/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..623d83f36536df405ac8f31f30e45a209833adaf --- /dev/null +++ b/tasks/format-code-task-002055/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/factories/test_urlscan.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002055/tests/test_command.sh b/tasks/format-code-task-002055/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002055/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002099/environment/Dockerfile b/tasks/format-code-task-002099/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..92c0a87a8b17f0a7607c88da11d5909c134a4998 --- /dev/null +++ b/tasks/format-code-task-002099/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:82f810c559a12e6d7b968d2ec811ff82ac6c5503ff8c76b8ac54dd113ac1645d diff --git a/tasks/format-code-task-002099/environment/setup/files/blocklist b/tasks/format-code-task-002099/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002099/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002099/environment/setup/setup.sh b/tasks/format-code-task-002099/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002099/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002099/tests/test.patch b/tasks/format-code-task-002099/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..86ab527ac3a8c35127b5f356d66f99d5313e3179 --- /dev/null +++ b/tasks/format-code-task-002099/tests/test.patch @@ -0,0 +1,274 @@ +diff --git a/app/rpc/tests/rpc_test.go b/app/rpc/tests/rpc_test.go +index 1c9d4890f4..08cb363d6e 100644 +--- a/app/rpc/tests/rpc_test.go ++++ b/app/rpc/tests/rpc_test.go +@@ -10,7 +10,14 @@ import ( + "bytes" + "encoding/json" + "fmt" ++ "log" ++ "math/big" ++ "math/rand" ++ "os" ++ "strings" + "sync" ++ "testing" ++ "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + ethcmn "github.com/ethereum/go-ethereum/common" +@@ -20,13 +27,6 @@ import ( + "github.com/okex/okexchain/app/rpc/websockets" + "github.com/stretchr/testify/require" + "golang.org/x/net/websocket" +- +- "math/big" +- "math/rand" +- "os" +- "strings" +- "testing" +- "time" + ) + + const ( +@@ -1260,7 +1260,7 @@ func TestEth_Subscribe_And_UnSubscribe(t *testing.T) { + excuteInvalidMessage(t, ws, invalidMessage) + } + +-func excuteValidMessage(t *testing.T, ws *websocket.Conn, message []byte) { ++func excuteValidMessage(t *testing.T, ws *websocket.Conn, message []byte) { + fmt.Println("Send:", string(message)) + _, err := ws.Write(message) + require.NoError(t, err) +@@ -1293,7 +1293,7 @@ func excuteValidMessage(t *testing.T, ws *websocket.Conn, message []byte) { + require.Equal(t, "true", string(res.Result)) + } + +-func excuteInvalidMessage(t *testing.T, ws *websocket.Conn, message []byte) { ++func excuteInvalidMessage(t *testing.T, ws *websocket.Conn, message []byte) { + fmt.Println("Send:", string(message)) + _, err := ws.Write(message) + require.NoError(t, err) +@@ -1367,4 +1367,156 @@ func TestWebsocket_PendingTransaction(t *testing.T) { + cancelMsg := fmt.Sprintf(`{"id": 2, "method": "eth_unsubscribe", "params": [%s]}`, subscriptionId) + _, err = ws.Write([]byte(cancelMsg)) + require.NoError(t, err) +-} +\ No newline at end of file ++} ++ ++ ++ ++ ++ ++ ++func TestWebsocket_Logs(t *testing.T) { ++ contractAddr1, contractAddr2, contractAddr3 := deployTestTokenContract(t), deployTestTokenContract(t), deployTestTokenContract(t) ++ ++ ++ tests := []struct { ++ addressList string ++ topicsList string ++ expected int ++ }{ ++ ++ {"", "", 21}, ++ ++ {fmt.Sprintf(`"address":"%s"`, contractAddr1), "", 7}, ++ ++ {fmt.Sprintf(`"address":["%s","%s"]`, contractAddr1, contractAddr2), "", 14}, ++ ++ {fmt.Sprintf(`"address":["%s","%s"]`, contractAddr1, contractAddr2), fmt.Sprintf(`"topics":["%s"]`, approveFuncHash), 6}, ++ ++ {fmt.Sprintf(`"address":["%s","%s"]`, contractAddr1, contractAddr2), fmt.Sprintf(`"topics":[null, null, ["%s"]]`, recvAddr1Hash), 4}, ++ ++ {fmt.Sprintf(`"address":["%s","%s"]`, contractAddr1, contractAddr2), fmt.Sprintf(`"topics":[["%s"], null, ["%s"]]`, approveFuncHash, recvAddr1Hash), 2}, ++ ++ {fmt.Sprintf(`"address":["%s","%s"]`, contractAddr1, contractAddr2), fmt.Sprintf(`"topics":[["%s","%s"], null, ["%s","%s"]]`, approveFuncHash, transferFuncHash, recvAddr1Hash, recvAddr2Hash), 8}, ++ } ++ ++ go func() { ++ time.Sleep(time.Minute * 2) ++ panic("the tasks have been running for too long time, over 2 minutes") ++ }() ++ ++ var wg sync.WaitGroup ++ wg.Add(len(tests) + 1) ++ for i, test := range tests { ++ go verifyWebSocketRecvNum(t, &wg, i, test.addressList, test.topicsList, test.expected) ++ } ++ go sendTxs(t, &wg, contractAddr1, contractAddr2, contractAddr3) ++ wg.Wait() ++} ++ ++func deployTestTokenContract(t *testing.T) string { ++ param := make([]map[string]string, 1) ++ param[0] = map[string]string{ ++ "from": hexAddr1.Hex(), ++ "data": ttokenContractByteCode, ++ "gasPrice": (*hexutil.Big)(defaultGasPrice.Amount.BigInt()).String(), ++ } ++ rpcRes := Call(t, "eth_sendTransaction", param) ++ var hash ethcmn.Hash ++ require.NoError(t, json.Unmarshal(rpcRes.Result, &hash)) ++ receipt := WaitForReceipt(t, hash) ++ require.NotNil(t, receipt) ++ contractAddr, ok := receipt["contractAddress"].(string) ++ require.True(t, ok) ++ return contractAddr ++} ++ ++func verifyWebSocketRecvNum(t *testing.T, wg *sync.WaitGroup, index int, addressList, topicsList string, expected int) { ++ defer wg.Done() ++ ++ ++ origin, url := "http://127.0.0.1:8546/", "ws://127.0.0.1:8546" ++ ws, err := websocket.Dial(url, "", origin) ++ require.NoError(t, err) ++ defer func() { ++ ++ err := ws.Close() ++ require.NoError(t, err) ++ }() ++ ++ ++ param := assembleParameters(addressList, topicsList) ++ _, err = ws.Write([]byte(param)) ++ require.NoError(t, err) ++ ++ msg := make([]byte, 10240) ++ ++ n, err := ws.Read(msg) ++ var res Response ++ require.NoError(t, err) ++ require.NoError(t, json.Unmarshal(msg[:n], &res)) ++ require.Nil(t, res.Error) ++ subscriptionId := string(res.Result) ++ log.Printf("test case %d: websocket %s is created successfully, expect receive %d logs \n", index, subscriptionId, expected) ++ ++ for i := 0; i < expected; i++ { ++ n, err = ws.Read(msg) ++ require.NoError(t, err) ++ var notification websockets.SubscriptionNotification ++ require.NoError(t, json.Unmarshal(msg[:n], ¬ification)) ++ } ++ ++ ++ cancelMsg := fmt.Sprintf(`{"id": 2, "method": "eth_unsubscribe", "params": [%s]}`, subscriptionId) ++ _, err = ws.Write([]byte(cancelMsg)) ++ require.NoError(t, err) ++ log.Printf("test case %d: webdocket %s receive %d logs, then close successfully", index, subscriptionId, expected) ++} ++ ++func assembleParameters(addressList string, topicsList string) string { ++ var param string ++ if addressList == "" { ++ param = topicsList ++ } ++ if topicsList == "" { ++ param = addressList ++ } ++ if addressList != "" && topicsList != "" { ++ param = addressList + "," + topicsList ++ } ++ return fmt.Sprintf(`{"id": 2, "method": "eth_subscribe", "params": ["logs",{%s}]}`, param) ++} ++ ++func sendTxs(t *testing.T, wg *sync.WaitGroup, contractAddrs ...string) { ++ dataList := []string{ ++ ++ "0x40c10f190000000000000000000000002cf4ea7df75b513509d95946b43062e26bd8803500000000000000000000000000000000000000000000000000000000ffffffff", ++ ++ "0x095ea7b30000000000000000000000009ad84c8630e0282f78e5479b46e64e17779e3cfb0000000000000000000000000000000000000000000000000000000000bc614e", ++ ++ "0x095ea7b3000000000000000000000000c9c9b43322f5e1dc401252076fa4e699c9122cd60000000000000000000000000000000000000000000000000000000000bc614e", ++ ++ "0x095ea7b30000000000000000000000002b5cf24aebce90f0b8f80bc42603157b27cfbf470000000000000000000000000000000000000000000000000000000000bc614e", ++ ++ "0xa9059cbb0000000000000000000000009ad84c8630e0282f78e5479b46e64e17779e3cfb00000000000000000000000000000000000000000000000000000000000004d2", ++ ++ "0xa9059cbb000000000000000000000000c9c9b43322f5e1dc401252076fa4e699c9122cd600000000000000000000000000000000000000000000000000000000000004d2", ++ ++ "0xa9059cbb0000000000000000000000002b5cf24aebce90f0b8f80bc42603157b27cfbf4700000000000000000000000000000000000000000000000000000000000004d2", ++ } ++ defer wg.Done() ++ for _, contractAddr := range contractAddrs { ++ for i := 0; i < 7; i++ { ++ param := make([]map[string]string, 1) ++ param[0] = make(map[string]string) ++ param[0]["from"] = hexAddr1.Hex() ++ param[0]["to"] = contractAddr ++ param[0]["data"] = dataList[i] ++ param[0]["gasPrice"] = (*hexutil.Big)(defaultGasPrice.Amount.BigInt()).String() ++ rpcRes := Call(t, "eth_sendTransaction", param) ++ var hash ethcmn.Hash ++ require.NoError(t, json.Unmarshal(rpcRes.Result, &hash)) ++ ++ time.Sleep(time.Second * 1) ++ } ++ } ++} +diff --git a/app/rpc/tests/utils_test.go b/app/rpc/tests/utils_test.go +index 05a09a19e4..0517002296 100644 +--- a/app/rpc/tests/utils_test.go ++++ b/app/rpc/tests/utils_test.go +@@ -58,6 +58,15 @@ const ( + + // world parameter in Hello event: 1024 + worldTopic = "0x0000000000000000000000000000000000000000000000000000000000000400" ++ ++ ++ ttokenContractByteCode = "0x608060405234801561001057600080fd5b5060405162000b6438038062000b648339818101604052608081101561003557600080fd5b810190808051604051939291908464010000000082111561005557600080fd5b90830190602082018581111561006a57600080fd5b825164010000000081118282018810171561008457600080fd5b82525081516020918201929091019080838360005b838110156100b1578181015183820152602001610099565b50505050905090810190601f1680156100de5780820380516001836020036101000a031916815260200191505b506040526020018051604051939291908464010000000082111561010157600080fd5b90830190602082018581111561011657600080fd5b825164010000000081118282018810171561013057600080fd5b82525081516020918201929091019080838360005b8381101561015d578181015183820152602001610145565b50505050905090810190601f16801561018a5780820380516001836020036101000a031916815260200191505b5060409081526020828101519290910151865192945092506101b191600091870190610201565b5082516101c5906001906020860190610201565b50600280546001600160a01b0390921661010002610100600160a81b031960ff90941660ff1990931692909217929092161790555061029c9050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061024257805160ff191683800117855561026f565b8280016001018555821561026f579182015b8281111561026f578251825591602001919060010190610254565b5061027b92915061027f565b5090565b61029991905b8082111561027b5760008155600101610285565b90565b6108b880620002ac6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c806340c10f191161007157806340c10f19146101d957806342966c681461020557806370a082311461022257806395d89b4114610248578063a9059cbb14610250578063dd62ed3e1461027c576100a9565b806306fdde03146100ae578063095ea7b31461012b57806318160ddd1461016b57806323b872dd14610185578063313ce567146101bb575b600080fd5b6100b66102aa565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f05781810151838201526020016100d8565b50505050905090810190601f16801561011d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101576004803603604081101561014157600080fd5b506001600160a01b038135169060200135610340565b604080519115158252519081900360200190f35b6101736103a7565b60408051918252519081900360200190f35b6101576004803603606081101561019b57600080fd5b506001600160a01b038135811691602081013590911690604001356103ad565b6101c3610519565b6040805160ff9092168252519081900360200190f35b610157600480360360408110156101ef57600080fd5b506001600160a01b038135169060200135610522565b6101576004803603602081101561021b57600080fd5b5035610537565b6101736004803603602081101561023857600080fd5b50356001600160a01b031661060c565b6100b6610627565b6101576004803603604081101561026657600080fd5b506001600160a01b038135169060200135610687565b6101736004803603604081101561029257600080fd5b506001600160a01b0381358116916020013516610694565b60008054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103365780601f1061030b57610100808354040283529160200191610336565b820191906000526020600020905b81548152906001019060200180831161031957829003601f168201915b5050505050905090565b3360008181526005602090815260408083206001600160a01b038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b60035490565b6000336001600160a01b03851614806103e957506001600160a01b03841660009081526005602090815260408083203384529091529020548211155b610432576040805162461bcd60e51b815260206004820152601560248201527422a9292fa12a27a5a2a72fa120a22fa1a0a62622a960591b604482015290519081900360640190fd5b61043d8484846106bf565b336001600160a01b0385161480159061047b57506001600160a01b038416600090815260056020908152604080832033845290915290205460001914155b1561050f576001600160a01b03841660009081526005602090815260408083203384529091529020546104ae90836107d1565b6001600160a01b03858116600090815260056020908152604080832033808552908352928190208590558051948552519287169391927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35b5060019392505050565b60025460ff1690565b600061052e83836107e1565b50600192915050565b30600090815260046020526040812054821115610592576040805162461bcd60e51b815260206004820152601460248201527311549497d25394d551919250d251539517d0905360621b604482015290519081900360640190fd5b306000908152600460205260409020546105ac90836107d1565b306000908152600460205260409020556003546105c990836107d1565b60035560408051838152905160009130917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3506001919050565b6001600160a01b031660009081526004602052604090205490565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156103365780601f1061030b57610100808354040283529160200191610336565b600061052e3384846106bf565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b6001600160a01b038316600090815260046020526040902054811115610723576040805162461bcd60e51b815260206004820152601460248201527311549497d25394d551919250d251539517d0905360621b604482015290519081900360640190fd5b6001600160a01b03831660009081526004602052604090205461074690826107d1565b6001600160a01b0380851660009081526004602052604080822093909355908416815220546107759082610872565b6001600160a01b0380841660008181526004602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b808203828111156103a157600080fd5b6001600160a01b0382166000908152600460205260409020546108049082610872565b6001600160a01b03831660009081526004602052604090205560035461082a9082610872565b6003556040805182815290516001600160a01b038416916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b808201828110156103a157600080fdfea2646970667358221220a3d106c9f53703c13c9efe61ba3fdde06510efec7cce1c90fb4f376e677c7d5364736f6c63430006000033000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000120000000000000000000000002cf4ea7df75b513509d95946b43062e26bd8803500000000000000000000000000000000000000000000000000000000000000036f6b74000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036f6b740000000000000000000000000000000000000000000000000000000000" ++ approveFuncHash = "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925" ++ transferFuncHash = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" ++ recvAddr1 = "0xc9c9b43322f5e1dc401252076fa4e699c9122cd6" ++ recvAddr2 = "0x9ad84c8630e0282f78e5479b46e64e17779e3cfb" ++ recvAddr1Hash = "0x000000000000000000000000c9c9b43322f5e1dc401252076fa4e699c9122cd6" ++ recvAddr2Hash = "0x0000000000000000000000009ad84c8630e0282f78e5479b46e64e17779e3cfb" + ) + + const ( +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,28 @@ ++H4sIAAAAAAAAA+1X63PUNhDPZ/8Vi8gkMBPfizw6YUKHwk3JEBKGZAKdNOORbd2diC0ZSz4SHv97 ++f7J9j4RLkxaYltZ7H06WVvv47Wq1aoWFTOJAqHF76XtRB7S1sVH+g67+l+PuRq/TW9/cevCgt9Tp ++djc7G0u08d0smqPCWJ4TLeVa2z/ju2n9B6XWLP5WGBtEOk25iltm9O103BD/rfWtWfw7nU3Ef32z ++t7VEnW9nwvX0P4//3TvtUKp2yM3IM8KSLzwviqlMhlDEnve8/1t3h/FERoK5j94OC3XIvCfPHu/u ++7z7dYfpMnEcjLpUYp/7mBvNeHOzvPu+/qlaY9+zgRT/45fFhf4dNpLZ5lrXzLCq/TTuIeDQSAfbX ++3If9V8dOwPJ0b7s1VRPXTE/2dq/hiBLJPO8uRYngqshoUKjISq28euLeffroEWVnMknIH9DMhZhc ++NlhGvUftWIzbqgDHp09k80JgR56Sn4N/ppV5nz2b82yqq/9m98jpLmVzdUHiXBor1ZCyXEfCGGG8 ++v6rYJEJk1HVic5HqsZgJjTkmFBTFsEAKZb1FNjostBrIYZELAm7ePFT1Ep2Jixwi/ZBHZwLyXGzI ++90c6FRNp2MoW7i2/fRmDsc4LdtuturBZYemtgRu33AK44GmJzW23gNdYX+lYXLsNIB3iACCGQMJc ++luJmiMfOP3cenHO5iBCJnPyUWJYUaijIyOSMhomEkmHCjaGoyBGs6ALJQUYBVxryPORg1aGJXDDE ++eZYjKSgWEce2WLocuMmny9b0rlqT8A8XUJ2FmucxvRc8sSOKuNKCsiJF8imYYTLKEn6BBDIjpI8V ++SnFCKkmrc0q5FbnkCY2RqDB3oUnAaxfsYJMfgOpI1MnozSW1BAM21RXBibk5U6rDX8p/Mk3aoVDC ++SONF3F7ma1cBbtcMLZdHjD7R23e02kKZCXCurDhh+IPjQ3Z6wjKe89S4UahVHCCXdMpOXbmybJUe ++LZZv0yy4rGNlhdLxbZlvtvnvuxblEsvOH2zAnLLBQAj3/cO7NtTjyo9MG2mDWeRSqYJ6Fp+d/4Kv ++cMleTk83869JTxzHvuIhKln/+AVahZh8SaumzUQ5izs8Sdg2DXhixNVJV3Lbq7fRskBuLgDPl5In ++07eXDQ8eJ4lGgKb1hHgU6UJZM1+0UFn9et2v12n53pcV2Iz0+9mFwBfUyPvUnb5wEL5rCt1Xqe59 ++lWp358mhmsKBVkYZXjVLc2Zh2Z5DhOKliMkVeIuOoVZUz/pVj3LpGnFVPklEZGdGnM/rjqpVv7TB ++XOPHXTrGNRTPRXZexLhem0B7HRh7B78Ge/3j/t5Oin3bUg30Wnk4q2GMnivfjkVYDNd4YUfVrDuk ++9eSA52k1LIF1DV15L5ZtB25dN3ZYDXMEFjezxL2Mw0SmyDKdW+9qN0i/o+f0/SwvFGDeUdqOXM9X ++zaJ9bhUI1kBMJoB+K0EG5WSjbLvd7rTK3/ZPG+sbNc+i27daSfQwSMRYJFia4jBZRFpEEzWLojtn ++QKFwws4CpMYkUdYmebqQK7iauDXb1dxiLrkmi8BcpkXqo40BOniZGGLwtKauq5S04nn7B0/7wUu8 ++UZbvuIC85mhGBmhvpjGxmkKBnprHF56IRpqY43EYO7a5cICxjEir1WKeW5Munsv3jHhHXdrs3H9I ++sYZpcuB6PvT2yLE39PLg8Ij8Z8TQx6DBsv7RRSa2CTUfrynuDlm7Kr++j/TktPqRuW9Elm2zXqsD ++6FJhRzrGJ/6D0IG2X6ShyLFU3xPbJ6drTIKl+3mVRta6yLsil4y0sVXsH9HsTdF7tNJ96BBQMJeo ++8nq/TFBTIUF8gO6Plj/Kz4aVTCHmzzAayMrFE1qWeCi+g+N0uljYgMtEzHBzaIHZoEtVcS0VbxiL ++R00tdvLGibUSLliviuq8YPcQXXn5UPSGuq4xY/LL4rjTJd/KVOARQQ86HaCOs0LsCEyvRWgAl7DB ++nh4aRq0rj84SCe+of3gUuDfbzvLP5RXnjCoPZqmotDGCQ145Wp6ye//0u72hhhpqqKGGGmqooYYa ++aqihhhpqqKGGGmroJvoDkxvpHAAoAAA= +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-002099/tests/test.sh b/tasks/format-code-task-002099/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..80dcbd64f7ef5149465629e9c3d2a5ceb1b1303b --- /dev/null +++ b/tasks/format-code-task-002099/tests/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +app/rpc/tests/rpc_test.go +app/rpc/tests/utils_test.go +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002099/tests/test_command.sh b/tasks/format-code-task-002099/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002099/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002142/environment/Dockerfile b/tasks/format-code-task-002142/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..8394438c94f94d59da7c2fba0a24f0f342bebcd3 --- /dev/null +++ b/tasks/format-code-task-002142/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:63c1e7a5a884e30ac9263dfb3c05745e5153b7b07bf1da14160583be6b89c1a9 diff --git a/tasks/format-code-task-002142/environment/setup/files/blocklist b/tasks/format-code-task-002142/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002142/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002142/environment/setup/setup.sh b/tasks/format-code-task-002142/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002142/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002142/tests/test.patch b/tasks/format-code-task-002142/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..52d25409dd9ad3d3289adc827bb7040a879e1d52 --- /dev/null +++ b/tasks/format-code-task-002142/tests/test.patch @@ -0,0 +1,44 @@ +diff --git a/openff/toolkit/_tests/test_molecule.py b/openff/toolkit/_tests/test_molecule.py +index 3c6d1af27..3c07f045d 100644 +--- a/openff/toolkit/_tests/test_molecule.py ++++ b/openff/toolkit/_tests/test_molecule.py +@@ -4086,6 +4086,16 @@ def test_molecule_from_pdb_mainchain_cys_dipeptide(self): + expected_mol, atom_stereochemistry_matching=False + ) + ++ def test_molecule_from_pdb_mainchain_cym_dipeptide(self): ++ offmol = Molecule.from_polymer_pdb( ++ get_data_file_path("proteins/MainChain_CYM.pdb") ++ ) ++ assert offmol.n_atoms == 22 ++ expected_mol = Molecule.from_smiles("CC(=O)N[C@H](C[S-])C(=O)NC") ++ assert offmol.is_isomorphic_with( ++ expected_mol, atom_stereochemistry_matching=False ++ ) ++ + def test_molecule_from_pdb_mainchain_cyx_dipeptide(self): + offmol = Molecule.from_polymer_pdb( + get_data_file_path("proteins/MainChain_CYX.pdb") +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,7 @@ ++H4sIAAAAAAAAA+3TQUvDMBQH8J77KZ66w3Zou9Z2A8HDDoInFdnF00jbN1uWJqVJy/btbSfqGKiX ++iYj/3yUhCS8P/omftqXMV6y6wPkp0948SfZj73jcz8MkCqMoSeLw0pmG4WwaOpT8WEcHWmNFQ+Q0 ++Wtuvzn23/0f5H/lbNnaV6aoSKvdNcbo7vss/TuL3/KN43ucfz6LEoenpWvjcP8//4ixISxWkwhRu ++ltP+EaScu+4FLTJbdsIyVWXW6EpUqaD+nZSNVhUr63InJJ2PxgfbpmApqdB6Q56hoejk3D3YF28l ++dc1qvR5uuVGmbZhswSR11lcc18JmBecTMrptMqbSUGv6lnhb68bSw9Py9v7uYbG8vX7r9mr0sTjU ++fGzVvmCf7DNbGk7RupTs1jtbaEVeRf1sWH3tI7Bay01pg9WwaF5/QqUlZ61kv96RtyWvc387KwAA ++AAAAAAAAAAAAAAAAAACAYy+94dq2ACgAAA== +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-002142/tests/test.sh b/tasks/format-code-task-002142/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0acd0d09d5b5098b1de1d810b2fef45f09bae718 --- /dev/null +++ b/tasks/format-code-task-002142/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +openff/toolkit/_tests/test_molecule.py +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002142/tests/test_command.sh b/tasks/format-code-task-002142/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002142/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002145/environment/Dockerfile b/tasks/format-code-task-002145/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..25cef715b023019f74951b99c406fab3a7049b16 --- /dev/null +++ b/tasks/format-code-task-002145/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:a03f02788361984f77bfc2ea75a387e57177652a4ff3e692dd888ecc7cd3812b diff --git a/tasks/format-code-task-002145/environment/setup/files/blocklist b/tasks/format-code-task-002145/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002145/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002145/environment/setup/setup.sh b/tasks/format-code-task-002145/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002145/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002145/tests/test.patch b/tasks/format-code-task-002145/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..b232ad3c4b9885178e7f730ea31b1b54cecabddc --- /dev/null +++ b/tasks/format-code-task-002145/tests/test.patch @@ -0,0 +1,221 @@ +diff --git a/test/fixtures/transform-request/style.json b/test/fixtures/transform-request/style.json +new file mode 100644 +index 0000000..640c95b +--- /dev/null ++++ b/test/fixtures/transform-request/style.json +@@ -0,0 +1,33 @@ ++{ ++ "version": 8, ++ "name": "transform-request-test", ++ "sources": { ++ "geojson": { ++ "type": "geojson", ++ "data": { ++ "type": "FeatureCollection", ++ "features": [ ++ { ++ "type": "Feature", ++ "properties": {}, ++ "geometry": { ++ "type": "Point", ++ "coordinates": [0, 0] ++ } ++ } ++ ] ++ } ++ } ++ }, ++ "layers": [ ++ { ++ "id": "points", ++ "type": "circle", ++ "source": "geojson", ++ "paint": { ++ "circle-color": "#ff0000", ++ "circle-radius": 5 ++ } ++ } ++ ] ++} +diff --git a/test/transformRequest.test.js b/test/transformRequest.test.js +new file mode 100644 +index 0000000..abdb426 +--- /dev/null ++++ b/test/transformRequest.test.js +@@ -0,0 +1,126 @@ ++import Map from 'ol/Map.js'; ++import olms from '../src/index.js'; ++import should from 'should'; ++ ++const origin = window.location.protocol + '//' + window.location.host; ++ ++describe('transformRequest option', function () { ++ let target; ++ ++ beforeEach(function () { ++ target = document.createElement('div'); ++ }); ++ ++ it('calls transformRequest for the style document with resource type "Style" and uses the original url when nothing is returned', function (done) { ++ const seen = []; ++ olms(target, './fixtures/hot-osm/hot-osm.json', { ++ transformRequest: function (url, resourceType) { ++ seen.push([url, resourceType]); ++ return undefined; ++ }, ++ }) ++ .then(function (map) { ++ should(map).be.instanceof(Map); ++ const styleCalls = seen.filter(function (call) { ++ return call[1] === 'Style'; ++ }); ++ should(styleCalls.length).be.greaterThan(0); ++ should(styleCalls[0][0].indexOf('hot-osm.json')).be.greaterThan(-1); ++ map.setTarget(undefined); ++ done(); ++ }) ++ .catch(done); ++ }); ++ ++ it('calls transformRequest for the sprite index with resource type "Sprite" and uses the returned Request for the fetch', function (done) { ++ const seen = []; ++ const style = { ++ version: 8, ++ sprite: origin + '/fixtures/does-not-exist-sprite', ++ sources: { ++ geojson: { ++ type: 'geojson', ++ data: { ++ type: 'FeatureCollection', ++ features: [ ++ { ++ type: 'Feature', ++ properties: {}, ++ geometry: {type: 'Point', coordinates: [0, 0]}, ++ }, ++ ], ++ }, ++ }, ++ }, ++ layers: [ ++ { ++ id: 'points', ++ type: 'circle', ++ source: 'geojson', ++ paint: {'circle-color': '#ff0000', 'circle-radius': 5}, ++ }, ++ ], ++ }; ++ olms(target, style, { ++ transformRequest: function (url, resourceType) { ++ seen.push([url, resourceType]); ++ if (resourceType === 'Sprite') { ++ const suffix = url.indexOf('@2x') > -1 ? '@2x' : ''; ++ return new Request( ++ origin + '/fixtures/osm-liberty/osm-liberty' + suffix + '.json' ++ ); ++ } ++ return undefined; ++ }, ++ }) ++ .then(function (map) { ++ should(map).be.instanceof(Map); ++ const spriteCalls = seen.filter(function (call) { ++ return call[1] === 'Sprite'; ++ }); ++ should(spriteCalls.length).be.greaterThan(0); ++ should(spriteCalls[0][0].indexOf('does-not-exist-sprite')).be.greaterThan( ++ -1 ++ ); ++ map.setTarget(undefined); ++ done(); ++ }) ++ .catch(done); ++ }); ++ ++ it('normalizes mapbox:// style urls using accessToken and passes the normalized url to transformRequest', function (done) { ++ const seen = []; ++ olms(target, 'mapbox://styles/mapbox/bright-v9', { ++ accessToken: 'tok', ++ transformRequest: function (url, resourceType) { ++ seen.push([url, resourceType]); ++ if (resourceType === 'Style') { ++ return new Request(origin + '/fixtures/transform-request/style.json'); ++ } ++ return undefined; ++ }, ++ }) ++ .then(function (map) { ++ should(map).be.instanceof(Map); ++ should(map.get('mapbox-style')).be.an.Object(); ++ should(seen[0][1]).be.exactly('Style'); ++ should(seen[0][0]).be.exactly( ++ 'https://api.mapbox.com/styles/v1/mapbox/bright-v9?access_token=tok' ++ ); ++ map.setTarget(undefined); ++ done(); ++ }) ++ .catch(done); ++ }); ++ ++ it('works without an options argument', function (done) { ++ olms(target, './fixtures/transform-request/style.json') ++ .then(function (map) { ++ should(map).be.instanceof(Map); ++ should(map.get('mapbox-style')).be.an.Object(); ++ map.setTarget(undefined); ++ done(); ++ }) ++ .catch(done); ++ }); ++}); +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,45 @@ ++#!/usr/bin/env bash ++ ++ ++ ++set -euo pipefail ++HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ++cd /testbed ++ ++ ++ ++ ++ ++ ++cat > /testbed/karma.task.cjs <<'EOF' ++const base = require('./test/karma.conf.cjs'); ++module.exports = function (karma) { ++ base(karma); ++ const files = (process.env.TASK_TEST_FILES || '').split(',').filter(Boolean); ++ karma.set({ ++ basePath: 'test', ++ browsers: ['ChromeHeadlessNoSandbox'], ++ customLaunchers: { ++ ChromeHeadlessNoSandbox: {base: 'ChromeHeadless', flags: ['--no-sandbox']}, ++ }, ++ reporters: ['dots'], ++ files: [ ++ ...files.map((f) => ({pattern: f, watched: false})), ++ {pattern: 'fixtures/**/*', included: false, watched: false}, ++ ], ++ preprocessors: {'**/*.js': ['webpack', 'sourcemap']}, ++ }); ++}; ++EOF ++trap 'rm -f /testbed/karma.task.cjs' EXIT ++ ++run_karma() { ++ TASK_TEST_FILES="$1" ./node_modules/.bin/karma start /testbed/karma.task.cjs \ ++ --single-run --log-level error ++} ++ ++ ++run_karma "applyStyle.test.js,finalizeLayer.test.js,index.test.js" ++ ++ ++run_karma "transformRequest.test.js" diff --git a/tasks/format-code-task-002145/tests/test.sh b/tasks/format-code-task-002145/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7c0c063637785b284c70cb5e0068cd3e5d640d58 --- /dev/null +++ b/tasks/format-code-task-002145/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test/fixtures/transform-request/style.json +test/transformRequest.test.js +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002145/tests/test_command.sh b/tasks/format-code-task-002145/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002145/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002189/environment/Dockerfile b/tasks/format-code-task-002189/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..8a57a479424ae7874ec103338eaa68bb64bf2c6a --- /dev/null +++ b/tasks/format-code-task-002189/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:9592505ce8d41125f79aeb8b5deb2629b6d185068b0c54bbe272df304eed2d4f diff --git a/tasks/format-code-task-002189/environment/setup/files/blocklist b/tasks/format-code-task-002189/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002189/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002189/environment/setup/setup.sh b/tasks/format-code-task-002189/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002189/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002189/tests/test.patch b/tasks/format-code-task-002189/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..4dd642461a560b3da751d39e2affc78b97a4f04b --- /dev/null +++ b/tasks/format-code-task-002189/tests/test.patch @@ -0,0 +1,198 @@ +diff --git a/tests/test_identity_mapping.py b/tests/test_identity_mapping.py +new file mode 100644 +index 0000000..40b8f51 +--- /dev/null ++++ b/tests/test_identity_mapping.py +@@ -0,0 +1,165 @@ ++# -*- coding: utf-8 -*- ++ ++ ++ ++ ++ ++ ++ ++from flask_security import ( ++ Security, ++ get_identity_lookup, ++ uia_email_mapper, ++ uia_phone_mapper, ++) ++ ++ ++def _init_security(app, datastore, **config): ++ for key, value in config.items(): ++ app.config["SECURITY_" + key] = value ++ app.security = Security(app, datastore=datastore) ++ return app ++ ++ ++ ++ ++ ++def _always(identity): ++ return identity ++ ++ ++def _never(identity): ++ return None ++ ++ ++def test_email_mapper_valid(): ++ for good in ["matt@lp.com", "MATT@lp.com", "a@b.co", "joe.smith@example.org"]: ++ assert uia_email_mapper(good) == good ++ ++ ++def test_email_mapper_invalid(): ++ for bad in ["not-an-email", "matt@", "12345", "user@example", "foo bar@x.com"]: ++ assert uia_email_mapper(bad) is None ++ ++ ++def test_phone_mapper_valid(): ++ for good in ["+1-555-555-5555", "555-555-5555", "(555) 555-5555", "5555555555"]: ++ assert uia_phone_mapper(good) == good ++ ++ ++def test_phone_mapper_invalid(): ++ for bad in ["matt@lp.com", "abc", "12"]: ++ assert uia_phone_mapper(bad) is None ++ ++ ++def test_default_lookup_email(app, sqlalchemy_datastore): ++ ++ _init_security(app, sqlalchemy_datastore) ++ assert get_identity_lookup("matt@lp.com", app=app) == {"email": "matt@lp.com"} ++ ++ ++def test_default_lookup_no_match(app, sqlalchemy_datastore): ++ ++ _init_security(app, sqlalchemy_datastore) ++ assert get_identity_lookup("555-555-5555", app=app) is None ++ ++ ++def test_lookup_returns_canonical_value(app, sqlalchemy_datastore): ++ ++ _init_security(app, sqlalchemy_datastore) ++ assert get_identity_lookup("MATT@lp.com", app=app) == {"email": "MATT@lp.com"} ++ ++ ++def test_lookup_respects_identity_attributes(app, sqlalchemy_datastore): ++ ++ ++ _init_security( ++ app, ++ sqlalchemy_datastore, ++ USER_IDENTITY_ATTRIBUTES=["email"], ++ USER_IDENTITY_MAPPINGS=[ ++ {"email": uia_email_mapper}, ++ {"us_phone_number": uia_phone_mapper}, ++ ], ++ ) ++ assert get_identity_lookup("555-555-5555", app=app) is None ++ assert get_identity_lookup("matt@lp.com", app=app) == {"email": "matt@lp.com"} ++ ++ ++def test_lookup_enabled_attribute_matches(app, sqlalchemy_datastore): ++ ++ _init_security( ++ app, ++ sqlalchemy_datastore, ++ USER_IDENTITY_ATTRIBUTES=["email", "us_phone_number"], ++ USER_IDENTITY_MAPPINGS=[ ++ {"email": uia_email_mapper}, ++ {"us_phone_number": uia_phone_mapper}, ++ ], ++ ) ++ assert get_identity_lookup("555-555-5555", app=app) == { ++ "us_phone_number": "555-555-5555" ++ } ++ ++ ++def test_lookup_order_first_match_wins(app, sqlalchemy_datastore): ++ ++ _init_security( ++ app, ++ sqlalchemy_datastore, ++ USER_IDENTITY_ATTRIBUTES=["email", "username"], ++ USER_IDENTITY_MAPPINGS=[ ++ {"username": _always}, ++ {"email": _always}, ++ ], ++ ) ++ assert get_identity_lookup("whatever", app=app) == {"username": "whatever"} ++ ++ ++def test_lookup_order_reversed(app, sqlalchemy_datastore): ++ _init_security( ++ app, ++ sqlalchemy_datastore, ++ USER_IDENTITY_ATTRIBUTES=["email", "username"], ++ USER_IDENTITY_MAPPINGS=[ ++ {"email": _always}, ++ {"username": _always}, ++ ], ++ ) ++ assert get_identity_lookup("whatever", app=app) == {"email": "whatever"} ++ ++ ++def test_lookup_skips_non_matching_mapper(app, sqlalchemy_datastore): ++ ++ _init_security( ++ app, ++ sqlalchemy_datastore, ++ USER_IDENTITY_ATTRIBUTES=["email", "username"], ++ USER_IDENTITY_MAPPINGS=[ ++ {"email": _never}, ++ {"username": _always}, ++ ], ++ ) ++ assert get_identity_lookup("whatever", app=app) == {"username": "whatever"} ++ ++ ++def test_lookup_no_mapping_matches(app, sqlalchemy_datastore): ++ _init_security( ++ app, ++ sqlalchemy_datastore, ++ USER_IDENTITY_ATTRIBUTES=["email"], ++ USER_IDENTITY_MAPPINGS=[{"email": uia_email_mapper}], ++ ) ++ assert get_identity_lookup("not-an-email", app=app) is None ++ ++ ++def test_default_mappings_present(app, sqlalchemy_datastore): ++ ++ _init_security(app, sqlalchemy_datastore) ++ mappings = app.config["SECURITY_USER_IDENTITY_MAPPINGS"] ++ assert isinstance(mappings, list) ++ assert all(isinstance(m, dict) and len(m) == 1 for m in mappings) ++ ++ for m in mappings: ++ for mapper in m.values(): ++ assert callable(mapper) +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,22 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++set -euo pipefail ++HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ++cd /testbed ++ ++ ++ ++ ++ ++ ++source /testbed/.venv/bin/activate ++PYTEST="python -m pytest -p no:cacheprovider -o addopts=" ++ ++ ++$PYTEST tests/test_common.py tests/test_configuration.py ++ ++ ++$PYTEST tests/test_identity_mapping.py diff --git a/tasks/format-code-task-002189/tests/test.sh b/tasks/format-code-task-002189/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..3bd6534876fb1094dce807adefe3d92fd3b1b472 --- /dev/null +++ b/tasks/format-code-task-002189/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/test_identity_mapping.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002189/tests/test_command.sh b/tasks/format-code-task-002189/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002189/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002202/environment/Dockerfile b/tasks/format-code-task-002202/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..e5fe189cbe1a43ec08aea2ef1da085f84b89b210 --- /dev/null +++ b/tasks/format-code-task-002202/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:67faea83bc2c001c42bf5a0be8ea8c077952f7df5d8d18cbb1a91c0552097ca1 diff --git a/tasks/format-code-task-002202/environment/setup/files/blocklist b/tasks/format-code-task-002202/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002202/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002202/environment/setup/setup.sh b/tasks/format-code-task-002202/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002202/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002202/tests/test.patch b/tasks/format-code-task-002202/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..70aaf80ecf83d4c2b8e70fda6db3110312fab014 --- /dev/null +++ b/tasks/format-code-task-002202/tests/test.patch @@ -0,0 +1,105 @@ +diff --git a/pandas/tests/io/formats/test_to_latex.py b/pandas/tests/io/formats/test_to_latex.py +index ddd34e0c16..aae46ee28f 100644 +--- a/pandas/tests/io/formats/test_to_latex.py ++++ b/pandas/tests/io/formats/test_to_latex.py +@@ -692,3 +692,78 @@ NaN & 2 & 4 \\ + \end{tabular} + """ + assert observed == expected ++ ++ def test_to_latex_escape_backslash_with_space(self): ++ # GH issue: backslash must be escaped to a *valid* LaTeX command, ++ # i.e. terminated with a space ("\textbackslash ") or with an ++ # empty group ("\textbackslash{}") - never the bare form ++ # "\textbackslash" (which forms an undefined command name) ++ # and never the double-escaped form "\textbackslash\{\}" (which ++ # would render the braces as literal characters). ++ df = DataFrame({'A': ['a\\b\\c']}) ++ result = df.to_latex() ++ has_space_form = 'a\\textbackslash b\\textbackslash c' in result ++ has_brace_form = 'a\\textbackslash{}b\\textbackslash{}c' in result ++ assert has_space_form or has_brace_form ++ # bare form (no terminator) is the original bug ++ assert 'a\\textbackslashb' not in result ++ # double-escaped braces are an over-broad-fix bug ++ assert '\\textbackslash\\{' not in result ++ ++ def test_to_latex_escape_tilde_with_space(self): ++ # tilde must be escaped to a *valid* LaTeX command: ++ # "\textasciitilde " (with space) or "\textasciitilde{}" (with ++ # empty group). The bare form "\textasciitilde" is invalid. ++ df = DataFrame({'A': ['a~b']}) ++ result = df.to_latex() ++ has_space_form = 'a\\textasciitilde b' in result ++ has_brace_form = 'a\\textasciitilde{}b' in result ++ assert has_space_form or has_brace_form ++ # bare form (no terminator) is the original bug ++ assert 'a\\textasciitildeb' not in result ++ ++ def test_to_latex_escape_caret_with_space(self): ++ # caret must be escaped to a *valid* LaTeX command: ++ # "\textasciicircum " (with space) or "\textasciicircum{}" (with ++ # empty group). The bare form "\textasciicircum" is invalid. ++ df = DataFrame({'A': ['a^b']}) ++ result = df.to_latex() ++ has_space_form = 'a\\textasciicircum b' in result ++ has_brace_form = 'a\\textasciicircum{}b' in result ++ assert has_space_form or has_brace_form ++ # bare form (no terminator) is the original bug ++ assert 'a\\textasciicircumb' not in result ++ ++ def test_to_latex_escape_false_preserves_backslash(self): ++ # escape=False should leave backslashes untouched ++ df = DataFrame({'A': ['a\\b\\c']}) ++ result = df.to_latex(escape=False) ++ assert 'a\\b\\c' in result ++ assert '\\textbackslash' not in result ++ ++ def test_to_latex_escape_backslash_at_end(self): ++ # backslash with no letter following must still be a valid ++ # \textbackslash command (either space-terminated or {}-terminated), ++ # never the double-escaped \textbackslash\{\} form (which renders ++ # as literal braces, not a backslash). ++ df = DataFrame({'A': ['a\\']}) ++ result = df.to_latex() ++ # double-escaped braces are an over-broad-fix bug ++ assert '\\textbackslash\\{' not in result ++ ++ def test_to_latex_escape_reproduce_issue(self): ++ # exact reproduction from the reported issue - all three backslashes ++ # must be valid \textbackslash commands (either space- or ++ # {}-terminated). The bare form is the original bug. ++ df = DataFrame({'A': ['a\\b\\c', 'p\\y\\c', 'a\\d\\x'], ++ 'B': [2, 9, 4]}) ++ result = df.to_latex() ++ space_form = ('a\\textbackslash b\\textbackslash c' in result ++ and 'p\\textbackslash y\\textbackslash c' in result ++ and 'a\\textbackslash d\\textbackslash x' in result) ++ brace_form = ('a\\textbackslash{}b\\textbackslash{}c' in result ++ and 'p\\textbackslash{}y\\textbackslash{}c' in result ++ and 'a\\textbackslash{}d\\textbackslash{}x' in result) ++ assert space_form or brace_form ++ # bare form is the bug ++ assert 'a\\textbackslashb' not in result +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 0000000000..680df44b1c +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["pytest pandas/tests/io/formats/test_to_latex.py -k 'test_to_latex_escape_backslash_with_space or test_to_latex_escape_tilde_with_space or test_to_latex_escape_caret_with_space or test_to_latex_escape_false_preserves_backslash or test_to_latex_escape_backslash_at_end or test_to_latex_escape_reproduce_issue' -v"] ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++pytest pandas/tests/io/formats/test_to_latex.py -k 'test_to_latex_escape_backslash_with_space or test_to_latex_escape_tilde_with_space or test_to_latex_escape_caret_with_space or test_to_latex_escape_false_preserves_backslash or test_to_latex_escape_backslash_at_end or test_to_latex_escape_reproduce_issue' -v ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-002202/tests/test.sh b/tasks/format-code-task-002202/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..815bc9f933e1168de9b4cc750737eef2a9469547 --- /dev/null +++ b/tasks/format-code-task-002202/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +pandas/tests/io/formats/test_to_latex.py +test_commands.json +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002202/tests/test_command.sh b/tasks/format-code-task-002202/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002202/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002205/environment/Dockerfile b/tasks/format-code-task-002205/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..934f92eb646936bc75dffa0c72290f8823ead689 --- /dev/null +++ b/tasks/format-code-task-002205/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:697b397a740b337dbb0dd984fcdb0726664a1871283e7e344ad219c85d6ddbe1 diff --git a/tasks/format-code-task-002205/environment/setup/files/blocklist b/tasks/format-code-task-002205/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002205/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002205/environment/setup/setup.sh b/tasks/format-code-task-002205/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002205/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002205/tests/test.patch b/tasks/format-code-task-002205/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..df9b2b5e9a27efe038920a05baf946a73a627b34 --- /dev/null +++ b/tasks/format-code-task-002205/tests/test.patch @@ -0,0 +1,90 @@ +diff --git a/pandas/tests/arithmetic/test_period.py b/pandas/tests/arithmetic/test_period.py +index 7158eae376..5834947495 100644 +--- a/pandas/tests/arithmetic/test_period.py ++++ b/pandas/tests/arithmetic/test_period.py +@@ -361,6 +361,63 @@ class TestPeriodIndexArithmetic(object): + expected = pd.Index([pd.NaT, 0 * off, 0 * off, 0 * off, 0 * off]) + tm.assert_index_equal(result, expected) + ++ def test_period_sub_period_24H_gh23915(self): ++ ++ ++ sd = pd.Period('20180101', freq='24H') ++ bd = pd.Period('19700101', freq='24H') ++ offset = sd - bd ++ ++ assert bd + offset == sd ++ ++ ++ ++ assert offset.n == 420768 ++ ++ def test_period_sub_period_5H_gh23915(self): ++ ++ p1 = pd.Period('20180101 00:00', freq='5H') ++ p2 = pd.Period('20180101 15:00', freq='5H') ++ offset = p2 - p1 ++ assert p1 + offset == p2 ++ ++ assert offset.n == 15 ++ ++ def test_period_sub_period_2D_gh23915(self): ++ ++ p1 = pd.Period('2018-01-01', freq='2D') ++ p2 = pd.Period('2018-01-05', freq='2D') ++ offset = p2 - p1 ++ assert p1 + offset == p2 ++ ++ assert offset.n == 4 ++ ++ def test_period_sub_period_unit_freq_preservation(self): ++ ++ p1 = pd.Period('2018-01-01 00:00', freq='H') ++ p2 = pd.Period('2018-01-01 05:00', freq='H') ++ offset = p2 - p1 ++ assert offset.n == 5 ++ assert p1 + offset == p2 ++ ++ d1 = pd.Period('2018-01-01', freq='D') ++ d2 = pd.Period('2018-01-15', freq='D') ++ offset = d2 - d1 ++ assert offset.n == 14 ++ assert d1 + offset == d2 ++ ++ def test_periodindex_sub_periodindex_24H_gh23915(self): ++ ++ ++ pi = pd.period_range('2018-01-01', periods=3, freq='24H') ++ pi2 = pd.period_range('1970-01-01', periods=3, freq='24H') ++ diff = pi - pi2 ++ ++ for off in diff: ++ assert off.n == 420768 ++ result = pi2 + diff ++ tm.assert_index_equal(result, pi) ++ + def test_parr_sub_pi_mismatched_freq(self, box_with_array): + rng = pd.period_range('1/1/2000', freq='D', periods=5) + other = pd.period_range('1/6/2000', freq='H', periods=5) +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 0000000000..11c4c208e9 +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["python -m pytest pandas/tests/arithmetic/test_period.py -k \"gh23915 or unit_freq_preservation\" -v"] ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++python -m pytest pandas/tests/arithmetic/test_period.py -k "gh23915 or unit_freq_preservation" -v ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-002205/tests/test.sh b/tasks/format-code-task-002205/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..474decd252350441ef747622a7ef5ff6b667ae02 --- /dev/null +++ b/tasks/format-code-task-002205/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +pandas/tests/arithmetic/test_period.py +test_commands.json +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002205/tests/test_command.sh b/tasks/format-code-task-002205/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002205/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002233/environment/Dockerfile b/tasks/format-code-task-002233/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..18f4557cb6b57715d10b3985eadcc76635002015 --- /dev/null +++ b/tasks/format-code-task-002233/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:2bb9a980453edbb7275db52f398ddc46259ab5f7ed8af7600e6689f1415d124e diff --git a/tasks/format-code-task-002233/environment/setup/files/blocklist b/tasks/format-code-task-002233/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002233/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002233/environment/setup/setup.sh b/tasks/format-code-task-002233/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002233/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002233/tests/test.patch b/tasks/format-code-task-002233/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..234f30186eacb752a4b42c112dccaa06f4450d83 --- /dev/null +++ b/tasks/format-code-task-002233/tests/test.patch @@ -0,0 +1,96 @@ +diff --git a/pandas/tests/series/methods/test_describe.py b/pandas/tests/series/methods/test_describe.py +index ab4b8881d6..fddd7c8b3e 100644 +--- a/pandas/tests/series/methods/test_describe.py ++++ b/pandas/tests/series/methods/test_describe.py +@@ -2,6 +2,7 @@ import numpy as np + import pytest + + from pandas.compat import is_numpy_dev ++import pandas.util._test_decorators as td + + from pandas.core.dtypes.common import ( + is_complex_dtype, +@@ -187,3 +188,61 @@ class TestSeriesDescribe: + dtype=dtype, + ) + tm.assert_series_equal(result, expected) ++ ++ @td.skip_if_no("pyarrow") ++ def test_describe_arrow_float64_dtype(self): ++ ++ ++ import pyarrow as pa ++ ++ import pandas as pd ++ ++ ser = Series([100.0, 200.0], dtype=pd.ArrowDtype(pa.float64())) ++ result = ser.describe() ++ assert isinstance(result.dtype, pd.ArrowDtype) ++ assert result.dtype == pd.ArrowDtype(pa.float64()) ++ ++ from pandas.core.arrays.floating import Float64Dtype ++ ++ assert not isinstance(result.dtype, Float64Dtype) ++ ++ @td.skip_if_no("pyarrow") ++ def test_describe_arrow_int64_dtype(self): ++ ++ ++ import pyarrow as pa ++ ++ import pandas as pd ++ ++ ser = Series([1, 2, 3, 4], dtype=pd.ArrowDtype(pa.int64())) ++ result = ser.describe() ++ assert isinstance(result.dtype, pd.ArrowDtype) ++ assert result.dtype == pd.ArrowDtype(pa.float64()) ++ ++ @td.skip_if_no("pyarrow") ++ def test_describe_arrow_float32_dtype(self): ++ ++ ++ import pyarrow as pa ++ ++ import pandas as pd ++ ++ ser = Series([1.0, 2.0], dtype=pd.ArrowDtype(pa.float32())) ++ result = ser.describe() ++ assert isinstance(result.dtype, pd.ArrowDtype) ++ assert result.dtype == pd.ArrowDtype(pa.float64()) ++ ++ def test_describe_masked_float64_dtype(self): ++ ++ ++ from pandas.core.arrays.floating import Float64Dtype ++ ++ ser = Series([1.0, 2.0], dtype="Float64") ++ result = ser.describe() ++ assert isinstance(result.dtype, Float64Dtype) ++ ++ def test_describe_numpy_float_dtype_preserved(self): ++ ++ ser = Series([1.0, 2.0]) ++ result = ser.describe() ++ assert result.dtype == np.dtype("float64") +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 0000000000..01afc5f87b +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["python -m pytest pandas/tests/series/methods/test_describe.py -v"] ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++python -m pytest pandas/tests/series/methods/test_describe.py -v ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-002233/tests/test.sh b/tasks/format-code-task-002233/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..b1f156dfcd864d4d719b7dc01c33c0724c287568 --- /dev/null +++ b/tasks/format-code-task-002233/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +pandas/tests/series/methods/test_describe.py +test_commands.json +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002233/tests/test_command.sh b/tasks/format-code-task-002233/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002233/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002251/environment/Dockerfile b/tasks/format-code-task-002251/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..c967e383340a09ac4c841cbb5f305295bdf0860c --- /dev/null +++ b/tasks/format-code-task-002251/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:aa999111298285fb1bf54d91459c09551aab6862085a5aedc9356f8bb4ec13e8 diff --git a/tasks/format-code-task-002251/environment/setup/files/blocklist b/tasks/format-code-task-002251/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002251/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002251/environment/setup/setup.sh b/tasks/format-code-task-002251/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002251/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002251/tests/test.patch b/tasks/format-code-task-002251/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..5f5ff92b00494e481ba590dd6342a4f7e64e9744 --- /dev/null +++ b/tasks/format-code-task-002251/tests/test.patch @@ -0,0 +1,124 @@ +diff --git a/src/test/php/PDepend/Source/AST/ASTEnumTest.php b/src/test/php/PDepend/Source/AST/ASTEnumTest.php +new file mode 100644 +index 0000000000..7ebdf8afc8 +--- /dev/null ++++ b/src/test/php/PDepend/Source/AST/ASTEnumTest.php +@@ -0,0 +1,89 @@ ++. ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * ++ * * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * ++ * * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in ++ * the documentation and/or other materials provided with the ++ * distribution. ++ * ++ * * Neither the name of Manuel Pichler nor the names of his ++ * contributors may be used to endorse or promote products derived ++ * from this software without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ++ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ++ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, ++ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ++ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ++ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ++ * POSSIBILITY OF SUCH DAMAGE. ++ * ++ * @copyright 2008-2017 Manuel Pichler. All rights reserved. ++ * @license http://www.opensource.org/licenses/bsd-license.php BSD License ++ */ ++ ++namespace PDepend\Source\AST; ++ ++use PDepend\Source\Builder\BuilderContext\GlobalBuilderContext; ++use PDepend\Source\Language\PHP\PHPBuilder; ++use PDepend\Util\Cache\Driver\MemoryCacheDriver; ++ ++/** ++ * Test case for the {@link \PDepend\Source\AST\ASTForInit} class. ++ * ++ * @copyright 2008-2017 Manuel Pichler. All rights reserved. ++ * @license http://www.opensource.org/licenses/bsd-license.php BSD License ++ * ++ * @covers \PDepend\Source\Language\PHP\AbstractPHPParser ++ * @covers \PDepend\Source\AST\ASTForInit ++ * @group unittest ++ */ ++class ASTEnumTest extends AbstractASTArtifactTest ++{ ++ /** ++ * testForInitHasExpectedStartLine ++ * ++ * @return void ++ */ ++ public function testSerialization() ++ { ++ $enum = $this->createItem(); ++ $serializedClass = serialize($enum); ++ ++ /** @var ASTEnum $enum */ ++ $deserializedEnum = unserialize($serializedClass); ++ ++ $this->assertInstanceOf('PDepend\\Source\\AST\\ASTEnum', $deserializedEnum); ++ $this->assertSame('test', $deserializedEnum->getName()); ++ $this->assertInstanceOf('PDepend\\Source\\AST\\ASTScalarType', $deserializedEnum->getType()); ++ $this->assertSame('string', $deserializedEnum->getType()->getImage()); ++ } ++ ++ protected function createItem() ++ { ++ $enum = new ASTEnum('test', new ASTScalarType('string')); ++ $enum->setCache(new MemoryCacheDriver()); ++ $enum->setContext(new GlobalBuilderContext(new PHPBuilder())); ++ $enum->setCompilationUnit(new ASTCompilationUnit(__FILE__)); ++ ++ return $enum; ++ } ++} +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,13 @@ ++H4sIAAAAAAAAA+2WS2+bQBCAfeZXTNUotqVijGuSSq1TVW2qHqM2PVtrGOJV8IL24dhq8t87iyF2 +++kguTp/zHYCd2d15LQODmZNFNkW1jDqPxZA4TpL6Tnx7r5/jZBTHx+PR0M+L46Ph8w4kj+bRDs5Y ++oQE6uiztffMe0v+lDLb1R5HOp1VZrHNZFINqXu3Lhi/w0Xj80/qPj27rHx+PYqp/Eo+SDgz35cB9 ++/Of1f/WaCh3IHHpPcqdSK0s1xZU01vS6/kB0+334EgDRqsGLe4cHQmuxbpWeg0tcwwTo2muUL291 ++3sBGP5mAckWxu9Cj0TqtIBeFwe2ym+3mS1E4pO1TpzUq+70JhasfSJt9a3FvCJOT2s1n0KVrdzuM ++68faBunqe3crava7CW6C312vfbPz/ls0dpqWi4VQ2cDM92fjgf4fx8lO/4/9+08dYczv/68gzaAu ++/AyzIHgKp8o4jXD24QxeDGKQBuwcIcNcuMJCTyFmmEFeaj/ls5IWksEK6NBUwsqZLKRd9wNXZcJi ++KAqLWpF8iQbC0KAF6jUQOaOjmVQRDbyN0UmU4TLyTQGur8Fqh96T9xrNHKSi8pCizOEtGSkNavKm ++QpWhSiWaQC8g1DksSUJOpc2cQVGml0E7go1D5EOlMUcdZtTftiOyMCu8VpWhVOSz2PS50clh7D35 ++6FSdBZ+UO5FCLldgUi0rSg2J0zkF2njSpqdJFWVz1Q98+EandcJ9+NHZuzqWiDYKaRze2d5/gnft ++0zm9oBz6xXAl7bwW1s24D+1nG3qN4EoY6n2LcknlkqpxYbhxIcxAOFtOKX5vfUoLcdKegui+P4Im ++urZ8zkcYhqSlrMGbT+enyi3OsU4uJTMl61pcUGqX/1zfZBiGYRiGYRiGYRiGYRiGYRiGYRiG+dP4 ++CnJA+csAKAAA +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-002251/tests/test.sh b/tasks/format-code-task-002251/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..be4e2503b415bc9903aec636615f47811ec46119 --- /dev/null +++ b/tasks/format-code-task-002251/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +src/test/php/PDepend/Source/AST/ASTEnumTest.php +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002251/tests/test_command.sh b/tasks/format-code-task-002251/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002251/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002260/environment/Dockerfile b/tasks/format-code-task-002260/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..26aabb3b2529eeb2ac77aafd05cb99be11346f6f --- /dev/null +++ b/tasks/format-code-task-002260/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:2e5170bf2bcda2c0f2d6129cc855a43a6430436825fd306901d897d9894fae18 diff --git a/tasks/format-code-task-002260/environment/setup/files/blocklist b/tasks/format-code-task-002260/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002260/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002260/environment/setup/setup.sh b/tasks/format-code-task-002260/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-002260/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002260/tests/test.patch b/tasks/format-code-task-002260/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..177d94143cbb1085b1be12b5a2addc1924778658 --- /dev/null +++ b/tasks/format-code-task-002260/tests/test.patch @@ -0,0 +1,357 @@ +diff --git a/usercase-test-coderl/admin-delete.test.ts b/usercase-test-coderl/admin-delete.test.ts +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/admin-delete.test.ts +@@ -0,0 +1,303 @@ ++import { TSGhostAdminAPI } from "../packages/ts-ghost-admin-api/src/index"; ++import { ++ APIComposer, ++ HTTPClientFactory, ++ baseTagsSchema, ++ slugOrIdSchema, ++} from "../packages/ts-ghost-core-api/src/index"; ++ ++ ++ ++ ++ ++ ++ ++ ++ ++const ADMIN_KEY = ++ "1efedd9db174adee2d23d982:4b74dca0219bad629852191af326a45037346c2231240e0f7aec1f9371cc14e8"; ++ ++type QueuedFetch = ++ | { kind: "response"; status: number; body?: unknown } ++ | { kind: "throw"; error: Error }; ++ ++type FetchCall = { ++ url: string; ++ method: string | undefined; ++}; ++ ++type ExpectedDeleteCall = { ++ origin: string; ++ pathname: string; ++ key?: string; ++}; ++ ++const queuedFetches: QueuedFetch[] = []; ++const fetchCalls: FetchCall[] = []; ++ ++function installFetchStub() { ++ queuedFetches.length = 0; ++ fetchCalls.length = 0; ++ ++ vi.stubGlobal( ++ "fetch", ++ vi.fn(async (url: string, init?: RequestInit) => { ++ fetchCalls.push({ ++ url, ++ method: init?.method, ++ }); ++ ++ const next = queuedFetches.shift(); ++ if (!next) { ++ throw new Error("missing queued fetch response"); ++ } ++ if (next.kind === "throw") { ++ throw next.error; ++ } ++ ++ return new Response(next.body === undefined ? null : JSON.stringify(next.body), { ++ status: next.status, ++ headers: { "Content-Type": "application/json" }, ++ }); ++ }), ++ ); ++} ++ ++function makeAdminAPI(url = "https://ghost.org") { ++ return new TSGhostAdminAPI(url, ADMIN_KEY, "v6.0"); ++} ++ ++function makeCustomTagClient() { ++ return new APIComposer( ++ "tags", ++ { ++ schema: baseTagsSchema, ++ identitySchema: slugOrIdSchema, ++ include: baseTagsSchema, ++ }, ++ new HTTPClientFactory({ ++ url: "https://ghost.org", ++ key: ADMIN_KEY, ++ version: "v6.0", ++ endpoint: "admin", ++ }), ++ ).access(["delete"]); ++} ++ ++function expectDeleteCall(call: FetchCall | undefined, expected: ExpectedDeleteCall) { ++ expect(call).toBeDefined(); ++ expect(call?.method).toBe("DELETE"); ++ const url = new URL(call?.url ?? "http://invalid.local"); ++ expect(url.origin).toBe(expected.origin); ++ ++ expect(url.pathname.replace(/\/+$/, "")).toBe(expected.pathname.replace(/\/+$/, "")); ++ if (expected.key !== undefined) { ++ expect(url.searchParams.get("key")).toBe(expected.key); ++ } else { ++ expect(url.search).toBe(""); ++ } ++} ++ ++beforeEach(() => { ++ installFetchStub(); ++}); ++ ++afterEach(() => { ++ vi.restoreAllMocks(); ++ vi.unstubAllGlobals(); ++}); ++ ++test("admin resource clients expose delete methods", () => { ++ ++ ++ const api = makeAdminAPI(); ++ ++ expect(typeof api.posts.delete).toBe("function"); ++ expect(typeof api.pages.delete).toBe("function"); ++ expect(typeof api.members.delete).toBe("function"); ++ expect(typeof api.tags.delete).toBe("function"); ++ expect(typeof api.webhooks.delete).toBe("function"); ++}); ++ ++test("admin delete sends resource identity DELETE requests and resolves 204 successes", async () => { ++ ++ ++ const api = makeAdminAPI(); ++ queuedFetches.push( ++ { kind: "response", status: 204 }, ++ { kind: "response", status: 204 }, ++ { kind: "response", status: 204 }, ++ { kind: "response", status: 204 }, ++ { kind: "response", status: 204 }, ++ ); ++ ++ await expect(api.posts.delete("post-id-1")).resolves.toStrictEqual({ success: true }); ++ ++ expect(fetchCalls).toHaveLength(1); ++ expectDeleteCall(fetchCalls[0], { ++ origin: "https://ghost.org", ++ pathname: "/ghost/api/admin/posts/post-id-1", ++ }); ++ ++ await expect(api.pages.delete("page-id-1")).resolves.toStrictEqual({ success: true }); ++ ++ expect(fetchCalls).toHaveLength(2); ++ expectDeleteCall(fetchCalls[1], { ++ origin: "https://ghost.org", ++ pathname: "/ghost/api/admin/pages/page-id-1", ++ }); ++ ++ await expect(api.members.delete("member-id-1")).resolves.toStrictEqual({ success: true }); ++ ++ expect(fetchCalls).toHaveLength(3); ++ expectDeleteCall(fetchCalls[2], { ++ origin: "https://ghost.org", ++ pathname: "/ghost/api/admin/members/member-id-1", ++ }); ++ ++ await expect(api.tags.delete("tag-id-1")).resolves.toStrictEqual({ success: true }); ++ ++ expect(fetchCalls).toHaveLength(4); ++ expectDeleteCall(fetchCalls[3], { ++ origin: "https://ghost.org", ++ pathname: "/ghost/api/admin/tags/tag-id-1", ++ }); ++ ++ await expect(api.webhooks.delete("webhook-id-1")).resolves.toStrictEqual({ success: true }); ++ ++ expect(fetchCalls).toHaveLength(5); ++ expectDeleteCall(fetchCalls[4], { ++ origin: "https://ghost.org", ++ pathname: "/ghost/api/admin/webhooks/webhook-id-1", ++ }); ++}); ++ ++test("admin delete resolves Ghost error JSON with status", async () => { ++ ++ ++ const api = makeAdminAPI(); ++ queuedFetches.push({ ++ kind: "response", ++ status: 404, ++ body: { ++ errors: [{ type: "NotFoundError", message: "Resource not found", context: "Could not find Post" }], ++ }, ++ }); ++ ++ await expect(api.posts.delete("missing-post")).resolves.toStrictEqual({ ++ success: false, ++ errors: [{ type: "NotFoundError", message: "Resource not found", context: "Could not find Post" }], ++ status: 404, ++ }); ++ ++ expect(fetchCalls).toHaveLength(1); ++ expectDeleteCall(fetchCalls[0], { ++ origin: "https://ghost.org", ++ pathname: "/ghost/api/admin/posts/missing-post", ++ }); ++}); ++ ++test("admin delete resolves fetch throws as status zero FetchError", async () => { ++ ++ ++ const api = makeAdminAPI(); ++ queuedFetches.push({ kind: "throw", error: new Error("socket exploded") }); ++ ++ const result = await api.pages.delete("page-id-1"); ++ ++ ++ expect(result.success).toBe(false); ++ if (!result.success) { ++ expect(result.status).toBe(0); ++ expect(result.errors).toHaveLength(1); ++ expect(result.errors[0]?.type).toBe("FetchError"); ++ } ++ ++ expect(fetchCalls).toHaveLength(1); ++ expectDeleteCall(fetchCalls[0], { ++ origin: "https://ghost.org", ++ pathname: "/ghost/api/admin/pages/page-id-1", ++ }); ++}); ++ ++test("delete rejects empty id before making a request", async () => { ++ ++ ++ const api = makeAdminAPI(); ++ const error = await api.posts.delete("").then( ++ () => undefined, ++ (caught) => caught, ++ ); ++ ++ ++ expect(error).toBeDefined(); ++ expect(fetchCalls).toHaveLength(0); ++}); ++ ++test("custom APIComposer resource clients expose and run delete", async () => { ++ ++ ++ const customTags = makeCustomTagClient(); ++ queuedFetches.push({ kind: "response", status: 204 }); ++ ++ expect(typeof customTags.delete).toBe("function"); ++ await expect(customTags.delete("custom-tag")).resolves.toStrictEqual({ success: true }); ++ ++ expect(fetchCalls).toHaveLength(1); ++ expectDeleteCall(fetchCalls[0], { ++ origin: "https://ghost.org", ++ pathname: "/ghost/api/admin/tags/custom-tag", ++ }); ++}); ++ ++test("separate admin client instances keep their own base URL state", async () => { ++ ++ ++ const a = makeAdminAPI("https://ghost-a.example"); ++ const b = makeAdminAPI("https://ghost-b.example/blog"); ++ queuedFetches.push({ kind: "response", status: 204 }, { kind: "response", status: 204 }); ++ ++ await expect(a.tags.delete("tag-a")).resolves.toStrictEqual({ success: true }); ++ ++ expect(fetchCalls).toHaveLength(1); ++ expectDeleteCall(fetchCalls[0], { ++ origin: "https://ghost-a.example", ++ pathname: "/ghost/api/admin/tags/tag-a", ++ }); ++ ++ await expect(b.tags.delete("tag-b")).resolves.toStrictEqual({ success: true }); ++ ++ expect(fetchCalls).toHaveLength(2); ++ expectDeleteCall(fetchCalls[1], { ++ origin: "https://ghost-b.example", ++ pathname: "/blog/ghost/api/admin/tags/tag-b", ++ }); ++}); ++ ++test("repeated constructed delete sessions do not leave active Node resources", async () => { ++ ++ ++ const beforeActiveResources = process.getActiveResourcesInfo().length; ++ ++ for (let i = 0; i < 100; i += 1) { ++ queuedFetches.push({ kind: "response", status: 204 }); ++ const api = makeAdminAPI(); ++ await expect(api.posts.delete(`cycle-${i}`)).resolves.toStrictEqual({ success: true }); ++ } ++ await new Promise((resolve) => setImmediate(resolve)); ++ ++ const activeResourceDelta = process.getActiveResourcesInfo().length - beforeActiveResources; ++ ++ expect(Number.isFinite(activeResourceDelta)).toBe(true); ++ expect(fetchCalls.length).toBe(100); ++ expect(fetchCalls.every((call) => call.method === "DELETE")).toBe(true); ++ ++ expectDeleteCall(fetchCalls[0], { ++ origin: "https://ghost.org", ++ pathname: "/ghost/api/admin/posts/cycle-0", ++ }); ++ expectDeleteCall(fetchCalls[99], { ++ origin: "https://ghost.org", ++ pathname: "/ghost/api/admin/posts/cycle-99", ++ }); ++}); +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,44 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++set -euo pipefail ++ ++cd /workspace/repo ++ ++ ++ ++ ++required_paths=( ++ "packages/ts-ghost-admin-api/node_modules/.bin/vitest" ++ "packages/ts-ghost-admin-api/node_modules/vitest/dist/cli.js" ++ "packages/ts-ghost-admin-api/node_modules/vite/dist/node/index.js" ++ "packages/ts-ghost-admin-api/node_modules/vite-tsconfig-paths/dist/index.js" ++ "packages/ts-ghost-admin-api/node_modules/typescript/lib/typescript.js" ++ "packages/ts-ghost-admin-api/node_modules/zod/index.cjs" ++ "packages/ts-ghost-admin-api/node_modules/validator/index.js" ++ "packages/ts-ghost-admin-api/node_modules/@ts-ghost/core-api/src/index.ts" ++ "packages/ts-ghost-core-api/node_modules/jose/dist/webapi/index.js" ++ "node_modules/.pnpm/rollup@4.52.5/node_modules/rollup/dist/rollup.js" ++ "node_modules/.pnpm/@rollup+rollup-linux-x64-gnu@4.52.5/node_modules/@rollup/rollup-linux-x64-gnu/rollup.linux-x64-gnu.node" ++ "node_modules/.pnpm/esbuild@0.27.2/node_modules/esbuild/lib/main.js" ++ "node_modules/.pnpm/@esbuild+linux-x64@0.27.2/node_modules/@esbuild/linux-x64/bin/esbuild" ++) ++for path in "${required_paths[@]}"; do ++ if [[ ! -e "$path" ]]; then ++ echo "missing preinstalled offline dependency: $path" >&2 ++ exit 127 ++ fi ++done ++ ++exec packages/ts-ghost-admin-api/node_modules/.bin/vitest run \ ++ --config packages/ts-ghost-admin-api/vitest.config.ts \ ++ /workspace/repo/usercase-test-coderl/admin-delete.test.ts \ ++ --reporter=verbose diff --git a/tasks/format-code-task-002260/tests/test.sh b/tasks/format-code-task-002260/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..77a9347a8f55b5f2626a2d4ca6913ce2a5435c63 --- /dev/null +++ b/tasks/format-code-task-002260/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/admin-delete.test.ts +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002260/tests/test_command.sh b/tasks/format-code-task-002260/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-002260/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002267/environment/Dockerfile b/tasks/format-code-task-002267/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..d2e28d513a60b83ba812bab0e90ad6b1f026180d --- /dev/null +++ b/tasks/format-code-task-002267/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:b16e47725c3b2ec805158ff42ec6a41898593d42d96d15753fd66bc7de1b3380 diff --git a/tasks/format-code-task-002267/environment/setup/files/blocklist b/tasks/format-code-task-002267/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002267/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002267/environment/setup/setup.sh b/tasks/format-code-task-002267/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002267/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002267/tests/test.patch b/tasks/format-code-task-002267/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..e97df8404c2668d6b26e059413fd34e429d1b4e0 --- /dev/null +++ b/tasks/format-code-task-002267/tests/test.patch @@ -0,0 +1,57 @@ +diff --git a/store/tikv/tikvrpc/tikvrpc_test.go b/store/tikv/tikvrpc/tikvrpc_test.go +new file mode 100644 +index 0000000000000..a9dbd84c579d8 +--- /dev/null ++++ b/store/tikv/tikvrpc/tikvrpc_test.go +@@ -0,0 +1,31 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++package tikvrpc ++ ++import ( ++ "github.com/pingcap/kvproto/pkg/tikvpb" ++ ++ . "github.com/pingcap/check" ++) ++ ++type testBatchCommand struct{} ++ ++var _ = Suite(&testBatchCommand{}) ++ ++func (s *testBatchCommand) TestBatchResponse(c *C) { ++ resp := &tikvpb.BatchCommandsResponse_Response{} ++ batchResp, err := FromBatchCommandsResponse(resp) ++ c.Assert(batchResp == nil, IsTrue) ++ c.Assert(err != nil, IsTrue) ++} +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,4 @@ ++H4sIAAAAAAAAA+3R3QqCQBCGYY+9ir2B1FU3LyfUlZLSDV29/jYJ+oHyRInofQ5mBmZhB76gGOqT ++3lXtGHpriZxMqak7r32apYqjOM1clV4kpcoyT6jVLnow9DbvhPA6Y+ynd3P7HxXc87dVb3elaZq8 ++1UF/WO6P2fzd7pZ/ksSpyz/dSpd/tNwJ7/15/qUWU/BFpf29EddRbEYRhL01XRXa+jhOpTuXof/t ++YwEAAAAAAAAAAAAAAAA8uQCrbZJ8ACgAAA== +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-002267/tests/test.sh b/tasks/format-code-task-002267/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..ee7e2f1b9813e76667087ff62481124353905700 --- /dev/null +++ b/tasks/format-code-task-002267/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +store/tikv/tikvrpc/tikvrpc_test.go +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002267/tests/test_command.sh b/tasks/format-code-task-002267/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002267/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002293/environment/Dockerfile b/tasks/format-code-task-002293/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..0ab4d4119d6b3875c361faa44534cb065e0af3dc --- /dev/null +++ b/tasks/format-code-task-002293/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:e33baf95a22a669c5806a07ab8ac2b2db46df760ccc176e9d49c6654791cc133 diff --git a/tasks/format-code-task-002293/environment/setup/files/blocklist b/tasks/format-code-task-002293/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002293/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002293/environment/setup/setup.sh b/tasks/format-code-task-002293/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002293/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002293/tests/test.patch b/tasks/format-code-task-002293/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..647ef3c8d0151e84c1a900a18c414cd6c8b2abf7 --- /dev/null +++ b/tasks/format-code-task-002293/tests/test.patch @@ -0,0 +1,50 @@ +diff --git a/packages/plugin-commands-publishing/test/pack.ts b/packages/plugin-commands-publishing/test/pack.ts +index acb9e2c056a..3715c2f0331 100644 +--- a/packages/plugin-commands-publishing/test/pack.ts ++++ b/packages/plugin-commands-publishing/test/pack.ts +@@ -262,3 +262,21 @@ test('pack should read from the correct node_modules when publishing from a cust + }, + }) + }) ++ ++test('pack to custom destination directory', async () => { ++ prepare({ ++ name: 'custom-dest', ++ version: '0.0.0', ++ }) ++ ++ const output = await pack.handler({ ++ ...DEFAULT_OPTS, ++ argv: { original: [] }, ++ dir: process.cwd(), ++ extraBinPaths: [], ++ packDestination: path.resolve('custom-dest'), ++ embedReadme: false, ++ }) ++ ++ expect(output).toBe(path.resolve('custom-dest/custom-dest-0.0.0.tgz')) ++}) +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,8 @@ ++H4sIAAAAAAAAA+3TzU7jMBAA4J79FLPANXHTklZC6mFVDvQAqtreo/xME4NrW7aDKE+Pk8IuWmlB ++SCBAzHexNZ6J44wTF62QVYbqlg8+yjCYpmk/Bv+O/TxJR8loNEqTaYgnSTqdDCD9sDd6pnU+twAD ++q7V/Ke+19W8q/tt/j85npd7tclXFrnm/PV7r/2Q8+dP/4TgJ/T+dJOMBDN/vFf7vh/f/+BdvneWF ++UDzcAShy1zCHHiJsNRhhcJsLyVhZQX8/CqwYwzujrYfl783F7Kgvl7rMZfeQs5MuevSUoswu3Ci1 ++FXVmsRbO2/2s8d64M86fAnFIunaxtjVn7BgWKjRESqjQoKpQlQIdMyEHxONKFCkdba2+RxWFjW+2 ++QmJXOdc7E6aw2Rtcl1YYf6izrYLysBZpJfdd7irEfINg8vIGuoM9PyHvonmNjhvZ1kJFjz+Fi0xb ++SOEaoWq2vFpeZuv5arHcZOvVPDtfrGZveUD4NndwHfL77fuK2LvD4Up9izbUs8++HYQQQgghhBBC ++CCGEEEIIIYQQQggh5Kt7AGVy/OEAKAAA +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-002293/tests/test.sh b/tasks/format-code-task-002293/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7b494096db30a84b32d9b82e54fad2a392c26e0b --- /dev/null +++ b/tasks/format-code-task-002293/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +packages/plugin-commands-publishing/test/pack.ts +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002293/tests/test_command.sh b/tasks/format-code-task-002293/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002293/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002294/environment/Dockerfile b/tasks/format-code-task-002294/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..093025888c0590b9acf11ec0757fe479e7f17737 --- /dev/null +++ b/tasks/format-code-task-002294/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:51f83a0e51a4cb0dd8df5debad73da22bbac0ade6f6fc7c6a96584465a345156 diff --git a/tasks/format-code-task-002294/environment/setup/files/blocklist b/tasks/format-code-task-002294/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002294/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002294/environment/setup/setup.sh b/tasks/format-code-task-002294/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002294/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002294/tests/test.patch b/tasks/format-code-task-002294/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..c530df8df0365963470bcba85b3b4f03764d00b1 --- /dev/null +++ b/tasks/format-code-task-002294/tests/test.patch @@ -0,0 +1,283 @@ +diff --git a/server/tests/subscription/test_recurring_interval.py b/server/tests/subscription/test_recurring_interval.py +new file mode 100644 +index 000000000..9f48dcfb5 +--- /dev/null ++++ b/server/tests/subscription/test_recurring_interval.py +@@ -0,0 +1,232 @@ ++import uuid ++from types import SimpleNamespace ++from unittest.mock import AsyncMock, MagicMock ++ ++import pytest ++from httpx import AsyncClient ++from pydantic import ValidationError ++from pytest_mock import MockerFixture ++ ++from polar.authz.service import Authz ++from polar.models import Organization, SubscriptionBenefit, UserOrganization ++from polar.postgres import AsyncSession ++from polar.subscription.schemas import SubscriptionTierCreate ++from polar.subscription.service.subscription_tier import ( ++ subscription_tier as subscription_tier_service, ++) ++ ++ ++@pytest.fixture ++def authz(session: AsyncSession) -> Authz: ++ return Authz(session) ++ ++ ++@pytest.fixture ++def enqueue_job_mock(mocker: MockerFixture) -> AsyncMock: ++ return mocker.patch("polar.subscription.service.subscription_tier.enqueue_job") ++ ++ ++def _stub_stripe_product(stripe_service_mock: MagicMock) -> None: ++ create_product_with_price_mock: MagicMock = ( ++ stripe_service_mock.create_product_with_price ++ ) ++ create_product_with_price_mock.return_value = SimpleNamespace( ++ id="PRODUCT_ID", default_price="PRICE_ID" ++ ) ++ ++ ++class TestRecurringIntervalSchema: ++ def test_default_is_month(self) -> None: ++ create_schema = SubscriptionTierCreate( ++ type="individual", ++ name="Tier", ++ price_amount=1000, ++ organization_id=uuid.uuid4(), ++ ) ++ assert create_schema.recurring_interval == "month" ++ ++ def test_explicit_year(self) -> None: ++ create_schema = SubscriptionTierCreate( ++ type="individual", ++ name="Tier", ++ price_amount=1000, ++ recurring_interval="year", ++ organization_id=uuid.uuid4(), ++ ) ++ assert create_schema.recurring_interval == "year" ++ ++ def test_invalid_value_rejected(self) -> None: ++ with pytest.raises(ValidationError): ++ SubscriptionTierCreate( ++ type="individual", ++ name="Tier", ++ price_amount=1000, ++ recurring_interval="weekly", ++ organization_id=uuid.uuid4(), ++ ) ++ ++ ++@pytest.mark.asyncio ++class TestCreateFreeTier: ++ async def test_free_tier_is_monthly( ++ self, ++ session: AsyncSession, ++ organization: Organization, ++ subscription_benefits: list[SubscriptionBenefit], ++ enqueue_job_mock: AsyncMock, ++ ) -> None: ++ session.expunge_all() ++ ++ free_tier = await subscription_tier_service.create_free( ++ session, benefits=subscription_benefits, organization=organization ++ ) ++ assert free_tier.recurring_interval == "month" ++ ++ ++@pytest.mark.asyncio ++@pytest.mark.http_auto_expunge ++class TestCreateSubscriptionTierEndpoint: ++ @pytest.mark.authenticated ++ async def test_default_month( ++ self, ++ client: AsyncClient, ++ organization: Organization, ++ user_organization_admin: UserOrganization, ++ stripe_service_mock: MagicMock, ++ session: AsyncSession, ++ ) -> None: ++ _stub_stripe_product(stripe_service_mock) ++ session.expunge_all() ++ ++ response = await client.post( ++ "/api/v1/subscriptions/tiers/", ++ json={ ++ "type": "individual", ++ "name": "Subscription Tier", ++ "price_amount": 1000, ++ "organization_id": str(organization.id), ++ }, ++ ) ++ ++ assert response.status_code == 201 ++ assert response.json()["recurring_interval"] == "month" ++ ++ @pytest.mark.authenticated ++ async def test_explicit_year( ++ self, ++ client: AsyncClient, ++ organization: Organization, ++ user_organization_admin: UserOrganization, ++ stripe_service_mock: MagicMock, ++ session: AsyncSession, ++ ) -> None: ++ _stub_stripe_product(stripe_service_mock) ++ session.expunge_all() ++ ++ response = await client.post( ++ "/api/v1/subscriptions/tiers/", ++ json={ ++ "type": "individual", ++ "name": "Subscription Tier", ++ "price_amount": 1000, ++ "recurring_interval": "year", ++ "organization_id": str(organization.id), ++ }, ++ ) ++ ++ assert response.status_code == 201 ++ assert response.json()["recurring_interval"] == "year" ++ ++ @pytest.mark.authenticated ++ async def test_invalid_interval( ++ self, ++ client: AsyncClient, ++ organization: Organization, ++ user_organization_admin: UserOrganization, ++ stripe_service_mock: MagicMock, ++ session: AsyncSession, ++ ) -> None: ++ _stub_stripe_product(stripe_service_mock) ++ session.expunge_all() ++ ++ response = await client.post( ++ "/api/v1/subscriptions/tiers/", ++ json={ ++ "type": "individual", ++ "name": "Subscription Tier", ++ "price_amount": 1000, ++ "recurring_interval": "weekly", ++ "organization_id": str(organization.id), ++ }, ++ ) ++ ++ assert response.status_code == 422 ++ ++ ++@pytest.mark.asyncio ++class TestSearchFilterByRecurringInterval: ++ @pytest.mark.authenticated ++ async def test_filter( ++ self, ++ client: AsyncClient, ++ organization: Organization, ++ user_organization_admin: UserOrganization, ++ stripe_service_mock: MagicMock, ++ session: AsyncSession, ++ ) -> None: ++ _stub_stripe_product(stripe_service_mock) ++ session.expunge_all() ++ ++ async def create_tier(name: str, interval: str | None) -> None: ++ payload = { ++ "type": "individual", ++ "name": name, ++ "price_amount": 1000, ++ "organization_id": str(organization.id), ++ } ++ if interval is not None: ++ payload["recurring_interval"] = interval ++ response = await client.post( ++ "/api/v1/subscriptions/tiers/", json=payload ++ ) ++ assert response.status_code == 201 ++ ++ await create_tier("Monthly A", None) ++ await create_tier("Monthly B", "month") ++ await create_tier("Yearly A", "year") ++ ++ base_params = { ++ "platform": organization.platform.value, ++ "organization_name": organization.name, ++ } ++ ++ ++ response = await client.get( ++ "/api/v1/subscriptions/tiers/search", params=base_params ++ ) ++ assert response.status_code == 200 ++ assert response.json()["pagination"]["total_count"] == 3 ++ ++ ++ response = await client.get( ++ "/api/v1/subscriptions/tiers/search", ++ params={**base_params, "recurring_interval": "year"}, ++ ) ++ assert response.status_code == 200 ++ json = response.json() ++ assert json["pagination"]["total_count"] == 1 ++ assert all( ++ item["recurring_interval"] == "year" for item in json["items"] ++ ) ++ ++ ++ response = await client.get( ++ "/api/v1/subscriptions/tiers/search", ++ params={**base_params, "recurring_interval": "month"}, ++ ) ++ assert response.status_code == 200 ++ json = response.json() ++ assert json["pagination"]["total_count"] == 2 ++ assert all( ++ item["recurring_interval"] == "month" for item in json["items"] ++ ) +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,40 @@ ++#!/usr/bin/env bash ++ ++ ++ ++set -euo pipefail ++HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ++cd /testbed ++ ++ ++ ++ ++ ++source /opt/venv/bin/activate ++ ++pg_ctlcluster 16 main start >/dev/null 2>&1 || true ++ ++for _ in $(seq 1 30); do ++ if pg_isready -h 127.0.0.1 -p 5432 >/dev/null 2>&1; then ++ break ++ fi ++ sleep 1 ++done ++ ++ ++ ++sudo -u postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname='polar'" 2>/dev/null | grep -q 1 \ ++ || sudo -u postgres psql -c "CREATE ROLE polar WITH LOGIN PASSWORD 'polar' SUPERUSER;" >/dev/null 2>&1 ++sudo -u postgres psql -tAc "SELECT 1 FROM pg_database WHERE datname='polar_test'" 2>/dev/null | grep -q 1 \ ++ || sudo -u postgres psql -c "CREATE DATABASE polar_test OWNER polar;" >/dev/null 2>&1 ++PGPASSWORD=polar psql -h 127.0.0.1 -U polar -d polar_test \ ++ -c "DROP SCHEMA public CASCADE; CREATE SCHEMA public;" >/dev/null 2>&1 || true ++ ++cd /testbed/server ++ ++ ++pytest tests/subscription/test_endpoints.py \ ++ tests/subscription/service/test_subscription_tier.py -q ++ ++ ++pytest tests/subscription/test_recurring_interval.py -q diff --git a/tasks/format-code-task-002294/tests/test.sh b/tasks/format-code-task-002294/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..02ef3c5f71478723aae46eb852bfcf4468aa4069 --- /dev/null +++ b/tasks/format-code-task-002294/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +server/tests/subscription/test_recurring_interval.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002294/tests/test_command.sh b/tasks/format-code-task-002294/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002294/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002370/environment/Dockerfile b/tasks/format-code-task-002370/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..ea7bdfb0e009ba40ba3dbc0eab2ccffcc3e02645 --- /dev/null +++ b/tasks/format-code-task-002370/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:3977a66366211f05ac6306c0725f6dc0457eab05c65e7ec994d804d64a48e800 diff --git a/tasks/format-code-task-002370/environment/setup/files/blocklist b/tasks/format-code-task-002370/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002370/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002370/environment/setup/setup.sh b/tasks/format-code-task-002370/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002370/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002370/tests/test.patch b/tasks/format-code-task-002370/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..5d1f57e91e2d191ac6fe87b0941779d600d534c1 --- /dev/null +++ b/tasks/format-code-task-002370/tests/test.patch @@ -0,0 +1,129 @@ +diff --git a/tests/test_schema.py b/tests/test_schema.py +index b08690ef24e..ef5d2b0eb1c 100644 +--- a/tests/test_schema.py ++++ b/tests/test_schema.py +@@ -250,6 +250,103 @@ class Model(BaseModel): + } + + ++def test_enum_schema_custom_field(): ++ class FooBarEnum(str, Enum): ++ foo = 'foo' ++ bar = 'bar' ++ ++ class Model(BaseModel): ++ pika: FooBarEnum = Field(alias='pikalias', title='Pikapika!', description='Pika is definitely the best!') ++ bulbi: FooBarEnum = Field('foo', alias='bulbialias', title='Bulbibulbi!', description='Bulbi is not...') ++ cara: FooBarEnum ++ ++ assert Model.schema() == { ++ 'definitions': { ++ 'FooBarEnum': { ++ 'description': 'An enumeration.', ++ 'enum': ['foo', 'bar'], ++ 'title': 'FooBarEnum', ++ 'type': 'string', ++ } ++ }, ++ 'properties': { ++ 'pikalias': { ++ 'allOf': [{'$ref': '#/definitions/FooBarEnum'}], ++ 'description': 'Pika is definitely the best!', ++ 'title': 'Pikapika!', ++ }, ++ 'bulbialias': { ++ 'allOf': [{'$ref': '#/definitions/FooBarEnum'}], ++ 'description': 'Bulbi is not...', ++ 'title': 'Bulbibulbi!', ++ 'default': 'foo', ++ }, ++ 'cara': {'$ref': '#/definitions/FooBarEnum'}, ++ }, ++ 'required': ['pikalias', 'cara'], ++ 'title': 'Model', ++ 'type': 'object', ++ } ++ ++ ++def test_enum_and_model_have_same_behaviour(): ++ class Names(str, Enum): ++ rick = 'Rick' ++ morty = 'Morty' ++ summer = 'Summer' ++ ++ class Pika(BaseModel): ++ a: str ++ ++ class Foo(BaseModel): ++ enum: Names ++ titled_enum: Names = Field( ++ ..., ++ title='Title of enum', ++ description='Description of enum', ++ ) ++ model: Pika ++ titled_model: Pika = Field( ++ ..., ++ title='Title of model', ++ description='Description of model', ++ ) ++ ++ assert Foo.schema() == { ++ 'definitions': { ++ 'Pika': { ++ 'properties': {'a': {'title': 'A', 'type': 'string'}}, ++ 'required': ['a'], ++ 'title': 'Pika', ++ 'type': 'object', ++ }, ++ 'Names': { ++ 'description': 'An enumeration.', ++ 'enum': ['Rick', 'Morty', 'Summer'], ++ 'title': 'Names', ++ 'type': 'string', ++ }, ++ }, ++ 'properties': { ++ 'enum': {'$ref': '#/definitions/Names'}, ++ 'model': {'$ref': '#/definitions/Pika'}, ++ 'titled_enum': { ++ 'allOf': [{'$ref': '#/definitions/Names'}], ++ 'description': 'Description of enum', ++ 'title': 'Title of enum', ++ }, ++ 'titled_model': { ++ 'allOf': [{'$ref': '#/definitions/Pika'}], ++ 'description': 'Description of model', ++ 'title': 'Title of model', ++ }, ++ }, ++ 'required': ['enum', 'titled_enum', 'model', 'titled_model'], ++ 'title': 'Foo', ++ 'type': 'object', ++ } ++ ++ + def test_json_schema(): + class Model(BaseModel): + a = b'foobar' +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,5 @@ ++H4sIAAAAAAAAA+3SwWoDIRAGYM95iiGXnLS6iVnIuQ/QW47BdSW7kNVFTWjevnYDbSm0uSSUtv93 ++cIQZUPkVzbE/tDvnTw/sXmRRaz3V4nOd9kpXqtJSr+olk0qtpWak73ajD44pm0jEYgj5u7lr/V9K ++vOefXco7G4bB+Fak7nZnXMu/pP2Wf1VXJf/VWi0Zydtd4Wv/PH/b0hR849pZY1JH/GBpMZ5zFzzx ++gcqudOl1SZcfkmznBiPGM/Fn4ifiW5r3ex+i22wu0+JpKo9ujM6a3Ae/NdH3fj9fzH76vQAAAAAA ++AAAAAAAAAAAAAAAAf8kLi6D5rAAoAAA= +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-002370/tests/test.sh b/tasks/format-code-task-002370/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8c6c84ab8be3620344373e09d43f806b70023db1 --- /dev/null +++ b/tasks/format-code-task-002370/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/test_schema.py +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002370/tests/test_command.sh b/tasks/format-code-task-002370/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002370/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002377/environment/Dockerfile b/tasks/format-code-task-002377/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..4c50c38085664dcfb72495e420120b2194f80447 --- /dev/null +++ b/tasks/format-code-task-002377/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:a92ae5bfd8535d84efc908ab60ee608986145010416000a70791af0e484d7b99 diff --git a/tasks/format-code-task-002377/environment/setup/files/blocklist b/tasks/format-code-task-002377/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002377/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002377/environment/setup/setup.sh b/tasks/format-code-task-002377/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002377/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002377/tests/test.patch b/tasks/format-code-task-002377/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..d64980bd4c601da4ef106f7ce15abf10f80239b8 --- /dev/null +++ b/tasks/format-code-task-002377/tests/test.patch @@ -0,0 +1,140 @@ +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 0000000..7f6ca1e +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["python -m pytest tests/test_settings.py -k \"test_env_file_with_extra_forbid_issue_repro or test_env_file_with_default_extra_forbid or test_env_file_with_extra_allow_exposes_extra_fields or test_env_file_with_extra_ignore_drops_extras or test_env_file_no_extras_with_extra_forbid or test_env_file_nested_delimiter_no_extra_error\" -v"] ++} +diff --git a/tests/test_settings.py b/tests/test_settings.py +index dbc3ff5..3d37d62 100644 +--- a/tests/test_settings.py ++++ b/tests/test_settings.py +@@ -1512,3 +1512,113 @@ def test_nested_model_case_insensitive(env): + assert s.nested.SUB_sub.Val2 == 'v2' + assert s.nested.SUB_sub.SUB_sub_SuB.VaL3 == 'v3' + assert s.nested.SUB_sub.SUB_sub_SuB.val4 == 'v4' ++ ++ ++@pytest.mark.skipif(not dotenv, reason='python-dotenv not installed') ++def test_env_file_with_extra_forbid_issue_repro(tmp_path): ++ """Reproduces the issue: Extra.forbid not applied with env_file (explicit forbid).""" ++ p = tmp_path / '.env.test' ++ p.write_text('title="cool stuff"\nother=42\n') ++ ++ class Plop(BaseSettings): ++ title: str ++ ++ model_config = ConfigDict(extra='forbid', env_file=p) ++ ++ with pytest.raises(ValidationError) as exc_info: ++ Plop() ++ ++ errors = exc_info.value.errors() ++ error_locs = {err['loc'][0] for err in errors} ++ assert 'other' in error_locs ++ assert all(err['type'] == 'extra_forbidden' for err in errors if err['loc'][0] == 'other') ++ ++ ++@pytest.mark.skipif(not dotenv, reason='python-dotenv not installed') ++def test_env_file_with_default_extra_forbid(tmp_path): ++ """BaseSettings defaults to extra='forbid' — must still apply when env_file is used.""" ++ p = tmp_path / '.env' ++ p.write_text('title=cool\nother=42\n') ++ ++ class Plop(BaseSettings): ++ title: str ++ ++ ++ model_config = ConfigDict(env_file=p) ++ ++ with pytest.raises(ValidationError) as exc_info: ++ Plop() ++ error_locs = {err['loc'][0] for err in exc_info.value.errors()} ++ assert 'other' in error_locs ++ ++ ++@pytest.mark.skipif(not dotenv, reason='python-dotenv not installed') ++def test_env_file_with_extra_allow_exposes_extra_fields(tmp_path): ++ """extra='allow' with env_file: extra fields should be exposed on the instance.""" ++ p = tmp_path / '.env' ++ p.write_text('title=cool\nother=hello\n') ++ ++ class Plop(BaseSettings): ++ title: str ++ ++ model_config = ConfigDict(extra='allow', env_file=p) ++ ++ s = Plop() ++ assert s.title == 'cool' ++ assert s.model_dump() == {'title': 'cool', 'other': 'hello'} ++ assert getattr(s, 'other', None) == 'hello' ++ ++ ++@pytest.mark.skipif(not dotenv, reason='python-dotenv not installed') ++def test_env_file_with_extra_ignore_drops_extras(tmp_path): ++ """extra='ignore' with env_file: extra fields are silently dropped — no error.""" ++ p = tmp_path / '.env' ++ p.write_text('title=cool\nother=hello\n') ++ ++ class Plop(BaseSettings): ++ title: str ++ ++ model_config = ConfigDict(extra='ignore', env_file=p) ++ ++ s = Plop() ++ assert s.title == 'cool' ++ assert s.model_dump() == {'title': 'cool'} ++ assert not hasattr(s, 'other') or getattr(s, 'other', None) is None ++ ++ ++@pytest.mark.skipif(not dotenv, reason='python-dotenv not installed') ++def test_env_file_no_extras_with_extra_forbid(tmp_path): ++ """Preservation: env_file with only valid fields under extra='forbid' must succeed.""" ++ p = tmp_path / '.env' ++ p.write_text('title=cool\nname=alice\n') ++ ++ class Plop(BaseSettings): ++ title: str ++ name: str ++ ++ model_config = ConfigDict(extra='forbid', env_file=p) ++ ++ s = Plop() ++ assert s.title == 'cool' ++ assert s.name == 'alice' ++ ++ ++@pytest.mark.skipif(not dotenv, reason='python-dotenv not installed') ++def test_env_file_nested_delimiter_no_extra_error(tmp_path): ++ """Preservation: nested env vars from env_file with env_nested_delimiter ++ should populate the nested model — first segment is the model field name, not an extra.""" ++ p = tmp_path / '.env' ++ p.write_text('top__apple=red\ntop__banana=yellow\n') ++ ++ class Top(BaseModel): ++ apple: str ++ banana: str ++ ++ class Settings(BaseSettings): ++ top: Top ++ ++ model_config = ConfigDict(env_file=p, env_nested_delimiter='__') ++ ++ s = Settings() ++ assert s.top.apple == 'red' ++ assert s.top.banana == 'yellow' +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++python -m pytest tests/test_settings.py -k "test_env_file_with_extra_forbid_issue_repro or test_env_file_with_default_extra_forbid or test_env_file_with_extra_allow_exposes_extra_fields or test_env_file_with_extra_ignore_drops_extras or test_env_file_no_extras_with_extra_forbid or test_env_file_nested_delimiter_no_extra_error" -v ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-002377/tests/test.sh b/tasks/format-code-task-002377/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..297adae79a5873477080f9cb9cae6ed3f9b0d3c4 --- /dev/null +++ b/tasks/format-code-task-002377/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test_commands.json +tests/test_settings.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002377/tests/test_command.sh b/tasks/format-code-task-002377/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002377/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002383/environment/Dockerfile b/tasks/format-code-task-002383/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..3ac95aaf33d7e1998ee1f5583d330dddc26b1deb --- /dev/null +++ b/tasks/format-code-task-002383/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:23a498b7df9e6714db52ce525d1b9e98e30b183d68253ebe9e79bceb77b7ef1f diff --git a/tasks/format-code-task-002383/environment/setup/files/blocklist b/tasks/format-code-task-002383/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002383/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002383/environment/setup/setup.sh b/tasks/format-code-task-002383/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002383/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002383/tests/test.patch b/tasks/format-code-task-002383/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..fc992403067cc67b7cc4adbfb57dd801dd6b7333 --- /dev/null +++ b/tasks/format-code-task-002383/tests/test.patch @@ -0,0 +1,147 @@ +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 00000000..22d91fb6 +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["python -m pytest tests/test_python_lexer.py -v"] ++} +diff --git a/tests/test_python_lexer.py b/tests/test_python_lexer.py +new file mode 100644 +index 00000000..94e177c6 +--- /dev/null ++++ b/tests/test_python_lexer.py +@@ -0,0 +1,119 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++import pytest ++ ++from pygments.lexers.python import PythonTracebackLexer, Python2TracebackLexer ++from pygments.token import Operator, Generic ++ ++ ++@pytest.fixture(scope='module') ++def lexer3(): ++ yield PythonTracebackLexer() ++ ++ ++@pytest.fixture(scope='module') ++def lexer2(): ++ yield Python2TracebackLexer() ++ ++ ++PEP657_TRACEBACK = ( ++ 'Traceback (most recent call last):\n' ++ ' File "test.py", line 2, in \n' ++ " x['a']['b']['c']['d'] = 1\n" ++ ' ^^^^^^^^^^^^^^^^\n' ++ "TypeError: 'NoneType' object is not subscriptable\n" ++) ++ ++SYNTAXERROR_TRACEBACK_PY3 = ( ++ ' File "test.py", line 1\n' ++ ' foo bar\n' ++ ' ^\n' ++ 'SyntaxError: invalid syntax\n' ++) ++ ++SYNTAXERROR_TRACEBACK_PY2 = ( ++ ' File "test.py", line 1\n' ++ ' foo bar\n' ++ ' ^\n' ++ 'SyntaxError: invalid syntax\n' ++) ++ ++NO_MARKER_TRACEBACK = ( ++ 'Traceback (most recent call last):\n' ++ ' File "test.py", line 2, in \n' ++ ' 1 / 0\n' ++ 'ZeroDivisionError: division by zero\n' ++) ++ ++ ++def _tokens(lexer, text): ++ return list(lexer.get_tokens(text)) ++ ++ ++def test_pythontb_pep657_caret_not_operator(lexer3): ++ ++ tokens = _tokens(lexer3, PEP657_TRACEBACK) ++ for tok, val in tokens: ++ if '^' in val: ++ assert tok is not Operator, ( ++ "caret %r unexpectedly tokenized as Operator" % val ++ ) ++ ++ ++def test_pythontb_pep657_marker_present(lexer3): ++ ++ ++ tokens = _tokens(lexer3, PEP657_TRACEBACK) ++ carets_seen = ''.join(val for _t, val in tokens if set(val) <= {'^', ' ', '\n'} and '^' in val) ++ assert '^^^^^^^^^^^^^^^^' in carets_seen, ( ++ "expected the full ^^^^^^^^^^^^^^^^ marker text in the token stream" ++ ) ++ ++ ++def test_pythontb_preserves_code_line(lexer3): ++ ++ tokens = _tokens(lexer3, PEP657_TRACEBACK) ++ values = [v for _t, v in tokens] ++ assert any(v == "'a'" or v == 'a' for v in values), ( ++ "expected the indexed string literal pieces to still be tokenized" ++ ) ++ ++ ++def test_pythontb_no_marker_line_unchanged(lexer3): ++ ++ tokens = _tokens(lexer3, NO_MARKER_TRACEBACK) ++ ++ found_error = any(tok is Generic.Error and val == 'ZeroDivisionError' ++ for tok, val in tokens) ++ assert found_error, "expected ZeroDivisionError to be Generic.Error" ++ ++ ++def test_pythontb_syntaxerror_single_caret_not_operator(lexer3): ++ ++ tokens = _tokens(lexer3, SYNTAXERROR_TRACEBACK_PY3) ++ for tok, val in tokens: ++ if val.strip() == '^': ++ assert tok is not Operator, ( ++ "single caret unexpectedly tokenized as Operator" ++ ) ++ ++ ++def test_python2tb_syntaxerror_caret_not_operator(lexer2): ++ ++ tokens = _tokens(lexer2, SYNTAXERROR_TRACEBACK_PY2) ++ for tok, val in tokens: ++ if '^' in val: ++ assert tok is not Operator, ( ++ "py2 caret %r unexpectedly tokenized as Operator" % val ++ ) +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++python -m pytest -v -rA tests/test_python_lexer.py::test_pythontb_pep657_caret_not_operator tests/test_python_lexer.py::test_pythontb_pep657_marker_present tests/test_python_lexer.py::test_pythontb_preserves_code_line tests/test_python_lexer.py::test_pythontb_no_marker_line_unchanged tests/test_python_lexer.py::test_pythontb_syntaxerror_single_caret_not_operator tests/test_python_lexer.py::test_python2tb_syntaxerror_caret_not_operator ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-002383/tests/test.sh b/tasks/format-code-task-002383/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0203e34e0b84940a90c054607583834b25f2fd31 --- /dev/null +++ b/tasks/format-code-task-002383/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test_commands.json +tests/test_python_lexer.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002383/tests/test_command.sh b/tasks/format-code-task-002383/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002383/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002384/environment/Dockerfile b/tasks/format-code-task-002384/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..56409282e742f0a0ad324d4e9dffc30d13d1569c --- /dev/null +++ b/tasks/format-code-task-002384/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:cda9c11030de20e9f6f75d28aee7f01305a20d3f7166864850f9127a69de3eac diff --git a/tasks/format-code-task-002384/environment/setup/files/blocklist b/tasks/format-code-task-002384/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002384/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002384/environment/setup/setup.sh b/tasks/format-code-task-002384/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002384/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002384/tests/test.patch b/tasks/format-code-task-002384/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..16dbae2bf17346ce2380338530a08657c9f09a99 --- /dev/null +++ b/tasks/format-code-task-002384/tests/test.patch @@ -0,0 +1,302 @@ +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 0000000..8ea3087 +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["python -m pytest tests/functions/test_complete.py -v --no-header -p no:cacheprovider --no-cov"] ++} +diff --git a/tests/functions/test_complete.py b/tests/functions/test_complete.py +index 29429c0..eba4dfc 100644 +--- a/tests/functions/test_complete.py ++++ b/tests/functions/test_complete.py +@@ -427,3 +427,275 @@ def test_complete_groupby(): + expected = expected.reindex(columns=df.columns) + + assert_frame_equal(result, expected) ++ ++ ++ ++ ++ ++ ++ ++def _issue_df(): ++ """Source DataFrame from the issue example.""" ++ return pd.DataFrame( ++ dict( ++ group=(1, 2, 1, 2), ++ item_id=(1, 2, 2, 3), ++ item_name=("a", "a", "b", "b"), ++ value1=(1, np.nan, 3, 4), ++ value2=range(4, 8), ++ ) ++ ) ++ ++ ++def test_complete_fill_value_default_unchanged(): ++ """ ++ Without `fill_value`, behaviour is unchanged: nulls (both pre-existing ++ and newly-introduced) remain NaN. ++ """ ++ df = _issue_df() ++ result = df.complete("group", ("item_id", "item_name"), sort=True) ++ expected = pd.DataFrame( ++ { ++ "group": [1, 1, 1, 1, 2, 2, 2, 2], ++ "item_id": [1, 2, 2, 3, 1, 2, 2, 3], ++ "item_name": ["a", "a", "b", "b", "a", "a", "b", "b"], ++ "value1": [1.0, np.nan, 3.0, np.nan, np.nan, np.nan, np.nan, 4.0], ++ "value2": [4.0, np.nan, 6.0, np.nan, np.nan, 5.0, np.nan, 7.0], ++ } ++ ) ++ assert_frame_equal(result, expected, check_dtype=False) ++ ++ ++def test_complete_fill_value_scalar_explicit_true(): ++ """ ++ Issue example: scalar `fill_value`, `explicit=True` (default). ++ All NaN values are replaced with the fill value, including the ++ pre-existing NaN in `value1` (group=2, item_id=2, item_name=a). ++ """ ++ df = _issue_df() ++ result = df.complete( ++ "group", ++ ("item_id", "item_name"), ++ fill_value=0, ++ sort=True, ++ explicit=True, ++ ) ++ expected = pd.DataFrame( ++ { ++ "group": [1, 1, 1, 1, 2, 2, 2, 2], ++ "item_id": [1, 2, 2, 3, 1, 2, 2, 3], ++ "item_name": ["a", "a", "b", "b", "a", "a", "b", "b"], ++ "value1": [1, 0, 3, 0, 0, 0, 0, 4], ++ "value2": [4, 0, 6, 0, 0, 5, 0, 7], ++ } ++ ) ++ assert_frame_equal( ++ result.reset_index(drop=True), ++ expected, ++ check_dtype=False, ++ ) ++ ++ ++ cell = result.loc[ ++ (result["group"] == 2) ++ & (result["item_id"] == 2) ++ & (result["item_name"] == "a"), ++ "value1", ++ ].iloc[0] ++ assert cell == 0 ++ assert not pd.isna(cell) ++ ++ ++def test_complete_fill_value_scalar_explicit_false(): ++ """ ++ Issue example: scalar `fill_value`, `explicit=False`. ++ Only newly-generated NaN values are filled. ++ The pre-existing NaN in `value1` at (group=2, item_id=2, item_name='a') ++ must remain NaN; `value2` at that row must remain 5 (untouched). ++ """ ++ df = _issue_df() ++ result = df.complete( ++ "group", ++ ("item_id", "item_name"), ++ fill_value=0, ++ sort=True, ++ explicit=False, ++ ).reset_index(drop=True) ++ ++ ++ pre_existing = result.loc[ ++ (result["group"] == 2) ++ & (result["item_id"] == 2) ++ & (result["item_name"] == "a"), ++ "value1", ++ ].iloc[0] ++ assert pd.isna(pre_existing) ++ ++ ++ assert ( ++ result.loc[ ++ (result["group"] == 1) ++ & (result["item_id"] == 1) ++ & (result["item_name"] == "a"), ++ "value1", ++ ].iloc[0] ++ == 1 ++ ) ++ assert ( ++ result.loc[ ++ (result["group"] == 2) ++ & (result["item_id"] == 2) ++ & (result["item_name"] == "a"), ++ "value2", ++ ].iloc[0] ++ == 5 ++ ) ++ ++ ++ new_row = result.loc[ ++ (result["group"] == 1) ++ & (result["item_id"] == 2) ++ & (result["item_name"] == "a") ++ ] ++ assert float(new_row["value1"].iloc[0]) == 0 ++ assert float(new_row["value2"].iloc[0]) == 0 ++ ++ ++def test_complete_fill_value_dict_explicit_true(): ++ """ ++ Dictionary `fill_value` with `explicit=True`: each column gets its ++ own fill value, and pre-existing NaN values are also filled. ++ Use *different* fill values per column so we know each is used. ++ """ ++ df = _issue_df() ++ result = df.complete( ++ "group", ++ ("item_id", "item_name"), ++ fill_value={"value1": 0, "value2": 99}, ++ sort=True, ++ explicit=True, ++ ).reset_index(drop=True) ++ ++ expected_value1 = [1, 0, 3, 0, 0, 0, 0, 4] ++ expected_value2 = [4, 99, 6, 99, 99, 5, 99, 7] ++ assert list(result["value1"].astype(int)) == expected_value1 ++ assert list(result["value2"].astype(int)) == expected_value2 ++ ++ ++ pre_existing = result.loc[ ++ (result["group"] == 2) ++ & (result["item_id"] == 2) ++ & (result["item_name"] == "a"), ++ "value1", ++ ].iloc[0] ++ assert pre_existing == 0 ++ ++ ++def test_complete_fill_value_dict_explicit_false(): ++ """ ++ Dictionary `fill_value` with `explicit=False`: pre-existing NaN is ++ preserved; only newly-introduced NaN is filled with the per-column ++ value. Use *different* values per column so each is verified. ++ """ ++ df = _issue_df() ++ result = df.complete( ++ "group", ++ ("item_id", "item_name"), ++ fill_value={"value1": 0, "value2": 99}, ++ sort=True, ++ explicit=False, ++ ).reset_index(drop=True) ++ ++ ++ pre_existing = result.loc[ ++ (result["group"] == 2) ++ & (result["item_id"] == 2) ++ & (result["item_name"] == "a"), ++ "value1", ++ ].iloc[0] ++ assert pd.isna(pre_existing) ++ ++ ++ assert ( ++ result.loc[ ++ (result["group"] == 2) ++ & (result["item_id"] == 2) ++ & (result["item_name"] == "a"), ++ "value2", ++ ].iloc[0] ++ == 5 ++ ) ++ ++ ++ new_row = result.loc[ ++ (result["group"] == 1) ++ & (result["item_id"] == 2) ++ & (result["item_name"] == "a") ++ ] ++ assert float(new_row["value1"].iloc[0]) == 0 ++ assert float(new_row["value2"].iloc[0]) == 99 ++ ++ ++def test_complete_fill_value_dict_partial_columns(): ++ """ ++ Dictionary `fill_value` only covers some columns; other columns' ++ NaN stay NaN (independent of `explicit`). ++ """ ++ df = _issue_df() ++ result = df.complete( ++ "group", ++ ("item_id", "item_name"), ++ fill_value={"value2": 99}, ++ sort=True, ++ explicit=True, ++ ).reset_index(drop=True) ++ ++ ++ assert int( ++ result.loc[ ++ (result["group"] == 1) ++ & (result["item_id"] == 2) ++ & (result["item_name"] == "a"), ++ "value2", ++ ].iloc[0] ++ ) == 99 ++ ++ assert pd.isna( ++ result.loc[ ++ (result["group"] == 1) ++ & (result["item_id"] == 2) ++ & (result["item_name"] == "a"), ++ "value1", ++ ].iloc[0] ++ ) ++ ++ ++def test_complete_fill_value_explicit_default_is_true(): ++ """ ++ If `explicit` is not passed and `fill_value` is, behaviour matches ++ `explicit=True`: all NaN (including pre-existing) are filled. ++ """ ++ df = _issue_df() ++ with_default = df.complete( ++ "group", ("item_id", "item_name"), fill_value=0, sort=True ++ ).reset_index(drop=True) ++ with_explicit_true = df.complete( ++ "group", ++ ("item_id", "item_name"), ++ fill_value=0, ++ sort=True, ++ explicit=True, ++ ).reset_index(drop=True) ++ assert_frame_equal(with_default, with_explicit_true) ++ ++ ++def test_complete_explicit_bad_type_raises(): ++ """`explicit` must be a bool; non-bool raises TypeError.""" ++ df = _issue_df() ++ with pytest.raises(TypeError): ++ df.complete( ++ "group", ++ ("item_id", "item_name"), ++ fill_value=0, ++ explicit="yes", ++ ) +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++python -m pytest tests/functions/test_complete.py -v --no-header -p no:cacheprovider --no-cov ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-002384/tests/test.sh b/tasks/format-code-task-002384/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..fef6a0e363e86135ee05f0d8b585e3372a5de8dc --- /dev/null +++ b/tasks/format-code-task-002384/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test_commands.json +tests/functions/test_complete.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002384/tests/test_command.sh b/tasks/format-code-task-002384/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002384/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002409/environment/Dockerfile b/tasks/format-code-task-002409/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..1d62dd61c7419d5c135a617b3617a00b5dfa324c --- /dev/null +++ b/tasks/format-code-task-002409/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:273e1f4a23842603d161c3063fb69dfd367ee1fcb9fc4b1d751dbaec7996bda6 diff --git a/tasks/format-code-task-002409/environment/setup/files/blocklist b/tasks/format-code-task-002409/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002409/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002409/environment/setup/setup.sh b/tasks/format-code-task-002409/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002409/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002409/tests/test.patch b/tasks/format-code-task-002409/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..e227cb1f9b7189adf6cee01f8985733f14258b1b --- /dev/null +++ b/tasks/format-code-task-002409/tests/test.patch @@ -0,0 +1,54 @@ +diff --git a/test/test_invalid_frame_sequences.py b/test/test_invalid_frame_sequences.py +index 24bb0dfd3..f288466c1 100644 +--- a/test/test_invalid_frame_sequences.py ++++ b/test/test_invalid_frame_sequences.py +@@ -162,3 +162,28 @@ def test_reject_invalid_settings_values(self, frame_factory, settings): + h2.errors.FLOW_CONTROL_ERROR if 0x4 in settings else + h2.errors.PROTOCOL_ERROR + ) ++ ++ def test_invalid_frame_headers_are_protocol_errors(self, frame_factory): ++ """ ++ When invalid frame headers are received they cause ProtocolErrors to be ++ raised. ++ """ ++ c = h2.connection.H2Connection(client_side=False) ++ c.initiate_connection() ++ c.receive_data(frame_factory.preamble()) ++ ++ f = frame_factory.build_headers_frame( ++ headers=self.example_request_headers ++ ) ++ ++ ++ ++ ++ ++ frame_data = f.serialize() ++ frame_data = frame_data[:9].replace(b'\x01', b'\x00') + frame_data[9:] ++ ++ with pytest.raises(h2.exceptions.ProtocolError) as e: ++ c.receive_data(frame_data) ++ ++ assert "Stream ID must be non-zero" in str(e.value) +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,5 @@ ++H4sIAAAAAAAAA+3STUvDMBwG8J77Kf6UHvTQLukWB4IHD8IuogfvpW0iC6xJbdLivr1pPUwE3WVD ++hs/vkIS8kyd5PeidLJUZF9G5sGAtxFwH3+u5zUXBC8aEEKGfc7FeRSTOdqMvBuernijqrfW/zTs2 ++fqHyQ/5eOV82tm0rI3O3Pd0Zx/IvWHHIny9D/qsbxiNip7vCz/55/o2kOfhayVi9d7b39Hz/srlL ++0s3T48Mi7/bT16i1uU2n/iRWY7WjJL2aB0gb7Sm7TuJu77fWLClrKTTDhjQVn39Km7BGy/K1r1pV ++OvU2KNMoF/ambIz/+gUAAAAAAAAAAAAAAAAAAAAAAC7XB0FJLDcAKAAA +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-002409/tests/test.sh b/tasks/format-code-task-002409/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..6b17d98b0408d2471d51e3fc3b3bf4fef79b2d3c --- /dev/null +++ b/tasks/format-code-task-002409/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test/test_invalid_frame_sequences.py +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002409/tests/test_command.sh b/tasks/format-code-task-002409/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002409/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002431/environment/Dockerfile b/tasks/format-code-task-002431/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..cd788b0550b5e28921254407d06c58748607751f --- /dev/null +++ b/tasks/format-code-task-002431/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:fcdee1bcaecb69a12677bd918794b3cb5ed2e2d6548dd74d8e7dbb38b1c5ba73 diff --git a/tasks/format-code-task-002431/environment/setup/files/blocklist b/tasks/format-code-task-002431/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002431/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002431/environment/setup/setup.sh b/tasks/format-code-task-002431/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002431/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002431/tests/test.patch b/tasks/format-code-task-002431/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..07312875111f7d49eb30896787f53d22e2d6b31a --- /dev/null +++ b/tasks/format-code-task-002431/tests/test.patch @@ -0,0 +1,170 @@ +diff --git a/mypy/test/test_exclude_list.py b/mypy/test/test_exclude_list.py +new file mode 100644 +index 000000000..3b1e70d8f +--- /dev/null ++++ b/mypy/test/test_exclude_list.py +@@ -0,0 +1,142 @@ ++ ++ ++ ++ ++ ++ ++ ++import os ++import tempfile ++import unittest ++from typing import List, Set ++ ++from mypy.options import Options ++from mypy.main import process_options ++from mypy.config_parser import parse_config_file ++from mypy.modulefinder import matches_exclude ++from mypy.fscache import FileSystemCache ++ ++ ++class FakeFSCache(FileSystemCache): ++ def __init__(self, files: Set[str]) -> None: ++ self.files = {os.path.abspath(f) for f in files} ++ ++ def isfile(self, file: str) -> bool: ++ return file in self.files ++ ++ def isdir(self, dir: str) -> bool: ++ if not dir.endswith(os.sep): ++ dir += os.sep ++ return any(f.startswith(dir) for f in self.files) ++ ++ def listdir(self, dir: str) -> List[str]: ++ if not dir.endswith(os.sep): ++ dir += os.sep ++ return list(set(f[len(dir):].split(os.sep)[0] ++ for f in self.files if f.startswith(dir))) ++ ++ ++class ExcludeListSuite(unittest.TestCase): ++ ++ ++ def test_default_exclude_is_empty_list(self) -> None: ++ opts = Options() ++ ++ self.assertEqual(opts.exclude, []) ++ self.assertIsInstance(opts.exclude, list) ++ ++ ++ ++ def test_cli_no_exclude_default(self) -> None: ++ _, opts = process_options(['foo.py'], require_targets=False) ++ self.assertEqual(opts.exclude, []) ++ self.assertIsInstance(opts.exclude, list) ++ ++ def test_cli_single_exclude_produces_list(self) -> None: ++ _, opts = process_options(['--exclude', 'patX', 'foo.py'], ++ require_targets=False) ++ self.assertEqual(opts.exclude, ['patX']) ++ self.assertIsInstance(opts.exclude, list) ++ ++ def test_cli_multiple_exclude_aggregates(self) -> None: ++ ++ _, opts = process_options( ++ ['--exclude', 'pat1', '--exclude', 'pat2', 'foo.py'], ++ require_targets=False) ++ self.assertEqual(opts.exclude, ['pat1', 'pat2']) ++ ++ def test_cli_three_excludes_aggregates(self) -> None: ++ _, opts = process_options( ++ ['--exclude', 'a', '--exclude', 'b', '--exclude', 'c', 'foo.py'], ++ require_targets=False) ++ self.assertEqual(opts.exclude, ['a', 'b', 'c']) ++ ++ def test_cli_exclude_with_pipe_backward_compat(self) -> None: ++ ++ _, opts = process_options( ++ ['--exclude', 'pat1|pat2', 'foo.py'], ++ require_targets=False) ++ self.assertEqual(opts.exclude, ['pat1|pat2']) ++ ++ ++ ++ def _parse_ini(self, content: str) -> Options: ++ opts = Options() ++ with tempfile.NamedTemporaryFile(mode='w', suffix='.ini', ++ delete=False) as fh: ++ fh.write(content) ++ path = fh.name ++ try: ++ parse_config_file(opts, lambda: None, path) ++ finally: ++ os.unlink(path) ++ return opts ++ ++ def test_ini_multiline_exclude(self) -> None: ++ ++ opts = self._parse_ini( ++ '[mypy]\n' ++ 'exclude =\n' ++ ' pat1\n' ++ ' pat2\n' ++ ' pat3\n' ++ ) ++ self.assertEqual(opts.exclude, ['pat1', 'pat2', 'pat3']) ++ self.assertIsInstance(opts.exclude, list) ++ ++ def test_ini_single_line_exclude_backward_compat(self) -> None: ++ ++ opts = self._parse_ini( ++ '[mypy]\n' ++ 'exclude = pat1|pat2|pat3\n' ++ ) ++ self.assertEqual(opts.exclude, ['pat1|pat2|pat3']) ++ self.assertIsInstance(opts.exclude, list) ++ ++ ++ ++ def test_matches_exclude_empty_list_returns_false(self) -> None: ++ fsc = FakeFSCache({'/foo.py'}) ++ self.assertFalse(matches_exclude('foo.py', [], fsc, False)) ++ ++ def test_matches_exclude_list_any_pattern_matches(self) -> None: ++ fsc = FakeFSCache({'/foo.py'}) ++ ++ self.assertTrue( ++ matches_exclude('foo.py', ['xyz', 'foo'], fsc, False)) ++ ++ def test_matches_exclude_list_first_pattern_matches(self) -> None: ++ fsc = FakeFSCache({'/foo.py'}) ++ ++ self.assertTrue( ++ matches_exclude('foo.py', ['foo', 'xyz'], fsc, False)) ++ ++ def test_matches_exclude_list_no_pattern_matches(self) -> None: ++ fsc = FakeFSCache({'/foo.py'}) ++ ++ self.assertFalse( ++ matches_exclude('foo.py', ['xyz', 'abc'], fsc, False)) ++ ++ ++if __name__ == '__main__': ++ unittest.main() +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 000000000..110c89570 +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["python -m pytest mypy/test/test_exclude_list.py -v"] ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++python -m pytest mypy/test/test_exclude_list.py -v ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-002431/tests/test.sh b/tasks/format-code-task-002431/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..613be91301b6c685898f9a397e22a9a7804a7aac --- /dev/null +++ b/tasks/format-code-task-002431/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +mypy/test/test_exclude_list.py +test_commands.json +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002431/tests/test_command.sh b/tasks/format-code-task-002431/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002431/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002436/environment/Dockerfile b/tasks/format-code-task-002436/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..bedd74e03b2b53fdd950ace2117489edc6b7c458 --- /dev/null +++ b/tasks/format-code-task-002436/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:fd009378c9e66d8e4102c913d4017cb6be653c8a680f8d745a05e28eed161fdf diff --git a/tasks/format-code-task-002436/environment/setup/files/blocklist b/tasks/format-code-task-002436/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002436/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002436/environment/setup/setup.sh b/tasks/format-code-task-002436/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002436/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002436/tests/test.patch b/tasks/format-code-task-002436/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..f9f5a399d8717d3ba29071a23dbecfe25dda521d --- /dev/null +++ b/tasks/format-code-task-002436/tests/test.patch @@ -0,0 +1,83 @@ +diff --git a/test-data/unit/check-namedtuple.test b/test-data/unit/check-namedtuple.test +index 6e3628060..090a67aa5 100644 +--- a/test-data/unit/check-namedtuple.test ++++ b/test-data/unit/check-namedtuple.test +@@ -1346,3 +1346,56 @@ class Test: + self.item: self.Item # E: Name "self.Item" is not defined + [builtins fixtures/tuple.pyi] + [typing fixtures/typing-namedtuple.pyi] ++ ++[case testNamedTupleSliceReturnTypeMismatchOriginalIssue] ++from typing import NamedTuple, List, Tuple, Sequence ++ ++class NT(NamedTuple): ++ matched_text: str ++ matches: Sequence[str] ++ matches_origin: int ++ ++def f() -> Tuple[str, List[str]]: ++ nt = NT("a", ["a", "b"], 1) ++ return nt[:2] # E: Incompatible return value type (got "Tuple[str, Sequence[str]]", expected "Tuple[str, List[str]]") ++[builtins fixtures/tuple.pyi] ++[typing fixtures/typing-namedtuple.pyi] ++ ++[case testNamedTupleSliceRevealType] ++from typing import NamedTuple, Sequence ++ ++class NT(NamedTuple): ++ a: str ++ b: Sequence[str] ++ c: int ++ ++nt = NT("a", ["x"], 1) ++reveal_type(nt[:2]) # N: Revealed type is "Tuple[builtins.str, typing.Sequence[builtins.str]]" ++reveal_type(nt[:]) # N: Revealed type is "Tuple[builtins.str, typing.Sequence[builtins.str], builtins.int]" ++reveal_type(nt[1:]) # N: Revealed type is "Tuple[typing.Sequence[builtins.str], builtins.int]" ++reveal_type(nt[::2]) # N: Revealed type is "Tuple[builtins.str, builtins.int]" ++reveal_type(nt[-1:]) # N: Revealed type is "Tuple[builtins.int]" ++[builtins fixtures/tuple.pyi] ++[typing fixtures/typing-namedtuple.pyi] ++ ++[case testNamedTupleSliceLosesNamedTupleAttributes] ++from typing import NamedTuple ++ ++class NT(NamedTuple): ++ a: str ++ b: int ++ ++nt = NT("x", 1) ++sliced = nt[:1] ++reveal_type(sliced) # N: Revealed type is "Tuple[builtins.str]" ++sliced._fields # E: "Tuple[str]" has no attribute "_fields" ++[builtins fixtures/tuple.pyi] ++[typing fixtures/typing-namedtuple.pyi] ++ ++[case testRegularTupleSlicePreserved] ++from typing import Tuple ++t: Tuple[int, str, float] ++reveal_type(t[:2]) # N: Revealed type is "Tuple[builtins.int, builtins.str]" ++reveal_type(t[:]) # N: Revealed type is "Tuple[builtins.int, builtins.str, builtins.float]" ++reveal_type(t[1:]) # N: Revealed type is "Tuple[builtins.str, builtins.float]" ++[builtins fixtures/tuple.pyi] +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 000000000..441892f49 +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["python -m pytest mypy/test/testcheck.py -k 'testNamedTupleSliceReturnTypeMismatchOriginalIssue or testNamedTupleSliceRevealType or testNamedTupleSliceLosesNamedTupleAttributes or testRegularTupleSlicePreserved'"] ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++python -m pytest mypy/test/testcheck.py -k 'testNamedTupleSliceReturnTypeMismatchOriginalIssue or testNamedTupleSliceRevealType or testNamedTupleSliceLosesNamedTupleAttributes or testRegularTupleSlicePreserved' ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-002436/tests/test.sh b/tasks/format-code-task-002436/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..d3448b74da707344a60e48a2c19a7d0179a1d29b --- /dev/null +++ b/tasks/format-code-task-002436/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test-data/unit/check-namedtuple.test +test_commands.json +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002436/tests/test_command.sh b/tasks/format-code-task-002436/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002436/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002453/environment/Dockerfile b/tasks/format-code-task-002453/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..1645b09f67cb5b896f5c6c2f3bef084cb8197e3c --- /dev/null +++ b/tasks/format-code-task-002453/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:165ca51a6aeced83059e10bed667a0d5ec3e95a1737cf8849e843865fca919ae diff --git a/tasks/format-code-task-002453/environment/setup/files/blocklist b/tasks/format-code-task-002453/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002453/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002453/environment/setup/setup.sh b/tasks/format-code-task-002453/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002453/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002453/tests/test.patch b/tasks/format-code-task-002453/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..96f947e39d14a1fd004d93e8dc9ec0651897542b --- /dev/null +++ b/tasks/format-code-task-002453/tests/test.patch @@ -0,0 +1,329 @@ +diff --git a/satpy/tests/multiscene_tests/test_blend.py b/satpy/tests/multiscene_tests/test_blend.py +index f9d7e3546..c96450122 100644 +--- a/satpy/tests/multiscene_tests/test_blend.py ++++ b/satpy/tests/multiscene_tests/test_blend.py +@@ -245,10 +245,9 @@ class TestBlendFuncs: + ("select_with_weights", _get_expected_stack_select), + ("blend_with_weights", _get_expected_stack_blend), + ]) +- @pytest.mark.parametrize("combine_times", [False, True]) + def test_blend_two_scenes_using_stack_weighted(self, multi_scene_and_weights, groups, + scene1_with_weights, scene2_with_weights, +- combine_times, blend_func, exp_result_func): ++ blend_func, exp_result_func): + """Test stacking two scenes using weights. + + Here we test that the start and end times can be combined so that they +@@ -266,7 +265,7 @@ class TestBlendFuncs: + multi_scene.group(simple_groups) + + weights = [weights[0][0], weights[1][0]] +- stack_func = partial(stack, weights=weights, blend_type=blend_func, combine_times=combine_times) ++ stack_func = partial(stack, weights=weights, blend_type=blend_func) + weighted_blend = multi_scene.blend(blend_function=stack_func) + + expected = exp_result_func(scene1, scene2) +@@ -275,12 +274,8 @@ class TestBlendFuncs: + np.testing.assert_allclose(result.data, expected.data) + + _check_stacked_metadata(result, "CloudType") +- if combine_times: +- assert result.attrs["start_time"] == datetime(2023, 1, 16, 11, 9, 17) +- assert result.attrs["end_time"] == datetime(2023, 1, 16, 11, 28, 1, 900000) +- else: +- assert result.attrs["start_time"] == datetime(2023, 1, 16, 11, 11, 7, 250000) +- assert result.attrs["end_time"] == datetime(2023, 1, 16, 11, 20, 11, 950000) ++ assert result.attrs["start_time"] == datetime(2023, 1, 16, 11, 9, 17) ++ assert result.attrs["end_time"] == datetime(2023, 1, 16, 11, 28, 1, 900000) + + @pytest.fixture() + def datasets_and_weights(self): +@@ -329,7 +324,7 @@ class TestBlendFuncs: + input_data["weights"][1][line, :] = 2 + input_data["weights"][2][:, column] = 2 + +- stack_with_weights = partial(stack, weights=input_data["weights"], combine_times=False) ++ stack_with_weights = partial(stack, weights=input_data["weights"]) + blend_result = stack_with_weights(input_data["datasets"][0:3]) + + ds1 = input_data["datasets"][0] +diff --git a/satpy/tests/test_composites.py b/satpy/tests/test_composites.py +index b5d5a54b9..14545647b 100644 +--- a/satpy/tests/test_composites.py ++++ b/satpy/tests/test_composites.py +@@ -1420,8 +1420,8 @@ class TestStaticImageCompositor(unittest.TestCase): + filenames=["/foo.tif"]) + register.assert_not_called() + retrieve.assert_not_called() +- assert "start_time" in res.attrs +- assert "end_time" in res.attrs ++ assert "start_time" not in res.attrs or res.attrs["start_time"] is None ++ assert "end_time" not in res.attrs or res.attrs["end_time"] is None + assert res.attrs["sensor"] is None + assert "modifiers" not in res.attrs + assert "calibration" not in res.attrs +@@ -1434,8 +1434,8 @@ class TestStaticImageCompositor(unittest.TestCase): + res = comp() + Scene.assert_called_once_with(reader="generic_image", + filenames=["data_dir/foo.tif"]) +- assert "start_time" in res.attrs +- assert "end_time" in res.attrs ++ assert "start_time" not in res.attrs or res.attrs["start_time"] is None ++ assert "end_time" not in res.attrs or res.attrs["end_time"] is None + assert res.attrs["sensor"] is None + assert "modifiers" not in res.attrs + assert "calibration" not in res.attrs +diff --git a/satpy/tests/test_dataset.py b/satpy/tests/test_dataset.py +index 1b827b8dc..f5c1e05a3 100644 +--- a/satpy/tests/test_dataset.py ++++ b/satpy/tests/test_dataset.py +@@ -101,12 +101,43 @@ class TestCombineMetadata(unittest.TestCase): + + def setUp(self): + """Set up the test case.""" +- self.datetime_dts = ( +- {"start_time": datetime(2018, 2, 1, 11, 58, 0)}, +- {"start_time": datetime(2018, 2, 1, 11, 59, 0)}, +- {"start_time": datetime(2018, 2, 1, 12, 0, 0)}, +- {"start_time": datetime(2018, 2, 1, 12, 1, 0)}, +- {"start_time": datetime(2018, 2, 1, 12, 2, 0)}, ++ self.start_time_dts = ( ++ {"start_time": datetime(2020, 5, 1, 12, 0, 0)}, ++ {"start_time": datetime(2020, 5, 1, 11, 45, 0)}, ++ {"start_time": datetime(2020, 5, 1, 12, 30, 0)}, ++ ) ++ self.end_time_dts = ( ++ {"end_time": datetime(2020, 5, 1, 12, 0, 0)}, ++ {"end_time": datetime(2020, 5, 1, 12, 45, 0)}, ++ {"end_time": datetime(2020, 5, 1, 12, 15, 0)}, ++ ) ++ self.other_time_dts = ( ++ {"nominal_time": datetime(2020, 5, 1, 10, 0, 0)}, ++ {"nominal_time": datetime(2020, 5, 1, 10, 10, 0)}, ++ {"nominal_time": datetime(2020, 5, 1, 10, 20, 0)}, ++ ) ++ self.boundary_dts_with_invalid_values = ( ++ { ++ "start_time": None, ++ "end_time": datetime(2020, 5, 1, 12, 0, 0), ++ }, ++ { ++ "start_time": datetime(2020, 5, 1, 12, 0, 0), ++ "end_time": None, ++ }, ++ { ++ "start_time": "not-a-time", ++ "end_time": "not-a-time", ++ }, ++ { ++ "start_time": datetime(2020, 5, 1, 11, 0, 0), ++ "end_time": datetime(2020, 5, 1, 13, 0, 0), ++ }, ++ ) ++ self.all_invalid_time_dts = ( ++ {"start_time": None}, ++ {"start_time": "not-a-time"}, ++ {"start_time": 42}, + ) + + def test_average_datetimes(self): +@@ -122,19 +153,87 @@ class TestCombineMetadata(unittest.TestCase): + ret = average_datetimes(dts) + assert dts[2] == ret + +- def test_combine_times_with_averaging(self): +- """Test the combine_metadata with times with averaging.""" ++ def test_combine_metadata_start_time_uses_earliest_datetime(self): ++ """Test that merged start times use the earliest valid boundary.""" ++ from satpy.dataset.metadata import combine_metadata ++ ret = combine_metadata(*self.start_time_dts) ++ expected = min(info["start_time"] for info in self.start_time_dts) ++ assert ret["start_time"] == expected ++ ++ def test_combine_metadata_end_time_uses_latest_datetime(self): ++ """Test that merged end times use the latest valid boundary.""" ++ from satpy.dataset.metadata import combine_metadata ++ ret = combine_metadata(*self.end_time_dts) ++ expected = max(info["end_time"] for info in self.end_time_dts) ++ assert ret["end_time"] == expected ++ ++ def test_combine_metadata_ignores_none_and_non_datetime_for_boundaries(self): ++ """Test that invalid boundary values don't pollute merged times.""" + from satpy.dataset.metadata import combine_metadata +- ret = combine_metadata(*self.datetime_dts) +- assert self.datetime_dts[2]["start_time"] == ret["start_time"] ++ ret = combine_metadata(*self.boundary_dts_with_invalid_values) ++ assert ret["start_time"] == datetime(2020, 5, 1, 11, 0, 0) ++ assert ret["end_time"] == datetime(2020, 5, 1, 13, 0, 0) + +- def test_combine_times_without_averaging(self): +- """Test the combine_metadata with times without averaging.""" ++ def test_combine_metadata_other_time_keys_still_average_valid_datetimes(self): ++ """Test that non-boundary time values keep the averaging behavior.""" + from satpy.dataset.metadata import combine_metadata +- ret = combine_metadata(*self.datetime_dts, average_times=False) +- # times are not equal so don't include it in the final result ++ ret = combine_metadata(*self.other_time_dts) ++ assert ret["nominal_time"] == datetime(2020, 5, 1, 10, 10, 0) ++ ++ def test_combine_metadata_omits_time_key_when_no_valid_datetimes(self): ++ """Test that all-invalid time metadata doesn't appear in the result.""" ++ from satpy.dataset.metadata import combine_metadata ++ ret = combine_metadata(*self.all_invalid_time_dts) + assert "start_time" not in ret + ++ def test_combine_metadata_time_parameters_merges_child_time_values(self): ++ """Test that nested time-parameter values are merged by time semantics.""" ++ from satpy.dataset.metadata import combine_metadata ++ ++ info = ( ++ {"time_parameters": { ++ "observation_start_time": datetime(2021, 7, 4, 3, 30, 0), ++ "observation_end_time": datetime(2021, 7, 4, 3, 45, 0), ++ "nominal_time": datetime(2021, 7, 4, 4, 0, 0), ++ }}, ++ {"time_parameters": { ++ "observation_start_time": datetime(2021, 7, 4, 3, 0, 0), ++ "observation_end_time": datetime(2021, 7, 4, 4, 15, 0), ++ "nominal_time": datetime(2021, 7, 4, 4, 10, 0), ++ }}, ++ {"time_parameters": { ++ "observation_start_time": datetime(2021, 7, 4, 3, 15, 0), ++ "observation_end_time": datetime(2021, 7, 4, 4, 0, 0), ++ "nominal_time": datetime(2021, 7, 4, 4, 20, 0), ++ }}, ++ ) ++ ret = combine_metadata(*info) ++ assert ret["time_parameters"]["observation_start_time"] == datetime(2021, 7, 4, 3, 0, 0) ++ assert ret["time_parameters"]["observation_end_time"] == datetime(2021, 7, 4, 4, 15, 0) ++ assert ret["time_parameters"]["nominal_time"] == datetime(2021, 7, 4, 4, 10, 0) ++ ++ def test_combine_metadata_average_times_warns_and_keeps_span_semantics(self): ++ """Test that the legacy average_times option warns without changing boundaries.""" ++ import warnings ++ ++ from satpy.dataset.metadata import combine_metadata ++ ++ info = ( ++ {"start_time": datetime(2022, 1, 1, 2, 0, 0), ++ "end_time": datetime(2022, 1, 1, 2, 15, 0)}, ++ {"start_time": datetime(2022, 1, 1, 1, 30, 0), ++ "end_time": datetime(2022, 1, 1, 3, 0, 0)}, ++ ) ++ for average_times in (True, False): ++ with self.subTest(average_times=average_times): ++ with warnings.catch_warnings(record=True) as caught_warnings: ++ warnings.simplefilter("always") ++ ret = combine_metadata(*info, average_times=average_times) ++ assert caught_warnings ++ assert any(issubclass(w.category, Warning) for w in caught_warnings) ++ assert ret["start_time"] == datetime(2022, 1, 1, 1, 30, 0) ++ assert ret["end_time"] == datetime(2022, 1, 1, 3, 0, 0) ++ + def test_combine_arrays(self): + """Test the combine_metadata with arrays.""" + from numpy import arange, ones +diff --git a/satpy/tests/test_file_handlers.py b/satpy/tests/test_file_handlers.py +index 403e68620..925da3e56 100644 +--- a/satpy/tests/test_file_handlers.py ++++ b/satpy/tests/test_file_handlers.py +@@ -49,25 +49,27 @@ class TestBaseFileHandler(unittest.TestCase): + """Set up the test.""" + self.fh = BaseFileHandler( + "filename", {"filename_info": "bla"}, "filetype_info") ++ self.early_time = datetime(2024, 2, 12, 11, 00) ++ self.late_time = datetime(2024, 2, 12, 12, 00) + + def test_combine_times(self): + """Combine times.""" +- info1 = {"start_time": 1} +- info2 = {"start_time": 2} ++ info1 = {"start_time": self.early_time} ++ info2 = {"start_time": self.late_time} + res = self.fh.combine_info([info1, info2]) +- exp = {"start_time": 1} ++ exp = {"start_time": self.early_time} + assert res == exp + res = self.fh.combine_info([info2, info1]) +- exp = {"start_time": 1} ++ exp = {"start_time": self.early_time} + assert res == exp + +- info1 = {"end_time": 1} +- info2 = {"end_time": 2} ++ info1 = {"end_time": self.early_time} ++ info2 = {"end_time": self.late_time} + res = self.fh.combine_info([info1, info2]) +- exp = {"end_time": 2} ++ exp = {"end_time": self.late_time} + assert res == exp + res = self.fh.combine_info([info2, info1]) +- exp = {"end_time": 2} ++ exp = {"end_time": self.late_time} + assert res == exp + + def test_combine_orbits(self): +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,59 @@ ++#!/bin/bash ++set -uo pipefail ++ ++ ++cd /testbed ++ ++if [ ! -f satpy/version.py ]; then ++ printf '%s\n' 'version = "0+fixture"' > satpy/version.py ++fi ++ ++PYTEST=(python3 -m pytest -q) ++ ++BASE_TARGETS=( ++ satpy/tests/multiscene_tests/test_blend.py ++ satpy/tests/test_composites.py ++ satpy/tests/test_dataset.py ++ satpy/tests/test_file_handlers.py ++) ++ ++DESELECT_NEW_OR_MODIFIED=( ++ --deselect=satpy/tests/multiscene_tests/test_blend.py::TestBlendFuncs::test_blend_two_scenes_using_stack_weighted ++ --deselect=satpy/tests/multiscene_tests/test_blend.py::TestBlendFuncs::test_blend_function_stack_weighted ++ --deselect=satpy/tests/test_composites.py::TestStaticImageCompositor::test_call ++ --deselect=satpy/tests/test_dataset.py::TestCombineMetadata::test_combine_metadata_start_time_uses_earliest_datetime ++ --deselect=satpy/tests/test_dataset.py::TestCombineMetadata::test_combine_metadata_end_time_uses_latest_datetime ++ --deselect=satpy/tests/test_dataset.py::TestCombineMetadata::test_combine_metadata_ignores_none_and_non_datetime_for_boundaries ++ --deselect=satpy/tests/test_dataset.py::TestCombineMetadata::test_combine_metadata_other_time_keys_still_average_valid_datetimes ++ --deselect=satpy/tests/test_dataset.py::TestCombineMetadata::test_combine_metadata_omits_time_key_when_no_valid_datetimes ++ --deselect=satpy/tests/test_dataset.py::TestCombineMetadata::test_combine_metadata_time_parameters_merges_child_time_values ++ --deselect=satpy/tests/test_dataset.py::TestCombineMetadata::test_combine_metadata_average_times_warns_and_keeps_span_semantics ++ --deselect=satpy/tests/test_file_handlers.py::TestBaseFileHandler::test_combine_times ++) ++ ++NEW_TARGETS=( ++ satpy/tests/multiscene_tests/test_blend.py::TestBlendFuncs::test_blend_two_scenes_using_stack_weighted ++ satpy/tests/multiscene_tests/test_blend.py::TestBlendFuncs::test_blend_function_stack_weighted ++ satpy/tests/test_composites.py::TestStaticImageCompositor::test_call ++ satpy/tests/test_dataset.py::TestCombineMetadata::test_combine_metadata_start_time_uses_earliest_datetime ++ satpy/tests/test_dataset.py::TestCombineMetadata::test_combine_metadata_end_time_uses_latest_datetime ++ satpy/tests/test_dataset.py::TestCombineMetadata::test_combine_metadata_ignores_none_and_non_datetime_for_boundaries ++ satpy/tests/test_dataset.py::TestCombineMetadata::test_combine_metadata_other_time_keys_still_average_valid_datetimes ++ satpy/tests/test_dataset.py::TestCombineMetadata::test_combine_metadata_omits_time_key_when_no_valid_datetimes ++ satpy/tests/test_dataset.py::TestCombineMetadata::test_combine_metadata_time_parameters_merges_child_time_values ++ satpy/tests/test_dataset.py::TestCombineMetadata::test_combine_metadata_average_times_warns_and_keeps_span_semantics ++ satpy/tests/test_file_handlers.py::TestBaseFileHandler::test_combine_times ++) ++ ++case "${1:-}" in ++ base) ++ "${PYTEST[@]}" "${BASE_TARGETS[@]}" "${DESELECT_NEW_OR_MODIFIED[@]}" ++ ;; ++ new) ++ "${PYTEST[@]}" "${NEW_TARGETS[@]}" ++ ;; ++ *) ++ echo "usage: $0 base|new" ++ exit 2 ++ ;; ++esac diff --git a/tasks/format-code-task-002453/tests/test.sh b/tasks/format-code-task-002453/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..5f47e0f5d94a002bafa846786d6e236af738b668 --- /dev/null +++ b/tasks/format-code-task-002453/tests/test.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +satpy/tests/multiscene_tests/test_blend.py +satpy/tests/test_composites.py +satpy/tests/test_dataset.py +satpy/tests/test_file_handlers.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002453/tests/test_command.sh b/tasks/format-code-task-002453/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..e8d2f32b64045b5a5a56e0ad5667da87d8e0bc2a --- /dev/null +++ b/tasks/format-code-task-002453/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new \ No newline at end of file diff --git a/tasks/format-code-task-002454/environment/Dockerfile b/tasks/format-code-task-002454/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..36ea450e6289f0e045a9a3f278ba3e9c414309d6 --- /dev/null +++ b/tasks/format-code-task-002454/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:afdb0f85316ea48fd5f653914b3ca3866ef7f0208e3dd5f344ef4430de73c1ce diff --git a/tasks/format-code-task-002454/environment/setup/files/blocklist b/tasks/format-code-task-002454/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002454/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002454/environment/setup/setup.sh b/tasks/format-code-task-002454/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002454/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002454/tests/test.patch b/tasks/format-code-task-002454/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..02517a71d5e145d08b9e7e451287870cf85054e3 --- /dev/null +++ b/tasks/format-code-task-002454/tests/test.patch @@ -0,0 +1,80 @@ +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 000000000..eb400920f +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["python -m pytest tests/test_objects.py -k numpy_to_texture -v"] ++} +diff --git a/tests/test_objects.py b/tests/test_objects.py +index 5673efaa3..153c5edaf 100644 +--- a/tests/test_objects.py ++++ b/tests/test_objects.py +@@ -233,3 +233,53 @@ def test_skybox(): + + skybox = texture.to_skybox() + assert isinstance(skybox, vtk.vtkOpenGLSkybox) ++ ++ ++def test_numpy_to_texture_uint8_preserved(): ++ """numpy_to_texture with uint8 input must preserve dtype and values.""" ++ import warnings as _warnings ++ ++ img = (np.ones((4, 4, 3), dtype=np.uint8) * 255) ++ with _warnings.catch_warnings(): ++ ++ _warnings.simplefilter("error", UserWarning) ++ tex = pyvista.numpy_to_texture(img) ++ assert tex is not None ++ arr = tex.to_array() ++ assert arr.dtype == np.uint8 ++ assert (arr == 255).all() ++ ++ ++def test_numpy_to_texture_float_returns_uint8_dtype(): ++ """numpy_to_texture must convert float input so resulting data is uint8. ++ ++ Per the issue, float-dtype arrays render as black with the pythreejs ++ backend because the texture data is not uint8. The fix at the ++ ``numpy_to_texture`` entry point is to convert the data to uint8 so the ++ texture's stored array is uint8 regardless of input dtype. ++ """ ++ import warnings as _warnings ++ ++ img = np.ones((4, 4, 3)) * 255.0 ++ assert img.dtype != np.uint8 ++ with _warnings.catch_warnings(): ++ ++ _warnings.simplefilter("ignore", UserWarning) ++ tex = pyvista.numpy_to_texture(img) ++ arr = tex.to_array() ++ assert arr.dtype == np.uint8 ++ ++ assert (arr == 255).all() ++ ++ ++def test_numpy_to_texture_int_dtype_returns_uint8_dtype(): ++ """Non-uint8 integer dtype must also be converted to uint8.""" ++ import warnings as _warnings ++ ++ img = (np.ones((4, 4, 3), dtype=np.int32) * 200) ++ with _warnings.catch_warnings(): ++ _warnings.simplefilter("ignore", UserWarning) ++ tex = pyvista.numpy_to_texture(img) ++ arr = tex.to_array() ++ assert arr.dtype == np.uint8 ++ assert (arr == 200).all() +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++python -m pytest -v -rA tests/test_objects.py::test_numpy_to_texture_uint8_preserved tests/test_objects.py::test_numpy_to_texture_float_returns_uint8_dtype tests/test_objects.py::test_numpy_to_texture_int_dtype_returns_uint8_dtype ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-002454/tests/test.sh b/tasks/format-code-task-002454/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..391cdc594cef9897867dc829c3144a1c37759dbb --- /dev/null +++ b/tasks/format-code-task-002454/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test_commands.json +tests/test_objects.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002454/tests/test_command.sh b/tasks/format-code-task-002454/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002454/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002462/environment/Dockerfile b/tasks/format-code-task-002462/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..a178194dd9ea142b85de00dbf9f2f27d97971f2a --- /dev/null +++ b/tasks/format-code-task-002462/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:494e1659581e74ba725f4b310b5677e03b2279f472282865cfeaf81e44674884 diff --git a/tasks/format-code-task-002462/environment/setup/files/blocklist b/tasks/format-code-task-002462/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002462/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002462/environment/setup/setup.sh b/tasks/format-code-task-002462/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002462/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002462/tests/test.patch b/tasks/format-code-task-002462/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..d11e05a9a3f0bb1d312e4ab63b48d9ba134525ae --- /dev/null +++ b/tasks/format-code-task-002462/tests/test.patch @@ -0,0 +1,159 @@ +diff --git a/internal/handshake/transport_parameters_origconnid_test.go b/internal/handshake/transport_parameters_origconnid_test.go +new file mode 100644 +index 00000000..5bac78a8 +--- /dev/null ++++ b/internal/handshake/transport_parameters_origconnid_test.go +@@ -0,0 +1,77 @@ ++package handshake ++ ++import ( ++ "bytes" ++ ++ "github.com/lucas-clemente/quic-go/internal/protocol" ++ ++ . "github.com/onsi/ginkgo" ++ . "github.com/onsi/gomega" ++) ++ ++var _ = Describe("Transport Parameters original_connection_id", func() { ++ It("round-trips the original connection ID through marshaling", func() { ++ connID := protocol.ConnectionID{0xde, 0xad, 0xbe, 0xef} ++ params := &TransportParameters{ ++ InitialMaxData: 0x4321, ++ StatelessResetToken: bytes.Repeat([]byte{0x42}, 16), ++ OriginalConnectionID: connID, ++ } ++ b := &bytes.Buffer{} ++ params.marshal(b) ++ ++ p := &TransportParameters{} ++ Expect(p.unmarshal(b.Bytes(), protocol.PerspectiveServer)).To(Succeed()) ++ Expect(p.OriginalConnectionID).To(Equal(connID)) ++ ++ Expect(p.InitialMaxData).To(Equal(protocol.ByteCount(0x4321))) ++ }) ++ ++ It("leaves the original connection ID empty when none was sent", func() { ++ params := &TransportParameters{ ++ InitialMaxData: 0x1234, ++ StatelessResetToken: bytes.Repeat([]byte{0x42}, 16), ++ } ++ b := &bytes.Buffer{} ++ params.marshal(b) ++ ++ p := &TransportParameters{} ++ Expect(p.unmarshal(b.Bytes(), protocol.PerspectiveServer)).To(Succeed()) ++ Expect(p.OriginalConnectionID).To(BeEmpty()) ++ }) ++ ++ It("rejects an original_connection_id sent by a client", func() { ++ params := &TransportParameters{ ++ OriginalConnectionID: protocol.ConnectionID{0xca, 0xfe}, ++ } ++ b := &bytes.Buffer{} ++ params.marshal(b) ++ ++ p := &TransportParameters{} ++ err := p.unmarshal(b.Bytes(), protocol.PerspectiveClient) ++ Expect(err).To(HaveOccurred()) ++ Expect(err.Error()).To(ContainSubstring("original_connection_id")) ++ }) ++ ++ It("accepts an original_connection_id sent by a server", func() { ++ params := &TransportParameters{ ++ OriginalConnectionID: protocol.ConnectionID{0xca, 0xfe}, ++ StatelessResetToken: bytes.Repeat([]byte{0x42}, 16), ++ } ++ b := &bytes.Buffer{} ++ params.marshal(b) ++ ++ p := &TransportParameters{} ++ Expect(p.unmarshal(b.Bytes(), protocol.PerspectiveServer)).To(Succeed()) ++ Expect(p.OriginalConnectionID).To(Equal(protocol.ConnectionID{0xca, 0xfe})) ++ }) ++ ++ It("includes the original connection ID in the string representation", func() { ++ connID := protocol.ConnectionID{0xde, 0xad, 0xbe, 0xef} ++ withID := (&TransportParameters{OriginalConnectionID: connID}).String() ++ Expect(withID).To(ContainSubstring(connID.String())) ++ ++ withoutID := (&TransportParameters{}).String() ++ Expect(withoutID).ToNot(ContainSubstring(connID.String())) ++ }) ++}) +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,71 @@ ++#!/usr/bin/env bash ++ ++ ++ ++set -euo pipefail ++HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ++ ++ ++ ++ ++ ++GOPATH_DIR="$(go env GOPATH)" ++MOD="$GOPATH_DIR/pkg/mod" ++SRC="$GOPATH_DIR/src" ++REPO="$SRC/github.com/lucas-clemente/quic-go" ++ ++link_mod() { ++ local importpath="$1" glob="$2" target ++ target="$(ls -d $MOD/$glob 2>/dev/null | sort -V | head -1 || true)" ++ if [ -z "$target" ]; then ++ echo "missing dependency in module cache: $glob" >&2 ++ exit 1 ++ fi ++ mkdir -p "$(dirname "$SRC/$importpath")" ++ ln -sfn "$target" "$SRC/$importpath" ++} ++ ++ ++if [ ! -e "$REPO" ]; then ++ mkdir -p "$(dirname "$REPO")" ++ ln -sfn /testbed "$REPO" ++fi ++ ++link_mod github.com/onsi/ginkgo 'github.com/onsi/ginkgo@*' ++link_mod github.com/onsi/gomega 'github.com/onsi/gomega@v1.27.10' ++link_mod github.com/golang/mock 'github.com/golang/mock@*' ++link_mod github.com/golang/protobuf 'github.com/golang/protobuf@*' ++link_mod github.com/google/go-cmp 'github.com/google/go-cmp@v0.5.9' ++link_mod google.golang.org/protobuf 'google.golang.org/protobuf@v1.28.0' ++link_mod gopkg.in/yaml.v3 'gopkg.in/yaml.v3@*' ++link_mod go.yaml.in/yaml/v3 'go.yaml.in/yaml/v3@*' ++link_mod github.com/go-task/slim-sprig 'github.com/go-task/slim-sprig@*' ++link_mod github.com/nxadm/tail 'github.com/nxadm/tail@*' ++link_mod github.com/go-logr/logr 'github.com/go-logr/logr@*' ++link_mod github.com/fsnotify/fsnotify 'github.com/fsnotify/fsnotify@*' ++link_mod github.com/kr/pretty 'github.com/kr/pretty@*' ++link_mod github.com/kr/text 'github.com/kr/text@*' ++link_mod github.com/rogpeppe/go-internal 'github.com/rogpeppe/go-internal@*' ++link_mod github.com/chzyer/readline 'github.com/chzyer/readline@*' ++link_mod github.com/ianlancetaylor/demangle 'github.com/ianlancetaylor/demangle@*' ++link_mod github.com/cheekybits/genny 'github.com/cheekybits/genny@*' ++link_mod github.com/google/pprof 'github.com/google/pprof@v0.0.0-20210407192527-94a9f03dee38' ++link_mod gopkg.in/tomb.v1 'gopkg.in/tomb.v1@*' ++link_mod gopkg.in/check.v1 'gopkg.in/check.v1@v1.0.0-20180628173108-788fd7840127' ++link_mod golang.org/x/sys 'golang.org/x/sys@v0.10.0' ++link_mod golang.org/x/text 'golang.org/x/text@v0.11.0' ++link_mod golang.org/x/net 'golang.org/x/net@v0.12.0' ++link_mod golang.org/x/tools 'golang.org/x/tools@v0.9.3' ++link_mod golang.org/x/crypto 'golang.org/x/crypto@v0.11.0' ++ ++cd "$REPO" ++ ++ ++ ++PKG=github.com/lucas-clemente/quic-go/internal/handshake ++ ++ ++GO111MODULE=off go test "$PKG" -args -ginkgo.focus='Transport Parameters|Cookie Generator' ++ ++ ++GO111MODULE=off go test "$PKG" -args -ginkgo.focus='original_connection_id' diff --git a/tasks/format-code-task-002462/tests/test.sh b/tasks/format-code-task-002462/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..65e653639dabd7641ac8511e633bf933e6a02af7 --- /dev/null +++ b/tasks/format-code-task-002462/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +internal/handshake/transport_parameters_origconnid_test.go +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002462/tests/test_command.sh b/tasks/format-code-task-002462/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002462/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002465/environment/Dockerfile b/tasks/format-code-task-002465/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..a6155899fb7e2de47c61bd9c84fe362ff25d92c3 --- /dev/null +++ b/tasks/format-code-task-002465/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:47058cab6e4b5c001e3f06dff17707b8df4a6e312ff70958776a15b34ff4ce31 diff --git a/tasks/format-code-task-002465/environment/setup/files/blocklist b/tasks/format-code-task-002465/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002465/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002465/environment/setup/setup.sh b/tasks/format-code-task-002465/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002465/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002465/tests/test.patch b/tasks/format-code-task-002465/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..c8a55d0be728974c4e6fc6026a54d6e41e001ca8 --- /dev/null +++ b/tasks/format-code-task-002465/tests/test.patch @@ -0,0 +1,92 @@ +diff --git a/src/C++/test/TimeRangeTestCase.cpp b/src/C++/test/TimeRangeTestCase.cpp +index f82de7489..54f5643a2 100644 +--- a/src/C++/test/TimeRangeTestCase.cpp ++++ b/src/C++/test/TimeRangeTestCase.cpp +@@ -274,6 +274,20 @@ TEST(isInSameRangeWithDay) + endDay = -1; + CHECK( TimeRange::isInSameRange(startTime, endTime, startDay, endDay, time1, time2) ); + ++ startDay = 5; ++ endDay = 5; ++ startTime = UtcTimeOnly(22, 28, 20); ++ endTime = UtcTimeOnly(22, 28, 5); ++ time1 = UtcTimeStamp(22, 28, 2, 16, 1, 2020); ++ time2 = UtcTimeStamp(22, 30, 47, 16, 1, 2020); ++ CHECK( !TimeRange::isInSameRange(startTime, endTime, startDay, endDay, time1, time2) ); ++ ++ startTime = UtcTimeOnly(22, 24, 0); ++ endTime = UtcTimeOnly(22, 15, 30); ++ time1 = UtcTimeStamp(18, 15, 15, 15, 1, 2020); ++ time2 = UtcTimeStamp(22, 26, 20, 16, 1, 2020); ++ CHECK( !TimeRange::isInSameRange(startTime, endTime, startDay, endDay, time1, time2) ); ++ + // Session days are the same + startDay = 1; + endDay = 1; +@@ -286,6 +300,44 @@ TEST(isInSameRangeWithDay) + CHECK( !TimeRange::isInSameRange(startTime, endTime, startDay, endDay, time1, time2) ); + time2 = UtcTimeStamp(9, 1, 0, 4, 12, 2006); + CHECK( TimeRange::isInSameRange(startTime, endTime, startDay, endDay, time1, time2) ); ++ ++ time1 = UtcTimeStamp(10, 1, 0, 3, 12, 2006); ++ time2 = UtcTimeStamp(9, 1, 0, 10, 12, 2006); ++ CHECK( !TimeRange::isInSameRange(startTime, endTime, startDay, endDay, time1, time2) ); ++ time2 = UtcTimeStamp(8, 1, 0, 10, 12, 2006); ++ CHECK( TimeRange::isInSameRange(startTime, endTime, startDay, endDay, time1, time2) ); ++ time2 = UtcTimeStamp(8, 1, 0, 5, 12, 2006); ++ CHECK( TimeRange::isInSameRange(startTime, endTime, startDay, endDay, time1, time2) ); ++ ++ ++ startDay = 2; ++ endDay = 2; ++ startTime = UtcTimeOnly(9, 1, 0); ++ endTime = UtcTimeOnly(8, 59, 0); ++ time1 = UtcTimeStamp(9, 1, 0, 3, 12, 2006); ++ time2 = UtcTimeStamp(9, 1, 0, 5, 12, 2006); ++ CHECK( !TimeRange::isInSameRange(startTime, endTime, startDay, endDay, time1, time2) ); ++ time2 = UtcTimeStamp(9, 1, 0, 11, 12, 2006); ++ CHECK( !TimeRange::isInSameRange(startTime, endTime, startDay, endDay, time1, time2) ); ++ time2 = UtcTimeStamp(8, 1, 0, 3, 12, 2006); ++ CHECK( TimeRange::isInSameRange(startTime, endTime, startDay, endDay, time1, time2) ); ++ ++ ++ startDay = 2; ++ endDay = 2; ++ startTime = UtcTimeOnly(17, 0, 0); ++ endTime = UtcTimeOnly(16, 02, 30); ++ time1 = UtcTimeStamp(23, 4, 3, 17, 1, 2020); ++ time2 = UtcTimeStamp(6, 0, 0, 19, 1, 2020); ++ CHECK( TimeRange::isInSameRange(startTime, endTime, startDay, endDay, time1, time2) ); ++ ++ startDay = 4; ++ endDay = 4; ++ startTime = UtcTimeOnly(17, 0, 0); ++ endTime = UtcTimeOnly(16, 02, 30); ++ time1 = UtcTimeStamp(23, 4, 3, 17, 1, 2020); ++ time2 = UtcTimeStamp(6, 0, 0, 20, 1, 2020); ++ CHECK( TimeRange::isInSameRange(startTime, endTime, startDay, endDay, time1, time2) ); + } + + } +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,6 @@ ++H4sIAAAAAAAAA+3UTU/CMBgH8J33KZ6DMXpYt5a96AGTyTAxojEICcaYZWxDEcbIXjj54S2LAYJB ++LiyG+P9d2rRN+6RPn7JhOZ5Gfjxb6EpdDMmxrKqVttuqzy3Bue0IYTYUQ/YMUyGrtog2lHkRZERK ++lqbFb+v2zR8pts5/EeeFH6ZJEswilr8f7ox9+W9s5J8LOc5N22goZBwuhN3+ef7DiKrED+NITSbR ++OCNtTtWbUOXUdycJJjExRprXunfv2v51/7bj+b3nx3azG0/jII9XU63BwH/quQ+e2/Wa3CRxdcrp ++k4pgPCXNUqudtI+Ts9k8S8NzKovtFUzPs1CX4zKOywvHJm20ilDfeK1lwcLRm/rX93fsftxoDWcs ++a9w2zd3/Pxfr+jdsWf/CWf7/qP/6vXjtG7ff6b2ikgAAAAAAAAAAAAAAAAAAAI7WF7u0u4AAKAAA +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-002465/tests/test.sh b/tasks/format-code-task-002465/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..18e811acc1b60e11525b98c49c5a9abbc4d11137 --- /dev/null +++ b/tasks/format-code-task-002465/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +src/C++/test/TimeRangeTestCase.cpp +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002465/tests/test_command.sh b/tasks/format-code-task-002465/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002465/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002491/environment/Dockerfile b/tasks/format-code-task-002491/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..36a1acb23106570d63de9cbe4af8ddcc27d606a2 --- /dev/null +++ b/tasks/format-code-task-002491/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:201d6c11a6e9dd7915f8f3cf1ea0ea6c82011f922bf62d25bba7e606333816f4 diff --git a/tasks/format-code-task-002491/environment/setup/files/blocklist b/tasks/format-code-task-002491/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002491/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002491/environment/setup/setup.sh b/tasks/format-code-task-002491/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002491/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002491/tests/test.patch b/tasks/format-code-task-002491/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..240a733183d73e0f174b05319f94186c86b273fd --- /dev/null +++ b/tasks/format-code-task-002491/tests/test.patch @@ -0,0 +1,85 @@ +diff --git a/src/lib/history.test.js b/src/lib/history.test.js +index e2eefeb..7fd10e6 100644 +--- a/src/lib/history.test.js ++++ b/src/lib/history.test.js +@@ -38,3 +38,58 @@ it("should have a proper search", () => { + testHistory.navigate("/?asdf"); + expect(testHistory.location.search).toEqual("?asdf"); + }); ++ ++describe("getLocation pathname encoding (unicode URLs / MS Edge)", () => { ++ const makeMockSource = ({ pathname, search = "", hash = "" }) => ({ ++ history: { state: null }, ++ location: { pathname, search, hash } ++ }); ++ ++ it("encodes a raw unicode pathname (MS Edge style)", () => { ++ ++ ++ const history = createHistory(makeMockSource({ pathname: "/påge" })); ++ expect(history.location.pathname).toBe("/p%C3%A5ge"); ++ }); ++ ++ it("leaves an already percent-encoded unicode pathname unchanged (Chrome style)", () => { ++ ++ ++ const history = createHistory( ++ makeMockSource({ pathname: "/p%C3%A5ge" }) ++ ); ++ expect(history.location.pathname).toBe("/p%C3%A5ge"); ++ }); ++ ++ it("preserves a plain ASCII pathname", () => { ++ const history = createHistory(makeMockSource({ pathname: "/test" })); ++ expect(history.location.pathname).toBe("/test"); ++ }); ++ ++ it("preserves search and hash alongside an encoded pathname", () => { ++ const history = createHistory( ++ makeMockSource({ ++ pathname: "/påge", ++ search: "?foo=bar", ++ hash: "#section" ++ }) ++ ); ++ expect(history.location.pathname).toBe("/p%C3%A5ge"); ++ expect(history.location.search).toBe("?foo=bar"); ++ expect(history.location.hash).toBe("#section"); ++ }); ++ ++ it("encodes a multi-segment unicode pathname", () => { ++ const history = createHistory( ++ makeMockSource({ pathname: "/café/menü" }) ++ ); ++ expect(history.location.pathname).toBe("/caf%C3%A9/men%C3%BC"); ++ }); ++ ++ it("exposes encoded pathname through createMemorySource + createHistory", () => { ++ ++ ++ const history = createHistory(createMemorySource("/påge")); ++ expect(history.location.pathname).toBe("/p%C3%A5ge"); ++ }); ++}); +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 0000000..f642060 +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["npx jest src/lib/history.test.js"] ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++npx jest src/lib/history.test.js ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-002491/tests/test.sh b/tasks/format-code-task-002491/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..eaa4a3324f0c25a7a3b002ee0629b3351dad53b6 --- /dev/null +++ b/tasks/format-code-task-002491/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +src/lib/history.test.js +test_commands.json +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002491/tests/test_command.sh b/tasks/format-code-task-002491/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002491/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002496/environment/Dockerfile b/tasks/format-code-task-002496/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..2c5334e05d947d4fd895d333c16db799638df8bd --- /dev/null +++ b/tasks/format-code-task-002496/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:affa47b780807b1597bee2c2fc06aa652e2c6d5adbf466ad7346c87cc8cab2a3 diff --git a/tasks/format-code-task-002496/environment/setup/files/blocklist b/tasks/format-code-task-002496/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002496/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002496/environment/setup/setup.sh b/tasks/format-code-task-002496/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002496/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002496/tests/test.patch b/tasks/format-code-task-002496/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..41b1446792d1a10062c200ef99130114ce6e002c --- /dev/null +++ b/tasks/format-code-task-002496/tests/test.patch @@ -0,0 +1,67 @@ +diff --git a/readthedocs/rtd_tests/tests/test_automation_rules.py b/readthedocs/rtd_tests/tests/test_automation_rules.py +index 2fff7bec77f..125175b5b12 100644 +--- a/readthedocs/rtd_tests/tests/test_automation_rules.py ++++ b/readthedocs/rtd_tests/tests/test_automation_rules.py +@@ -202,6 +202,29 @@ def test_action_set_default_version(self): + assert rule.run(version) is True + assert self.project.get_default_version() == version.slug + ++ @mock.patch('readthedocs.builds.automation_actions.trigger_build') ++ def test_version_hide_action(self, trigger_build): ++ version = get( ++ Version, ++ verbose_name='v2', ++ project=self.project, ++ active=False, ++ hidden=False, ++ type=TAG, ++ ) ++ rule = get( ++ RegexAutomationRule, ++ project=self.project, ++ priority=0, ++ match_arg='.*', ++ action=VersionAutomationRule.HIDE_VERSION_ACTION, ++ version_type=TAG, ++ ) ++ assert rule.run(version) is True ++ assert version.active is True ++ assert version.hidden is True ++ trigger_build.assert_called_once() ++ + + @pytest.mark.django_db + class TestAutomationRuleManager: +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,17 @@ ++H4sIAAAAAAAAA+2WTW/bNhjHKTtpPBlZhxx62oFLVqReItmSrRho5w1OXLTp8mLA3mEFCkGW2Iid ++LGki3c077djDDr1tx5y6DesH6MdIgBwCX3vazUAvQ08jHalWkqVpgSZFW/4g8OXhQ5HUoz9JtdPD ++nmMi/34RnBUlRtUwRjnjaD4qa4au6bqhV6sVUNK0Ja0EoHFmM0rRI9SKIARRENCX+Z3W/o6ijuNv ++mmHftmwXmeab/RdePf6VpZLO419hHUT8z4MT4k8wRTb7NEEX/4xUO+xTN/CVsqapzOd1x+ABXqpU ++Tox/taIfjr+uVfQygKWzWPBRPvD4/zE9LfNcXivcW5AAeJpu/CjOn4Us+Q04wJE8cPsgl1ieaYA7 ++X9zOZADKIoAyjzIA/J1JOpNPmX2C21k+icC9C0nLUc9HWVbLJjUJ/LrgSC1QyP7DqxuFycHUuhWG ++2N8afLzeo1bHQ0k9t0pRxA0DOW5pITrItdAPPeTbqDA1yNuB5yGb4sAng4upimp17MGERWk0mHIt ++clAgiB4UtuJClnn9BZ7xiTz/vEgRoR3kFFOiOSyUsP8892U3cHoe+iqaGS2GfYgeS4ZZSZL2wcxO ++8uyDSzvJM7wAppvSEGSklTj9pbGfn3lQfXhte2I3f3kvf3kIpMkVaT938cHUw/zv7e3qdvXPa4+/ ++ftLYnavvzdV3c8t7ueWd3PK/w8nxW6JPTo3/S5by+j/TCZym/4pRHutf09n+b5SMqtD/eYC7YRBR ++mBKGfNzEtSLLc3A98L9HfSW0qO3Cu0EEkWcRim2CrMh2FYd4rFeXNeMO9jDtwx8xdWFzdHjAsqqV ++FmTeiysLYh9emY91PL8I5w8rm1sSbadambp5LdH3fOGqDBn4LvQDCmMZX0nNfHE0WOzGiRV+3GcR ++bh1v4guPX1GQ33aozoSU/vnuZrL4dS3fUYn75sY47f431j9LjBK//y2xbUDo/xyY+6zYwX6xYxFX ++th2YHHGyjH4a7QKNW/WNG5tm63q7vbpxo2Wubza+Xbtei5DlUBc5gU1UJinKJEtU3vekfq1vVpvm ++2uZKfa3WjnoocWt+1765udGst2/WZv/neL36wpYa8IVxVpYPLqZlqHQhKzIzTDkWI+qY3EiK49S0 ++euyEs7i8zYid04SddFBRaKdGXD4jRQnuoyjCDlKwj2uzluMEISW12fdT/wKBQCAQCAQCgUAgEAgE ++AoFAIBAI3j/+A/loGkwAKAAA +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-002496/tests/test.sh b/tasks/format-code-task-002496/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..d5ecd6096ff8a0e9e4787a660abc72fa305b00f6 --- /dev/null +++ b/tasks/format-code-task-002496/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +readthedocs/rtd_tests/tests/test_automation_rules.py +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002496/tests/test_command.sh b/tasks/format-code-task-002496/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002496/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002519/environment/Dockerfile b/tasks/format-code-task-002519/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..7141e371ff7fecffead4c9fb00d5e847ed64f46b --- /dev/null +++ b/tasks/format-code-task-002519/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:58f921940beac030898622e19c5f7c3a2d5b59776b7e7f2a12bf7ef5f751bda3 diff --git a/tasks/format-code-task-002519/environment/setup/files/blocklist b/tasks/format-code-task-002519/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002519/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002519/environment/setup/setup.sh b/tasks/format-code-task-002519/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002519/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002519/tests/test.patch b/tasks/format-code-task-002519/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..95aedce4abbbc3385f44600b7347411e3d6333db --- /dev/null +++ b/tasks/format-code-task-002519/tests/test.patch @@ -0,0 +1,100 @@ +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 0000000..df0c57e +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["python -m pytest tests/modules/test_tautulli.py -v"] ++} +diff --git a/tests/modules/test_tautulli.py b/tests/modules/test_tautulli.py +index cca6615..2e9dbf6 100644 +--- a/tests/modules/test_tautulli.py ++++ b/tests/modules/test_tautulli.py +@@ -134,3 +134,73 @@ def test_get_activity( + mock_prepare_activity_entry.assert_called_once_with( + {"rating_key": "123", "stopped": "2022-01-02"}, {"guid": "guid"} + ) ++ ++ ++@patch("app.config.Config", Mock()) ++@patch("app.modules.tautulli.RawAPI", Mock()) ++def test_calculate_min_date_both_thresholds_missing(): ++ """Issue repro: empty library_config must not raise TypeError. ++ ++ Reference behavior: missing keys default to 0 days, so result is ~now. ++ """ ++ with patch("tautulli.RawAPI", Mock()): ++ tautulli = Tautulli("url", "api_key") ++ before = datetime.now() ++ result = tautulli._calculate_min_date({}) ++ after = datetime.now() ++ ++ ++ assert isinstance(result, datetime) ++ assert result >= before - timedelta(seconds=5) ++ assert result <= after + timedelta(seconds=5) ++ ++ ++@patch("app.config.Config", Mock()) ++@patch("app.modules.tautulli.RawAPI", Mock()) ++def test_calculate_min_date_only_last_watched_threshold_present(): ++ """When added_at_threshold is missing, last_watched_threshold drives the result. ++ ++ Reference treats missing key as 0 days, so min(now - 30d, now) == now - 30d. ++ """ ++ with patch("tautulli.RawAPI", Mock()): ++ tautulli = Tautulli("url", "api_key") ++ expected = datetime.now() - timedelta(days=30) ++ result = tautulli._calculate_min_date({"last_watched_threshold": 30}) ++ ++ assert isinstance(result, datetime) ++ assert result.date() == expected.date() ++ ++ ++@patch("app.config.Config", Mock()) ++@patch("app.modules.tautulli.RawAPI", Mock()) ++def test_calculate_min_date_only_added_at_threshold_present(): ++ """When last_watched_threshold is missing, added_at_threshold drives the result. ++ ++ Reference treats missing key as 0 days, so min(now, now - 45d) == now - 45d. ++ """ ++ with patch("tautulli.RawAPI", Mock()): ++ tautulli = Tautulli("url", "api_key") ++ expected = datetime.now() - timedelta(days=45) ++ result = tautulli._calculate_min_date({"added_at_threshold": 45}) ++ ++ assert isinstance(result, datetime) ++ assert result.date() == expected.date() ++ ++ ++@patch("app.config.Config", Mock()) ++@patch("app.modules.tautulli.RawAPI", Mock()) ++def test_calculate_min_date_both_thresholds_missing_returns_recent_datetime(): ++ """Stricter: empty config must NOT return datetime.min, None, or raise. ++ ++ Discriminates candidates returning datetime.min / None / raising ValueError. ++ """ ++ with patch("tautulli.RawAPI", Mock()): ++ tautulli = Tautulli("url", "api_key") ++ result = tautulli._calculate_min_date({}) ++ ++ ++ assert isinstance(result, datetime) ++ ++ assert result != datetime.min ++ ++ assert result > datetime.now() - timedelta(days=1) +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++python -m pytest -v -rA tests/modules/test_tautulli.py::test_calculate_min_date_both_thresholds_missing tests/modules/test_tautulli.py::test_calculate_min_date_only_last_watched_threshold_present tests/modules/test_tautulli.py::test_calculate_min_date_only_added_at_threshold_present tests/modules/test_tautulli.py::test_calculate_min_date_both_thresholds_missing_returns_recent_datetime ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-002519/tests/test.sh b/tasks/format-code-task-002519/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0818421294204a70472f85794f13aa1a52081f1b --- /dev/null +++ b/tasks/format-code-task-002519/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test_commands.json +tests/modules/test_tautulli.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002519/tests/test_command.sh b/tasks/format-code-task-002519/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002519/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002521/environment/Dockerfile b/tasks/format-code-task-002521/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..4f37c4d2723ed2d65ae8f355fe0d6c24b4f3c832 --- /dev/null +++ b/tasks/format-code-task-002521/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:295299523f148527cd179726e2a3046cf561a425a52ed40cf2df11e6cd36accb diff --git a/tasks/format-code-task-002521/environment/setup/files/blocklist b/tasks/format-code-task-002521/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002521/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002521/environment/setup/setup.sh b/tasks/format-code-task-002521/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002521/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002521/tests/test.patch b/tasks/format-code-task-002521/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..1e7951185fdf6e69ef674a59e795ffe6da4268bb --- /dev/null +++ b/tasks/format-code-task-002521/tests/test.patch @@ -0,0 +1,48 @@ +diff --git a/tests/nosetests/pyanaconda_tests/simple_ui_test.py b/tests/nosetests/pyanaconda_tests/simple_ui_test.py +index 81dd457dbf4..1fd45bba97e 100644 +--- a/tests/nosetests/pyanaconda_tests/simple_ui_test.py ++++ b/tests/nosetests/pyanaconda_tests/simple_ui_test.py +@@ -174,15 +174,15 @@ def gui_test(self, window_group, window, meh, builder, proxy_getter): + ], + 'SoftwareCategory': [ + 'SoftwareSelectionSpoke', +- 'SourceSpoke' ++ 'SourceSpoke', ++ 'SubscriptionSpoke' + ], + 'SystemCategory': [ + 'BlivetGuiSpoke', + 'CustomPartitioningSpoke', + 'FilterSpoke', + 'NetworkSpoke', +- 'StorageSpoke', +- 'SubscriptionSpoke' ++ 'StorageSpoke' + ], + 'UserSettingsCategory': [ + 'PasswordSpoke', +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,9 @@ ++H4sIAAAAAAAAA+3TS2/UMBAA4D3nVwy7B6BqnpCuhMQBcWkvUNHtAQkpcuLpxiKxg+0E9t8zyZam ++rVR62QpVzCet/BjveBwnUdmrRhaoh3jxVBKyzvOpJffbqZ/mWZKts+wko/k0zdfrBeRPVtEtvfPC ++AiysMf5v6x6LP1PRfP8enS8q07ZCy8jVh9vjkftPsySd7z/J6P7fniT5ApLDlfCw//z+Vy/iUum4 ++FK4OHHoIMQhWcEE9iz96ZVECvRvKGt2i9jAIq0TZoAvwV2esh8uz8w+b0/fL6e0pUcbdTmhRGS1F ++3Kt4S7/ln7XnXzennz/dXf/u5o9j6+JGlcuxgi+9Bl8j0OVsqZgxCFeqQeid0lvotfLT3E/la6D8 ++jarU9bIWfW0k1X+FFnVFta7g1a2IoxwI2jgMnd9RyqNiimrRUupjiuwTFUfH4My8lei9CaVylRnQ ++7kAadPrlWJWWY6nt6+DmLNEwflDjg+12tKV+A2E7J/oWAJnOG41l7Hvzgyv2E061XYNFr6ZxdDEN ++L882NPgoHEaVsRYrX7jOfEdXGCvR0gGKQ+6xvY4cKp+/my8cgn/9ATDGGGOMMcYYY4wxxhhjjDHG ++GGOMPXO/AUom5mcAKAAA +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-002521/tests/test.sh b/tasks/format-code-task-002521/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..422ad838d58550d04958ed1b4772b3adf747e07c --- /dev/null +++ b/tasks/format-code-task-002521/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/nosetests/pyanaconda_tests/simple_ui_test.py +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002521/tests/test_command.sh b/tasks/format-code-task-002521/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002521/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002528/environment/Dockerfile b/tasks/format-code-task-002528/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..6f86036eca4be9aa153f2c8ccd9df30cc2fd62e0 --- /dev/null +++ b/tasks/format-code-task-002528/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:a603a75cde3363901d2823b6ae270361f1d7a39d93b5cdd18b1d02d426b2c243 diff --git a/tasks/format-code-task-002528/environment/setup/files/blocklist b/tasks/format-code-task-002528/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002528/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002528/environment/setup/setup.sh b/tasks/format-code-task-002528/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002528/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002528/tests/test.patch b/tasks/format-code-task-002528/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..3316b3588a09559bf6bfc8f60ba108f8218e6a7d --- /dev/null +++ b/tasks/format-code-task-002528/tests/test.patch @@ -0,0 +1,34 @@ +diff --git a/tests/db/1password4pif.1pif b/tests/db/1password4pif.1pif +index 80bb19f..fe02d30 100644 +--- a/tests/db/1password4pif.1pif ++++ b/tests/db/1password4pif.1pif +@@ -4,7 +4,7 @@ + ***5642bee8-a5ff-11dc-8314-0800200c9a66*** + {"keyID":"726DDDBAEED5444791554F3F45843737","locationKey":"","typeName":"webforms.WebForm","location":"","uuid":"3F84003682524F79937F410FD6A5034A","createdAt":1511042143,"securityLevel":"SL5","openContents":{"autosubmit":"default"},"folderUuid":"4FA6EFE421A94028A7C9E8D3A2EE5AF3","title":"note","updatedAt":1511042165,"txTimestamp":1511042165,"contentsHash":"d59787fb","secureContents":{"notesPlain":"This is a multiline note entry. Cube shank petroleum guacamole dart mower\nacutely slashing upper cringing lunchbox tapioca wrongful unbeaten sift."}} + ***5642bee8-a5ff-11dc-8314-0800200c9a66*** +-{"keyID":"726DDDBAEED5444791554F3F45843737","locationKey":"","typeName":"webforms.WebForm","uuid":"4098F0EC5F0D4EE7A53E11AF3E832D94","createdAt":1511041931,"securityLevel":"SL5","openContents":{"autosubmit":"default","usernameHash":"5b8c81f6c4e5fe0f036893c3c16bf4d054e09f610c76fe2b2e8450a68988a41a"},"folderUuid":"B510713697134C4B9BFD3D5B3F15E6EA","title":"dpbx@afoqwdr.tx","location":"https://afoqwdr.tx","updatedAt":1511041951,"txTimestamp":1511041951,"contentsHash":"69389034","secureContents":{"URLs":[{"url":"https://afoqwdr.tx"}],"fields":[{"type":"T","id":"username","name":"username","value":"dpbx","designation":"username"},{"type":"P","id":"password","name":"password","value":"9KVHnx:.S_S;cF`=CE@e\\p{v6","designation":"password"}]}} ++{"keyID":"726DDDBAEED5444791554F3F45843737","locationKey":"","typeName":"webforms.WebForm","uuid":"4098F0EC5F0D4EE7A53E11AF3E832D94","createdAt":1511041931,"securityLevel":"SL5","openContents":{"autosubmit":"default","usernameHash":"5b8c81f6c4e5fe0f036893c3c16bf4d054e09f610c76fe2b2e8450a68988a41a"},"folderUuid":"B510713697134C4B9BFD3D5B3F15E6EA","title":"dpbx@afoqwdr.tx","location":"https://afoqwdr.tx","updatedAt":1511041951,"txTimestamp":1511041951,"contentsHash":"69389034","secureContents":{"URLs":[{"url":"https://afoqwdr.tx"}],"fields":[{"type":"T","id":"username","name":"username","value":"dpbx","designation":"username"},{"type":"P","id":"pass-id","name":"","value":"9KVHnx:.S_S;cF`=CE@e\\p{v6","designation":"password"}]}} + ***5642bee8-a5ff-11dc-8314-0800200c9a66*** + {"keyID":"726DDDBAEED5444791554F3F45843737","locationKey":"","typeName":"system.folder.Regular","location":"","uuid":"4FA6EFE421A94028A7C9E8D3A2EE5AF3","createdAt":1511041644,"securityLevel":"SL5","title":"CornerCases","trashed":false,"updatedAt":1511041652,"txTimestamp":1511041652,"contentsHash":"2eda37b3","secureContents":{}} + ***5642bee8-a5ff-11dc-8314-0800200c9a66*** +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,5 @@ ++H4sIAAAAAAAAA+3Sy26EIBQGYNY+xXkB8DLiPEP33RtF0iFRsIAmffuii+lMk3Y2M2mb/t+CixhB ++/iP6xYxDq+2as0cpkqOUe5987vdxKauybGQtDxUr0qiQjOTDTnRhCbHzRMw7F79779b6HyU+8o86 ++xFa5aersIMLpfnvcyr+qm3P+dZWel3VTHhkV9zvC1/55/mqgPfheD1lwi1ea8u1Xc7FuNdEbm3cq ++mrWLOpvNTMam+xpH4tw6vtcON8GNXTTOEtckiL9m81s8OXsgPtFiTdy+T1sTxF5jZpqdj9oH8Zym ++T+fZ9WL7oq32RhFfs5++JQAAAAAAAAAAAAAAAAAAAACA3+kdprE61QAoAAA= +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-002528/tests/test.sh b/tasks/format-code-task-002528/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0ffee28b2b0e9a5aa1e1b3844078042da59c486d --- /dev/null +++ b/tasks/format-code-task-002528/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/db/1password4pif.1pif +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002528/tests/test_command.sh b/tasks/format-code-task-002528/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002528/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002650/environment/Dockerfile b/tasks/format-code-task-002650/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..f874c1a296fc7a5717a4405988212457f69820fb --- /dev/null +++ b/tasks/format-code-task-002650/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:18d6eb7042f376b2365a6175f4284ff79b9e5cba5fc44602e306d7099eea5e0b diff --git a/tasks/format-code-task-002650/environment/setup/files/blocklist b/tasks/format-code-task-002650/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002650/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002650/environment/setup/setup.sh b/tasks/format-code-task-002650/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002650/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002650/tests/test.patch b/tasks/format-code-task-002650/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..5dde89c2af775821d9ed33540cefec5b4fba17de --- /dev/null +++ b/tasks/format-code-task-002650/tests/test.patch @@ -0,0 +1,277 @@ +diff --git a/src/h5web/metadata-viewer/utils.test.ts b/src/h5web/metadata-viewer/utils.test.ts +index 25939223..9fbcc2fa 100644 +--- a/src/h5web/metadata-viewer/utils.test.ts ++++ b/src/h5web/metadata-viewer/utils.test.ts +@@ -1,4 +1,5 @@ +-import { renderShape } from './utils'; ++import { HDF5TypeClass } from '../providers/hdf5-models'; ++import { renderShape, renderType } from './utils'; + + describe('renderShape', () => { + it('should render scalar shape', () => { +@@ -17,3 +18,14 @@ describe('renderShape', () => { + expect(renderShape(null)).toBe('None'); + }); + }); ++ ++ ++describe('renderType', () => { ++ it('renders unknown structured HDF5 type as unknown', () => { ++ expect( ++ renderType({ ++ class: HDF5TypeClass.Unknown, ++ }) ++ ).toBe('unknown'); ++ }); ++}); +diff --git a/src/h5web/providers/hsds/api.unknown-types.test.ts b/src/h5web/providers/hsds/api.unknown-types.test.ts +new file mode 100644 +index 00000000..7ad7efbf +--- /dev/null ++++ b/src/h5web/providers/hsds/api.unknown-types.test.ts +@@ -0,0 +1,122 @@ ++import axios from 'axios'; ++import { HDF5Collection, HDF5LinkClass, HDF5TypeClass } from '../hdf5-models'; ++import { EntityKind } from '../models'; ++import { HsdsApi } from './api'; ++ ++jest.mock('axios'); ++ ++const mockClient = { ++ get: jest.fn(), ++}; ++ ++describe('HsdsApi unknown datatypes', () => { ++ beforeEach(() => { ++ (axios.create as jest.Mock).mockReturnValue(mockClient as never); ++ mockClient.get.mockReset(); ++ }); ++ ++ it('getEntity returns an inspectable dataset for an unsupported type', async () => { ++ const rawType = { ++ class: 'VENDOR_DATASET_TYPE', ++ vendor: 'acme', ++ }; ++ ++ mockClient.get ++ .mockResolvedValueOnce({ data: { root: 'root-id' } }) ++ .mockResolvedValueOnce({ ++ data: { id: 'root-id', linkCount: 1, attributeCount: 0 }, ++ }) ++ .mockResolvedValueOnce({ ++ data: { ++ links: [ ++ { ++ class: HDF5LinkClass.Hard, ++ title: 'custom', ++ collection: HDF5Collection.Datasets, ++ id: 'dataset-id', ++ }, ++ ], ++ }, ++ }) ++ .mockResolvedValueOnce({ ++ data: { ++ id: 'dataset-id', ++ type: rawType, ++ shape: { class: 'H5S_SIMPLE', dims: [3] }, ++ attributeCount: 0, ++ }, ++ }); ++ ++ const api = new HsdsApi( ++ 'http://example.test', ++ 'user', ++ 'password', ++ '/example-domain' ++ ); ++ const entity = await api.getEntity('/custom'); ++ ++ expect(entity.kind).toBe(EntityKind.Dataset); ++ if (entity.kind !== EntityKind.Dataset) { ++ throw new Error('Expected dataset entity'); ++ } ++ expect(entity.type).toEqual({ ++ class: HDF5TypeClass.Unknown, ++ }); ++ expect(entity.rawType).toEqual(rawType); ++ }); ++ ++ it('getEntity returns an inspectable committed datatype for an unsupported type', async () => { ++ const rawType = { ++ class: 'VENDOR_DATATYPE_TYPE', ++ tag: 'opaque-v2', ++ }; ++ ++ mockClient.get ++ .mockResolvedValueOnce({ data: { root: 'root-id' } }) ++ .mockResolvedValueOnce({ ++ data: { id: 'root-id', linkCount: 1, attributeCount: 0 }, ++ }) ++ .mockResolvedValueOnce({ ++ data: { ++ links: [ ++ { ++ class: HDF5LinkClass.Hard, ++ title: 'custom', ++ collection: HDF5Collection.Datatypes, ++ id: 'datatype-id', ++ }, ++ ], ++ }, ++ }) ++ .mockResolvedValueOnce({ ++ data: { ++ id: 'datatype-id', ++ type: rawType, ++ }, ++ }); ++ ++ const api = new HsdsApi( ++ 'http://example.test', ++ 'user', ++ 'password', ++ '/example-domain' ++ ); ++ const root = await api.getEntity('/'); ++ ++ expect(root.kind).toBe(EntityKind.Group); ++ if (root.kind !== EntityKind.Group) { ++ throw new Error('Expected group entity'); ++ } ++ ++ const entity = root.children[0]; ++ ++ expect(entity.kind).toBe(EntityKind.Datatype); ++ if (entity.kind !== EntityKind.Datatype) { ++ throw new Error('Expected datatype entity'); ++ } ++ expect(entity.type).toEqual({ ++ class: HDF5TypeClass.Unknown, ++ }); ++ expect(entity.rawType).toEqual(rawType); ++ }); ++}); +diff --git a/src/h5web/providers/hsds/utils.test.ts b/src/h5web/providers/hsds/utils.test.ts +index 8cadcf17..64e89b26 100644 +--- a/src/h5web/providers/hsds/utils.test.ts ++++ b/src/h5web/providers/hsds/utils.test.ts +@@ -160,11 +160,15 @@ describe('convertHsdsType', () => { + }); + }); + +- it('should throw when encountering an unknown type', () => { ++ it('should handle unknown type objects as unknown HDF5 types', () => { + const unknownType = { class: 'NO_CLASS' }; +- expect(() => convertHsdsType(unknownType as HsdsType)).toThrow( +- /Unknown type/ +- ); ++ const customType = { class: 'CUSTOM_CLASS', vendor: 'acme' }; ++ expect(convertHsdsType(unknownType as HsdsType)).toEqual({ ++ class: HDF5TypeClass.Unknown, ++ }); ++ expect(convertHsdsType(customType as HsdsType)).toEqual({ ++ class: HDF5TypeClass.Unknown, ++ }); + }); + }); + +diff --git a/src/h5web/providers/jupyter/api.unknown-types.test.ts b/src/h5web/providers/jupyter/api.unknown-types.test.ts +new file mode 100644 +index 00000000..8c0a90d1 +--- /dev/null ++++ b/src/h5web/providers/jupyter/api.unknown-types.test.ts +@@ -0,0 +1,46 @@ ++import axios from 'axios'; ++import { EntityKind } from '../models'; ++import { HDF5TypeClass } from '../hdf5-models'; ++import { JupyterApi } from './api'; ++ ++jest.mock('axios'); ++ ++const mockClient = { ++ get: jest.fn(), ++}; ++ ++describe('JupyterApi unknown datatypes', () => { ++ beforeEach(() => { ++ (axios.create as jest.Mock).mockReturnValue(mockClient as never); ++ mockClient.get.mockReset(); ++ }); ++ ++ it('getEntity returns an inspectable dataset for an unsupported dtype', async () => { ++ const rawDtype = '|vendorOpaque'; ++ ++ mockClient.get ++ .mockResolvedValueOnce({ ++ data: { ++ id: 'dataset-id', ++ name: 'custom', ++ type: EntityKind.Dataset, ++ shape: [2], ++ dtype: rawDtype, ++ attributes: [], ++ }, ++ }) ++ .mockResolvedValueOnce({ data: {} }); ++ ++ const api = new JupyterApi('http://example.test', '/files/example.h5'); ++ const entity = await api.getEntity('/custom'); ++ ++ expect(entity.kind).toBe(EntityKind.Dataset); ++ if (entity.kind !== EntityKind.Dataset) { ++ throw new Error('Expected dataset entity'); ++ } ++ expect(entity.type).toEqual({ ++ class: HDF5TypeClass.Unknown, ++ }); ++ expect(entity.rawType).toBe(rawDtype); ++ }); ++}); +diff --git a/src/h5web/providers/jupyter/utils.test.ts b/src/h5web/providers/jupyter/utils.test.ts +index e523c13f..8776e84b 100644 +--- a/src/h5web/providers/jupyter/utils.test.ts ++++ b/src/h5web/providers/jupyter/utils.test.ts +@@ -81,8 +81,13 @@ describe('convertDtype', () => { + expect(() => convertDtype('^f8')).toThrow(/Unknown endianness symbol/); + }); + +- it('should throw when encountering an unknown type', () => { +- expect(() => convertDtype('>notAType')).toThrow(/Unknown dtype/); ++ it('should handle unknown dtype as an unknown HDF5 type', () => { ++ expect(convertDtype('>notAType')).toEqual({ ++ class: HDF5TypeClass.Unknown, ++ }); ++ expect(convertDtype('>x9')).toEqual({ ++ class: HDF5TypeClass.Unknown, ++ }); + }); + }); + +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,22 @@ ++#!/bin/bash ++set -uo pipefail ++cd /testbed ++export CI=true ++export BROWSER=none ++ ++if [ ! -x ./node_modules/.bin/react-scripts ]; then ++ npm ci ++fi ++ ++case "${1:-}" in ++ base) ++ ./node_modules/.bin/react-scripts test --watchAll=false --testPathPattern="metadata-viewer/utils\.test\.ts$" ++ ;; ++ new) ++ ./node_modules/.bin/react-scripts test --watchAll=false --testPathPattern="(providers/(hsds|jupyter)/(utils|api\.unknown-types)|metadata-viewer/utils)\.test\.ts$" --testNamePattern="unknown dtype as an unknown HDF5 type|unknown type objects as unknown HDF5 types|getEntity returns an inspectable dataset for an unsupported dtype|getEntity returns an inspectable dataset for an unsupported type|getEntity returns an inspectable committed datatype for an unsupported type|renders unknown structured HDF5 type as unknown" ++ ;; ++ *) ++ echo "usage: $0 base|new" ++ exit 2 ++ ;; ++esac diff --git a/tasks/format-code-task-002650/tests/test.sh b/tasks/format-code-task-002650/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..2360a0ce1374a009488cda2c9b523f5688fdc903 --- /dev/null +++ b/tasks/format-code-task-002650/tests/test.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +src/h5web/metadata-viewer/utils.test.ts +src/h5web/providers/hsds/api.unknown-types.test.ts +src/h5web/providers/hsds/utils.test.ts +src/h5web/providers/jupyter/api.unknown-types.test.ts +src/h5web/providers/jupyter/utils.test.ts +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002650/tests/test_command.sh b/tasks/format-code-task-002650/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..e8d2f32b64045b5a5a56e0ad5667da87d8e0bc2a --- /dev/null +++ b/tasks/format-code-task-002650/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new \ No newline at end of file diff --git a/tasks/format-code-task-002657/environment/Dockerfile b/tasks/format-code-task-002657/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..62ce583d6aaa7ed77a709048ff05d5e16491d3f5 --- /dev/null +++ b/tasks/format-code-task-002657/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:513c3a6473f2376f61bdd85225dd149cead9d0b04868c42edd5a09428b7480f6 diff --git a/tasks/format-code-task-002657/environment/setup/files/blocklist b/tasks/format-code-task-002657/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002657/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002657/environment/setup/setup.sh b/tasks/format-code-task-002657/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002657/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002657/tests/test.patch b/tasks/format-code-task-002657/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..13939baeb753d1d2da272ce354d3e4122a0ae78d --- /dev/null +++ b/tasks/format-code-task-002657/tests/test.patch @@ -0,0 +1,63 @@ +diff --git a/test/new-for-builtins.js b/test/new-for-builtins.js +index 5f3de4b6..c558f3c9 100644 +--- a/test/new-for-builtins.js ++++ b/test/new-for-builtins.js +@@ -249,22 +249,32 @@ test({ + { + code: 'const foo = new Boolean()', + errors: [disallowNewError('Boolean')], +- output: 'const foo = Boolean()' ++ output: null + }, + { + code: 'const foo = new Number()', + errors: [disallowNewError('Number')], +- output: 'const foo = Number()' ++ output: null + }, + { + code: 'const foo = new Number(\'123\')', + errors: [disallowNewError('Number')], +- output: 'const foo = Number(\'123\')' ++ output: null + }, + { + code: 'const foo = new String()', + errors: [disallowNewError('String')], +- output: 'const foo = String()' ++ output: null ++ }, ++ { ++ code: 'const str = new String(\'test\')', ++ errors: [disallowNewError('String')], ++ output: null ++ }, ++ { ++ code: 'const foo = new Boolean(1)', ++ errors: [disallowNewError('Boolean')], ++ output: null + }, + { + code: 'const foo = new Symbol()', +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 00000000..faed409e +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["npx ava test/new-for-builtins.js"] ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++npx ava test/new-for-builtins.js ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-002657/tests/test.sh b/tasks/format-code-task-002657/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..b85a0d52b8febbf1e2464d0d6c3e82f01bb72a65 --- /dev/null +++ b/tasks/format-code-task-002657/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test/new-for-builtins.js +test_commands.json +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002657/tests/test_command.sh b/tasks/format-code-task-002657/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002657/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002659/environment/Dockerfile b/tasks/format-code-task-002659/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..41d7b2c443b4ac87e9f158630076c07415faf1d2 --- /dev/null +++ b/tasks/format-code-task-002659/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:d1a0c29092f891dc5b14ee57f8df88fdbdd9171ae336ff79cae4ca0ab684cad6 diff --git a/tasks/format-code-task-002659/environment/setup/files/blocklist b/tasks/format-code-task-002659/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002659/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002659/environment/setup/setup.sh b/tasks/format-code-task-002659/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002659/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002659/tests/test.patch b/tasks/format-code-task-002659/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..d48de90bf6fcd3b832d5fb621a9c4358ea92e2e2 --- /dev/null +++ b/tasks/format-code-task-002659/tests/test.patch @@ -0,0 +1,88 @@ +diff --git a/test-script.mjs b/test-script.mjs +new file mode 100644 +index 0000000..aafde06 +--- /dev/null ++++ b/test-script.mjs +@@ -0,0 +1,15 @@ ++import {execa} from './index.js'; ++process.on('uncaughtException', err => { ++ console.log('UNCAUGHT:', err.message); ++ process.exit(99); ++}); ++const subprocess = execa('node', ['./test/fixtures/forever.js'], {buffer: false, all: true, reject: false, timeout: 3e3}); ++setTimeout(() => { ++ subprocess.all.destroy(new Error('test-all-destroy')); ++}, 100); ++try { ++ const result = await subprocess; ++ console.log('failed:', result.failed, 'timedOut:', result.timedOut, 'msg:', result.shortMessage); ++} catch (e) { ++ console.log('CAUGHT:', e.message); ++} +diff --git a/test/stream.js b/test/stream.js +index cc68c04..cecdef5 100644 +--- a/test/stream.js ++++ b/test/stream.js +@@ -355,6 +355,40 @@ test('Process buffers stdout right away, even if directly read', testBufferDirec + test('Process buffers stderr right away, even if directly read', testBufferDirect, 2); + test('Process buffers stdio[*] right away, even if directly read', testBufferDirect, 3); + ++ ++const testBufferFalseDestroyReject = async (t, streamName) => { ++ const subprocess = execa('forever.js', {buffer: false}); ++ subprocess[streamName].destroy(new Error('destroyed-test')); ++ await t.throwsAsync(subprocess, {message: /destroyed-test/}); ++}; ++ ++test('buffer: false > stdout.destroy(error) rejects subprocess promise', testBufferFalseDestroyReject, 'stdout'); ++test('buffer: false > stderr.destroy(error) rejects subprocess promise', testBufferFalseDestroyReject, 'stderr'); ++ ++test('buffer: false, reject: false > stdout.destroy(error) resolves without uncaught exception', async t => { ++ const subprocess = execa('forever.js', {buffer: false, reject: false, timeout: 1e4}); ++ subprocess.stdout.destroy(new Error('destroyed-test')); ++ const result = await subprocess; ++ t.true(result.failed); ++ t.false(result.timedOut); ++}); ++ ++test('buffer: false, reject: false > stderr.destroy(error) resolves without uncaught exception', async t => { ++ const subprocess = execa('forever.js', {buffer: false, reject: false, timeout: 1e4}); ++ subprocess.stderr.destroy(new Error('destroyed-test')); ++ const result = await subprocess; ++ t.true(result.failed); ++ t.false(result.timedOut); ++}); ++ ++test('buffer: false, all: true > stdout.destroy(error) does not hang', async t => { ++ const subprocess = execa('forever.js', {buffer: false, all: true, reject: false, timeout: 1e4}); ++ subprocess.stdout.destroy(new Error('destroyed-test')); ++ const result = await subprocess; ++ t.true(result.failed); ++ t.false(result.timedOut); ++}); ++ + const testBufferDestroyOnEnd = async (t, index) => { + const childProcess = execa('noop-fd.js', [`${index}`], fullStdio); + const result = await childProcess; +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 0000000..c960688 +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["npx ava test/stream.js --match \"*buffer: false > stdout.destroy*\" --match \"*buffer: false > stderr.destroy*\" --match \"*buffer: false, reject: false > stdout.destroy*\" --match \"*buffer: false, reject: false > stderr.destroy*\" --match \"*buffer: false, all: true > stdout.destroy*\" --match \"*Destroying stdin*\" --match \"*Destroying stdout should make*\" --match \"*Destroying stderr should make*\""] ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++npx ava test/stream.js --match "*buffer: false > stdout.destroy*" --match "*buffer: false > stderr.destroy*" --match "*buffer: false, reject: false > stdout.destroy*" --match "*buffer: false, reject: false > stderr.destroy*" --match "*buffer: false, all: true > stdout.destroy*" --match "*Destroying stdin*" --match "*Destroying stdout should make*" --match "*Destroying stderr should make*" ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-002659/tests/test.sh b/tasks/format-code-task-002659/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7bc4ef1e62bd02c31fa59a6ee209ed6311cb0bbb --- /dev/null +++ b/tasks/format-code-task-002659/tests/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test-script.mjs +test/stream.js +test_commands.json +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002659/tests/test_command.sh b/tasks/format-code-task-002659/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002659/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002661/environment/Dockerfile b/tasks/format-code-task-002661/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..d8ef7dafa560bf316a57649a6ffdff350c58d87e --- /dev/null +++ b/tasks/format-code-task-002661/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:1c44e13bc82b549e94072b8b3268ca74948345dd4f9581b3571108baf935ab03 diff --git a/tasks/format-code-task-002661/environment/setup/files/blocklist b/tasks/format-code-task-002661/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002661/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002661/environment/setup/setup.sh b/tasks/format-code-task-002661/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002661/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002661/tests/test.patch b/tasks/format-code-task-002661/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..c0f70ea732f97335f4faaae2dedf05d4e0ce60c5 --- /dev/null +++ b/tasks/format-code-task-002661/tests/test.patch @@ -0,0 +1,74 @@ +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 0000000..849c99b +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["python -m pytest tests/contrib/test_google.py -v"] ++} +diff --git a/tests/contrib/test_google.py b/tests/contrib/test_google.py +index b75c30a..e93d6d7 100644 +--- a/tests/contrib/test_google.py ++++ b/tests/contrib/test_google.py +@@ -16,7 +16,7 @@ def test_blueprint_factory(): + redirect_to="index", + ) + assert isinstance(google_bp, OAuth2ConsumerBlueprint) +- assert google_bp.session.scope == ["profile"] ++ assert google_bp.session.scope == ["https://www.googleapis.com/auth/userinfo.profile"] + assert google_bp.session.base_url == "https://www.googleapis.com/" + assert google_bp.session.client_id == "foo" + assert google_bp.client_secret == "bar" +@@ -24,6 +24,38 @@ def test_blueprint_factory(): + assert google_bp.token_url == "https://accounts.google.com/o/oauth2/token" + + ++def test_default_scope_is_only_userinfo_profile(): ++ google_bp = make_google_blueprint( ++ client_id="foo", ++ client_secret="bar", ++ ) ++ scope = google_bp.session.scope ++ assert scope == ["https://www.googleapis.com/auth/userinfo.profile"] ++ assert len(scope) == 1 ++ assert "profile" not in scope ++ assert "https://www.googleapis.com/auth/userinfo.email" not in scope ++ assert "email" not in scope ++ assert "openid" not in scope ++ ++ ++def test_default_scope_in_authorization_redirect(): ++ app = Flask(__name__) ++ app.secret_key = "anything" ++ goog_bp = make_google_blueprint(client_id="foo", client_secret="bar") ++ app.register_blueprint(goog_bp) ++ ++ with app.test_client() as client: ++ resp = client.get( ++ "/google", ++ base_url="https://a.b.c", ++ follow_redirects=False, ++ ) ++ assert resp.status_code == 302 ++ location = URLObject(resp.headers["Location"]) ++ scope_param = location.query_dict["scope"] ++ assert scope_param == "https://www.googleapis.com/auth/userinfo.profile" ++ ++ + def test_load_from_config(): + app = Flask(__name__) + app.secret_key = "anything" +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++python -m pytest tests/contrib/test_google.py -v ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-002661/tests/test.sh b/tasks/format-code-task-002661/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..796a044b28becf870d0a79b893957c331495c13f --- /dev/null +++ b/tasks/format-code-task-002661/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test_commands.json +tests/contrib/test_google.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002661/tests/test_command.sh b/tasks/format-code-task-002661/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002661/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002666/environment/Dockerfile b/tasks/format-code-task-002666/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..9c0ea3b4dc7f1c8e5d4c775c32fda58c76a9ea81 --- /dev/null +++ b/tasks/format-code-task-002666/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:00b7faa38daee51df4bcc5c0decba8f183b9aff80bd5d6ca6d7ddf870f331848 diff --git a/tasks/format-code-task-002666/environment/setup/files/blocklist b/tasks/format-code-task-002666/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002666/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002666/environment/setup/setup.sh b/tasks/format-code-task-002666/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002666/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002666/tests/test.patch b/tasks/format-code-task-002666/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..a13b15d2a3f5695f4a4a222d94b4ae398cb9d79c --- /dev/null +++ b/tasks/format-code-task-002666/tests/test.patch @@ -0,0 +1,78 @@ +diff --git a/src/test/java/org/jilt/test/MetaAnnotationsTest.java b/src/test/java/org/jilt/test/MetaAnnotationsTest.java +index ed544e1..0255d66 100644 +--- a/src/test/java/org/jilt/test/MetaAnnotationsTest.java ++++ b/src/test/java/org/jilt/test/MetaAnnotationsTest.java +@@ -1,8 +1,8 @@ + package org.jilt.test; + + import org.jilt.test.data.meta.MetaConstructorValue; +-import org.jilt.test.data.meta.MetaConstructorValueBuilder; +-import org.jilt.test.data.meta.MetaConstructorValueBuilders.Meta; ++import org.jilt.test.data.meta.MetaConstructorValueJiltBuilder; ++import org.jilt.test.data.meta.MetaConstructorValueJiltBuilders.Meta; + import org.junit.Test; + + import static org.assertj.core.api.Assertions.assertThat; +@@ -10,7 +10,7 @@ + public class MetaAnnotationsTest { + @Test + public void test_meta_builder_on_constructor() { +- Meta lastValue = MetaConstructorValueBuilder.builder() ++ Meta lastValue = MetaConstructorValueJiltBuilder.builder() + .withAttr2("attr2_value") + .withAttr4(4) + .withAttr3(true); +diff --git a/src/test/java/org/jilt/test/data/meta/MetaBuilder.java b/src/test/java/org/jilt/test/data/meta/MetaBuilder.java +index b5e3022..d211a35 100644 +--- a/src/test/java/org/jilt/test/data/meta/MetaBuilder.java ++++ b/src/test/java/org/jilt/test/data/meta/MetaBuilder.java +@@ -5,6 +5,6 @@ + import org.jilt.BuilderStyle; + + @BuilderInterfaces(lastInnerName = "Meta") +-@Builder(setterPrefix = "with", factoryMethod = "builder", style = BuilderStyle.STAGED) ++@Builder(setterPrefix = "with", factoryMethod = "builder", style = BuilderStyle.STAGED, className = "*JiltBuilder") + public @interface MetaBuilder { + } +diff --git a/src/test/java/org/jilt/test/data/typesafe_ungrouped/TypeSafeValue.java b/src/test/java/org/jilt/test/data/typesafe_ungrouped/TypeSafeValue.java +index b0a873e..666b00a 100644 +--- a/src/test/java/org/jilt/test/data/typesafe_ungrouped/TypeSafeValue.java ++++ b/src/test/java/org/jilt/test/data/typesafe_ungrouped/TypeSafeValue.java +@@ -6,14 +6,13 @@ + + @Builder( + style = BuilderStyle.TYPE_SAFE_UNGROUPED_OPTIONALS, +- className = "TypeSafeValueCreator", ++ className = "*Creator", + packageName = "org.jilt.test.data.typesafe_ungrouped.custom", + setterPrefix = "with", + factoryMethod = "creator", + buildMethod = "create" + ) + @BuilderInterfaces( +- outerName = "TypeSafeValueCreators", + packageName = "org.jilt.test.data.typesafe_ungrouped.custom.customer", + innerNames = "Step_*" + ) +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,6 @@ ++H4sIAAAAAAAAA+3ST0/DIBgG8J77KXCeC6Xrn5OHHkyMyeLB6XWhA7fOFhqgU7+9XQ9qTOYuW6bx +++V1eKG+A8JRWfd3IhdJbFpxKPCiybKyD73Uc8yzhyTTOeJIGMedZkQYkO9mNvuidF5aQwBrjf+o7 ++tP5H0c/8vXJ+sTRtK7Skbn28Mw7ln+T5R/7xmH+a82lA4uNdYb9/nv/lBatqzSrh1uFSkvEnqJQM ++Q/XaGevJbflYLm7uZtdXrHeWNXXFNtt2aGt7W+uIF9FGPkeilXkahpStrJCNeiG7bUgU7YojE2NX ++dFM3nu7mdKa8KLU2XvjaaDcfvk329c7fOnUvntSDXlnTd0qO3eG5Xw0AAAAAAAAAAAAAAAAAAAAA ++4Hd4BzgWQw8AKAAA +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++# Verifier for the opensource-code dataset. Exit 0 means resolved. ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-002666/tests/test.sh b/tasks/format-code-task-002666/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..4df11c0fc8ac268eccea5094209b31cc887b8e40 --- /dev/null +++ b/tasks/format-code-task-002666/tests/test.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +src/test/java/org/jilt/test/MetaAnnotationsTest.java +src/test/java/org/jilt/test/data/meta/MetaBuilder.java +src/test/java/org/jilt/test/data/typesafe_ungrouped/TypeSafeValue.java +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002666/tests/test_command.sh b/tasks/format-code-task-002666/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002666/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002668/environment/Dockerfile b/tasks/format-code-task-002668/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..efe915b5fce6ba5efe37f56ff2fa24e82285844e --- /dev/null +++ b/tasks/format-code-task-002668/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:a152867d972b63008cad78439006e28e553286c96cbfdf6130cf524c05ee095c diff --git a/tasks/format-code-task-002668/environment/setup/files/blocklist b/tasks/format-code-task-002668/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002668/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002668/environment/setup/setup.sh b/tasks/format-code-task-002668/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002668/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002668/tests/test.patch b/tasks/format-code-task-002668/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..a8105983774b4519a7c7c74852763d3c9ded4d0b --- /dev/null +++ b/tasks/format-code-task-002668/tests/test.patch @@ -0,0 +1,185 @@ +diff --git a/sktime/forecasting/tests/test_structural.py b/sktime/forecasting/tests/test_structural.py +index 01e6233c4..d6957db49 100644 +--- a/sktime/forecasting/tests/test_structural.py ++++ b/sktime/forecasting/tests/test_structural.py +@@ -183,3 +183,158 @@ def test_result_consistency_exog(structure_params=structure_params, levels=level + y_pred_base = result.forecast(steps=n_test, exog=X_test) + assert_series_equal(left=y_pred_forecaster, right=y_pred_base) + assert len(fh) == y_pred_forecaster.shape[0] ++ ++ ++ ++ ++ ++ ++ ++def _fit_airline_forecaster(): ++ y = load_airline() ++ forecaster = UnobservedComponents(level="local linear trend") ++ forecaster.fit(y) ++ return forecaster, y ++ ++ ++def test_pred_int_capability_tag(): ++ """Forecaster should advertise probabilistic prediction capability.""" ++ forecaster = UnobservedComponents(level="local linear trend") ++ assert forecaster.get_tag("capability:pred_int") is True ++ ++ ++def test_predict_interval_returns_dataframe(): ++ """predict_interval must return a pandas DataFrame, not raise NotImplemented.""" ++ forecaster, _ = _fit_airline_forecaster() ++ pred_int = forecaster.predict_interval(fh=[1, 2, 3], coverage=0.9) ++ assert isinstance(pred_int, pd.DataFrame) ++ assert pred_int.shape == (3, 2) ++ ++ ++def test_predict_interval_columns_structure(): ++ """Column index is a 3-level MultiIndex: (var, coverage, lower/upper).""" ++ forecaster, _ = _fit_airline_forecaster() ++ pred_int = forecaster.predict_interval(fh=[1, 2, 3], coverage=0.9) ++ assert isinstance(pred_int.columns, pd.MultiIndex) ++ assert pred_int.columns.nlevels == 3 ++ cols = list(pred_int.columns) ++ assert cols == [ ++ ("Coverage", 0.9, "lower"), ++ ("Coverage", 0.9, "upper"), ++ ] ++ ++ ++def test_predict_interval_multiple_coverages_preserves_order(): ++ """Multiple coverage values produce columns in the same input order.""" ++ forecaster, _ = _fit_airline_forecaster() ++ pred_int = forecaster.predict_interval(fh=[1, 2, 3], coverage=[0.5, 0.9]) ++ cols = list(pred_int.columns) ++ assert cols == [ ++ ("Coverage", 0.5, "lower"), ++ ("Coverage", 0.5, "upper"), ++ ("Coverage", 0.9, "lower"), ++ ("Coverage", 0.9, "upper"), ++ ] ++ assert pred_int.shape == (3, 4) ++ ++ ++def test_predict_interval_lower_lt_upper(): ++ """For every coverage, lower bound is strictly below upper bound.""" ++ forecaster, _ = _fit_airline_forecaster() ++ pred_int = forecaster.predict_interval(fh=[1, 2, 3], coverage=[0.5, 0.9]) ++ for c in [0.5, 0.9]: ++ lower = pred_int[("Coverage", c, "lower")].values ++ upper = pred_int[("Coverage", c, "upper")].values ++ assert np.all(lower < upper) ++ ++ ++def test_predict_interval_wider_with_higher_coverage(): ++ """Higher nominal coverage must yield wider intervals.""" ++ forecaster, _ = _fit_airline_forecaster() ++ pred_int = forecaster.predict_interval(fh=[1, 2, 3], coverage=[0.5, 0.9, 0.99]) ++ w50 = ( ++ pred_int[("Coverage", 0.5, "upper")].values ++ - pred_int[("Coverage", 0.5, "lower")].values ++ ) ++ w90 = ( ++ pred_int[("Coverage", 0.9, "upper")].values ++ - pred_int[("Coverage", 0.9, "lower")].values ++ ) ++ w99 = ( ++ pred_int[("Coverage", 0.99, "upper")].values ++ - pred_int[("Coverage", 0.99, "lower")].values ++ ) ++ assert np.all(w50 < w90) ++ assert np.all(w90 < w99) ++ ++ ++def test_predict_interval_index_matches_fh(): ++ """Row index of the returned interval forecast must equal the absolute fh.""" ++ forecaster, y = _fit_airline_forecaster() ++ pred_int = forecaster.predict_interval(fh=[1, 2, 3], coverage=0.9) ++ expected_index = pd.period_range(start=y.index[-1] + 1, periods=3, freq="M") ++ assert len(pred_int.index) == 3 ++ assert list(pred_int.index) == list(expected_index) ++ ++ ++def test_predict_interval_matches_statsmodels(): ++ """Values must match statsmodels' summary_frame mean_ci_lower / mean_ci_upper.""" ++ forecaster, y = _fit_airline_forecaster() ++ pred_int = forecaster.predict_interval(fh=[1, 2, 3], coverage=0.9) ++ model = _UnobservedComponents(level="local linear trend", endog=y) ++ result = model.fit(disp=0) ++ pred = result.get_prediction(start=y.index[-1] + 1, end=y.index[-1] + 3) ++ sf = pred.summary_frame(alpha=0.1) ++ np.testing.assert_allclose( ++ pred_int[("Coverage", 0.9, "lower")].values, ++ sf["mean_ci_lower"].values, ++ ) ++ np.testing.assert_allclose( ++ pred_int[("Coverage", 0.9, "upper")].values, ++ sf["mean_ci_upper"].values, ++ ) ++ ++ ++def test_predict_interval_with_exogenous_X(): ++ """predict_interval must accept and use exogenous X for out-of-sample forecasts.""" ++ np.random.seed(42) ++ n = 50 ++ idx = pd.RangeIndex(n) ++ X = pd.DataFrame({"x": np.random.randn(n)}, index=idx) ++ y = pd.Series( ++ np.cumsum(np.random.randn(n)) + X["x"].values * 5.0, ++ index=idx, ++ ) ++ n_train = 40 ++ y_tr, X_tr = y[:n_train], X[:n_train] ++ X_te = X[n_train:] ++ forecaster = UnobservedComponents(level="local level", mle_regression=False) ++ forecaster.fit(y_tr, X=X_tr) ++ fh = list(range(1, len(X_te) + 1)) ++ pred_int = forecaster.predict_interval(fh=fh, X=X_te, coverage=0.9) ++ assert pred_int.shape == (len(X_te), 2) ++ ++ ++ X_te_zero = X_te * 0.0 ++ pred_int_zero = forecaster.predict_interval(fh=fh, X=X_te_zero, coverage=0.9) ++ assert not np.allclose( ++ pred_int[("Coverage", 0.9, "lower")].values, ++ pred_int_zero[("Coverage", 0.9, "lower")].values, ++ ) ++ assert not np.allclose( ++ pred_int[("Coverage", 0.9, "upper")].values, ++ pred_int_zero[("Coverage", 0.9, "upper")].values, ++ ) ++ ++ ++def test_predict_interval_subset_fh(): ++ """Non-contiguous fh selection: row index must be exactly the requested fh.""" ++ forecaster, y = _fit_airline_forecaster() ++ pred_int = forecaster.predict_interval(fh=[1, 3, 5], coverage=0.9) ++ expected = [ ++ y.index[-1] + 1, ++ y.index[-1] + 3, ++ y.index[-1] + 5, ++ ] ++ assert list(pred_int.index) == expected ++ assert pred_int.shape == (3, 2) +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 000000000..5cbb67a72 +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["python -m pytest sktime/forecasting/tests/test_structural.py -v"] ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++python -m pytest sktime/forecasting/tests/test_structural.py -v ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-002668/tests/test.sh b/tasks/format-code-task-002668/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..ba33d155f1e057e31deec4bd360be0d939c20eb2 --- /dev/null +++ b/tasks/format-code-task-002668/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +sktime/forecasting/tests/test_structural.py +test_commands.json +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002668/tests/test_command.sh b/tasks/format-code-task-002668/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002668/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002692/environment/Dockerfile b/tasks/format-code-task-002692/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..cca84039e1208a0df704d0ac85b272e993643fcf --- /dev/null +++ b/tasks/format-code-task-002692/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:7f196e3044028640ce24cb2ac328e5e8b5ee9edc79875074aeae638adc3b740f diff --git a/tasks/format-code-task-002692/environment/setup/files/blocklist b/tasks/format-code-task-002692/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002692/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002692/environment/setup/setup.sh b/tasks/format-code-task-002692/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002692/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002692/tests/test.patch b/tasks/format-code-task-002692/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..7f927755c09cbbebd5be2e28790781939f853295 --- /dev/null +++ b/tasks/format-code-task-002692/tests/test.patch @@ -0,0 +1,164 @@ +diff --git a/client/web/src/integration/insights/create-insights.test.ts b/client/web/src/integration/insights/create-insights.test.ts +index 34b2135ba24a..df40d03263de 100644 +--- a/client/web/src/integration/insights/create-insights.test.ts ++++ b/client/web/src/integration/insights/create-insights.test.ts +@@ -6,6 +6,7 @@ import { accessibilityAudit } from '@sourcegraph/shared/src/testing/accessibilit + import { createDriverForTest, Driver } from '@sourcegraph/shared/src/testing/driver' + import { afterEachSaveScreenshotIfFailed } from '@sourcegraph/shared/src/testing/screenshotReporter' + ++import { TimeIntervalStepUnit } from '../../graphql-operations' + import { createWebIntegrationTestContext, WebIntegrationTestContext } from '../context' + import { percySnapshotWithVariants } from '../utils' + +@@ -158,11 +159,74 @@ describe('Code insight create insight page', () => { + repositories: { nodes: [] }, + }), + +- CreateSearchBasedInsight: () => ({ ++ FirstStepCreateSearchBasedInsight: () => ({ + __typename: 'Mutation', + createLineChartSearchInsight: { ++ view: { ++ id: '001', ++ isFrozen: false, ++ appliedFilters: { ++ includeRepoRegex: null, ++ excludeRepoRegex: null, ++ searchContexts: [], ++ __typename: 'InsightViewFilters', ++ }, ++ dashboardReferenceCount: 0, ++ presentation: { ++ __typename: 'LineChartInsightViewPresentation', ++ title: 'Test insight title', ++ seriesPresentation: [ ++ { ++ seriesId: '1', ++ label: 'test series #1 title', ++ color: 'var(--oc-cyan-7)', ++ __typename: 'LineChartDataSeriesPresentation', ++ }, ++ { ++ seriesId: '2', ++ label: 'test series #2 title', ++ color: 'var(--oc-grape-7)', ++ __typename: 'LineChartDataSeriesPresentation', ++ }, ++ ], ++ }, ++ dataSeriesDefinitions: [ ++ { ++ seriesId: '1', ++ query: 'test series #1 query', ++ repositoryScope: { ++ repositories: ['github.com/sourcegraph/sourcegraph'], ++ __typename: 'InsightRepositoryScope', ++ }, ++ timeScope: { ++ unit: TimeIntervalStepUnit.MONTH, ++ value: 2, ++ __typename: 'InsightIntervalTimeScope', ++ }, ++ isCalculated: false, ++ generatedFromCaptureGroups: false, ++ __typename: 'SearchInsightDataSeriesDefinition', ++ }, ++ { ++ seriesId: '1', ++ query: 'test series #2 query', ++ repositoryScope: { ++ repositories: ['github.com/sourcegraph/sourcegraph'], ++ __typename: 'InsightRepositoryScope', ++ }, ++ timeScope: { ++ unit: TimeIntervalStepUnit.MONTH, ++ value: 2, ++ __typename: 'InsightIntervalTimeScope', ++ }, ++ isCalculated: false, ++ generatedFromCaptureGroups: false, ++ __typename: 'SearchInsightDataSeriesDefinition', ++ }, ++ ], ++ __typename: 'InsightView', ++ }, + __typename: 'InsightViewPayload', +- view: { __typename: 'InsightView', id: '001' }, + }, + }), + }, +@@ -222,7 +286,7 @@ describe('Code insight create insight page', () => { + + const addToUserConfigRequest = await testContext.waitForGraphQLRequest(async () => { + await driver.page.click('[data-testid="insight-save-button"]') +- }, 'CreateSearchBasedInsight') ++ }, 'FirstStepCreateSearchBasedInsight') + + // Check that new org settings config has edited insight + assert.deepStrictEqual(addToUserConfigRequest.input, { +diff --git a/client/web/src/integration/insights/drill-down-filters.test.ts b/client/web/src/integration/insights/drill-down-filters.test.ts +index bdc0a7a5acb8..fe261ef5eac2 100644 +--- a/client/web/src/integration/insights/drill-down-filters.test.ts ++++ b/client/web/src/integration/insights/drill-down-filters.test.ts +@@ -210,7 +210,7 @@ describe('Backend insight drill down filters', () => { + lineColor: 'var(--oc-red-7)', + }, + repositoryScope: { +- repositories: [], ++ repositories: ['github.com/sourcegraph/sourcegraph'], + }, + timeScope: { + stepInterval: { +@@ -227,7 +227,7 @@ describe('Backend insight drill down filters', () => { + lineColor: 'var(--oc-blue-7)', + }, + repositoryScope: { +- repositories: [], ++ repositories: ['github.com/sourcegraph/sourcegraph'], + }, + timeScope: { + stepInterval: { +diff --git a/client/web/src/integration/insights/edit-search-insights.test.ts b/client/web/src/integration/insights/edit-search-insights.test.ts +index 9fb05ba1a068..aacce8c49b0c 100644 +--- a/client/web/src/integration/insights/edit-search-insights.test.ts ++++ b/client/web/src/integration/insights/edit-search-insights.test.ts +@@ -242,7 +242,11 @@ describe('Code insight edit insight page', () => { + title: 'Test insight title', + }, + viewControls: { +- filters: {}, ++ filters: { ++ excludeRepoRegex: '', ++ includeRepoRegex: '', ++ searchContexts: [], ++ }, + }, + }, + id: '001', +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,11 @@ ++H4sIAAAAAAAAA+3TX2/TMBAA8D7nU5wKQtuDk6b/JpCCNFikDaG1avuIFLn2LTVL7Mh2xjbx4XG6 ++FSYQm0AbCHG/lySOc3e6i+N1qypZoL5Iek9lEBxMJttr8P11e59OhulwPB4fHIx7gzSdpqMeTJ6s ++ojta57kF6Flj/H37Hnr/j4q/zd+j84Uwdc21jN3m8XI8MP90NJx+nf9kOgrzH0+Hkx4MHq+En/vP ++5y8kbAe/RhnhZWOsh/nh6jjrJ6bxiTYS2XCQrJV+9bxb7+82nc6O8mI2X53MTpdZn7GaXxYm/Eiu ++4QILp64xGw9eToEx06B2rmIVllxcscaaCyXR9qPoGZzo0P2qAolhk0QtFDrY67IWtZFtFZ6Ug1J5 ++VWpjUUL4NaHmV7BG+KQalPvRFbca1G0cxs6suUbNKiPOz1SFYeXmU4a6VDrEG75+kcJn8FyF7aOu ++iDfdCQC/CSFxDbxpYK9VCXcOvUu6/N5ycX6bvAyLN6nBaLAYNu1H+ekqX8wXJ8s8S0E3l1C2VQPb ++k9UlWLR6G15pj6XlXoUvu567XTNXy2Lbz/li9i5/u8p2E0lEpVD7JNSVOCuSOwES74TRZ6qMPzqj ++d4GO88Oj9/lymXnbYtRVUhux4aELFr0NzQ31MeZVjab12bQ7ffAhAujH96UK3VXlJjRDWOQe2e45 ++7sqMvev/SgxpVVUxaT5pFgbk0f5eGJTKM4fcis2P9UR/+1QRQgghhBBCCCGEEEIIIYQQQgghhPw5 ++XwAgPwZUACgAAA== +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-002692/tests/test.sh b/tasks/format-code-task-002692/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..c9e32f74498c20f9a5a837ff8432b94be244a7a3 --- /dev/null +++ b/tasks/format-code-task-002692/tests/test.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +client/web/src/integration/insights/create-insights.test.ts +client/web/src/integration/insights/drill-down-filters.test.ts +client/web/src/integration/insights/edit-search-insights.test.ts +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002692/tests/test_command.sh b/tasks/format-code-task-002692/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002692/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002695/environment/Dockerfile b/tasks/format-code-task-002695/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..7dec4e8cdfd055566454e404e8e3e5b8600cee30 --- /dev/null +++ b/tasks/format-code-task-002695/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:90ebd0ce72c793ad8d678267a7565108a78aa01ad4b5d1ae866237db2c9e399c diff --git a/tasks/format-code-task-002695/environment/setup/files/blocklist b/tasks/format-code-task-002695/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002695/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002695/environment/setup/setup.sh b/tasks/format-code-task-002695/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002695/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002695/tests/test.patch b/tasks/format-code-task-002695/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..eaf88347775b17cc2bbf357d838bb4378f674ff2 --- /dev/null +++ b/tasks/format-code-task-002695/tests/test.patch @@ -0,0 +1,277 @@ +diff --git a/tests/integration/test_case.go b/tests/integration/test_case.go +index 435f1cf9..b592881d 100644 +--- a/tests/integration/test_case.go ++++ b/tests/integration/test_case.go +@@ -148,6 +148,9 @@ type CreateView struct { + // String can be a partial, and the test will pass if an error is returned that + // contains this string. + ExpectedError string ++ ++ ++ ExpectedErrorAlternatives []string + } + + // CreateDoc will attempt to create the given document in the given collection +diff --git a/tests/integration/utils2.go b/tests/integration/utils2.go +index dc344d49..b7d85b97 100644 +--- a/tests/integration/utils2.go ++++ b/tests/integration/utils2.go +@@ -1058,6 +1058,21 @@ func createView( + ) { + for _, node := range getNodes(action.NodeID, s.nodes) { + _, err := node.AddView(s.ctx, action.Query, action.SDL) ++ if len(action.ExpectedErrorAlternatives) != 0 { ++ expectedErrorRaised := AssertErrorEqualsAny(err, action.ExpectedErrorAlternatives) ++ if err != nil && !expectedErrorRaised { ++ assert.Fail(s.t, "Unexpected error", err.Error()) ++ } ++ ++ assertExpectedAnyErrorRaised( ++ s.t, ++ s.testCase.Description, ++ action.ExpectedErrorAlternatives, ++ expectedErrorRaised, ++ ) ++ continue ++ } ++ + expectedErrorRaised := AssertError(s.t, s.testCase.Description, err, action.ExpectedError) + + assertExpectedErrorRaised(s.t, s.testCase.Description, action.ExpectedError, expectedErrorRaised) +@@ -1733,6 +1748,25 @@ func assertExpectedErrorRaised(t *testing.T, description string, expectedError s + } + } + ++func AssertErrorEqualsAny(err error, expectedErrors []string) bool { ++ if err == nil { ++ return false ++ } ++ ++ for _, expectedError := range expectedErrors { ++ if err.Error() == expectedError { ++ return true ++ } ++ } ++ return false ++} ++ ++func assertExpectedAnyErrorRaised(t *testing.T, description string, expectedErrors []string, wasRaised bool) { ++ if len(expectedErrors) != 0 && !wasRaised { ++ assert.Fail(t, "Expected one of the acceptable errors however none was raised.", description) ++ } ++} ++ + func assertIntrospectionResults( + s *state, + action IntrospectionRequest, +diff --git a/tests/integration/view/one_to_many/simple_test.go b/tests/integration/view/one_to_many/simple_test.go +index 1eb4dfb7..b6647a22 100644 +--- a/tests/integration/view/one_to_many/simple_test.go ++++ b/tests/integration/view/one_to_many/simple_test.go +@@ -363,3 +363,185 @@ func TestView_OneToManyMultipleViewsWithEmbeddedSchema(t *testing.T) { + + testUtils.ExecuteTestCase(t, test) + } ++ ++func TestView_OneToManyWithDoubleSidedRelation_Errors(t *testing.T) { ++ test := testUtils.TestCase{ ++ Description: "Double-sided relations between view result types are rejected", ++ Actions: []any{ ++ testUtils.SchemaUpdate{ ++ Schema: ` ++ type Author { ++ name: String ++ books: [Book] ++ } ++ type Book { ++ name: String ++ author: Author ++ } ++ `, ++ }, ++ testUtils.CreateView{ ++ Query: ` ++ Author { ++ name ++ books { ++ name ++ } ++ } ++ `, ++ SDL: ` ++ type AuthorView { ++ name: String ++ books: [BookView] ++ } ++ interface BookView { ++ name: String ++ author: AuthorView ++ } ++ `, ++ ++ ExpectedErrorAlternatives: []string{ ++ "relations in views must only be defined on one schema. Field: books, Type: BookView", ++ "relations in views must only be defined on one schema. Field: author, Type: AuthorView", ++ }, ++ }, ++ }, ++ } ++ ++ testUtils.ExecuteTestCase(t, test) ++} ++ ++func TestView_OneToManyWithDoubleSidedRelation_AlternateNames_Errors(t *testing.T) { ++ test := testUtils.TestCase{ ++ Description: "Double-sided view relations are rejected for non-example names", ++ Actions: []any{ ++ testUtils.SchemaUpdate{ ++ Schema: ` ++ type Writer { ++ displayName: String ++ stories: [Story] ++ } ++ type Story { ++ title: String ++ writtenBy: Writer ++ } ++ `, ++ }, ++ testUtils.CreateView{ ++ Query: ` ++ Writer { ++ displayName ++ stories { ++ title ++ } ++ } ++ `, ++ SDL: ` ++ type WriterResult { ++ displayName: String ++ stories: [StoryResult] ++ } ++ interface StoryResult { ++ title: String ++ writtenBy: WriterResult ++ } ++ `, ++ ++ ExpectedErrorAlternatives: []string{ ++ "relations in views must only be defined on one schema. Field: stories, Type: StoryResult", ++ "relations in views must only be defined on one schema. Field: writtenBy, Type: WriterResult", ++ }, ++ }, ++ }, ++ } ++ ++ testUtils.ExecuteTestCase(t, test) ++} ++ ++func TestView_OneToManyWithSingleSidedRelation_Succeeds(t *testing.T) { ++ test := testUtils.TestCase{ ++ Description: "One-sided relations between view result types remain valid", ++ Actions: []any{ ++ testUtils.SchemaUpdate{ ++ Schema: ` ++ type Writer { ++ displayName: String ++ stories: [Story] ++ } ++ type Story { ++ title: String ++ writtenBy: Writer ++ } ++ `, ++ }, ++ testUtils.CreateView{ ++ Query: ` ++ Writer { ++ displayName ++ stories { ++ title ++ } ++ } ++ `, ++ SDL: ` ++ type WriterResult { ++ displayName: String ++ stories: [StoryResult] ++ } ++ interface StoryResult { ++ title: String ++ } ++ `, ++ }, ++ }, ++ } ++ ++ testUtils.ExecuteTestCase(t, test) ++} ++ ++func TestView_OneToOneWithDoubleSidedRelation_Errors(t *testing.T) { ++ test := testUtils.TestCase{ ++ Description: "Double-sided scalar relations between view result types are rejected", ++ Actions: []any{ ++ testUtils.SchemaUpdate{ ++ Schema: ` ++ type Person { ++ name: String ++ passport: Passport ++ } ++ type Passport { ++ number: String ++ owner: Person ++ } ++ `, ++ }, ++ testUtils.CreateView{ ++ Query: ` ++ Person { ++ name ++ passport { ++ number ++ } ++ } ++ `, ++ SDL: ` ++ type PersonResult { ++ name: String ++ passport: PassportResult ++ } ++ interface PassportResult { ++ number: String ++ owner: PersonResult ++ } ++ `, ++ ++ ExpectedErrorAlternatives: []string{ ++ "relations in views must only be defined on one schema. Field: passport, Type: PassportResult", ++ "relations in views must only be defined on one schema. Field: owner, Type: PersonResult", ++ }, ++ }, ++ }, ++ } ++ ++ testUtils.ExecuteTestCase(t, test) ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,16 @@ ++#!/bin/bash ++set -uo pipefail ++cd /testbed ++ ++case "${1:-}" in ++ base) ++ go test -v -race -count=1 -timeout 5m ./tests/integration/view/one_to_many/ -run '^(TestView_OneToMany|TestView_OneToManyWithMixedSDL_Errors|TestView_OneToManyFromInnerSide_Errors|TestView_OneToManyOuterToInnerToOuter_Errors|TestView_OneToManyWithRelationInQueryButNotInSDL|TestView_OneToManyMultipleViewsWithEmbeddedSchema)$' ++ ;; ++ new) ++ go test -v -race -count=1 -timeout 5m ./tests/integration/view/one_to_many/ -run '^(TestView_OneToManyWithDoubleSidedRelation_Errors|TestView_OneToManyWithDoubleSidedRelation_AlternateNames_Errors|TestView_OneToManyWithSingleSidedRelation_Succeeds|TestView_OneToOneWithDoubleSidedRelation_Errors)$' ++ ;; ++ *) ++ echo "usage: $0 base|new" ++ exit 2 ++ ;; ++esac diff --git a/tasks/format-code-task-002695/tests/test.sh b/tasks/format-code-task-002695/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..ff8fd96bb30944375a869aad430f6289c36f3c46 --- /dev/null +++ b/tasks/format-code-task-002695/tests/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +tests/integration/test_case.go +tests/integration/utils2.go +tests/integration/view/one_to_many/simple_test.go +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002695/tests/test_command.sh b/tasks/format-code-task-002695/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..e8d2f32b64045b5a5a56e0ad5667da87d8e0bc2a --- /dev/null +++ b/tasks/format-code-task-002695/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new \ No newline at end of file diff --git a/tasks/format-code-task-002713/environment/Dockerfile b/tasks/format-code-task-002713/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..799ce496c8c01219b75d6b8e6656648db8b3cd2f --- /dev/null +++ b/tasks/format-code-task-002713/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:e9735548ef1be193a9be6da103b981b6e1f56c0cd9080d146be8f13c54e71fe3 diff --git a/tasks/format-code-task-002713/environment/setup/files/blocklist b/tasks/format-code-task-002713/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002713/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002713/environment/setup/setup.sh b/tasks/format-code-task-002713/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002713/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002713/tests/test.patch b/tasks/format-code-task-002713/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..4687ce39cfd3b5798713816055baabf57dc7c833 --- /dev/null +++ b/tasks/format-code-task-002713/tests/test.patch @@ -0,0 +1,381 @@ +diff --git a/internal/catalog/build_test.go b/internal/catalog/build_test.go +index f2df039d7f..da3bd628f0 100644 +--- a/internal/catalog/build_test.go ++++ b/internal/catalog/build_test.go +@@ -45,6 +45,43 @@ func TestUpdate(t *testing.T) { + }, + }, + }, ++ { ++ ` ++ CREATE TYPE status AS ENUM ('open', 'closed'); ++ ALTER TYPE status RENAME VALUE 'closed' TO 'shut'; ++ `, ++ pg.Catalog{ ++ Schemas: map[string]pg.Schema{ ++ "public": { ++ Types: map[string]pg.Type{ ++ "status": pg.Enum{ ++ Name: "status", ++ Vals: []string{"open", "shut"}, ++ }, ++ }, ++ }, ++ }, ++ }, ++ }, ++ { ++ ` ++ CREATE TYPE status AS ENUM ('open', 'closed'); ++ ALTER TYPE status ADD VALUE 'unknown'; ++ ALTER TYPE status ADD VALUE IF NOT EXISTS 'unknown'; ++ `, ++ pg.Catalog{ ++ Schemas: map[string]pg.Schema{ ++ "public": { ++ Types: map[string]pg.Type{ ++ "status": pg.Enum{ ++ Name: "status", ++ Vals: []string{"open", "closed", "unknown"}, ++ }, ++ }, ++ }, ++ }, ++ }, ++ }, + { + "CREATE TABLE venues ();", + pg.Catalog{ +@@ -240,6 +277,27 @@ func TestUpdate(t *testing.T) { + }, + }, + }, ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + { + ` + CREATE TABLE venues (); +diff --git a/internal/postgresql/catalog_test.go b/internal/postgresql/catalog_test.go +index 61619794fa..abc1a26477 100644 +--- a/internal/postgresql/catalog_test.go ++++ b/internal/postgresql/catalog_test.go +@@ -17,11 +17,13 @@ import ( + func TestUpdate(t *testing.T) { + p := NewParser() + +- for i, tc := range []struct { ++ for _, tc := range []struct { ++ name string + stmt string + s *catalog.Schema + }{ + { ++ "create-enum", + "CREATE TYPE status AS ENUM ('open', 'closed');", + &catalog.Schema{ + Name: "public", +@@ -34,6 +36,40 @@ func TestUpdate(t *testing.T) { + }, + }, + { ++ "alter-type-rename-value", ++ ` ++ CREATE TYPE status AS ENUM ('open', 'closed'); ++ ALTER TYPE status RENAME VALUE 'closed' TO 'shut'; ++ `, ++ &catalog.Schema{ ++ Name: "public", ++ Types: []catalog.Type{ ++ &catalog.Enum{ ++ Name: "status", ++ Vals: []string{"open", "shut"}, ++ }, ++ }, ++ }, ++ }, ++ { ++ "alter-type-add-value", ++ ` ++ CREATE TYPE status AS ENUM ('open', 'closed'); ++ ALTER TYPE status ADD VALUE 'unknown'; ++ ALTER TYPE status ADD VALUE IF NOT EXISTS 'unknown'; ++ `, ++ &catalog.Schema{ ++ Name: "public", ++ Types: []catalog.Type{ ++ &catalog.Enum{ ++ Name: "status", ++ Vals: []string{"open", "closed", "unknown"}, ++ }, ++ }, ++ }, ++ }, ++ { ++ "create-table", + "CREATE TABLE venues ();", + &catalog.Schema{ + Name: "public", +@@ -45,6 +81,7 @@ func TestUpdate(t *testing.T) { + }, + }, + { ++ "alter-table-drop-column", + ` + CREATE TABLE foo (); + ALTER TABLE foo ADD COLUMN bar text; +@@ -60,6 +97,7 @@ func TestUpdate(t *testing.T) { + }, + }, + { ++ "alter-table-drop-column-if-exists", + ` + CREATE TABLE foo (); + ALTER TABLE foo DROP COLUMN IF EXISTS bar; +@@ -74,6 +112,7 @@ func TestUpdate(t *testing.T) { + }, + }, + { ++ "alter-table-set-not-null", + ` + CREATE TABLE foo (bar text); + ALTER TABLE foo ALTER bar SET NOT NULL; +@@ -116,6 +155,7 @@ func TestUpdate(t *testing.T) { + }, + */ + { ++ "alter-table-drop-not-null", + ` + CREATE TABLE foo (bar text NOT NULL); + ALTER TABLE foo ALTER bar DROP NOT NULL; +@@ -136,6 +176,7 @@ func TestUpdate(t *testing.T) { + }, + }, + { ++ "alter-table-column-drop-not-null", + ` + CREATE TABLE foo (bar text NOT NULL); + ALTER TABLE foo ALTER COLUMN bar DROP NOT NULL; +@@ -156,6 +197,7 @@ func TestUpdate(t *testing.T) { + }, + }, + { ++ "alter-table-rename-column", + ` + CREATE TABLE foo (bar text); + ALTER TABLE foo RENAME bar TO baz; +@@ -176,6 +218,7 @@ func TestUpdate(t *testing.T) { + }, + }, + { ++ "alter-table-set-data-type", + ` + CREATE TABLE foo (bar text); + ALTER TABLE foo ALTER bar SET DATA TYPE bool; +@@ -196,6 +239,7 @@ func TestUpdate(t *testing.T) { + }, + }, + { ++ "alter-table-set-schema", + ` + CREATE SCHEMA foo; + CREATE TABLE bar (); +@@ -211,6 +255,7 @@ func TestUpdate(t *testing.T) { + }, + }, + { ++ "drop-table", + ` + CREATE TABLE venues (); + DROP TABLE venues; +@@ -218,6 +263,7 @@ func TestUpdate(t *testing.T) { + nil, + }, + { ++ "drop-table-if-exists", + ` + CREATE TABLE venues (); + DROP TABLE IF EXISTS venues; +@@ -226,6 +272,7 @@ func TestUpdate(t *testing.T) { + nil, + }, + { ++ "alter-table-rename", + ` + CREATE TABLE venues (); + ALTER TABLE venues RENAME TO arenas; +@@ -240,6 +287,7 @@ func TestUpdate(t *testing.T) { + }, + }, + { ++ "drop-type", + ` + CREATE TYPE status AS ENUM ('open', 'closed'); + DROP TYPE status; +@@ -247,6 +295,7 @@ func TestUpdate(t *testing.T) { + nil, + }, + { ++ "drop-type-if-exists", + ` + CREATE TYPE status AS ENUM ('open', 'closed'); + DROP TYPE IF EXISTS status; +@@ -255,6 +304,7 @@ func TestUpdate(t *testing.T) { + nil, + }, + { ++ "drop-table-in-schema", + ` + CREATE TABLE venues (); + DROP TABLE public.venues; +@@ -262,6 +312,7 @@ func TestUpdate(t *testing.T) { + nil, + }, + { ++ "drop-type-in-schema", + ` + CREATE TYPE status AS ENUM ('open', 'closed'); + DROP TYPE public.status; +@@ -269,6 +320,7 @@ func TestUpdate(t *testing.T) { + nil, + }, + { ++ "drop-schema", + ` + CREATE SCHEMA foo; + DROP SCHEMA foo; +@@ -276,12 +328,14 @@ func TestUpdate(t *testing.T) { + nil, + }, + { ++ "drop-schema-if-exists", + ` + DROP SCHEMA IF EXISTS foo; + `, + nil, + }, + { ++ "drop-function-if-exists", + ` + DROP FUNCTION IF EXISTS bar; + DROP FUNCTION IF EXISTS bar(); +@@ -289,6 +343,7 @@ func TestUpdate(t *testing.T) { + nil, + }, + { ++ "alter-table-drop-constraint", + ` + CREATE TABLE venues (id SERIAL PRIMARY KEY); + ALTER TABLE venues DROP CONSTRAINT venues_id_pkey; +@@ -310,6 +365,7 @@ func TestUpdate(t *testing.T) { + }, + }, + { ++ "create-function", + ` + CREATE FUNCTION foo(TEXT) RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; + `, +@@ -329,6 +385,7 @@ func TestUpdate(t *testing.T) { + }, + }, + { ++ "create-function-args", + ` + CREATE FUNCTION foo(bar TEXT) RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; + CREATE FUNCTION foo(bar TEXT, baz TEXT) RETURNS TEXT AS $$ SELECT "baz" $$ LANGUAGE sql; +@@ -364,6 +421,7 @@ func TestUpdate(t *testing.T) { + }, + }, + { ++ "create-function-types", + ` + CREATE FUNCTION foo(bar TEXT) RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; + CREATE FUNCTION foo(bar INTEGER) RETURNS TEXT AS $$ SELECT "baz" $$ LANGUAGE sql; +@@ -395,6 +453,7 @@ func TestUpdate(t *testing.T) { + }, + }, + { ++ "create-function-return", + ` + CREATE FUNCTION foo(bar TEXT, baz TEXT="baz") RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; + `, +@@ -420,6 +479,7 @@ func TestUpdate(t *testing.T) { + }, + }, + { ++ "drop-function-args", + ` + CREATE FUNCTION foo(bar text) RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; + DROP FUNCTION foo(text); +@@ -427,6 +487,7 @@ func TestUpdate(t *testing.T) { + nil, + }, + { ++ "drop-function", + ` + CREATE FUNCTION foo(bar text) RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; + DROP FUNCTION foo; +@@ -437,6 +498,7 @@ func TestUpdate(t *testing.T) { + // CREATE FUNCTION foo() RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; + // DROP FUNCTION foo -- FAIL + { ++ "pg_temp", + ` + CREATE TABLE pg_temp.migrate (val SERIAL); + INSERT INTO pg_temp.migrate (val) SELECT val FROM old; +@@ -458,6 +520,7 @@ func TestUpdate(t *testing.T) { + }, + }, + { ++ "comment", + ` + CREATE SCHEMA foo; + CREATE TABLE foo.bar (baz text); +@@ -494,7 +557,7 @@ func TestUpdate(t *testing.T) { + }, + } { + test := tc +- t.Run(strconv.Itoa(i), func(t *testing.T) { ++ t.Run(test.name, func(t *testing.T) { + stmts, err := p.Parse(strings.NewReader(test.stmt)) + if err != nil { + t.Log(test.stmt) +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,5 @@ ++H4sIAAAAAAAAA+3S326DIBQGcK99itPsWhEserW9SoNA1IRCJ+hev85k2Z9s602bpdn3uzkETsIJ ++H2U3j84crF9YdivVqpVyq6uvdVtzKbgQdc2bOqs4l22bkbzZRB/MMamJKJtCSL/1XTq/U+V7/snG ++dNDheFTelHG43h2X8hecv+Uv2n2z5r9veJ1Rdb0RfvbP83/YsW70rFNxyLWh7RN01uTGLkV8GZMe ++qNeaeE3iia2bzM/O5X2g10Yq2eiTnbxyTKukXOgZFQsVOsw+PfLv+k4hpn6y8dl9bv3rhwAAAAAA ++AAAAAAAAAAAAAAAAuENnr431LQAoAAA= +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-002713/tests/test.sh b/tasks/format-code-task-002713/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..77d622367fb9e04943dc6bb8b9128ade9f632cb9 --- /dev/null +++ b/tasks/format-code-task-002713/tests/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +internal/catalog/build_test.go +internal/postgresql/catalog_test.go +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002713/tests/test_command.sh b/tasks/format-code-task-002713/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002713/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002714/environment/Dockerfile b/tasks/format-code-task-002714/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..9acf190307d80abde94c6a1e602ff3b275d84d97 --- /dev/null +++ b/tasks/format-code-task-002714/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:570382a08ae2bed313a621f3bbc9b878e1fb417bcae56c61f4ea6ba8d6aeaed7 diff --git a/tasks/format-code-task-002714/environment/setup/files/blocklist b/tasks/format-code-task-002714/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002714/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002714/environment/setup/setup.sh b/tasks/format-code-task-002714/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002714/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002714/tests/test.patch b/tasks/format-code-task-002714/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..0355e1ca1a7d1836a943e09bca1082394be16190 --- /dev/null +++ b/tasks/format-code-task-002714/tests/test.patch @@ -0,0 +1,171 @@ +diff --git a/test/dialects/ansi_test.py b/test/dialects/ansi_test.py +index 628fb8035..f8b9ff2e1 100644 +--- a/test/dialects/ansi_test.py ++++ b/test/dialects/ansi_test.py +@@ -213,3 +213,144 @@ def test__dialect__ansi_parse_indented_joins(sql_string, indented_joins, meta_lo + idx for idx, raw_seg in enumerate(parsed.tree.iter_raw_seg()) if raw_seg.is_meta + ) + assert res_meta_locs == meta_loc ++ ++ ++ ++ ++ ++_USING_AT_JOIN_SQL = ( ++ "SELECT\n" ++ " a,\n" ++ " b\n" ++ "FROM\n" ++ " table1\n" ++ "JOIN\n" ++ " table2\n" ++ "USING (a, b)\n" ++) ++ ++_USING_INDENTED_SQL = ( ++ "SELECT\n" ++ " a,\n" ++ " b\n" ++ "FROM\n" ++ " table1\n" ++ "JOIN\n" ++ " table2\n" ++ " USING (a, b)\n" ++) ++ ++_ON_AT_JOIN_SQL = ( ++ "SELECT\n" ++ " a,\n" ++ " b\n" ++ "FROM\n" ++ " table1\n" ++ "JOIN\n" ++ " table2\n" ++ "ON table1.a = table2.a\n" ++) ++ ++_ON_INDENTED_SQL = ( ++ "SELECT\n" ++ " a,\n" ++ " b\n" ++ "FROM\n" ++ " table1\n" ++ "JOIN\n" ++ " table2\n" ++ " ON table1.a = table2.a\n" ++) ++ ++ ++def _lint_l003(sql, indented_using_on): ++ """Run linter with given indented_using_on config, return L003 violations.""" ++ config = FluffConfig( ++ configs={"indentation": {"indented_using_on": indented_using_on}}, ++ overrides=dict(dialect="ansi"), ++ ) ++ lnt = Linter(config=config) ++ result = lnt.lint_string(sql) ++ return [v for v in result.violations if v.rule_code() == "L003"] ++ ++ ++def test__dialect__ansi_indented_using_on_false_accepts_using_at_join_level(): ++ """indented_using_on=False: USING at JOIN level passes L003.""" ++ violations = _lint_l003(_USING_AT_JOIN_SQL, indented_using_on=False) ++ assert violations == [] ++ ++ ++def test__dialect__ansi_indented_using_on_false_rejects_using_indented(): ++ """indented_using_on=False: USING indented from JOIN triggers L003.""" ++ violations = _lint_l003(_USING_INDENTED_SQL, indented_using_on=False) ++ assert len(violations) >= 1 ++ ++ ++def test__dialect__ansi_indented_using_on_true_accepts_using_indented(): ++ """indented_using_on=True: USING indented from JOIN passes L003.""" ++ violations = _lint_l003(_USING_INDENTED_SQL, indented_using_on=True) ++ assert violations == [] ++ ++ ++def test__dialect__ansi_indented_using_on_true_rejects_using_at_join_level(): ++ """indented_using_on=True: USING at JOIN level triggers L003.""" ++ violations = _lint_l003(_USING_AT_JOIN_SQL, indented_using_on=True) ++ assert len(violations) >= 1 ++ ++ ++def test__dialect__ansi_indented_using_on_false_accepts_on_at_join_level(): ++ """indented_using_on=False: ON at JOIN level passes L003.""" ++ violations = _lint_l003(_ON_AT_JOIN_SQL, indented_using_on=False) ++ assert violations == [] ++ ++ ++def test__dialect__ansi_indented_using_on_false_rejects_on_indented(): ++ """indented_using_on=False: ON indented from JOIN triggers L003.""" ++ violations = _lint_l003(_ON_INDENTED_SQL, indented_using_on=False) ++ assert len(violations) >= 1 ++ ++ ++def test__dialect__ansi_indented_using_on_true_accepts_on_indented(): ++ """indented_using_on=True: ON indented from JOIN passes L003.""" ++ violations = _lint_l003(_ON_INDENTED_SQL, indented_using_on=True) ++ assert violations == [] ++ ++ ++def test__dialect__ansi_indented_using_on_true_rejects_on_at_join_level(): ++ """indented_using_on=True: ON at JOIN level triggers L003.""" ++ violations = _lint_l003(_ON_AT_JOIN_SQL, indented_using_on=True) ++ assert len(violations) >= 1 ++ ++ ++@pytest.mark.parametrize( ++ "sql_string, indented_using_on, meta_loc", ++ [ ++ ( ++ "select field_1 from my_table as alias_1 join foo using (field_1)", ++ True, ++ (1, 5, 8, 15, 17, 22, 25, 27, 29, 30), ++ ), ++ ( ++ "select field_1 from my_table as alias_1 join foo using (field_1)", ++ False, ++ (1, 5, 8, 15, 17, 21, 23, 26, 28, 30, 31, 32), ++ ), ++ ], ++) ++def test__dialect__ansi_parse_indented_using_on( ++ sql_string, indented_using_on, meta_loc ++): ++ """Conditional meta segments fire on indented_using_on config.""" ++ lnt = Linter( ++ config=FluffConfig( ++ configs={"indentation": {"indented_using_on": indented_using_on}} ++ ) ++ ) ++ parsed = lnt.parse_string(sql_string) ++ assert "unparsable" not in parsed.tree.type_set() ++ res_meta_locs = tuple( ++ idx ++ for idx, raw_seg in enumerate(parsed.tree.iter_raw_seg()) ++ if raw_seg.is_meta ++ ) ++ assert res_meta_locs == meta_loc +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 000000000..d282efa18 +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["PYTHONPATH=src python -m pytest test/dialects/ansi_test.py -k indented_using_on -v"] ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++PYTHONPATH=src python -m pytest test/dialects/ansi_test.py -k indented_using_on -v ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-002714/tests/test.sh b/tasks/format-code-task-002714/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..6cadafd000158a0f55c8d6e36a0d6bdbdb19c969 --- /dev/null +++ b/tasks/format-code-task-002714/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test/dialects/ansi_test.py +test_commands.json +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002714/tests/test_command.sh b/tasks/format-code-task-002714/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002714/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002805/environment/Dockerfile b/tasks/format-code-task-002805/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..afd268127c00e5265523e58081e2ee23be26451f --- /dev/null +++ b/tasks/format-code-task-002805/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:236d3223e14945eeb9e7bbfbe4295c090bc32d8088edafea42665350a90c1a04 diff --git a/tasks/format-code-task-002805/environment/setup/files/blocklist b/tasks/format-code-task-002805/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002805/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002805/environment/setup/setup.sh b/tasks/format-code-task-002805/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002805/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002805/tests/test.patch b/tasks/format-code-task-002805/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..3edf0a6cd6525ba4cb8af980ce85ce9a7574712e --- /dev/null +++ b/tasks/format-code-task-002805/tests/test.patch @@ -0,0 +1,174 @@ +diff --git a/pkg/version/version_test.go b/pkg/version/version_test.go +index 0d3ac2c746..e09eac3647 100644 +--- a/pkg/version/version_test.go ++++ b/pkg/version/version_test.go +@@ -98,6 +98,59 @@ func TestGetPipelineVersion(t *testing.T) { + } + } + ++func TestGetPipelinesVersionViaConfigMap(t *testing.T) { ++ ++ testParams := []struct { ++ name string ++ namespace string ++ userProvidedNamespace string ++ configMap *corev1.ConfigMap ++ want string ++ }{ ++ { ++ name: "get pipelines version from configmap in tekton-pipelines namespace", ++ namespace: "tekton-pipelines", ++ configMap: getConfigMapData("pipelines-info", "main", map[string]string{"app.kubernetes.io/part-of": "tekton-pipelines"}), ++ want: "main", ++ }, ++ { ++ name: "get pipelines version from configmap present in different namespace other than default namespaces", ++ namespace: "test", ++ userProvidedNamespace: "test", ++ configMap: getConfigMapData("pipelines-info", "test", map[string]string{"app.kubernetes.io/part-of": "tekton-pipelines"}), ++ want: "test", ++ }, ++ } ++ for _, tp := range testParams { ++ t.Run(tp.name, func(t *testing.T) { ++ cs, _ := test.SeedTestData(t, pipelinetest.Data{}) ++ p := &test.Params{Kube: cs.Kube} ++ cls, err := p.Clients() ++ if err != nil { ++ t.Errorf("failed to get client: %v", err) ++ } ++ if _, err := cls.Kube.CoreV1().ConfigMaps(tp.namespace).Create(context.Background(), tp.configMap, metav1.CreateOptions{}); err != nil { ++ t.Errorf("failed to create configmap: %v", err) ++ } ++ version, _ := GetPipelineVersion(cls, tp.userProvidedNamespace) ++ test.AssertOutput(t, tp.want, version) ++ }) ++ } ++} ++ ++func getConfigMapData(name, version string, labels map[string]string) *corev1.ConfigMap { ++ return &corev1.ConfigMap{ ++ TypeMeta: metav1.TypeMeta{}, ++ ObjectMeta: metav1.ObjectMeta{ ++ Name: name, ++ Labels: labels, ++ }, ++ Data: map[string]string{ ++ "version": version, ++ }, ++ } ++} ++ + func getDeploymentData(name, image string, deploymentLabels, podTemplateLabels, annotations map[string]string) *v1.Deployment { + return &v1.Deployment{ + TypeMeta: metav1.TypeMeta{}, +@@ -184,6 +237,45 @@ func TestGetTriggerVersion(t *testing.T) { + } + } + ++func TestGetTriggersVersionViaConfigMap(t *testing.T) { ++ ++ testParams := []struct { ++ name string ++ namespace string ++ userProvidedNamespace string ++ configMap *corev1.ConfigMap ++ want string ++ }{ ++ { ++ name: "get triggers version from configmap present in different namespace other than default namespaces", ++ namespace: "test", ++ userProvidedNamespace: "test", ++ configMap: getConfigMapData("triggers-info", "test", map[string]string{"app.kubernetes.io/part-of": "tekton-triggers"}), ++ want: "test", ++ }, { ++ name: "get triggers version from configmap in tekton-pipelines namespace", ++ namespace: "tekton-pipelines", ++ configMap: getConfigMapData("triggers-info", "main", map[string]string{"app.kubernetes.io/part-of": "tekton-triggers"}), ++ want: "main", ++ }, ++ } ++ for _, tp := range testParams { ++ t.Run(tp.name, func(t *testing.T) { ++ cs, _ := test.SeedTestData(t, pipelinetest.Data{}) ++ p := &test.Params{Kube: cs.Kube} ++ cls, err := p.Clients() ++ if err != nil { ++ t.Errorf("failed to get client: %v", err) ++ } ++ if _, err := cls.Kube.CoreV1().ConfigMaps(tp.namespace).Create(context.Background(), tp.configMap, metav1.CreateOptions{}); err != nil { ++ t.Errorf("failed to create configmap: %v", err) ++ } ++ version, _ := GetTriggerVersion(cls, tp.userProvidedNamespace) ++ test.AssertOutput(t, tp.want, version) ++ }) ++ } ++} ++ + func TestGetDashboardVersion(t *testing.T) { + oldDeploymentLabels := map[string]string{ + "app": "tekton-dashboard", +@@ -246,3 +338,43 @@ func TestGetDashboardVersion(t *testing.T) { + }) + } + } ++ ++func TestGetDashboardVersionViaConfigMap(t *testing.T) { ++ ++ testParams := []struct { ++ name string ++ namespace string ++ userProvidedNamespace string ++ configMap *corev1.ConfigMap ++ want string ++ }{ ++ { ++ name: "get dashboard version from configmap in tekton-pipelines namespace", ++ namespace: "tekton-pipelines", ++ configMap: getConfigMapData("dashboard-info", "main", map[string]string{"app.kubernetes.io/part-of": "tekton-dashboard"}), ++ want: "main", ++ }, ++ { ++ name: "get dashboard version from configmap present in different namespace other than default namespaces", ++ namespace: "test", ++ userProvidedNamespace: "test", ++ configMap: getConfigMapData("dashboard-info", "test", map[string]string{"app.kubernetes.io/part-of": "tekton-dashboard"}), ++ want: "test", ++ }, ++ } ++ for _, tp := range testParams { ++ t.Run(tp.name, func(t *testing.T) { ++ cs, _ := test.SeedTestData(t, pipelinetest.Data{}) ++ p := &test.Params{Kube: cs.Kube} ++ cls, err := p.Clients() ++ if err != nil { ++ t.Errorf("failed to get client: %v", err) ++ } ++ if _, err := cls.Kube.CoreV1().ConfigMaps(tp.namespace).Create(context.Background(), tp.configMap, metav1.CreateOptions{}); err != nil { ++ t.Errorf("failed to create configmap: %v", err) ++ } ++ version, _ := GetDashboardVersion(cls, tp.userProvidedNamespace) ++ test.AssertOutput(t, tp.want, version) ++ }) ++ } ++} +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,4 @@ ++H4sIAAAAAAAAA+3R0QqCMBTGca97ivMCuS2aXvUsYiolpQudPn9LiCIob4qI/r+bc2AH9sEXb4f6 ++WGZVO6roU3SQWjvN4HFOu7Ers9LWaB3ujLGpjsR+LNGdofd5JxJ1zvlXd3PvPyq+9e+r3meFa5q8 ++LeN+/74/Zvu36bV/nSYm9L9OTBKJfl+E5/68/6KUqfhtVS52Ti6rLEdZFm5o/cZIrE6HnRqrrq9d ++qxbfjgsAAAAAAAAAAAAAAADgzhlXr93YACgAAA== +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-002805/tests/test.sh b/tasks/format-code-task-002805/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..e4d8752f55f868165704a5d89bbf9757d114ca65 --- /dev/null +++ b/tasks/format-code-task-002805/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +pkg/version/version_test.go +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002805/tests/test_command.sh b/tasks/format-code-task-002805/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002805/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002833/environment/Dockerfile b/tasks/format-code-task-002833/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..44a3c886c30f7e8782790f13bed5e0a50b550b6c --- /dev/null +++ b/tasks/format-code-task-002833/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:c889517c7eb019c7b32ac3b90d548c0fd3b901e15622c4a2847ad0a90456b15e diff --git a/tasks/format-code-task-002833/environment/setup/files/blocklist b/tasks/format-code-task-002833/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002833/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002833/environment/setup/setup.sh b/tasks/format-code-task-002833/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-002833/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002833/tests/test.patch b/tasks/format-code-task-002833/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..65a932289b1eb0ec38783bcbfd1606eede26606d --- /dev/null +++ b/tasks/format-code-task-002833/tests/test.patch @@ -0,0 +1,354 @@ +diff --git a/usercase-test-coderl/fixtures/playwright/__init__.py b/usercase-test-coderl/fixtures/playwright/__init__.py +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/fixtures/playwright/__init__.py +@@ -0,0 +1,1 @@ ++ +diff --git a/usercase-test-coderl/fixtures/playwright/sync_api.py b/usercase-test-coderl/fixtures/playwright/sync_api.py +new file mode 100644 +--- /dev/null ++++ b/usercase-test-coderl/fixtures/playwright/sync_api.py +@@ -0,0 +1,114 @@ ++class Error(Exception): ++ pass ++ ++ ++class TimeoutError(Error): ++ pass ++ ++ ++class FakeLocator: ++ def __init__(self, page, selector): ++ self.page = page ++ self.selector = selector ++ ++ def wait_for(self, *args, **kwargs): ++ self.page.waited = self.selector ++ if self.selector in ("#never", "xpath=//never"): ++ ++ raise TimeoutError(f"Timeout 30000ms exceeded while waiting for locator {self.selector!r}") ++ ++ ++class FakePage: ++ def __init__(self, browser_name, user_agent=None): ++ self.browser_name = browser_name ++ self.user_agent = user_agent ++ self.navigated = None ++ self.wait_until = None ++ self.waited = None ++ ++ def goto(self, url, wait_until=None, **kwargs): ++ self.navigated = url ++ self.wait_until = wait_until ++ if url.endswith("/missing.html"): ++ ++ raise Error("Navigation failed for missing.html") ++ return None ++ ++ def locator(self, selector): ++ return FakeLocator(self, selector) ++ ++ def wait_for_selector(self, selector, *args, **kwargs): ++ return self.locator(selector).wait_for(*args, **kwargs) ++ ++ def content(self): ++ return ( ++ "" ++ f"
script-added for {self.navigated}
" ++ f"{self.browser_name}" ++ f"{self.user_agent}" ++ f"{self.wait_until}" ++ f"{self.waited}" ++ "" ++ ) ++ ++ def close(self): ++ pass ++ ++ ++class FakeBrowser: ++ def __init__(self, name): ++ self.name = name ++ ++ def launch(self, *args, **kwargs): ++ return self ++ ++ def new_page(self, user_agent=None, **kwargs): ++ return FakePage(self.name, user_agent) ++ ++ def new_context(self, user_agent=None, **kwargs): ++ ++ return FakeBrowserContext(self.name, user_agent) ++ ++ def close(self): ++ pass ++ ++ ++class FakeBrowserContext: ++ def __init__(self, browser_name, user_agent=None): ++ self.browser_name = browser_name ++ self.user_agent = user_agent ++ ++ def new_page(self, **kwargs): ++ return FakePage(self.browser_name, kwargs.get("user_agent", self.user_agent)) ++ ++ def close(self): ++ pass ++ ++ ++class FakePlaywright: ++ def __getitem__(self, name): ++ return FakeBrowser(name) ++ ++ def __getattr__(self, name): ++ if name.startswith("_"): ++ raise AttributeError(name) ++ return FakeBrowser(name) ++ ++ def stop(self): ++ pass ++ ++ ++class FakeContext: ++ def start(self): ++ ++ return FakePlaywright() ++ ++ def __enter__(self): ++ return FakePlaywright() ++ ++ def __exit__(self, exc_type, exc, tb): ++ return False ++ ++ ++def sync_playwright(): ++ return FakeContext() +diff --git a/usercase-test-coderl/usecase.sh b/usercase-test-coderl/usecase.sh +new file mode 100755 +--- /dev/null ++++ b/usercase-test-coderl/usecase.sh +@@ -0,0 +1,207 @@ ++#!/usr/bin/env bash ++ ++set -u ++export LANG=C.UTF-8 LC_ALL=C.UTF-8 TZ=UTC ++ ++fail() { echo "FAIL: $*" >&2; exit 1; } ++ ++REPO=/workspace/repo ++FIXTURES="$REPO/usercase-test-coderl/fixtures" ++VENV=/opt/urlwatch-stage4a-coderl-venv ++ ++ ++ ++BIN="$VENV/bin/urlwatch" ++[ -x "$BIN" ] || fail "missing urlwatch binary at $BIN" ++ ++TMP=$(mktemp -d); trap 'rm -rf "$TMP"' EXIT ++cd "$TMP" || fail "cd tmp" ++ ++write_config() { ++ printf '%s\n' '---' > "$1/config.yaml" ++} ++ ++run_urlwatch() { ++ case_name=$1 ++ shift ++ mkdir -p "$TMP/$case_name" ++ write_config "$TMP/$case_name" ++ PYTHONPATH="$FIXTURES" "$BIN" \ ++ --urls "$TMP/$case_name/jobs.yaml" \ ++ --cache "$TMP/$case_name/cache.db" \ ++ --config "$TMP/$case_name/config.yaml" \ ++ "$@" >"$TMP/$case_name/out" 2>"$TMP/$case_name/err" ++ ec=$? ++} ++ ++ ++ ++ ++cat > "$TMP/f1_jobs" <<'YAML' ++--- ++kind: browser ++navigate: "http://127.0.0.1:8000/page.html" ++YAML ++cp "$TMP/f1_jobs" "$TMP/f1/jobs.yaml" 2>/dev/null || { mkdir -p "$TMP/f1"; cp "$TMP/f1_jobs" "$TMP/f1/jobs.yaml"; } ++run_urlwatch f1 --test-filter 1 ++EXPECTED='
script-added for http://127.0.0.1:8000/page.html
chromiumNoneNoneNone' ++[ "$ec" -eq 0 ] || fail "F1 exit $ec; want 0" ++ ++grep -q '
script-added for http://127.0.0.1:8000/page.html
' "$TMP/f1/out" || fail "F1 stdout missing rendered page: $(cat "$TMP/f1/out")" ++grep -q 'chromium' "$TMP/f1/out" || fail "F1 stdout missing Chromium default: $(cat "$TMP/f1/out")" ++[ ! -s "$TMP/f1/err" ] || fail "F1 unexpected stderr: $(cat "$TMP/f1/err")" ++ ++ ++ ++ ++mkdir -p "$TMP/f2" ++cat > "$TMP/f2/jobs.yaml" <<'YAML' ++--- ++navigate: "http://127.0.0.1:8000/app.html" ++browser: firefox ++useragent: "FixtureBot/1.0" ++wait_until: domcontentloaded ++wait_for: "#ready" ++YAML ++run_urlwatch f2 --test-filter 1 ++EXPECTED='
script-added for http://127.0.0.1:8000/app.html
firefoxFixtureBot/1.0domcontentloaded#ready' ++[ "$ec" -eq 0 ] || fail "F2 exit $ec; want 0" ++[ "$(cat "$TMP/f2/out")" = "$EXPECTED" ] || fail "F2 stdout: $(cat "$TMP/f2/out")" ++[ ! -s "$TMP/f2/err" ] || fail "F2 unexpected stderr: $(cat "$TMP/f2/err")" ++ ++ ++ ++ ++mkdir -p "$TMP/f3" ++cat > "$TMP/f3/jobs.yaml" <<'YAML' ++--- ++kind: browser ++navigate: "http://127.0.0.1:8000/xpath.html" ++wait_until: commit ++wait_for: "xpath=//section[@id='ready']" ++YAML ++run_urlwatch f3 --test-filter 1 ++EXPECTED='
script-added for http://127.0.0.1:8000/xpath.html
chromiumNonecommitxpath=//section[@id='"'"'ready'"'"']' ++[ "$ec" -eq 0 ] || fail "F3 exit $ec; want 0" ++[ "$(cat "$TMP/f3/out")" = "$EXPECTED" ] || fail "F3 stdout: $(cat "$TMP/f3/out")" ++[ ! -s "$TMP/f3/err" ] || fail "F3 unexpected stderr: $(cat "$TMP/f3/err")" ++ ++ ++ ++ ++mkdir -p "$TMP/f4" ++cat > "$TMP/f4/jobs.yaml" <<'YAML' ++--- ++kind: browser ++navigate: "http://127.0.0.1:8000/legacy0.html" ++wait_until: networkidle0 ++YAML ++run_urlwatch f4 -v --test-filter 1 ++EXPECTED='
script-added for http://127.0.0.1:8000/legacy0.html
chromiumNonenetworkidleNone' ++[ "$ec" -eq 0 ] || fail "F4 exit $ec; want 0" ++[ "$(cat "$TMP/f4/out")" = "$EXPECTED" ] || fail "F4 stdout: $(cat "$TMP/f4/out")" ++ ++grep -qi 'networkidle0' "$TMP/f4/err" || fail "F4 warning should mention networkidle0: $(cat "$TMP/f4/err")" ++ ++ ++ ++ ++mkdir -p "$TMP/f5" ++cat > "$TMP/f5/jobs.yaml" <<'YAML' ++--- ++kind: browser ++navigate: "http://127.0.0.1:8000/legacy2.html" ++wait_until: networkidle2 ++YAML ++run_urlwatch f5 -v --test-filter 1 ++EXPECTED='
script-added for http://127.0.0.1:8000/legacy2.html
chromiumNonenetworkidleNone' ++[ "$ec" -eq 0 ] || fail "F5 exit $ec; want 0" ++[ "$(cat "$TMP/f5/out")" = "$EXPECTED" ] || fail "F5 stdout: $(cat "$TMP/f5/out")" ++ ++grep -qi 'networkidle2' "$TMP/f5/err" || fail "F5 warning should mention networkidle2: $(cat "$TMP/f5/err")" ++ ++ ++ ++ ++mkdir -p "$TMP/f6" ++cat > "$TMP/f6/jobs.yaml" <<'YAML' ++--- ++kind: browser ++navigate: "http://127.0.0.1:8000/list.html" ++YAML ++run_urlwatch f6 --list ++[ "$ec" -eq 0 ] || fail "F6 exit $ec; want 0" ++ ++grep -q 'http://127.0.0.1:8000/list.html' "$TMP/f6/out" || fail "F6 stdout missing navigate URL: $(cat "$TMP/f6/out")" ++[ ! -s "$TMP/f6/err" ] || fail "F6 unexpected stderr: $(cat "$TMP/f6/err")" ++ ++ ++ ++ ++mkdir -p "$TMP/f7" ++cat > "$TMP/f7/jobs.yaml" <<'YAML' ++--- ++kind: browser ++navigate: "http://127.0.0.1:8000/list-hidden.html" ++user_visible_url: "https://visible.example/rendered" ++YAML ++run_urlwatch f7 --list ++[ "$ec" -eq 0 ] || fail "F7 exit $ec; want 0" ++ ++grep -q 'https://visible.example/rendered' "$TMP/f7/out" || fail "F7 stdout missing visible URL: $(cat "$TMP/f7/out")" ++! grep -q 'http://127.0.0.1:8000/list-hidden.html' "$TMP/f7/out" || fail "F7 stdout should not show hidden navigate URL: $(cat "$TMP/f7/out")" ++[ ! -s "$TMP/f7/err" ] || fail "F7 unexpected stderr: $(cat "$TMP/f7/err")" ++ ++ ++ ++ ++mkdir -p "$TMP/f8" ++cat > "$TMP/f8/jobs.yaml" <<'YAML' ++--- ++kind: browser ++navigate: "http://127.0.0.1:8000/change-before.html" ++YAML ++run_urlwatch f8 --change-location 1 http://127.0.0.1:8000/other.html ++[ "$ec" -eq 0 ] || fail "F8 exit $ec; want 0" ++ ++mkdir -p "$TMP/f8_verify" ++cp "$TMP/f8/jobs.yaml" "$TMP/f8_verify/jobs.yaml" ++run_urlwatch f8_verify --list ++[ "$ec" -eq 0 ] || fail "F8 list exit $ec; want 0" ++grep -q 'http://127.0.0.1:8000/other.html' "$TMP/f8_verify/out" || fail "F8 list stdout missing updated URL: $(cat "$TMP/f8_verify/out")" ++! grep -q 'http://127.0.0.1:8000/change-before.html' "$TMP/f8_verify/out" || fail "F8 list stdout should not show old URL: $(cat "$TMP/f8_verify/out")" ++[ ! -s "$TMP/f8/err" ] || fail "F8 unexpected stderr: $(cat "$TMP/f8/err")" ++ ++ ++ ++ ++mkdir -p "$TMP/f9" ++cat > "$TMP/f9/jobs.yaml" <<'YAML' ++--- ++kind: browser ++navigate: "http://127.0.0.1:8000/missing.html" ++YAML ++run_urlwatch f9 --test-filter 1 ++[ "$ec" -ne 0 ] || fail "F9 exit $ec; want non-zero" ++[ ! -s "$TMP/f9/out" ] || fail "F9 stdout should be empty: $(cat "$TMP/f9/out")" ++ ++[ -s "$TMP/f9/err" ] || fail "F9 stderr should be non-empty" ++ ++ ++ ++ ++mkdir -p "$TMP/f10" ++cat > "$TMP/f10/jobs.yaml" <<'YAML' ++--- ++kind: browser ++navigate: "http://127.0.0.1:8000/page.html" ++wait_for: "#never" ++YAML ++run_urlwatch f10 --test-filter 1 ++[ "$ec" -ne 0 ] || fail "F10 exit $ec; want non-zero" ++[ ! -s "$TMP/f10/out" ] || fail "F10 stdout should be empty: $(cat "$TMP/f10/out")" ++ ++[ -s "$TMP/f10/err" ] || fail "F10 stderr should be non-empty" ++ ++echo "PASS" ++exit 0 +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,12 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++exec bash /workspace/repo/usercase-test-coderl/usecase.sh diff --git a/tasks/format-code-task-002833/tests/test.sh b/tasks/format-code-task-002833/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..9f05642f1cf3157f42597676d682e7191264ef60 --- /dev/null +++ b/tasks/format-code-task-002833/tests/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/fixtures/playwright/__init__.py +usercase-test-coderl/fixtures/playwright/sync_api.py +usercase-test-coderl/usecase.sh +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002833/tests/test_command.sh b/tasks/format-code-task-002833/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-002833/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002834/environment/Dockerfile b/tasks/format-code-task-002834/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..345b94fd2bc914f24be88f6cc507a189f7329c73 --- /dev/null +++ b/tasks/format-code-task-002834/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:b8cfedd95d0329baa48b79d07587b2110233b5fa4b62735c99d39468b55b1615 diff --git a/tasks/format-code-task-002834/environment/setup/files/blocklist b/tasks/format-code-task-002834/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002834/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002834/environment/setup/setup.sh b/tasks/format-code-task-002834/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9eb7daf39f9542bd095367feee457f3da77e492 --- /dev/null +++ b/tasks/format-code-task-002834/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/workspace/repo +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002834/tests/test.patch b/tasks/format-code-task-002834/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..fd6b35a84904b4f5f43dc376c21876d43af16148 --- /dev/null +++ b/tasks/format-code-task-002834/tests/test.patch @@ -0,0 +1,262 @@ +diff --git a/usercase-test-coderl/usecase.sh b/usercase-test-coderl/usecase.sh +new file mode 100755 +--- /dev/null ++++ b/usercase-test-coderl/usecase.sh +@@ -0,0 +1,240 @@ ++#!/usr/bin/env bash ++ ++set -u ++export LANG=C.UTF-8 LC_ALL=C.UTF-8 TZ=UTC ++ ++fail() { echo "FAIL: $*" >&2; exit 1; } ++ ++TMP="" ++cleanup() { ++ if [ -n "$TMP" ]; then ++ rm -rf "$TMP" ++ fi ++} ++trap cleanup EXIT ++ ++ ++ ++BIN="/opt/stage4a-urlwatch-venv/bin/urlwatch" ++PY="/opt/stage4a-urlwatch-venv/bin/python" ++[ -x "$BIN" ] || fail "missing urlwatch executable" ++[ -x "$PY" ] || fail "missing python executable" ++ ++TMP=$(mktemp -d) ++cd "$TMP" || fail "cd temp" ++ ++write_config() { ++ cat >"$1" <<'EOF' ++report: ++ stdout: ++ enabled: false ++EOF ++} ++ ++write_mixed_urls() { ++ cat >"$1" <<'EOF' ++url: https://example.com/old-url ++--- ++kind: browser ++navigate: https://example.com/old-browser ++--- ++kind: shell ++command: printf old-shell ++--- ++url: https://example.com/existing ++EOF ++} ++ ++assert_empty_err() { ++ [ ! -s "$1" ] || fail "$2 stderr: $(cat "$1")" ++} ++ ++assert_file_exact() { ++ actual=$(cat "$1") ++ expected=$2 ++ [ "$actual" = "$expected" ] || fail "$3 file mismatch: ++$actual" ++} ++ ++assert_line_exact() { ++ grep -qxF -- "$2" "$1" || fail "$3 missing line: $2 ++$(cat "$1")" ++} ++ ++assert_yaml_fields() { ++ "$PY" - "$@" <<'PY' ++import sys ++import yaml ++ ++path = sys.argv[1] ++expected = sys.argv[2:] ++with open(path, encoding="utf-8") as fp: ++ docs = list(yaml.safe_load_all(fp)) ++ ++if len(docs) != len(expected): ++ raise SystemExit(f"expected {len(expected)} jobs, got {len(docs)}: {docs!r}") ++ ++for idx, (doc, spec) in enumerate(zip(docs, expected), 1): ++ field, value = spec.split("=", 1) ++ if not isinstance(doc, dict): ++ raise SystemExit(f"job {idx} is not a mapping: {doc!r}") ++ if doc.get(field) != value: ++ raise SystemExit(f"job {idx} expected {field}={value!r}, got {doc!r}") ++PY ++} ++ ++ ++ ++ ++"$BIN" --help >out 2>err; ec=$? ++[ "$ec" -eq 0 ] || fail "F_help exit $ec; want 0" ++grep -qF -- "--change-location JOB NEW_LOCATION" out || fail "F_help missing metavar" ++ ++grep -qiF -- "change" out || fail "F_help missing change keyword" ++grep -qiF -- "location" out || fail "F_help missing location keyword" ++grep -qiF -- "index" out || fail "F_help missing index keyword" ++assert_empty_err err "F_help" ++ ++ ++ ++ ++case_dir="$TMP/f_url_index"; mkdir -p "$case_dir" ++write_config "$case_dir/config.yaml" ++write_mixed_urls "$case_dir/urls.yaml" ++"$BIN" --config "$case_dir/config.yaml" --urls "$case_dir/urls.yaml" --cache "$case_dir/cache.db" \ ++ --change-location 1 https://example.com/new-url >out 2>err; ec=$? ++[ "$ec" -eq 0 ] || fail "F_url_index exit $ec; want 0" ++assert_line_exact out 'Moving location of to "https://example.com/new-url"' "F_url_index stdout" ++assert_empty_err err "F_url_index" ++ ++assert_yaml_fields "$case_dir/urls.yaml" \ ++ "url=https://example.com/new-url" \ ++ "navigate=https://example.com/old-browser" \ ++ "command=printf old-shell" \ ++ "url=https://example.com/existing" ++! grep -qF 'Moved ' out || fail "F_url_index should not print moved snapshots without history" ++ ++ ++ ++ ++case_dir="$TMP/f_browser_location"; mkdir -p "$case_dir" ++write_config "$case_dir/config.yaml" ++write_mixed_urls "$case_dir/urls.yaml" ++"$BIN" --config "$case_dir/config.yaml" --urls "$case_dir/urls.yaml" --cache "$case_dir/cache.db" \ ++ --change-location https://example.com/old-browser https://example.com/new-browser >out 2>err; ec=$? ++[ "$ec" -eq 0 ] || fail "F_browser_location exit $ec; want 0" ++assert_line_exact out 'Moving location of to "https://example.com/new-browser"' "F_browser_location stdout" ++assert_empty_err err "F_browser_location" ++ ++assert_yaml_fields "$case_dir/urls.yaml" \ ++ "url=https://example.com/old-url" \ ++ "navigate=https://example.com/new-browser" \ ++ "command=printf old-shell" \ ++ "url=https://example.com/existing" ++ ++ ++ ++ ++case_dir="$TMP/f_shell_index_many"; mkdir -p "$case_dir" ++write_config "$case_dir/config.yaml" ++write_mixed_urls "$case_dir/urls.yaml" ++"$BIN" --config "$case_dir/config.yaml" --urls "$case_dir/urls.yaml" --cache "$case_dir/cache.db" \ ++ --change-location 3 "printf new-shell" >out 2>err; ec=$? ++[ "$ec" -eq 0 ] || fail "F_shell_index_many exit $ec; want 0" ++assert_line_exact out 'Moving location of to "printf new-shell"' "F_shell_index_many stdout" ++assert_empty_err err "F_shell_index_many" ++ ++assert_yaml_fields "$case_dir/urls.yaml" \ ++ "url=https://example.com/old-url" \ ++ "navigate=https://example.com/old-browser" \ ++ "command=printf new-shell" \ ++ "url=https://example.com/existing" ++ ++ ++ ++ ++case_dir="$TMP/f_duplicate"; mkdir -p "$case_dir" ++write_config "$case_dir/config.yaml" ++write_mixed_urls "$case_dir/urls.yaml" ++before_yaml=$(cat "$case_dir/urls.yaml") ++"$BIN" --config "$case_dir/config.yaml" --urls "$case_dir/urls.yaml" --cache "$case_dir/cache.db" \ ++ --change-location 1 https://example.com/existing >out 2>err; ec=$? ++expected_out='The new location "https://example.com/existing" already exists for a job. Delete the existing job or choose a different value.' ++[ "$ec" -eq 0 ] || fail "F_duplicate exit $ec; want 0" ++assert_line_exact out "$expected_out" "F_duplicate stdout" ++assert_empty_err err "F_duplicate" ++assert_file_exact "$case_dir/urls.yaml" "$before_yaml" "F_duplicate" ++ ++ ++ ++ ++case_dir="$TMP/f_not_found_location"; mkdir -p "$case_dir" ++write_config "$case_dir/config.yaml" ++write_mixed_urls "$case_dir/urls.yaml" ++before_yaml=$(cat "$case_dir/urls.yaml") ++"$BIN" --config "$case_dir/config.yaml" --urls "$case_dir/urls.yaml" --cache "$case_dir/cache.db" \ ++ --change-location https://example.com/missing https://example.com/new-missing >out 2>err; ec=$? ++expected_out='Not found: https://example.com/missing' ++[ "$ec" -eq 0 ] || fail "F_not_found_location exit $ec; want 0" ++assert_line_exact out "$expected_out" "F_not_found_location stdout" ++assert_empty_err err "F_not_found_location" ++assert_file_exact "$case_dir/urls.yaml" "$before_yaml" "F_not_found_location" ++ ++ ++ ++ ++case_dir="$TMP/f_not_found_zero_index"; mkdir -p "$case_dir" ++write_config "$case_dir/config.yaml" ++write_mixed_urls "$case_dir/urls.yaml" ++before_yaml=$(cat "$case_dir/urls.yaml") ++"$BIN" --config "$case_dir/config.yaml" --urls "$case_dir/urls.yaml" --cache "$case_dir/cache.db" \ ++ --change-location 0 https://example.com/new-zero >out 2>err; ec=$? ++expected_out='Not found: 0' ++[ "$ec" -eq 0 ] || fail "F_not_found_zero_index exit $ec; want 0" ++assert_line_exact out "$expected_out" "F_not_found_zero_index stdout" ++assert_empty_err err "F_not_found_zero_index" ++assert_file_exact "$case_dir/urls.yaml" "$before_yaml" "F_not_found_zero_index" ++ ++ ++ ++ ++case_dir="$TMP/f_missing_new_location"; mkdir -p "$case_dir" ++write_config "$case_dir/config.yaml" ++write_mixed_urls "$case_dir/urls.yaml" ++"$BIN" --config "$case_dir/config.yaml" --urls "$case_dir/urls.yaml" --cache "$case_dir/cache.db" \ ++ --change-location 1 >out 2>err; ec=$? ++ ++[ "$ec" -ne 0 ] || fail "F_missing_new_location exit $ec; want nonzero" ++[ ! -s out ] || fail "F_missing_new_location stdout: $(cat out)" ++grep -qF -- "--change-location" err || fail "F_missing_new_location stderr: $(cat err)" ++ ++ ++ ++ ++case_dir="$TMP/f_cache_moved"; mkdir -p "$case_dir" ++write_config "$case_dir/config.yaml" ++cat >"$case_dir/urls.yaml" <<'EOF' ++kind: shell ++command: printf cached-old ++EOF ++"$BIN" --config "$case_dir/config.yaml" --urls "$case_dir/urls.yaml" --cache "$case_dir/cache.db" >run.out 2>run.err; ec=$? ++[ "$ec" -eq 0 ] || fail "F_cache_moved initial run exit $ec; want 0" ++ ++"$BIN" --config "$case_dir/config.yaml" --urls "$case_dir/urls.yaml" --cache "$case_dir/cache.db" \ ++ --change-location "printf cached-old" "printf cached-new" >out 2>err; ec=$? ++[ "$ec" -eq 0 ] || fail "F_cache_moved change exit $ec; want 0" ++assert_line_exact out 'Moving location of to "printf cached-new"' "F_cache_moved change stdout" ++assert_line_exact out 'Moved 1 snapshots of "printf cached-old" to "printf cached-new"' "F_cache_moved change stdout" ++assert_empty_err err "F_cache_moved change" ++ ++assert_yaml_fields "$case_dir/urls.yaml" "command=printf cached-new" ++"$BIN" --config "$case_dir/config.yaml" --urls "$case_dir/urls.yaml" --cache "$case_dir/cache.db" \ ++ --dump-history "printf cached-new" >dump.out 2>dump.err; ec=$? ++[ "$ec" -eq 0 ] || fail "F_cache_moved dump new exit $ec; want 0" ++grep -qF -- "cached-old" dump.out || fail "F_cache_moved new history missing old snapshot" ++ ++[ -s dump.out ] || fail "F_cache_moved dump new should show moved history" ++assert_empty_err dump.err "F_cache_moved dump new" ++ ++echo "PASS" ++exit 0 +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,12 @@ ++#!/usr/bin/env bash ++ ++ ++ ++ ++export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" ++export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" ++export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" ++set -e ++cd /workspace/repo ++exec bash /workspace/repo/usercase-test-coderl/usecase.sh diff --git a/tasks/format-code-task-002834/tests/test.sh b/tasks/format-code-task-002834/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..d4d80bb634b14076ae561be99f395189577b7ac6 --- /dev/null +++ b/tasks/format-code-task-002834/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/workspace/repo +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +usercase-test-coderl/usecase.sh +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002834/tests/test_command.sh b/tasks/format-code-task-002834/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..88cb7810b836396c4869db31aeac7d4d4b189685 --- /dev/null +++ b/tasks/format-code-task-002834/tests/test_command.sh @@ -0,0 +1 @@ +bash /workspace/repo/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002851/environment/Dockerfile b/tasks/format-code-task-002851/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..3e6a322a09bac8dc08773c7a1071aa9074a9c85e --- /dev/null +++ b/tasks/format-code-task-002851/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:070e39e7bfba2b49eb0237d585095d991d77991f649b640c9336c9f3897789f8 diff --git a/tasks/format-code-task-002851/environment/setup/files/blocklist b/tasks/format-code-task-002851/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002851/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002851/environment/setup/setup.sh b/tasks/format-code-task-002851/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002851/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002851/tests/test.patch b/tasks/format-code-task-002851/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..9d492523b5e571e2836097bc618349a041c1e6e9 --- /dev/null +++ b/tasks/format-code-task-002851/tests/test.patch @@ -0,0 +1,84 @@ +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 000000000..a29c5b30b +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["python -m unittest tests.dialects.test_clickhouse.TestClickhouse.test_ternary -v"] ++} +diff --git a/tests/dialects/test_clickhouse.py b/tests/dialects/test_clickhouse.py +index 58f23b202..444347c2f 100644 +--- a/tests/dialects/test_clickhouse.py ++++ b/tests/dialects/test_clickhouse.py +@@ -62,6 +62,57 @@ class TestClickhouse(Validator): + write={"clickhouse": "SELECT position(haystack, needle)"}, + ) + ++ def test_ternary(self): ++ import sqlglot ++ from sqlglot import exp ++ ++ def assert_ternary(sql, cond_sql, true_sql, false_sql): ++ ++ expr = sqlglot.parse_one(sql, read="clickhouse") ++ ++ ++ self.assertIsInstance(expr, exp.If) ++ self.assertEqual(expr.this.sql(dialect="clickhouse"), cond_sql) ++ self.assertEqual(expr.args["true"].sql(dialect="clickhouse"), true_sql) ++ self.assertIsNotNone(expr.args.get("false")) ++ self.assertEqual(expr.args["false"].sql(dialect="clickhouse"), false_sql) ++ ++ regenerated = expr.sql(dialect="clickhouse") ++ reparsed = sqlglot.parse_one(regenerated, read="clickhouse") ++ self.assertEqual( ++ reparsed.sql(dialect="clickhouse"), ++ regenerated, ++ ) ++ ++ ++ assert_ternary("flagcolumn ? created : now()", "flagcolumn", "created", "now()") ++ ++ ++ assert_ternary("a ? b : c", "a", "b", "c") ++ ++ ++ assert_ternary("a > 1 ? b : c", "a > 1", "b", "c") ++ ++ ++ assert_ternary("a ? b + 1 : c - 1", "a", "b + 1", "c - 1") ++ ++ ++ assert_ternary("a AND b ? c : d", "a AND b", "c", "d") ++ ++ ++ ++ select = sqlglot.parse_one("SELECT a ? b : c FROM t", read="clickhouse") ++ select_exprs = select.args.get("expressions") or [] ++ self.assertEqual(len(select_exprs), 1) ++ inner = select_exprs[0] ++ self.assertIsInstance(inner, exp.If) ++ ++ regenerated = select.sql(dialect="clickhouse") ++ self.assertEqual( ++ sqlglot.parse_one(regenerated, read="clickhouse").sql(dialect="clickhouse"), ++ regenerated, ++ ) ++ + def test_cte(self): + self.validate_identity("WITH 'x' AS foo SELECT foo") + self.validate_identity("WITH SUM(bytes) AS foo SELECT foo FROM system.parts") +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++python -m unittest tests.dialects.test_clickhouse.TestClickhouse.test_ternary -v ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-002851/tests/test.sh b/tasks/format-code-task-002851/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..b36d69a048dbc9b435f913e8c1e33fd1e6db0c61 --- /dev/null +++ b/tasks/format-code-task-002851/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test_commands.json +tests/dialects/test_clickhouse.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002851/tests/test_command.sh b/tasks/format-code-task-002851/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002851/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002856/environment/Dockerfile b/tasks/format-code-task-002856/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..b364e76ec46308c9910e65f79a11e23f63fc9c5b --- /dev/null +++ b/tasks/format-code-task-002856/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:052fa3980eb8f3fefed1361b93782403a1030776f95ceadc2d3663a641511ca2 diff --git a/tasks/format-code-task-002856/environment/setup/files/blocklist b/tasks/format-code-task-002856/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002856/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002856/environment/setup/setup.sh b/tasks/format-code-task-002856/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002856/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002856/tests/test.patch b/tasks/format-code-task-002856/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..1865222e66034c41a95847e6b7d6fb0e98ee06c1 --- /dev/null +++ b/tasks/format-code-task-002856/tests/test.patch @@ -0,0 +1,73 @@ +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 000000000..7babab68c +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["python -m unittest tests.dialects.test_tsql.TestTSQL.test_format_with_culture tests.dialects.test_tsql.TestTSQL.test_format"] ++} +diff --git a/tests/dialects/test_tsql.py b/tests/dialects/test_tsql.py +index 9decd3544..9f28aec98 100644 +--- a/tests/dialects/test_tsql.py ++++ b/tests/dialects/test_tsql.py +@@ -999,6 +999,46 @@ WHERE + write={"spark": "SELECT FORMAT_NUMBER(num_col, 'c')"}, + ) + ++ def test_format_with_culture(self): ++ ++ e = parse_one( ++ "SELECT FORMAT(TimeStart, 'dddd', 'de-CH') FROM TableName", read="tsql" ++ ) ++ self.assertEqual( ++ e.sql(dialect="tsql"), ++ "SELECT FORMAT(TimeStart, 'dddd', 'de-CH') FROM TableName", ++ ) ++ ++ ++ self.validate_identity("SELECT FORMAT(TimeStart, 'dddd', 'de-CH') FROM TableName") ++ ++ ++ self.validate_identity("SELECT FORMAT(12345, '###.###.###', 'de-CH')") ++ ++ ++ self.validate_identity("SELECT FORMAT(TimeStart, 'dddd', 'en-US') FROM TableName") ++ ++ ++ self.validate_identity("SELECT FORMAT(TimeStart, 'dddd') FROM TableName") ++ ++ ++ e = parse_one("SELECT FORMAT(12345, '###.###.###', 'de-CH')", read="tsql") ++ fmt_node = e.find(exp.NumberToStr) ++ self.assertIsNotNone(fmt_node) ++ culture = fmt_node.args.get("culture") ++ self.assertIsNotNone(culture) ++ self.assertEqual(culture.name, "de-CH") ++ ++ ++ e = parse_one( ++ "SELECT FORMAT(TimeStart, 'dddd', 'de-CH') FROM TableName", read="tsql" ++ ) ++ fmt_node = e.find(exp.TimeToStr) ++ self.assertIsNotNone(fmt_node) ++ culture = fmt_node.args.get("culture") ++ self.assertIsNotNone(culture) ++ self.assertEqual(culture.name, "de-CH") ++ + def test_string(self): + self.validate_all( + "SELECT N'test'", +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++python -m unittest tests.dialects.test_tsql.TestTSQL.test_format_with_culture tests.dialects.test_tsql.TestTSQL.test_format ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-002856/tests/test.sh b/tasks/format-code-task-002856/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..c0f71aa48205d49dc8287659497830365299e87e --- /dev/null +++ b/tasks/format-code-task-002856/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +test_commands.json +tests/dialects/test_tsql.py +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002856/tests/test_command.sh b/tasks/format-code-task-002856/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002856/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002869/environment/Dockerfile b/tasks/format-code-task-002869/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..661b5bfbd3e7216d039aa4ecacb7aec1b873392e --- /dev/null +++ b/tasks/format-code-task-002869/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:7177724f2e74eec9152922b6eef1989007628dc9d876255660ed24de09256eb5 diff --git a/tasks/format-code-task-002869/environment/setup/files/blocklist b/tasks/format-code-task-002869/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002869/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002869/environment/setup/setup.sh b/tasks/format-code-task-002869/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002869/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002869/tests/test.patch b/tasks/format-code-task-002869/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..1c46e67f3dd30ec7e8d2d239001790d33cb79d49 --- /dev/null +++ b/tasks/format-code-task-002869/tests/test.patch @@ -0,0 +1,43 @@ +diff --git a/session/session_test.go b/session/session_test.go +index 6d288317..ab437859 100644 +--- a/session/session_test.go ++++ b/session/session_test.go +@@ -1507,3 +1507,18 @@ func TestSessionValidateHandshake(t *testing.T) { + }) + } + } ++ ++func TestGetNumberOfConnectedClients(t *testing.T) { ++ ctrl := gomock.NewController(t) ++ defer ctrl.Finish() ++ ++ entity := mocks.NewMockNetworkEntity(ctrl) ++ sessionPool := NewSessionPool() ++ connections := sessionPool.GetNumberOfConnectedClients() ++ assert.Equal(t, int64(0), connections) ++ ++ ss := sessionPool.NewSession(entity, true) ++ assert.NotNil(t, ss) ++ connections = sessionPool.GetNumberOfConnectedClients() ++ assert.Equal(t, int64(1), connections) ++} +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,4 @@ ++H4sIAAAAAAAAA+3RQQ6CMBCF4a45xVxAaIHKyrMYpURNlCa2cH6RDcZE3UCM8f82M5lp0kleuu9O ++Z7dt2j5TS9GDytqxDp7r2Bubm1zrIq+M0sbYKldiF7voQRfi7iqirt7Hd+8+7X9UOuUfmxC3tb9c ++dq1Lw3G+Pz7mb4sp/3KYm3I9rEXPd8Jrf55/7WQMft+45ODl3kqahSaEk28zWfWyqn3Xxo1Jvn0q ++AAAAAAAAAAAAAAAAgCc3Z3NBHwAoAAA= +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-002869/tests/test.sh b/tasks/format-code-task-002869/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..233324719869666e1e7d4c890b532debd94498f9 --- /dev/null +++ b/tasks/format-code-task-002869/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +session/session_test.go +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002869/tests/test_command.sh b/tasks/format-code-task-002869/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002869/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002941/environment/Dockerfile b/tasks/format-code-task-002941/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..a108581f103dd818ebacbbd8ca7179f3b97b7fad --- /dev/null +++ b/tasks/format-code-task-002941/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:2d16886e8342732b7bd4a01b03c97502e92181a4013489fa7dda6127b08b46a5 diff --git a/tasks/format-code-task-002941/environment/setup/files/blocklist b/tasks/format-code-task-002941/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002941/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002941/environment/setup/setup.sh b/tasks/format-code-task-002941/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002941/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002941/tests/test.patch b/tasks/format-code-task-002941/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..defc3c8405a53adbdcd9834f8f9744b26db2d419 --- /dev/null +++ b/tasks/format-code-task-002941/tests/test.patch @@ -0,0 +1,81 @@ +diff --git a/synapse/tests/test_lib_stormlib_modelext.py b/synapse/tests/test_lib_stormlib_modelext.py +index fc898bb642c..00760fb296d 100644 +--- a/synapse/tests/test_lib_stormlib_modelext.py ++++ b/synapse/tests/test_lib_stormlib_modelext.py +@@ -510,3 +510,55 @@ async def test_lib_stormlib_modelext_argtypes(self): + with self.raises(s_exc.BadArg) as exc: + await core.callStorm(query) + self.eq(err, exc.exception.get('mesg')) ++ ++ async def test_lib_stormlib_modelext_interfaces(self): ++ async with self.getTestCore() as core: ++ ++ await core.callStorm(''' ++ $forminfo = ({"interfaces": ["test:interface"]}) ++ $lib.model.ext.addForm(_test:iface, str, ({}), $forminfo) ++ $lib.model.ext.addFormProp(_test:iface, tick, (time, ({})), ({})) ++ ''') ++ ++ self.nn(core.model.form('_test:iface')) ++ self.nn(core.model.prop('_test:iface:flow')) ++ self.nn(core.model.prop('_test:iface:proc')) ++ self.nn(core.model.prop('_test:iface:tick')) ++ self.isin('_test:iface', core.model.formsbyiface['test:interface']) ++ self.isin('_test:iface', core.model.formsbyiface['inet:proto:request']) ++ self.isin('_test:iface', core.model.formsbyiface['it:host:activity']) ++ self.isin('_test:iface:flow', core.model.ifaceprops['inet:proto:request:flow']) ++ self.isin('_test:iface:proc', core.model.ifaceprops['test:interface:proc']) ++ self.isin('_test:iface:proc', core.model.ifaceprops['inet:proto:request:proc']) ++ self.isin('_test:iface:proc', core.model.ifaceprops['it:host:activity:proc']) ++ ++ q = '$lib.model.ext.delForm(_test:iface)' ++ with self.raises(s_exc.CantDelForm) as exc: ++ await core.callStorm(q) ++ self.eq('Form has extended properties: tick', exc.exception.get('mesg')) ++ ++ await core.callStorm(''' ++ $lib.model.ext.delFormProp(_test:iface, tick) ++ $lib.model.ext.delForm(_test:iface) ++ ''') ++ ++ self.none(core.model.form('_test:iface')) ++ self.none(core.model.prop('_test:iface:flow')) ++ self.none(core.model.prop('_test:iface:proc')) ++ self.none(core.model.prop('_test:iface:tick')) ++ self.notin('_test:iface', core.model.formsbyiface['test:interface']) ++ self.notin('_test:iface', core.model.formsbyiface['inet:proto:request']) ++ self.notin('_test:iface', core.model.formsbyiface['it:host:activity']) ++ self.notin('_test:iface:flow', core.model.ifaceprops['inet:proto:request:flow']) ++ self.notin('_test:iface:proc', core.model.ifaceprops['test:interface:proc']) ++ self.notin('_test:iface:proc', core.model.ifaceprops['inet:proto:request:proc']) ++ self.notin('_test:iface:proc', core.model.ifaceprops['it:host:activity:proc']) ++ ++ await core.stormlist(''' ++ $forminfo = ({"interfaces": ["newp"]}) ++ $lib.model.ext.addForm(_test:iface, str, ({}), $forminfo) ++ ''') ++ self.nn(core.model.form('_test:iface')) ++ ++ await core.callStorm('$lib.model.ext.delForm(_test:iface)') ++ self.none(core.model.form('_test:iface')) +diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 +new file mode 100644 +--- /dev/null ++++ b/mimo_build_env.tar.gz.b64 +@@ -0,0 +1,5 @@ ++H4sIAAAAAAAAA+3SwWqEMBAG4Jx9iik9GxO30ccRswkomERMVta3r7psWwrtXnYpbf/vkoEZSMI/ ++XJ/6wTTWzwV7FLGqldrP1edzr6UqZSlFfahqJqSshGKkHvaiD04xtRMRm0JI383d6v9S/D3/ZGNq ++jsG51hseu/vdcSt/qaq3/Mt6y/+lKg+MxP2e8LV/nv/zU6F7X+g2dtnR0L4E2prsWhR83nZjmxmX ++1AVPuaO1WrsUF9+O0e6j8bI+Q6+bmMLktsIFYwd7TnxcKD9TPmc//VsAAAAAAAAAAAAAAAAAAAAA ++gL/lFRuUHw0AKAAA +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,6 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed || exit 1 ++base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 ++exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' diff --git a/tasks/format-code-task-002941/tests/test.sh b/tasks/format-code-task-002941/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..855bd2aac2ae39f99c5a017cc79517b32003b754 --- /dev/null +++ b/tasks/format-code-task-002941/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +synapse/tests/test_lib_stormlib_modelext.py +mimo_build_env.tar.gz.b64 +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002941/tests/test_command.sh b/tasks/format-code-task-002941/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002941/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002970/environment/Dockerfile b/tasks/format-code-task-002970/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..e7596777c798f8962cf3de6f60acd9bc2066fe69 --- /dev/null +++ b/tasks/format-code-task-002970/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:b77d5310d502ab8b21a45d83a3b2e0e550872b6e924708afff163926995fa5a8 diff --git a/tasks/format-code-task-002970/environment/setup/files/blocklist b/tasks/format-code-task-002970/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002970/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002970/environment/setup/setup.sh b/tasks/format-code-task-002970/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002970/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002970/tests/test.patch b/tasks/format-code-task-002970/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..a75c860d59be0e0aed8d002d9b8be4e39c6d8587 --- /dev/null +++ b/tasks/format-code-task-002970/tests/test.patch @@ -0,0 +1,118 @@ +diff --git a/packages/vuetify/src/components/VIcon/__tests__/VIconSvgSize.spec.ts b/packages/vuetify/src/components/VIcon/__tests__/VIconSvgSize.spec.ts +new file mode 100644 +index 000000000..6cbd3c975 +--- /dev/null ++++ b/packages/vuetify/src/components/VIcon/__tests__/VIconSvgSize.spec.ts +@@ -0,0 +1,90 @@ ++ ++import Vue from 'vue' ++ ++ ++import VIcon from '../VIcon' ++ ++ ++import { ++ createLocalVue, ++ mount, ++ Wrapper, ++} from '@vue/test-utils' ++ ++const SVG_PATH = 'M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z' ++ ++describe('VIcon svg size', () => { ++ let mountFunction: (ctx?: object, name?: string) => Wrapper ++ let localVue: typeof Vue ++ ++ beforeEach(() => { ++ localVue = createLocalVue() ++ ++ mountFunction = (ctx = {}, name = SVG_PATH) => { ++ return mount(VIcon, { ++ sync: false, ++ localVue, ++ context: Object.assign({ ++ children: [name], ++ data: {}, ++ props: {}, ++ }, ctx), ++ }) ++ } ++ }) ++ ++ it('renderSvgIcon: applies size as inline style.height and style.width on svg element when size prop is set', () => { ++ const wrapper = mountFunction({ props: { size: '200px' } }) ++ ++ const svg = wrapper.element.querySelector('svg') as SVGElement ++ expect(svg).not.toBeNull() ++ ++ ++ ++ ++ expect(svg.style.height).toBe('200px') ++ expect(svg.style.width).toBe('200px') ++ }) ++ ++ it('renderSvgIcon: applies size from helper prop (large) as inline style on svg', () => { ++ const wrapper = mountFunction({ props: { large: true } }) ++ ++ const svg = wrapper.element.querySelector('svg') as SVGElement ++ expect(svg.style.height).toBe('36px') ++ expect(svg.style.width).toBe('36px') ++ }) ++ ++ it('renderSvgIcon: applies size from helper prop (xLarge) as inline style on svg', () => { ++ const wrapper = mountFunction({ props: { xLarge: true } }) ++ ++ const svg = wrapper.element.querySelector('svg') as SVGElement ++ expect(svg.style.height).toBe('40px') ++ expect(svg.style.width).toBe('40px') ++ }) ++ ++ it('renderSvgIcon: applies numeric size as px on svg style', () => { ++ const wrapper = mountFunction({ props: { size: '40' } }) ++ ++ const svg = wrapper.element.querySelector('svg') as SVGElement ++ expect(svg.style.height).toBe('40px') ++ expect(svg.style.width).toBe('40px') ++ }) ++ ++ it('renderSvgIcon: wrapper span retains size on its own inline style (preservation)', () => { ++ const wrapper = mountFunction({ props: { size: '200px' } }) ++ ++ ++ ++ expect((wrapper.element as HTMLElement).style.fontSize).toBe('200px') ++ expect((wrapper.element as HTMLElement).style.height).toBe('200px') ++ expect((wrapper.element as HTMLElement).style.width).toBe('200px') ++ }) ++ ++ it('renderFontIcon: size prop still applies fontSize to the icon element (preservation)', () => { ++ const wrapper = mountFunction({ props: { size: '200px' } }, 'add') ++ ++ ++ expect(wrapper.element.querySelector('svg')).toBeNull() ++ expect((wrapper.element as HTMLElement).style.fontSize).toBe('200px') ++ }) ++}) +diff --git a/test_commands.json b/test_commands.json +new file mode 100644 +index 000000000..469c6a1a1 +--- /dev/null ++++ b/test_commands.json +@@ -0,0 +1,3 @@ ++{ ++ "test_commands": ["cd packages/vuetify && node build/run-tests.js --testPathPattern VIconSvgSize"] ++} +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,8 @@ ++#!/usr/bin/env bash ++ ++set -uo pipefail ++cd /testbed ++rc=0 ++cd packages/vuetify && node build/run-tests.js --testPathPattern VIconSvgSize ++rc=$(( rc | $? )) ++exit $rc diff --git a/tasks/format-code-task-002970/tests/test.sh b/tasks/format-code-task-002970/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..eb3233a3441b076750458ece021bf336dc7a2f14 --- /dev/null +++ b/tasks/format-code-task-002970/tests/test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +packages/vuetify/src/components/VIcon/__tests__/VIconSvgSize.spec.ts +test_commands.json +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002970/tests/test_command.sh b/tasks/format-code-task-002970/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..7cb23076694ad17d72e8296d62b2b240083e36db --- /dev/null +++ b/tasks/format-code-task-002970/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh \ No newline at end of file diff --git a/tasks/format-code-task-002979/environment/Dockerfile b/tasks/format-code-task-002979/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..99f42d1df0d18b5e5957beb85f99147e58cef87e --- /dev/null +++ b/tasks/format-code-task-002979/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:f10f2a069b0bbcfa1542dd61f080c38c4a4c3cd92724dd9bb2b7a1dbc7201c3f diff --git a/tasks/format-code-task-002979/environment/setup/files/blocklist b/tasks/format-code-task-002979/environment/setup/files/blocklist new file mode 100644 index 0000000000000000000000000000000000000000..a8e4bdc4c7d9b739c047a3cb58ea72a1bb05bcbc --- /dev/null +++ b/tasks/format-code-task-002979/environment/setup/files/blocklist @@ -0,0 +1,33 @@ +# mimo answer-leak blocklist (mimoagent) +0.0.0.0 github.com +0.0.0.0 www.github.com +0.0.0.0 api.github.com +0.0.0.0 raw.githubusercontent.com +0.0.0.0 codeload.github.com +0.0.0.0 objects.githubusercontent.com +0.0.0.0 gist.github.com +0.0.0.0 gist.githubusercontent.com +0.0.0.0 gitlab.com +0.0.0.0 bitbucket.org +0.0.0.0 sourceforge.net +0.0.0.0 git.kernel.org +0.0.0.0 chromium.googlesource.com +0.0.0.0 android.googlesource.com +0.0.0.0 sourcegraph.com +0.0.0.0 bugs.chromium.org +0.0.0.0 issues.oss-fuzz.com +0.0.0.0 oss-fuzz.com +0.0.0.0 osv.dev +0.0.0.0 api.osv.dev +0.0.0.0 bugzilla.mozilla.org +0.0.0.0 proxy.golang.org +0.0.0.0 sum.golang.org +0.0.0.0 pkg.go.dev +0.0.0.0 google.com +0.0.0.0 www.google.com +0.0.0.0 bing.com +0.0.0.0 www.bing.com +0.0.0.0 duckduckgo.com +0.0.0.0 html.duckduckgo.com +0.0.0.0 search.brave.com +0.0.0.0 stackoverflow.com diff --git a/tasks/format-code-task-002979/environment/setup/setup.sh b/tasks/format-code-task-002979/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..d883db90cfcfb48f7a139861bbe9f6b5d95cad6f --- /dev/null +++ b/tasks/format-code-task-002979/environment/setup/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code). +CWD=/testbed +git config --global --add safe.directory "$CWD" +cd "$CWD" || fail "no working directory $CWD" +if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit + git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty +fi +BASE=$(git rev-parse HEAD 2>/dev/null) +[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD" +echo "$BASE" > "$M/base" +# Images are built with history truncated at the base. If one is not, the fix could be read out of git log, +# so .git is hidden while the agent works and put back for grading. +LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true) +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 +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 +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 +if [ "$LATER" -gt 0 ]; then + mv "$CWD/.git" "$M/git-hidden" + echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works" +fi +write_blocklist + +touch "$M/ready" +echo "setup done" diff --git a/tasks/format-code-task-002979/tests/test.patch b/tasks/format-code-task-002979/tests/test.patch new file mode 100644 index 0000000000000000000000000000000000000000..c39716038d74fa77f50c3258c0562815798ba8bb --- /dev/null +++ b/tasks/format-code-task-002979/tests/test.patch @@ -0,0 +1,160 @@ +diff --git a/src/components/__tests__/LeftPanel.test.tsx b/src/components/__tests__/LeftPanel.test.tsx +new file mode 100644 +index 0000000..4459b7f +--- /dev/null ++++ b/src/components/__tests__/LeftPanel.test.tsx +@@ -0,0 +1,126 @@ ++/** ++ * @jest-environment jsdom ++ */ ++import React, { useState } from 'react' ++ ++import { act, render, screen } from 'rtl' ++import { IconNames } from '@blueprintjs/icons' ++import { runInAction } from 'mobx' ++ ++import { AppState } from '$src/state/appState' ++import { FavoritesState } from '$src/state/favoritesState' ++import { SettingsState } from '$src/state/settingsState' ++ ++import { LeftPanel } from '../LeftPanel' ++ ++describe('LeftPanel favorites rendering', () => { ++ const options = { ++ providerProps: { ++ appState: null as AppState, ++ settingsState: null as SettingsState, ++ }, ++ } ++ ++ const makeFavorite = (label: string, path: string) => ({ ++ label, ++ path, ++ icon: IconNames.FOLDER_CLOSE, ++ isReadOnly: false, ++ }) ++ ++ let originalEnv: Record ++ let buildDrivesListSpy: jest.SpyInstance ++ let setHide: React.Dispatch> = () => undefined ++ ++ const Harness = ({ initialHide = false }: { initialHide?: boolean }) => { ++ const [hide, updateHide] = useState(initialHide) ++ setHide = updateHide ++ return ++ } ++ ++ beforeEach(async () => { ++ buildDrivesListSpy = jest.spyOn(FavoritesState.prototype, 'buildDrivesList').mockImplementation(function (this: FavoritesState) { ++ this.buildShortcuts() ++ }) ++ const appState = new AppState() ++ options.providerProps.appState = appState ++ options.providerProps.settingsState = appState.settingsState ++ await options.providerProps.appState.loadSettingsAndPrepareViews() ++ originalEnv = (window as any).ENV ++ ;(window as any).ENV = { ...(originalEnv ?? {}), CY: true } ++ setHide = () => undefined ++ }) ++ ++ afterEach(() => { ++ buildDrivesListSpy.mockRestore() ++ ;(window as any).ENV = originalEnv ++ }) ++ ++ it('renders_distribution_favorites_in_test_environment_when_present', () => { ++ const { favoritesState } = options.providerProps.appState ++ const suffix = `dist-${Date.now()}-${Math.random()}` ++ const ubuntuLabel = `Ubuntu favorite ${suffix}` ++ const debianLabel = `Debian favorite ${suffix}` ++ runInAction(() => { ++ favoritesState.distributions.push( ++ makeFavorite(ubuntuLabel, `/wsl/${suffix}/ubuntu`), ++ makeFavorite(debianLabel, `/wsl/${suffix}/debian`), ++ ) ++ }) ++ ++ render(, options) ++ ++ expect(screen.getByText(ubuntuLabel)).toBeInTheDocument() ++ expect(screen.getByText(debianLabel)).toBeInTheDocument() ++ }) ++ ++ it('reflects_place_and_distribution_changes_made_while_hidden_after_showing', () => { ++ const { favoritesState } = options.providerProps.appState ++ const suffix = `hidden-${Date.now()}-${Math.random()}` ++ const stalePlaceLabel = `Removed place ${suffix}` ++ const freshPlaceLabel = `Fresh place ${suffix}` ++ const staleDistroLabel = `Removed distro ${suffix}` ++ const freshDistroLabel = `Fresh distro ${suffix}` ++ runInAction(() => { ++ favoritesState.places.push(makeFavorite(stalePlaceLabel, `/tmp/${suffix}/removed-place`)) ++ favoritesState.distributions.push(makeFavorite(staleDistroLabel, `/wsl/${suffix}/removed-distro`)) ++ }) ++ render(, options) ++ expect(screen.getByText(stalePlaceLabel)).toBeInTheDocument() ++ ++ act(() => { ++ setHide(true) ++ }) ++ ++ act(() => { ++ runInAction(() => { ++ const stalePlaceIndex = favoritesState.places.findIndex((favorite) => favorite.label === stalePlaceLabel) ++ if (stalePlaceIndex !== -1) { ++ favoritesState.places.splice(stalePlaceIndex, 1) ++ } ++ const staleDistroIndex = favoritesState.distributions.findIndex( ++ (favorite) => favorite.label === staleDistroLabel, ++ ) ++ if (staleDistroIndex !== -1) { ++ favoritesState.distributions.splice(staleDistroIndex, 1) ++ } ++ favoritesState.places.push(makeFavorite(freshPlaceLabel, `/tmp/${suffix}/fresh-place`)) ++ favoritesState.distributions.push(makeFavorite(freshDistroLabel, `/wsl/${suffix}/fresh-distro`)) ++ }) ++ }) ++ ++ expect(screen.getByText(freshPlaceLabel)).toBeInTheDocument() ++ expect(screen.getByText(freshDistroLabel)).toBeInTheDocument() ++ expect(screen.queryByText(stalePlaceLabel)).not.toBeInTheDocument() ++ expect(screen.queryByText(staleDistroLabel)).not.toBeInTheDocument() ++ ++ act(() => { ++ setHide(false) ++ }) ++ ++ expect(screen.getByText(freshPlaceLabel)).toBeInTheDocument() ++ expect(screen.getByText(freshDistroLabel)).toBeInTheDocument() ++ expect(screen.queryByText(stalePlaceLabel)).not.toBeInTheDocument() ++ expect(screen.queryByText(staleDistroLabel)).not.toBeInTheDocument() ++ }) ++}) +diff --git a/mimo_test_command.sh b/mimo_test_command.sh +new file mode 100755 +--- /dev/null ++++ b/mimo_test_command.sh +@@ -0,0 +1,23 @@ ++#!/bin/bash ++set -uo pipefail ++ ++cd /testbed ++ ++ ++if [ ! -x node_modules/.bin/jest ] || [ ! -d node_modules/ts-jest ]; then ++ npm ci --no-audit --no-fund ++fi ++ ++ ++case "${1:-}" in ++ base) ++ exit 0 ++ ;; ++ new) ++ ./node_modules/.bin/jest --runInBand --no-coverage --runTestsByPath src/components/__tests__/LeftPanel.test.tsx ++ ;; ++ *) ++ echo "usage: $0 base|new" ++ exit 2 ++ ;; ++esac diff --git a/tasks/format-code-task-002979/tests/test.sh b/tasks/format-code-task-002979/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..962966a1a17f55debb48f25eea3308a978a2883f --- /dev/null +++ b/tasks/format-code-task-002979/tests/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the +# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored. +M=/var/lib/mimo +CWD=/testbed +V=/logs/verifier +mkdir -p "$V" +BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; } +cd "$CWD" || exit 1 +if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi +# the agent's change against the base, so its own commits count too +git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff" +git reset -q +if ! ( +while IFS= read -r tf; do + [ -z "$tf" ] && continue + if git cat-file -e $BASE:"$tf" 2>/dev/null; then + git checkout $BASE -- "$tf" 2>/dev/null || true + else + git rm -f --cached "$tf" >/dev/null 2>&1 || true + rm -f "$tf" + fi +done <<'EOF_RESET_TEST_FILES' +src/components/__tests__/LeftPanel.test.tsx +mimo_test_command.sh +EOF_RESET_TEST_FILES + +); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi +if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then + cat "$V/apply.log" >&2 + echo "the hidden tests could not be applied (testbed problem, not scored)" >&2 + exit 1 +fi +timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1 +RC=$? +tail -c 12000 "$V/test_output.log" +if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi +echo "test command exited $RC" diff --git a/tasks/format-code-task-002979/tests/test_command.sh b/tasks/format-code-task-002979/tests/test_command.sh new file mode 100644 index 0000000000000000000000000000000000000000..e8d2f32b64045b5a5a56e0ad5667da87d8e0bc2a --- /dev/null +++ b/tasks/format-code-task-002979/tests/test_command.sh @@ -0,0 +1 @@ +bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new \ No newline at end of file