Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- tasks/format-code-task-000007/environment/Dockerfile +3 -0
- tasks/format-code-task-000007/environment/setup/files/blocklist +33 -0
- tasks/format-code-task-000007/environment/setup/setup.sh +34 -0
- tasks/format-code-task-000007/tests/test.patch +67 -0
- tasks/format-code-task-000007/tests/test.sh +39 -0
- tasks/format-code-task-000007/tests/test_command.sh +1 -0
- tasks/format-code-task-000031/environment/Dockerfile +3 -0
- tasks/format-code-task-000031/environment/setup/files/blocklist +33 -0
- tasks/format-code-task-000031/environment/setup/setup.sh +34 -0
- tasks/format-code-task-000031/tests/test.patch +34 -0
- tasks/format-code-task-000031/tests/test.sh +39 -0
- tasks/format-code-task-000031/tests/test_command.sh +1 -0
- tasks/format-code-task-000036/environment/Dockerfile +3 -0
- tasks/format-code-task-000036/environment/setup/files/blocklist +33 -0
- tasks/format-code-task-000036/environment/setup/setup.sh +34 -0
- tasks/format-code-task-000036/tests/test.patch +246 -0
- tasks/format-code-task-000036/tests/test.sh +39 -0
- tasks/format-code-task-000036/tests/test_command.sh +1 -0
- tasks/format-code-task-000054/environment/Dockerfile +3 -0
- tasks/format-code-task-000054/environment/setup/files/blocklist +33 -0
- tasks/format-code-task-000054/environment/setup/setup.sh +34 -0
- tasks/format-code-task-000054/tests/test.patch +204 -0
- tasks/format-code-task-000054/tests/test.sh +38 -0
- tasks/format-code-task-000054/tests/test_command.sh +1 -0
- tasks/format-code-task-000091/environment/Dockerfile +3 -0
- tasks/format-code-task-000091/environment/setup/files/blocklist +33 -0
- tasks/format-code-task-000091/environment/setup/setup.sh +34 -0
- tasks/format-code-task-000091/tests/test.patch +175 -0
- tasks/format-code-task-000091/tests/test.sh +45 -0
- tasks/format-code-task-000091/tests/test_command.sh +1 -0
- tasks/format-code-task-000144/environment/Dockerfile +3 -0
- tasks/format-code-task-000144/environment/setup/files/blocklist +33 -0
- tasks/format-code-task-000144/environment/setup/setup.sh +34 -0
- tasks/format-code-task-000144/tests/test.patch +106 -0
- tasks/format-code-task-000144/tests/test.sh +39 -0
- tasks/format-code-task-000144/tests/test_command.sh +1 -0
- tasks/format-code-task-000172/environment/Dockerfile +3 -0
- tasks/format-code-task-000172/environment/setup/files/blocklist +33 -0
- tasks/format-code-task-000172/environment/setup/setup.sh +34 -0
- tasks/format-code-task-000172/tests/test.patch +95 -0
- tasks/format-code-task-000172/tests/test.sh +40 -0
- tasks/format-code-task-000172/tests/test_command.sh +1 -0
- tasks/format-code-task-000186/environment/Dockerfile +3 -0
- tasks/format-code-task-000186/environment/setup/files/blocklist +33 -0
- tasks/format-code-task-000186/environment/setup/setup.sh +34 -0
- tasks/format-code-task-000186/tests/test.patch +268 -0
- tasks/format-code-task-000186/tests/test.sh +38 -0
- tasks/format-code-task-000186/tests/test_command.sh +1 -0
- tasks/format-code-task-000203/environment/Dockerfile +3 -0
- tasks/format-code-task-000203/environment/setup/files/blocklist +33 -0
tasks/format-code-task-000007/environment/Dockerfile
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The task's image, pinned by digest (the same as [environment].docker_image).
|
| 2 |
+
# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
|
| 3 |
+
FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:39abf5a6f56accf125a99c5047a0c738af4ff1b920c29267a64b2a0901854f73
|
tasks/format-code-task-000007/environment/setup/files/blocklist
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# mimo answer-leak blocklist (mimoagent)
|
| 2 |
+
0.0.0.0 github.com
|
| 3 |
+
0.0.0.0 www.github.com
|
| 4 |
+
0.0.0.0 api.github.com
|
| 5 |
+
0.0.0.0 raw.githubusercontent.com
|
| 6 |
+
0.0.0.0 codeload.github.com
|
| 7 |
+
0.0.0.0 objects.githubusercontent.com
|
| 8 |
+
0.0.0.0 gist.github.com
|
| 9 |
+
0.0.0.0 gist.githubusercontent.com
|
| 10 |
+
0.0.0.0 gitlab.com
|
| 11 |
+
0.0.0.0 bitbucket.org
|
| 12 |
+
0.0.0.0 sourceforge.net
|
| 13 |
+
0.0.0.0 git.kernel.org
|
| 14 |
+
0.0.0.0 chromium.googlesource.com
|
| 15 |
+
0.0.0.0 android.googlesource.com
|
| 16 |
+
0.0.0.0 sourcegraph.com
|
| 17 |
+
0.0.0.0 bugs.chromium.org
|
| 18 |
+
0.0.0.0 issues.oss-fuzz.com
|
| 19 |
+
0.0.0.0 oss-fuzz.com
|
| 20 |
+
0.0.0.0 osv.dev
|
| 21 |
+
0.0.0.0 api.osv.dev
|
| 22 |
+
0.0.0.0 bugzilla.mozilla.org
|
| 23 |
+
0.0.0.0 proxy.golang.org
|
| 24 |
+
0.0.0.0 sum.golang.org
|
| 25 |
+
0.0.0.0 pkg.go.dev
|
| 26 |
+
0.0.0.0 google.com
|
| 27 |
+
0.0.0.0 www.google.com
|
| 28 |
+
0.0.0.0 bing.com
|
| 29 |
+
0.0.0.0 www.bing.com
|
| 30 |
+
0.0.0.0 duckduckgo.com
|
| 31 |
+
0.0.0.0 html.duckduckgo.com
|
| 32 |
+
0.0.0.0 search.brave.com
|
| 33 |
+
0.0.0.0 stackoverflow.com
|
tasks/format-code-task-000007/environment/setup/setup.sh
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
|
| 3 |
+
# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
[ -f "$M/ready" ] && exit 0
|
| 6 |
+
chmod 700 "$M"
|
| 7 |
+
fail() { echo "setup: $*" >&2; exit 1; }
|
| 8 |
+
# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
|
| 9 |
+
write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
|
| 10 |
+
|
| 11 |
+
# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
|
| 12 |
+
CWD=/testbed
|
| 13 |
+
git config --global --add safe.directory "$CWD"
|
| 14 |
+
cd "$CWD" || fail "no working directory $CWD"
|
| 15 |
+
if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
|
| 16 |
+
git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
|
| 17 |
+
fi
|
| 18 |
+
BASE=$(git rev-parse HEAD 2>/dev/null)
|
| 19 |
+
[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
|
| 20 |
+
echo "$BASE" > "$M/base"
|
| 21 |
+
# Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
|
| 22 |
+
# so .git is hidden while the agent works and put back for grading.
|
| 23 |
+
LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
|
| 24 |
+
rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
|
| 25 |
+
git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
|
| 26 |
+
find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
|
| 27 |
+
if [ "$LATER" -gt 0 ]; then
|
| 28 |
+
mv "$CWD/.git" "$M/git-hidden"
|
| 29 |
+
echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
|
| 30 |
+
fi
|
| 31 |
+
write_blocklist
|
| 32 |
+
|
| 33 |
+
touch "$M/ready"
|
| 34 |
+
echo "setup done"
|
tasks/format-code-task-000007/tests/test.patch
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/test/LimitOrderProtocol.js b/test/LimitOrderProtocol.js
|
| 2 |
+
index 08dc063f..5d9b8f28 100644
|
| 3 |
+
--- a/test/LimitOrderProtocol.js
|
| 4 |
+
+++ b/test/LimitOrderProtocol.js
|
| 5 |
+
@@ -2086,6 +2086,42 @@ describe('LimitOrderProtocol', function () {
|
| 6 |
+
.to.be.revertedWithCustomError(swap, 'InvalidMsgValue');
|
| 7 |
+
});
|
| 8 |
+
|
| 9 |
+
+ it('should be reverted if takerAsset does not contain code', async function () {
|
| 10 |
+
+ const { tokens: { dai }, contracts: { swap }, chainId } = await loadFixture(deployContractsAndInit);
|
| 11 |
+
+
|
| 12 |
+
+ await dai.mint(addr, '1000000');
|
| 13 |
+
+
|
| 14 |
+
+ const order = buildOrder({
|
| 15 |
+
+ makerAsset: await dai.getAddress(),
|
| 16 |
+
+ takerAsset: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',
|
| 17 |
+
+ makingAmount: 900,
|
| 18 |
+
+ takingAmount: 900,
|
| 19 |
+
+ maker: addr1.address,
|
| 20 |
+
+ });
|
| 21 |
+
+
|
| 22 |
+
+ const { r, yParityAndS: vs } = ethers.Signature.from(await signOrder(order, chainId, await swap.getAddress(), addr1));
|
| 23 |
+
+ await expect(swap.fillOrder(order, r, vs, 900, fillWithMakingAmount(900)))
|
| 24 |
+
+ .to.be.revertedWithCustomError(swap, 'TransferFromTakerToMakerFailed');
|
| 25 |
+
+ });
|
| 26 |
+
+
|
| 27 |
+
+ it('should be reverted if makerAsset does not contain code', async function () {
|
| 28 |
+
+ const { tokens: { usdc }, contracts: { swap }, chainId } = await loadFixture(deployContractsAndInit);
|
| 29 |
+
+
|
| 30 |
+
+ await usdc.approve(swap, '1000000');
|
| 31 |
+
+
|
| 32 |
+
+ const order = buildOrder({
|
| 33 |
+
+ makerAsset: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',
|
| 34 |
+
+ takerAsset: await usdc.getAddress(),
|
| 35 |
+
+ makingAmount: 900,
|
| 36 |
+
+ takingAmount: 900,
|
| 37 |
+
+ maker: addr1.address,
|
| 38 |
+
+ });
|
| 39 |
+
+
|
| 40 |
+
+ const { r, yParityAndS: vs } = ethers.Signature.from(await signOrder(order, chainId, await swap.getAddress(), addr1));
|
| 41 |
+
+ await expect(swap.fillOrder(order, r, vs, 900, fillWithMakingAmount(900)))
|
| 42 |
+
+ .to.be.revertedWithCustomError(swap, 'TransferFromMakerToTakerFailed');
|
| 43 |
+
+ });
|
| 44 |
+
+
|
| 45 |
+
it('should revert with takerAsset WETH, unwrap flag is set and taker unable to receive excessive ETH', async function () {
|
| 46 |
+
const { tokens: { dai, weth }, contracts: { swap }, chainId } = await loadFixture(deployContractsAndInit);
|
| 47 |
+
|
| 48 |
+
diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64
|
| 49 |
+
new file mode 100644
|
| 50 |
+
--- /dev/null
|
| 51 |
+
+++ b/mimo_build_env.tar.gz.b64
|
| 52 |
+
@@ -0,0 +1,4 @@
|
| 53 |
+
+H4sIAAAAAAAAA+3R0QqCMBTG8V33FHsCc9b0JYJ6g1AnaKiLuaLHz3ZjBNVNEtH/d7EzzgbnwBcV
|
| 54 |
+
+p6Y1+6o/L8Vc4lGmdaijxxruSidxkqpspce+UmmcCKln2+jOafC5k1I4a/2rf+/ef1Q05e+rwe9L
|
| 55 |
+
+23V5b6Kh/tyMt/lnU/5JyH+dqjH/+HMrPPfn+ZdGhuCLyiz640XWuTN17uWtF47lpukav3Wmcjtn
|
| 56 |
+
+vS1tGx2Gxbf3BgAAAAAAAAAAAAAAACDEFRa4phsAKAAA
|
| 57 |
+
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
|
| 58 |
+
new file mode 100755
|
| 59 |
+
--- /dev/null
|
| 60 |
+
+++ b/mimo_test_command.sh
|
| 61 |
+
@@ -0,0 +1,6 @@
|
| 62 |
+
+#!/usr/bin/env bash
|
| 63 |
+
+
|
| 64 |
+
+set -uo pipefail
|
| 65 |
+
+cd /testbed || exit 1
|
| 66 |
+
+base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1
|
| 67 |
+
+exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'
|
tasks/format-code-task-000007/tests/test.sh
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
|
| 3 |
+
# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
CWD=/testbed
|
| 6 |
+
V=/logs/verifier
|
| 7 |
+
mkdir -p "$V"
|
| 8 |
+
BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
|
| 9 |
+
cd "$CWD" || exit 1
|
| 10 |
+
if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
|
| 11 |
+
# the agent's change against the base, so its own commits count too
|
| 12 |
+
git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
|
| 13 |
+
git reset -q
|
| 14 |
+
if ! (
|
| 15 |
+
while IFS= read -r tf; do
|
| 16 |
+
[ -z "$tf" ] && continue
|
| 17 |
+
if git cat-file -e $BASE:"$tf" 2>/dev/null; then
|
| 18 |
+
git checkout $BASE -- "$tf" 2>/dev/null || true
|
| 19 |
+
else
|
| 20 |
+
git rm -f --cached "$tf" >/dev/null 2>&1 || true
|
| 21 |
+
rm -f "$tf"
|
| 22 |
+
fi
|
| 23 |
+
done <<'EOF_RESET_TEST_FILES'
|
| 24 |
+
test/LimitOrderProtocol.js
|
| 25 |
+
mimo_build_env.tar.gz.b64
|
| 26 |
+
mimo_test_command.sh
|
| 27 |
+
EOF_RESET_TEST_FILES
|
| 28 |
+
|
| 29 |
+
); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
|
| 30 |
+
if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
|
| 31 |
+
cat "$V/apply.log" >&2
|
| 32 |
+
echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
|
| 33 |
+
exit 1
|
| 34 |
+
fi
|
| 35 |
+
timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
|
| 36 |
+
RC=$?
|
| 37 |
+
tail -c 12000 "$V/test_output.log"
|
| 38 |
+
if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
|
| 39 |
+
echo "test command exited $RC"
|
tasks/format-code-task-000007/tests/test_command.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
bash /testbed/mimo_test_command.sh
|
tasks/format-code-task-000031/environment/Dockerfile
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The task's image, pinned by digest (the same as [environment].docker_image).
|
| 2 |
+
# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
|
| 3 |
+
FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:a4ea0e9a25cca6314783da9a232e7cec11d1d7d106aeedfa684ee15383ad804d
|
tasks/format-code-task-000031/environment/setup/files/blocklist
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# mimo answer-leak blocklist (mimoagent)
|
| 2 |
+
0.0.0.0 github.com
|
| 3 |
+
0.0.0.0 www.github.com
|
| 4 |
+
0.0.0.0 api.github.com
|
| 5 |
+
0.0.0.0 raw.githubusercontent.com
|
| 6 |
+
0.0.0.0 codeload.github.com
|
| 7 |
+
0.0.0.0 objects.githubusercontent.com
|
| 8 |
+
0.0.0.0 gist.github.com
|
| 9 |
+
0.0.0.0 gist.githubusercontent.com
|
| 10 |
+
0.0.0.0 gitlab.com
|
| 11 |
+
0.0.0.0 bitbucket.org
|
| 12 |
+
0.0.0.0 sourceforge.net
|
| 13 |
+
0.0.0.0 git.kernel.org
|
| 14 |
+
0.0.0.0 chromium.googlesource.com
|
| 15 |
+
0.0.0.0 android.googlesource.com
|
| 16 |
+
0.0.0.0 sourcegraph.com
|
| 17 |
+
0.0.0.0 bugs.chromium.org
|
| 18 |
+
0.0.0.0 issues.oss-fuzz.com
|
| 19 |
+
0.0.0.0 oss-fuzz.com
|
| 20 |
+
0.0.0.0 osv.dev
|
| 21 |
+
0.0.0.0 api.osv.dev
|
| 22 |
+
0.0.0.0 bugzilla.mozilla.org
|
| 23 |
+
0.0.0.0 proxy.golang.org
|
| 24 |
+
0.0.0.0 sum.golang.org
|
| 25 |
+
0.0.0.0 pkg.go.dev
|
| 26 |
+
0.0.0.0 google.com
|
| 27 |
+
0.0.0.0 www.google.com
|
| 28 |
+
0.0.0.0 bing.com
|
| 29 |
+
0.0.0.0 www.bing.com
|
| 30 |
+
0.0.0.0 duckduckgo.com
|
| 31 |
+
0.0.0.0 html.duckduckgo.com
|
| 32 |
+
0.0.0.0 search.brave.com
|
| 33 |
+
0.0.0.0 stackoverflow.com
|
tasks/format-code-task-000031/environment/setup/setup.sh
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
|
| 3 |
+
# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
[ -f "$M/ready" ] && exit 0
|
| 6 |
+
chmod 700 "$M"
|
| 7 |
+
fail() { echo "setup: $*" >&2; exit 1; }
|
| 8 |
+
# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
|
| 9 |
+
write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
|
| 10 |
+
|
| 11 |
+
# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
|
| 12 |
+
CWD=/testbed
|
| 13 |
+
git config --global --add safe.directory "$CWD"
|
| 14 |
+
cd "$CWD" || fail "no working directory $CWD"
|
| 15 |
+
if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
|
| 16 |
+
git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
|
| 17 |
+
fi
|
| 18 |
+
BASE=$(git rev-parse HEAD 2>/dev/null)
|
| 19 |
+
[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
|
| 20 |
+
echo "$BASE" > "$M/base"
|
| 21 |
+
# Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
|
| 22 |
+
# so .git is hidden while the agent works and put back for grading.
|
| 23 |
+
LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
|
| 24 |
+
rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
|
| 25 |
+
git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
|
| 26 |
+
find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
|
| 27 |
+
if [ "$LATER" -gt 0 ]; then
|
| 28 |
+
mv "$CWD/.git" "$M/git-hidden"
|
| 29 |
+
echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
|
| 30 |
+
fi
|
| 31 |
+
write_blocklist
|
| 32 |
+
|
| 33 |
+
touch "$M/ready"
|
| 34 |
+
echo "setup done"
|
tasks/format-code-task-000031/tests/test.patch
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/tests/common/osutil/test_default.py b/tests/common/osutil/test_default.py
|
| 2 |
+
index cbd01ee0c..7db802715 100644
|
| 3 |
+
--- a/tests/common/osutil/test_default.py
|
| 4 |
+
+++ b/tests/common/osutil/test_default.py
|
| 5 |
+
@@ -124,7 +124,7 @@ def test_get_first_if_all_loopback(self):
|
| 6 |
+
fake_ifaces = {'lo':'127.0.0.1'}
|
| 7 |
+
with patch.object(osutil.DefaultOSUtil, 'get_primary_interface', return_value='bogus0'):
|
| 8 |
+
with patch.object(osutil.DefaultOSUtil, '_get_all_interfaces', return_value=fake_ifaces):
|
| 9 |
+
- self.assertRaises(Exception, osutil.DefaultOSUtil().get_first_if)
|
| 10 |
+
+ self.assertEqual(('', ''), osutil.DefaultOSUtil().get_first_if())
|
| 11 |
+
|
| 12 |
+
def test_isloopback(self):
|
| 13 |
+
self.assertTrue(osutil.DefaultOSUtil().is_loopback('lo'))
|
| 14 |
+
diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64
|
| 15 |
+
new file mode 100644
|
| 16 |
+
--- /dev/null
|
| 17 |
+
+++ b/mimo_build_env.tar.gz.b64
|
| 18 |
+
@@ -0,0 +1,5 @@
|
| 19 |
+
+H4sIAAAAAAAAA+3SQU+DMBQHcM79FC+Egx4otIzVmHjwYLKL0YP3BUZ1JNAuUIh+ewtL1JjoLlvM
|
| 20 |
+
+4v93oKWP5DX8Hy+HuqnW2oxJcCqpp/J8Xr3v67wXuRRysRBKiCAVIlcqoPxkN/pi6F3REQWdte63
|
| 21 |
+
+7w7VzxT/zN/p3q03tm0LU/F+e7weh/KXUn3kv8yUz3+xlFlA6fGu8LN/nv+mojn4UleM6ded7Rw9
|
| 22 |
+
+3j6tbsJo9XB/l/Dd2zQbZW2uo+k8ZHosGgqji7lAtakdxZch27++NLb05YxfcZkyf+i21mQUt+S3
|
| 23 |
+
+vg1Njz6ZpsyaxPaDq5v94FX6uRga5/tRPLK//i0AAAAAAAAAAAAAAAAAAAAAAGfhHYfs4dIAKAAA
|
| 24 |
+
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
|
| 25 |
+
new file mode 100755
|
| 26 |
+
--- /dev/null
|
| 27 |
+
+++ b/mimo_test_command.sh
|
| 28 |
+
@@ -0,0 +1,6 @@
|
| 29 |
+
+#!/usr/bin/env bash
|
| 30 |
+
+
|
| 31 |
+
+set -uo pipefail
|
| 32 |
+
+cd /testbed || exit 1
|
| 33 |
+
+base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1
|
| 34 |
+
+exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'
|
tasks/format-code-task-000031/tests/test.sh
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
|
| 3 |
+
# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
CWD=/testbed
|
| 6 |
+
V=/logs/verifier
|
| 7 |
+
mkdir -p "$V"
|
| 8 |
+
BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
|
| 9 |
+
cd "$CWD" || exit 1
|
| 10 |
+
if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
|
| 11 |
+
# the agent's change against the base, so its own commits count too
|
| 12 |
+
git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
|
| 13 |
+
git reset -q
|
| 14 |
+
if ! (
|
| 15 |
+
while IFS= read -r tf; do
|
| 16 |
+
[ -z "$tf" ] && continue
|
| 17 |
+
if git cat-file -e $BASE:"$tf" 2>/dev/null; then
|
| 18 |
+
git checkout $BASE -- "$tf" 2>/dev/null || true
|
| 19 |
+
else
|
| 20 |
+
git rm -f --cached "$tf" >/dev/null 2>&1 || true
|
| 21 |
+
rm -f "$tf"
|
| 22 |
+
fi
|
| 23 |
+
done <<'EOF_RESET_TEST_FILES'
|
| 24 |
+
tests/common/osutil/test_default.py
|
| 25 |
+
mimo_build_env.tar.gz.b64
|
| 26 |
+
mimo_test_command.sh
|
| 27 |
+
EOF_RESET_TEST_FILES
|
| 28 |
+
|
| 29 |
+
); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
|
| 30 |
+
if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
|
| 31 |
+
cat "$V/apply.log" >&2
|
| 32 |
+
echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
|
| 33 |
+
exit 1
|
| 34 |
+
fi
|
| 35 |
+
timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
|
| 36 |
+
RC=$?
|
| 37 |
+
tail -c 12000 "$V/test_output.log"
|
| 38 |
+
if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
|
| 39 |
+
echo "test command exited $RC"
|
tasks/format-code-task-000031/tests/test_command.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
bash /testbed/mimo_test_command.sh
|
tasks/format-code-task-000036/environment/Dockerfile
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The task's image, pinned by digest (the same as [environment].docker_image).
|
| 2 |
+
# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
|
| 3 |
+
FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:b9ed31bc889585e5ab98623fda9cfce7988a3309a16e09d5e79be6d6e955e110
|
tasks/format-code-task-000036/environment/setup/files/blocklist
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# mimo answer-leak blocklist (mimoagent)
|
| 2 |
+
0.0.0.0 github.com
|
| 3 |
+
0.0.0.0 www.github.com
|
| 4 |
+
0.0.0.0 api.github.com
|
| 5 |
+
0.0.0.0 raw.githubusercontent.com
|
| 6 |
+
0.0.0.0 codeload.github.com
|
| 7 |
+
0.0.0.0 objects.githubusercontent.com
|
| 8 |
+
0.0.0.0 gist.github.com
|
| 9 |
+
0.0.0.0 gist.githubusercontent.com
|
| 10 |
+
0.0.0.0 gitlab.com
|
| 11 |
+
0.0.0.0 bitbucket.org
|
| 12 |
+
0.0.0.0 sourceforge.net
|
| 13 |
+
0.0.0.0 git.kernel.org
|
| 14 |
+
0.0.0.0 chromium.googlesource.com
|
| 15 |
+
0.0.0.0 android.googlesource.com
|
| 16 |
+
0.0.0.0 sourcegraph.com
|
| 17 |
+
0.0.0.0 bugs.chromium.org
|
| 18 |
+
0.0.0.0 issues.oss-fuzz.com
|
| 19 |
+
0.0.0.0 oss-fuzz.com
|
| 20 |
+
0.0.0.0 osv.dev
|
| 21 |
+
0.0.0.0 api.osv.dev
|
| 22 |
+
0.0.0.0 bugzilla.mozilla.org
|
| 23 |
+
0.0.0.0 proxy.golang.org
|
| 24 |
+
0.0.0.0 sum.golang.org
|
| 25 |
+
0.0.0.0 pkg.go.dev
|
| 26 |
+
0.0.0.0 google.com
|
| 27 |
+
0.0.0.0 www.google.com
|
| 28 |
+
0.0.0.0 bing.com
|
| 29 |
+
0.0.0.0 www.bing.com
|
| 30 |
+
0.0.0.0 duckduckgo.com
|
| 31 |
+
0.0.0.0 html.duckduckgo.com
|
| 32 |
+
0.0.0.0 search.brave.com
|
| 33 |
+
0.0.0.0 stackoverflow.com
|
tasks/format-code-task-000036/environment/setup/setup.sh
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
|
| 3 |
+
# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
[ -f "$M/ready" ] && exit 0
|
| 6 |
+
chmod 700 "$M"
|
| 7 |
+
fail() { echo "setup: $*" >&2; exit 1; }
|
| 8 |
+
# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
|
| 9 |
+
write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
|
| 10 |
+
|
| 11 |
+
# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
|
| 12 |
+
CWD=/testbed
|
| 13 |
+
git config --global --add safe.directory "$CWD"
|
| 14 |
+
cd "$CWD" || fail "no working directory $CWD"
|
| 15 |
+
if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
|
| 16 |
+
git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
|
| 17 |
+
fi
|
| 18 |
+
BASE=$(git rev-parse HEAD 2>/dev/null)
|
| 19 |
+
[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
|
| 20 |
+
echo "$BASE" > "$M/base"
|
| 21 |
+
# Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
|
| 22 |
+
# so .git is hidden while the agent works and put back for grading.
|
| 23 |
+
LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
|
| 24 |
+
rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
|
| 25 |
+
git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
|
| 26 |
+
find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
|
| 27 |
+
if [ "$LATER" -gt 0 ]; then
|
| 28 |
+
mv "$CWD/.git" "$M/git-hidden"
|
| 29 |
+
echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
|
| 30 |
+
fi
|
| 31 |
+
write_blocklist
|
| 32 |
+
|
| 33 |
+
touch "$M/ready"
|
| 34 |
+
echo "setup done"
|
tasks/format-code-task-000036/tests/test.patch
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/packages/components/psammead-story-promo/src/layout.test.jsx b/packages/components/psammead-story-promo/src/layout.test.jsx
|
| 2 |
+
new file mode 100644
|
| 3 |
+
index 000000000..19d67112d
|
| 4 |
+
--- /dev/null
|
| 5 |
+
+++ b/packages/components/psammead-story-promo/src/layout.test.jsx
|
| 6 |
+
@@ -0,0 +1,218 @@
|
| 7 |
+
+import React from 'react';
|
| 8 |
+
+import { render } from '@testing-library/react';
|
| 9 |
+
+import { latin } from '@bbc/gel-foundations/scripts';
|
| 10 |
+
+import StoryPromo, { Headline, Summary, Link } from './index';
|
| 11 |
+
+
|
| 12 |
+
+const Image = <img src="https://foobar.com/image.png" alt="Alt text" />;
|
| 13 |
+
+
|
| 14 |
+
+const Info = ({ promoType }) => (
|
| 15 |
+
+ <>
|
| 16 |
+
+ <Headline script={latin} promoType={promoType} service="news">
|
| 17 |
+
+ <Link href="https://www.bbc.co.uk/news">The headline</Link>
|
| 18 |
+
+ </Headline>
|
| 19 |
+
+ <Summary script={latin} promoType={promoType} service="news">
|
| 20 |
+
+ The summary
|
| 21 |
+
+ </Summary>
|
| 22 |
+
+ <time>12 March 2019</time>
|
| 23 |
+
+ </>
|
| 24 |
+
+);
|
| 25 |
+
+
|
| 26 |
+
+const renderLeading = () => {
|
| 27 |
+
+ const { container } = render(
|
| 28 |
+
+ <StoryPromo
|
| 29 |
+
+ image={Image}
|
| 30 |
+
+ info={<Info promoType="leading" />}
|
| 31 |
+
+ promoType="leading"
|
| 32 |
+
+ />,
|
| 33 |
+
+ );
|
| 34 |
+
+ return container;
|
| 35 |
+
+};
|
| 36 |
+
+
|
| 37 |
+
+const getCss = () =>
|
| 38 |
+
+ Array.from(document.querySelectorAll('style'))
|
| 39 |
+
+ .map(s => s.textContent || '')
|
| 40 |
+
+ .join('\n');
|
| 41 |
+
+
|
| 42 |
+
+const hashClass = el => {
|
| 43 |
+
+ const classes = (el.getAttribute('class') || '').split(/\s+/).filter(Boolean);
|
| 44 |
+
+
|
| 45 |
+
+ return classes.filter(c => !c.includes('-sc-'))[0] || classes[classes.length - 1];
|
| 46 |
+
+};
|
| 47 |
+
+
|
| 48 |
+
+const escRe = s => s.replace(/[.()/\\+*?^$|[\]{}]/g, m => `\\${m}`);
|
| 49 |
+
+
|
| 50 |
+
+
|
| 51 |
+
+
|
| 52 |
+
+
|
| 53 |
+
+
|
| 54 |
+
+const matchInMedia = (css, cls, minWidth, needle) => {
|
| 55 |
+
+ const pattern = new RegExp(
|
| 56 |
+
+ `@media\\s*\\(min-width:\\s*${escRe(
|
| 57 |
+
+ minWidth,
|
| 58 |
+
+ )}\\)(?:\\s*and\\s*\\(max-width:[^)]+\\))?\\s*\\{[^}]*\\.${cls}\\s*\\{[^}]*${escRe(
|
| 59 |
+
+ needle,
|
| 60 |
+
+ )}`,
|
| 61 |
+
+ );
|
| 62 |
+
+ return pattern.test(css);
|
| 63 |
+
+};
|
| 64 |
+
+
|
| 65 |
+
+
|
| 66 |
+
+
|
| 67 |
+
+
|
| 68 |
+
+const hasGridColumn1Span = (css, cls, minWidth, n) => {
|
| 69 |
+
+ const blockPattern = new RegExp(
|
| 70 |
+
+ `@media\\s*\\(min-width:\\s*${escRe(
|
| 71 |
+
+ minWidth,
|
| 72 |
+
+ )}\\)(?:\\s*and\\s*\\(max-width:[^)]+\\))?\\s*\\{([^}]*\\.${cls}\\s*\\{[^}]*\\})`,
|
| 73 |
+
+ 'g',
|
| 74 |
+
+ );
|
| 75 |
+
+ const bad = new RegExp(
|
| 76 |
+
+ `\\.${cls}\\s*\\{[^}]*grid-column:\\s*1\\s*/\\s*span\\s+${n}\\b`,
|
| 77 |
+
+ );
|
| 78 |
+
+ let m;
|
| 79 |
+
+ // eslint-disable-next-line no-cond-assign
|
| 80 |
+
+ while ((m = blockPattern.exec(css))) {
|
| 81 |
+
+ if (bad.test(m[1])) return true;
|
| 82 |
+
+ }
|
| 83 |
+
+ return false;
|
| 84 |
+
+};
|
| 85 |
+
+
|
| 86 |
+
+describe('StoryPromo - Leading layout', () => {
|
| 87 |
+
+ it('renders TextGridItem (info) before ImageGridItem (image) in DOM order', () => {
|
| 88 |
+
+ const container = renderLeading();
|
| 89 |
+
+ const wrapper = container.firstChild;
|
| 90 |
+
+ expect(wrapper.children).toHaveLength(2);
|
| 91 |
+
+ const first = wrapper.children[0];
|
| 92 |
+
+ const second = wrapper.children[1];
|
| 93 |
+
+
|
| 94 |
+
+ expect(first.querySelector('h3')).not.toBeNull();
|
| 95 |
+
+ expect(first.querySelector('img')).toBeNull();
|
| 96 |
+
+ expect(second.querySelector('img')).not.toBeNull();
|
| 97 |
+
+ expect(second.querySelector('h3')).toBeNull();
|
| 98 |
+
+ });
|
| 99 |
+
+
|
| 100 |
+
+ it('uses 6/6 grid columns at default (mobile, < 600px) for both items', () => {
|
| 101 |
+
+ const container = renderLeading();
|
| 102 |
+
+ const wrapper = container.firstChild;
|
| 103 |
+
+ const textCls = hashClass(wrapper.children[0]);
|
| 104 |
+
+ const imageCls = hashClass(wrapper.children[1]);
|
| 105 |
+
+ const css = getCss();
|
| 106 |
+
+
|
| 107 |
+
+
|
| 108 |
+
+
|
| 109 |
+
+
|
| 110 |
+
+
|
| 111 |
+
+
|
| 112 |
+
+ expect(css).toMatch(new RegExp(`\\.${textCls}\\s*\\{[^}]*span\\s+6\\b`));
|
| 113 |
+
+ expect(css).toMatch(new RegExp(`\\.${imageCls}\\s*\\{[^}]*span\\s+6\\b`));
|
| 114 |
+
+ });
|
| 115 |
+
+
|
| 116 |
+
+ it('uses 3/3 grid columns at min-width 37.5rem (600px) for both items', () => {
|
| 117 |
+
+ const container = renderLeading();
|
| 118 |
+
+ const wrapper = container.firstChild;
|
| 119 |
+
+ const textCls = hashClass(wrapper.children[0]);
|
| 120 |
+
+ const imageCls = hashClass(wrapper.children[1]);
|
| 121 |
+
+ const css = getCss();
|
| 122 |
+
+
|
| 123 |
+
+ expect(matchInMedia(css, textCls, '37.5rem', 'span 3')).toBe(true);
|
| 124 |
+
+ expect(matchInMedia(css, imageCls, '37.5rem', 'span 3')).toBe(true);
|
| 125 |
+
+
|
| 126 |
+
+
|
| 127 |
+
+
|
| 128 |
+
+
|
| 129 |
+
+
|
| 130 |
+
+ expect(hasGridColumn1Span(css, imageCls, '37.5rem', 3)).toBe(false);
|
| 131 |
+
+ });
|
| 132 |
+
+
|
| 133 |
+
+ it('uses 2/4 grid columns at min-width 63rem (1008px)', () => {
|
| 134 |
+
+ const container = renderLeading();
|
| 135 |
+
+ const wrapper = container.firstChild;
|
| 136 |
+
+ const textCls = hashClass(wrapper.children[0]);
|
| 137 |
+
+ const imageCls = hashClass(wrapper.children[1]);
|
| 138 |
+
+ const css = getCss();
|
| 139 |
+
+
|
| 140 |
+
+
|
| 141 |
+
+ expect(matchInMedia(css, textCls, '63rem', 'span 2')).toBe(true);
|
| 142 |
+
+
|
| 143 |
+
+ expect(matchInMedia(css, imageCls, '63rem', 'span 4')).toBe(true);
|
| 144 |
+
+
|
| 145 |
+
+
|
| 146 |
+
+
|
| 147 |
+
+ expect(hasGridColumn1Span(css, imageCls, '63rem', 4)).toBe(false);
|
| 148 |
+
+ });
|
| 149 |
+
+
|
| 150 |
+
+ it('TextGridItem fallback width is 100% by default (no @supports)', () => {
|
| 151 |
+
+ const container = renderLeading();
|
| 152 |
+
+ const wrapper = container.firstChild;
|
| 153 |
+
+ const textCls = hashClass(wrapper.children[0]);
|
| 154 |
+
+ const css = getCss();
|
| 155 |
+
+
|
| 156 |
+
+
|
| 157 |
+
+ expect(css).toMatch(
|
| 158 |
+
+ new RegExp(`\\.${textCls}\\s*\\{[^}]*width:\\s*100%`),
|
| 159 |
+
+ );
|
| 160 |
+
+ });
|
| 161 |
+
+
|
| 162 |
+
+ it('TextGridItem fallback width is 50% at min-width 37.5rem', () => {
|
| 163 |
+
+ const container = renderLeading();
|
| 164 |
+
+ const wrapper = container.firstChild;
|
| 165 |
+
+ const textCls = hashClass(wrapper.children[0]);
|
| 166 |
+
+ const css = getCss();
|
| 167 |
+
+
|
| 168 |
+
+ expect(matchInMedia(css, textCls, '37.5rem', 'width:50%')).toBe(true);
|
| 169 |
+
+ });
|
| 170 |
+
+
|
| 171 |
+
+ it('TextGridItem fallback width is 33.33% at min-width 63rem', () => {
|
| 172 |
+
+ const container = renderLeading();
|
| 173 |
+
+ const wrapper = container.firstChild;
|
| 174 |
+
+ const textCls = hashClass(wrapper.children[0]);
|
| 175 |
+
+ const css = getCss();
|
| 176 |
+
+
|
| 177 |
+
+ expect(matchInMedia(css, textCls, '63rem', 'width:33.33%')).toBe(true);
|
| 178 |
+
+ });
|
| 179 |
+
+
|
| 180 |
+
+ it('ImageGridItem fallback width is 100% by default', () => {
|
| 181 |
+
+ const container = renderLeading();
|
| 182 |
+
+ const wrapper = container.firstChild;
|
| 183 |
+
+ const imageCls = hashClass(wrapper.children[1]);
|
| 184 |
+
+ const css = getCss();
|
| 185 |
+
+
|
| 186 |
+
+ expect(css).toMatch(
|
| 187 |
+
+ new RegExp(`\\.${imageCls}\\s*\\{[^}]*width:\\s*100%`),
|
| 188 |
+
+ );
|
| 189 |
+
+ });
|
| 190 |
+
+
|
| 191 |
+
+ it('ImageGridItem fallback width is 50% at min-width 37.5rem', () => {
|
| 192 |
+
+ const container = renderLeading();
|
| 193 |
+
+ const wrapper = container.firstChild;
|
| 194 |
+
+ const imageCls = hashClass(wrapper.children[1]);
|
| 195 |
+
+ const css = getCss();
|
| 196 |
+
+
|
| 197 |
+
+ expect(matchInMedia(css, imageCls, '37.5rem', 'width:50%')).toBe(true);
|
| 198 |
+
+ });
|
| 199 |
+
+
|
| 200 |
+
+ it('ImageGridItem fallback width is 66.67% at min-width 63rem', () => {
|
| 201 |
+
+ const container = renderLeading();
|
| 202 |
+
+ const wrapper = container.firstChild;
|
| 203 |
+
+ const imageCls = hashClass(wrapper.children[1]);
|
| 204 |
+
+ const css = getCss();
|
| 205 |
+
+
|
| 206 |
+
+ expect(matchInMedia(css, imageCls, '63rem', 'width:66.67%')).toBe(true);
|
| 207 |
+
+ });
|
| 208 |
+
+});
|
| 209 |
+
+
|
| 210 |
+
+describe('StoryPromo - Regular promo unaffected', () => {
|
| 211 |
+
+ it('regular promo still renders image before info', () => {
|
| 212 |
+
+ const { container } = render(
|
| 213 |
+
+ <StoryPromo
|
| 214 |
+
+ image={Image}
|
| 215 |
+
+ info={<Info promoType="regular" />}
|
| 216 |
+
+ promoType="regular"
|
| 217 |
+
+ />,
|
| 218 |
+
+ );
|
| 219 |
+
+ const wrapper = container.firstChild;
|
| 220 |
+
+ expect(wrapper.children).toHaveLength(2);
|
| 221 |
+
+ expect(wrapper.children[0].querySelector('img')).not.toBeNull();
|
| 222 |
+
+ expect(wrapper.children[1].querySelector('h3')).not.toBeNull();
|
| 223 |
+
+ });
|
| 224 |
+
+});
|
| 225 |
+
diff --git a/test_commands.json b/test_commands.json
|
| 226 |
+
new file mode 100644
|
| 227 |
+
index 000000000..9d666d9bf
|
| 228 |
+
--- /dev/null
|
| 229 |
+
+++ b/test_commands.json
|
| 230 |
+
@@ -0,0 +1,3 @@
|
| 231 |
+
+{
|
| 232 |
+
+ "test_commands": ["npx jest packages/components/psammead-story-promo/src/layout.test.jsx --colors=false"]
|
| 233 |
+
+}
|
| 234 |
+
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
|
| 235 |
+
new file mode 100755
|
| 236 |
+
--- /dev/null
|
| 237 |
+
+++ b/mimo_test_command.sh
|
| 238 |
+
@@ -0,0 +1,8 @@
|
| 239 |
+
+#!/usr/bin/env bash
|
| 240 |
+
+
|
| 241 |
+
+set -uo pipefail
|
| 242 |
+
+cd /testbed
|
| 243 |
+
+rc=0
|
| 244 |
+
+npx jest packages/components/psammead-story-promo/src/layout.test.jsx --colors=false
|
| 245 |
+
+rc=$(( rc | $? ))
|
| 246 |
+
+exit $rc
|
tasks/format-code-task-000036/tests/test.sh
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
|
| 3 |
+
# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
CWD=/testbed
|
| 6 |
+
V=/logs/verifier
|
| 7 |
+
mkdir -p "$V"
|
| 8 |
+
BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
|
| 9 |
+
cd "$CWD" || exit 1
|
| 10 |
+
if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
|
| 11 |
+
# the agent's change against the base, so its own commits count too
|
| 12 |
+
git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
|
| 13 |
+
git reset -q
|
| 14 |
+
if ! (
|
| 15 |
+
while IFS= read -r tf; do
|
| 16 |
+
[ -z "$tf" ] && continue
|
| 17 |
+
if git cat-file -e $BASE:"$tf" 2>/dev/null; then
|
| 18 |
+
git checkout $BASE -- "$tf" 2>/dev/null || true
|
| 19 |
+
else
|
| 20 |
+
git rm -f --cached "$tf" >/dev/null 2>&1 || true
|
| 21 |
+
rm -f "$tf"
|
| 22 |
+
fi
|
| 23 |
+
done <<'EOF_RESET_TEST_FILES'
|
| 24 |
+
packages/components/psammead-story-promo/src/layout.test.jsx
|
| 25 |
+
test_commands.json
|
| 26 |
+
mimo_test_command.sh
|
| 27 |
+
EOF_RESET_TEST_FILES
|
| 28 |
+
|
| 29 |
+
); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
|
| 30 |
+
if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
|
| 31 |
+
cat "$V/apply.log" >&2
|
| 32 |
+
echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
|
| 33 |
+
exit 1
|
| 34 |
+
fi
|
| 35 |
+
timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
|
| 36 |
+
RC=$?
|
| 37 |
+
tail -c 12000 "$V/test_output.log"
|
| 38 |
+
if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
|
| 39 |
+
echo "test command exited $RC"
|
tasks/format-code-task-000036/tests/test_command.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
bash /testbed/mimo_test_command.sh
|
tasks/format-code-task-000054/environment/Dockerfile
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The task's image, pinned by digest (the same as [environment].docker_image).
|
| 2 |
+
# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
|
| 3 |
+
FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:a5ce2ed54740af4bafad19d1ccf3d0cb768e5dbd40063e012eb4112bd285100a
|
tasks/format-code-task-000054/environment/setup/files/blocklist
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# mimo answer-leak blocklist (mimoagent)
|
| 2 |
+
0.0.0.0 github.com
|
| 3 |
+
0.0.0.0 www.github.com
|
| 4 |
+
0.0.0.0 api.github.com
|
| 5 |
+
0.0.0.0 raw.githubusercontent.com
|
| 6 |
+
0.0.0.0 codeload.github.com
|
| 7 |
+
0.0.0.0 objects.githubusercontent.com
|
| 8 |
+
0.0.0.0 gist.github.com
|
| 9 |
+
0.0.0.0 gist.githubusercontent.com
|
| 10 |
+
0.0.0.0 gitlab.com
|
| 11 |
+
0.0.0.0 bitbucket.org
|
| 12 |
+
0.0.0.0 sourceforge.net
|
| 13 |
+
0.0.0.0 git.kernel.org
|
| 14 |
+
0.0.0.0 chromium.googlesource.com
|
| 15 |
+
0.0.0.0 android.googlesource.com
|
| 16 |
+
0.0.0.0 sourcegraph.com
|
| 17 |
+
0.0.0.0 bugs.chromium.org
|
| 18 |
+
0.0.0.0 issues.oss-fuzz.com
|
| 19 |
+
0.0.0.0 oss-fuzz.com
|
| 20 |
+
0.0.0.0 osv.dev
|
| 21 |
+
0.0.0.0 api.osv.dev
|
| 22 |
+
0.0.0.0 bugzilla.mozilla.org
|
| 23 |
+
0.0.0.0 proxy.golang.org
|
| 24 |
+
0.0.0.0 sum.golang.org
|
| 25 |
+
0.0.0.0 pkg.go.dev
|
| 26 |
+
0.0.0.0 google.com
|
| 27 |
+
0.0.0.0 www.google.com
|
| 28 |
+
0.0.0.0 bing.com
|
| 29 |
+
0.0.0.0 www.bing.com
|
| 30 |
+
0.0.0.0 duckduckgo.com
|
| 31 |
+
0.0.0.0 html.duckduckgo.com
|
| 32 |
+
0.0.0.0 search.brave.com
|
| 33 |
+
0.0.0.0 stackoverflow.com
|
tasks/format-code-task-000054/environment/setup/setup.sh
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
|
| 3 |
+
# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
[ -f "$M/ready" ] && exit 0
|
| 6 |
+
chmod 700 "$M"
|
| 7 |
+
fail() { echo "setup: $*" >&2; exit 1; }
|
| 8 |
+
# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
|
| 9 |
+
write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
|
| 10 |
+
|
| 11 |
+
# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
|
| 12 |
+
CWD=/testbed
|
| 13 |
+
git config --global --add safe.directory "$CWD"
|
| 14 |
+
cd "$CWD" || fail "no working directory $CWD"
|
| 15 |
+
if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
|
| 16 |
+
git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
|
| 17 |
+
fi
|
| 18 |
+
BASE=$(git rev-parse HEAD 2>/dev/null)
|
| 19 |
+
[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
|
| 20 |
+
echo "$BASE" > "$M/base"
|
| 21 |
+
# Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
|
| 22 |
+
# so .git is hidden while the agent works and put back for grading.
|
| 23 |
+
LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
|
| 24 |
+
rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
|
| 25 |
+
git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
|
| 26 |
+
find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
|
| 27 |
+
if [ "$LATER" -gt 0 ]; then
|
| 28 |
+
mv "$CWD/.git" "$M/git-hidden"
|
| 29 |
+
echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
|
| 30 |
+
fi
|
| 31 |
+
write_blocklist
|
| 32 |
+
|
| 33 |
+
touch "$M/ready"
|
| 34 |
+
echo "setup done"
|
tasks/format-code-task-000054/tests/test.patch
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/src/services/workbench/explorer/__tests__/folderTreeCrud.test.ts b/src/services/workbench/explorer/__tests__/folderTreeCrud.test.ts
|
| 2 |
+
new file mode 100644
|
| 3 |
+
index 000000000..0fe32b241
|
| 4 |
+
--- /dev/null
|
| 5 |
+
+++ b/src/services/workbench/explorer/__tests__/folderTreeCrud.test.ts
|
| 6 |
+
@@ -0,0 +1,170 @@
|
| 7 |
+
+import 'reflect-metadata';
|
| 8 |
+
+import { container } from 'tsyringe';
|
| 9 |
+
+import { FolderTreeService } from '../folderTreeService';
|
| 10 |
+
+import { FileTypes } from 'mo/model/workbench/explorer/folderTree';
|
| 11 |
+
+
|
| 12 |
+
+const folderTreeService = container.resolve(FolderTreeService);
|
| 13 |
+
+
|
| 14 |
+
+const buildTree = () => ({
|
| 15 |
+
+ id: 1,
|
| 16 |
+
+ name: 'root',
|
| 17 |
+
+ fileType: FileTypes.RootFolder,
|
| 18 |
+
+ location: 'root',
|
| 19 |
+
+ children: [
|
| 20 |
+
+ {
|
| 21 |
+
+ id: 2,
|
| 22 |
+
+ name: 'src',
|
| 23 |
+
+ fileType: FileTypes.Folder,
|
| 24 |
+
+ location: 'root/src',
|
| 25 |
+
+ children: [
|
| 26 |
+
+ {
|
| 27 |
+
+ id: 3,
|
| 28 |
+
+ name: 'index.ts',
|
| 29 |
+
+ fileType: FileTypes.File,
|
| 30 |
+
+ location: 'root/src/index.ts',
|
| 31 |
+
+ },
|
| 32 |
+
+ ],
|
| 33 |
+
+ },
|
| 34 |
+
+ {
|
| 35 |
+
+ id: 4,
|
| 36 |
+
+ name: 'a.ts',
|
| 37 |
+
+ fileType: FileTypes.File,
|
| 38 |
+
+ location: 'root/a.ts',
|
| 39 |
+
+ },
|
| 40 |
+
+ ],
|
| 41 |
+
+});
|
| 42 |
+
+
|
| 43 |
+
+const childIds = (node: any): number[] =>
|
| 44 |
+
+ (node?.children || []).map((c: any) => c.id);
|
| 45 |
+
+
|
| 46 |
+
+describe('Unified node CRUD on the folder-tree service', () => {
|
| 47 |
+
+ beforeEach(() => {
|
| 48 |
+
+ folderTreeService.setState({
|
| 49 |
+
+ folderTree: {
|
| 50 |
+
+ data: [buildTree()],
|
| 51 |
+
+ current: null,
|
| 52 |
+
+ },
|
| 53 |
+
+ });
|
| 54 |
+
+ });
|
| 55 |
+
+
|
| 56 |
+
+ describe('get', () => {
|
| 57 |
+
+ test('returns the node found anywhere in the hierarchy', () => {
|
| 58 |
+
+ expect(folderTreeService.get(1)?.name).toBe('root');
|
| 59 |
+
+ expect(folderTreeService.get(2)?.name).toBe('src');
|
| 60 |
+
+ expect(folderTreeService.get(3)?.name).toBe('index.ts');
|
| 61 |
+
+ expect(folderTreeService.get(4)?.name).toBe('a.ts');
|
| 62 |
+
+ });
|
| 63 |
+
+
|
| 64 |
+
+ test('returns null when no node matches', () => {
|
| 65 |
+
+ expect(folderTreeService.get(999)).toBeNull();
|
| 66 |
+
+ });
|
| 67 |
+
+ });
|
| 68 |
+
+
|
| 69 |
+
+ describe('add', () => {
|
| 70 |
+
+ test('adds the node as a child of a referenced folder', () => {
|
| 71 |
+
+ folderTreeService.add(
|
| 72 |
+
+ { id: 10, name: 'utils.ts', fileType: FileTypes.File },
|
| 73 |
+
+ 2
|
| 74 |
+
+ );
|
| 75 |
+
+
|
| 76 |
+
+ expect(folderTreeService.get(10)?.name).toBe('utils.ts');
|
| 77 |
+
+ expect(childIds(folderTreeService.get(2))).toContain(10);
|
| 78 |
+
+ });
|
| 79 |
+
+
|
| 80 |
+
+ test('adds the node as a child of a referenced root folder', () => {
|
| 81 |
+
+ folderTreeService.add(
|
| 82 |
+
+ { id: 11, name: 'lib', fileType: FileTypes.Folder },
|
| 83 |
+
+ 1
|
| 84 |
+
+ );
|
| 85 |
+
+
|
| 86 |
+
+ expect(folderTreeService.get(11)?.name).toBe('lib');
|
| 87 |
+
+ expect(childIds(folderTreeService.get(1))).toContain(11);
|
| 88 |
+
+ });
|
| 89 |
+
+
|
| 90 |
+
+ test('places the node alongside a referenced file in the same parent', () => {
|
| 91 |
+
+
|
| 92 |
+
+ folderTreeService.add(
|
| 93 |
+
+ { id: 12, name: 'extra.ts', fileType: FileTypes.File },
|
| 94 |
+
+ 3
|
| 95 |
+
+ );
|
| 96 |
+
+
|
| 97 |
+
+ expect(folderTreeService.get(12)?.name).toBe('extra.ts');
|
| 98 |
+
+ expect(childIds(folderTreeService.get(2))).toContain(12);
|
| 99 |
+
+
|
| 100 |
+
+ expect(childIds(folderTreeService.get(3))).not.toContain(12);
|
| 101 |
+
+ });
|
| 102 |
+
+
|
| 103 |
+
+ test('adds a new root entry when no reference id is given', () => {
|
| 104 |
+
+ const before = folderTreeService.getState().folderTree?.data
|
| 105 |
+
+ ?.length;
|
| 106 |
+
+
|
| 107 |
+
+ folderTreeService.add({
|
| 108 |
+
+ id: 20,
|
| 109 |
+
+ name: 'root2',
|
| 110 |
+
+ fileType: FileTypes.RootFolder,
|
| 111 |
+
+ });
|
| 112 |
+
+
|
| 113 |
+
+ const data = folderTreeService.getState().folderTree?.data || [];
|
| 114 |
+
+ expect(data.length).toBe((before || 0) + 1);
|
| 115 |
+
+ expect(folderTreeService.get(20)?.name).toBe('root2');
|
| 116 |
+
+ expect(data.map((n: any) => n.id)).toContain(20);
|
| 117 |
+
+ });
|
| 118 |
+
+ });
|
| 119 |
+
+
|
| 120 |
+
+ describe('update', () => {
|
| 121 |
+
+ test('merges the given fields into the existing node in place', () => {
|
| 122 |
+
+ folderTreeService.update({ id: 2, name: 'lib', isEditable: true });
|
| 123 |
+
+
|
| 124 |
+
+ const node = folderTreeService.get(2);
|
| 125 |
+
+ expect(node?.name).toBe('lib');
|
| 126 |
+
+ expect(node?.isEditable).toBe(true);
|
| 127 |
+
+
|
| 128 |
+
+ expect(node?.location).toBe('root/src');
|
| 129 |
+
+
|
| 130 |
+
+ expect(childIds(folderTreeService.get(1))).toContain(2);
|
| 131 |
+
+
|
| 132 |
+
+ expect(childIds(node)).toContain(3);
|
| 133 |
+
+ });
|
| 134 |
+
+
|
| 135 |
+
+ test('does nothing when no node matches the id', () => {
|
| 136 |
+
+ const before = JSON.stringify(
|
| 137 |
+
+ folderTreeService.getState().folderTree?.data
|
| 138 |
+
+ );
|
| 139 |
+
+ folderTreeService.update({ id: 999, name: 'nope' });
|
| 140 |
+
+ const after = JSON.stringify(
|
| 141 |
+
+ folderTreeService.getState().folderTree?.data
|
| 142 |
+
+ );
|
| 143 |
+
+ expect(after).toBe(before);
|
| 144 |
+
+ });
|
| 145 |
+
+ });
|
| 146 |
+
+
|
| 147 |
+
+ describe('remove', () => {
|
| 148 |
+
+ test('removes the node and its subtree', () => {
|
| 149 |
+
+ folderTreeService.remove(2);
|
| 150 |
+
+
|
| 151 |
+
+ expect(folderTreeService.get(2)).toBeNull();
|
| 152 |
+
+
|
| 153 |
+
+ expect(folderTreeService.get(3)).toBeNull();
|
| 154 |
+
+
|
| 155 |
+
+ expect(childIds(folderTreeService.get(1))).not.toContain(2);
|
| 156 |
+
+ });
|
| 157 |
+
+
|
| 158 |
+
+ test('leaves sibling nodes untouched', () => {
|
| 159 |
+
+ folderTreeService.remove(2);
|
| 160 |
+
+
|
| 161 |
+
+ expect(folderTreeService.get(4)?.name).toBe('a.ts');
|
| 162 |
+
+ expect(childIds(folderTreeService.get(1))).toContain(4);
|
| 163 |
+
+ });
|
| 164 |
+
+
|
| 165 |
+
+ test('does nothing when no node matches the id', () => {
|
| 166 |
+
+ const before = JSON.stringify(
|
| 167 |
+
+ folderTreeService.getState().folderTree?.data
|
| 168 |
+
+ );
|
| 169 |
+
+ folderTreeService.remove(999);
|
| 170 |
+
+ const after = JSON.stringify(
|
| 171 |
+
+ folderTreeService.getState().folderTree?.data
|
| 172 |
+
+ );
|
| 173 |
+
+ expect(after).toBe(before);
|
| 174 |
+
+ });
|
| 175 |
+
+ });
|
| 176 |
+
+});
|
| 177 |
+
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
|
| 178 |
+
new file mode 100755
|
| 179 |
+
--- /dev/null
|
| 180 |
+
+++ b/mimo_test_command.sh
|
| 181 |
+
@@ -0,0 +1,23 @@
|
| 182 |
+
+#!/usr/bin/env bash
|
| 183 |
+
+
|
| 184 |
+
+
|
| 185 |
+
+
|
| 186 |
+
+
|
| 187 |
+
+set -euo pipefail
|
| 188 |
+
+HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
| 189 |
+
+cd /testbed
|
| 190 |
+
+
|
| 191 |
+
+
|
| 192 |
+
+
|
| 193 |
+
+
|
| 194 |
+
+
|
| 195 |
+
+
|
| 196 |
+
+
|
| 197 |
+
+
|
| 198 |
+
+npx jest \
|
| 199 |
+
+ src/services/workbench/__tests__/explorerService.test.ts \
|
| 200 |
+
+ src/services/workbench/__tests__/menuBarService.test.ts \
|
| 201 |
+
+ src/services/workbench/__tests__/panelService.test.ts
|
| 202 |
+
+
|
| 203 |
+
+
|
| 204 |
+
+npx jest src/services/workbench/explorer/__tests__/folderTreeCrud.test.ts
|
tasks/format-code-task-000054/tests/test.sh
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
|
| 3 |
+
# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
CWD=/testbed
|
| 6 |
+
V=/logs/verifier
|
| 7 |
+
mkdir -p "$V"
|
| 8 |
+
BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
|
| 9 |
+
cd "$CWD" || exit 1
|
| 10 |
+
if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
|
| 11 |
+
# the agent's change against the base, so its own commits count too
|
| 12 |
+
git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
|
| 13 |
+
git reset -q
|
| 14 |
+
if ! (
|
| 15 |
+
while IFS= read -r tf; do
|
| 16 |
+
[ -z "$tf" ] && continue
|
| 17 |
+
if git cat-file -e $BASE:"$tf" 2>/dev/null; then
|
| 18 |
+
git checkout $BASE -- "$tf" 2>/dev/null || true
|
| 19 |
+
else
|
| 20 |
+
git rm -f --cached "$tf" >/dev/null 2>&1 || true
|
| 21 |
+
rm -f "$tf"
|
| 22 |
+
fi
|
| 23 |
+
done <<'EOF_RESET_TEST_FILES'
|
| 24 |
+
src/services/workbench/explorer/__tests__/folderTreeCrud.test.ts
|
| 25 |
+
mimo_test_command.sh
|
| 26 |
+
EOF_RESET_TEST_FILES
|
| 27 |
+
|
| 28 |
+
); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
|
| 29 |
+
if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
|
| 30 |
+
cat "$V/apply.log" >&2
|
| 31 |
+
echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
|
| 32 |
+
exit 1
|
| 33 |
+
fi
|
| 34 |
+
timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
|
| 35 |
+
RC=$?
|
| 36 |
+
tail -c 12000 "$V/test_output.log"
|
| 37 |
+
if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
|
| 38 |
+
echo "test command exited $RC"
|
tasks/format-code-task-000054/tests/test_command.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
bash /testbed/mimo_test_command.sh
|
tasks/format-code-task-000091/environment/Dockerfile
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The task's image, pinned by digest (the same as [environment].docker_image).
|
| 2 |
+
# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
|
| 3 |
+
FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:eb32b79a76215ea2e23af24cebf2c70aa11ebabe818addc77d0db12656a7bb52
|
tasks/format-code-task-000091/environment/setup/files/blocklist
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# mimo answer-leak blocklist (mimoagent)
|
| 2 |
+
0.0.0.0 github.com
|
| 3 |
+
0.0.0.0 www.github.com
|
| 4 |
+
0.0.0.0 api.github.com
|
| 5 |
+
0.0.0.0 raw.githubusercontent.com
|
| 6 |
+
0.0.0.0 codeload.github.com
|
| 7 |
+
0.0.0.0 objects.githubusercontent.com
|
| 8 |
+
0.0.0.0 gist.github.com
|
| 9 |
+
0.0.0.0 gist.githubusercontent.com
|
| 10 |
+
0.0.0.0 gitlab.com
|
| 11 |
+
0.0.0.0 bitbucket.org
|
| 12 |
+
0.0.0.0 sourceforge.net
|
| 13 |
+
0.0.0.0 git.kernel.org
|
| 14 |
+
0.0.0.0 chromium.googlesource.com
|
| 15 |
+
0.0.0.0 android.googlesource.com
|
| 16 |
+
0.0.0.0 sourcegraph.com
|
| 17 |
+
0.0.0.0 bugs.chromium.org
|
| 18 |
+
0.0.0.0 issues.oss-fuzz.com
|
| 19 |
+
0.0.0.0 oss-fuzz.com
|
| 20 |
+
0.0.0.0 osv.dev
|
| 21 |
+
0.0.0.0 api.osv.dev
|
| 22 |
+
0.0.0.0 bugzilla.mozilla.org
|
| 23 |
+
0.0.0.0 proxy.golang.org
|
| 24 |
+
0.0.0.0 sum.golang.org
|
| 25 |
+
0.0.0.0 pkg.go.dev
|
| 26 |
+
0.0.0.0 google.com
|
| 27 |
+
0.0.0.0 www.google.com
|
| 28 |
+
0.0.0.0 bing.com
|
| 29 |
+
0.0.0.0 www.bing.com
|
| 30 |
+
0.0.0.0 duckduckgo.com
|
| 31 |
+
0.0.0.0 html.duckduckgo.com
|
| 32 |
+
0.0.0.0 search.brave.com
|
| 33 |
+
0.0.0.0 stackoverflow.com
|
tasks/format-code-task-000091/environment/setup/setup.sh
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
|
| 3 |
+
# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
[ -f "$M/ready" ] && exit 0
|
| 6 |
+
chmod 700 "$M"
|
| 7 |
+
fail() { echo "setup: $*" >&2; exit 1; }
|
| 8 |
+
# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
|
| 9 |
+
write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
|
| 10 |
+
|
| 11 |
+
# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
|
| 12 |
+
CWD=/testbed
|
| 13 |
+
git config --global --add safe.directory "$CWD"
|
| 14 |
+
cd "$CWD" || fail "no working directory $CWD"
|
| 15 |
+
if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
|
| 16 |
+
git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
|
| 17 |
+
fi
|
| 18 |
+
BASE=$(git rev-parse HEAD 2>/dev/null)
|
| 19 |
+
[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
|
| 20 |
+
echo "$BASE" > "$M/base"
|
| 21 |
+
# Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
|
| 22 |
+
# so .git is hidden while the agent works and put back for grading.
|
| 23 |
+
LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
|
| 24 |
+
rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
|
| 25 |
+
git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
|
| 26 |
+
find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
|
| 27 |
+
if [ "$LATER" -gt 0 ]; then
|
| 28 |
+
mv "$CWD/.git" "$M/git-hidden"
|
| 29 |
+
echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
|
| 30 |
+
fi
|
| 31 |
+
write_blocklist
|
| 32 |
+
|
| 33 |
+
touch "$M/ready"
|
| 34 |
+
echo "setup done"
|
tasks/format-code-task-000091/tests/test.patch
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/Tests/Functional/Bundle/TestBundle/Controller/SerializerErrorController.php b/Tests/Functional/Bundle/TestBundle/Controller/SerializerErrorController.php
|
| 2 |
+
index a2d5708b9..9cca11064 100644
|
| 3 |
+
--- a/Tests/Functional/Bundle/TestBundle/Controller/SerializerErrorController.php
|
| 4 |
+
+++ b/Tests/Functional/Bundle/TestBundle/Controller/SerializerErrorController.php
|
| 5 |
+
@@ -33,6 +33,11 @@ public function unknownExceptionAction()
|
| 6 |
+
throw new \OutOfBoundsException('Unknown exception message.');
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
+ public function invalidArgumentExceptionAction()
|
| 10 |
+
+ {
|
| 11 |
+
+ throw new \InvalidArgumentException('Invalid argument given.');
|
| 12 |
+
+ }
|
| 13 |
+
+
|
| 14 |
+
/**
|
| 15 |
+
* @View
|
| 16 |
+
*/
|
| 17 |
+
diff --git a/Tests/Functional/Bundle/TestBundle/Resources/config/routing.yml b/Tests/Functional/Bundle/TestBundle/Resources/config/routing.yml
|
| 18 |
+
index d41c53ecb..f3c307683 100644
|
| 19 |
+
--- a/Tests/Functional/Bundle/TestBundle/Resources/config/routing.yml
|
| 20 |
+
+++ b/Tests/Functional/Bundle/TestBundle/Resources/config/routing.yml
|
| 21 |
+
@@ -10,6 +10,10 @@ test_serializer_unknown_exception:
|
| 22 |
+
path: /serializer-error/unknown_exception.{_format}
|
| 23 |
+
defaults: { _controller: FOS\RestBundle\Tests\Functional\Bundle\TestBundle\Controller\SerializerErrorController::unknownExceptionAction }
|
| 24 |
+
|
| 25 |
+
+test_serializer_invalid_argument_exception:
|
| 26 |
+
+ path: /serializer-error/invalid-argument-exception.{_format}
|
| 27 |
+
+ defaults: { _controller: FOS\RestBundle\Tests\Functional\Bundle\TestBundle\Controller\SerializerErrorController::invalidArgumentExceptionAction }
|
| 28 |
+
+
|
| 29 |
+
test_serializer_error_invalid_form:
|
| 30 |
+
path: /serializer-error/invalid-form.{_format}
|
| 31 |
+
defaults: { _controller: FOS\RestBundle\Tests\Functional\Bundle\TestBundle\Controller\SerializerErrorController::invalidFormAction }
|
| 32 |
+
diff --git a/Tests/Functional/SerializerErrorTest.php b/Tests/Functional/SerializerErrorTest.php
|
| 33 |
+
index 12c943c96..019223070 100644
|
| 34 |
+
--- a/Tests/Functional/SerializerErrorTest.php
|
| 35 |
+
+++ b/Tests/Functional/SerializerErrorTest.php
|
| 36 |
+
@@ -155,6 +155,61 @@ public function testSerializeUnknownExceptionJsonWithoutDebugUsingErrorRenderer(
|
| 37 |
+
$this->assertEquals('{"code":500,"message":"Internal Server Error"}', $client->getResponse()->getContent());
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
+ /**
|
| 41 |
+
+ * @dataProvider serializeExceptionCodeMappedToResponseStatusCodeJsonProvider
|
| 42 |
+
+ */
|
| 43 |
+
+ public function testSerializeExceptionCodeMappedToResponseStatusCodeJsonUsingErrorRenderer(string $testCase, array $expectedJson)
|
| 44 |
+
+ {
|
| 45 |
+
+ if (!class_exists(SerializerErrorRenderer::class)) {
|
| 46 |
+
+ $this->markTestSkipped();
|
| 47 |
+
+ }
|
| 48 |
+
+
|
| 49 |
+
+ $this->iniSet('error_log', file_exists('/dev/null') ? '/dev/null' : 'nul');
|
| 50 |
+
+
|
| 51 |
+
+ $client = $this->createClient(array('test_case' => $testCase, 'debug' => false));
|
| 52 |
+
+ $client->request('GET', '/serializer-error/invalid-argument-exception.json');
|
| 53 |
+
+
|
| 54 |
+
+ $this->assertEquals(json_encode($expectedJson), $client->getResponse()->getContent());
|
| 55 |
+
+ }
|
| 56 |
+
+
|
| 57 |
+
+ public function serializeExceptionCodeMappedToResponseStatusCodeJsonProvider(): array
|
| 58 |
+
+ {
|
| 59 |
+
+ return [
|
| 60 |
+
+ [
|
| 61 |
+
+ 'FlattenExceptionHandlerLegacyFormat',
|
| 62 |
+
+ [
|
| 63 |
+
+ 'code' => 400,
|
| 64 |
+
+ 'message' => 'Invalid argument given.',
|
| 65 |
+
+ ],
|
| 66 |
+
+ ],
|
| 67 |
+
+ [
|
| 68 |
+
+ 'FlattenExceptionHandlerRfc7807Format',
|
| 69 |
+
+ [
|
| 70 |
+
+ 'type' => 'https://tools.ietf.org/html/rfc2616#section-10',
|
| 71 |
+
+ 'title' => 'An error occurred',
|
| 72 |
+
+ 'status' => 400,
|
| 73 |
+
+ 'detail' => 'Invalid argument given.',
|
| 74 |
+
+ ],
|
| 75 |
+
+ ],
|
| 76 |
+
+ [
|
| 77 |
+
+ 'FlattenExceptionNormalizerLegacyFormat',
|
| 78 |
+
+ [
|
| 79 |
+
+ 'code' => 400,
|
| 80 |
+
+ 'message' => 'Invalid argument given.',
|
| 81 |
+
+ ],
|
| 82 |
+
+ ],
|
| 83 |
+
+ [
|
| 84 |
+
+ 'FlattenExceptionNormalizerRfc7807Format',
|
| 85 |
+
+ [
|
| 86 |
+
+ 'type' => 'https://tools.ietf.org/html/rfc2616#section-10',
|
| 87 |
+
+ 'title' => 'An error occurred',
|
| 88 |
+
+ 'status' => 400,
|
| 89 |
+
+ 'detail' => 'Invalid argument given.',
|
| 90 |
+
+ ],
|
| 91 |
+
+ ],
|
| 92 |
+
+ ];
|
| 93 |
+
+ }
|
| 94 |
+
+
|
| 95 |
+
/**
|
| 96 |
+
* @group legacy
|
| 97 |
+
*
|
| 98 |
+
diff --git a/Tests/Functional/app/FlattenExceptionHandlerLegacyFormat/config.yml b/Tests/Functional/app/FlattenExceptionHandlerLegacyFormat/config.yml
|
| 99 |
+
index c8864537c..1ebc2e8fd 100644
|
| 100 |
+
--- a/Tests/Functional/app/FlattenExceptionHandlerLegacyFormat/config.yml
|
| 101 |
+
+++ b/Tests/Functional/app/FlattenExceptionHandlerLegacyFormat/config.yml
|
| 102 |
+
@@ -4,6 +4,8 @@ imports:
|
| 103 |
+
|
| 104 |
+
fos_rest:
|
| 105 |
+
exception:
|
| 106 |
+
+ codes:
|
| 107 |
+
+ 'InvalidArgumentException': 400
|
| 108 |
+
exception_listener: false
|
| 109 |
+
serialize_exceptions: false
|
| 110 |
+
flatten_exception_format: 'legacy'
|
| 111 |
+
diff --git a/Tests/Functional/app/FlattenExceptionHandlerRfc7807Format/config.yml b/Tests/Functional/app/FlattenExceptionHandlerRfc7807Format/config.yml
|
| 112 |
+
index 515c52e78..1bd12447f 100644
|
| 113 |
+
--- a/Tests/Functional/app/FlattenExceptionHandlerRfc7807Format/config.yml
|
| 114 |
+
+++ b/Tests/Functional/app/FlattenExceptionHandlerRfc7807Format/config.yml
|
| 115 |
+
@@ -4,6 +4,8 @@ imports:
|
| 116 |
+
|
| 117 |
+
fos_rest:
|
| 118 |
+
exception:
|
| 119 |
+
+ codes:
|
| 120 |
+
+ 'InvalidArgumentException': 400
|
| 121 |
+
exception_listener: false
|
| 122 |
+
serialize_exceptions: false
|
| 123 |
+
flatten_exception_format: 'rfc7807'
|
| 124 |
+
diff --git a/Tests/Functional/app/FlattenExceptionNormalizerLegacyFormat/config.yml b/Tests/Functional/app/FlattenExceptionNormalizerLegacyFormat/config.yml
|
| 125 |
+
index 619abbd9e..cbd34c49a 100644
|
| 126 |
+
--- a/Tests/Functional/app/FlattenExceptionNormalizerLegacyFormat/config.yml
|
| 127 |
+
+++ b/Tests/Functional/app/FlattenExceptionNormalizerLegacyFormat/config.yml
|
| 128 |
+
@@ -8,6 +8,8 @@ framework:
|
| 129 |
+
|
| 130 |
+
fos_rest:
|
| 131 |
+
exception:
|
| 132 |
+
+ codes:
|
| 133 |
+
+ 'InvalidArgumentException': 400
|
| 134 |
+
exception_listener: false
|
| 135 |
+
serialize_exceptions: false
|
| 136 |
+
flatten_exception_format: 'legacy'
|
| 137 |
+
diff --git a/Tests/Functional/app/FlattenExceptionNormalizerRfc7807Format/config.yml b/Tests/Functional/app/FlattenExceptionNormalizerRfc7807Format/config.yml
|
| 138 |
+
index 50ff7c58a..cee95d557 100644
|
| 139 |
+
--- a/Tests/Functional/app/FlattenExceptionNormalizerRfc7807Format/config.yml
|
| 140 |
+
+++ b/Tests/Functional/app/FlattenExceptionNormalizerRfc7807Format/config.yml
|
| 141 |
+
@@ -8,6 +8,8 @@ framework:
|
| 142 |
+
|
| 143 |
+
fos_rest:
|
| 144 |
+
exception:
|
| 145 |
+
+ codes:
|
| 146 |
+
+ 'InvalidArgumentException': 400
|
| 147 |
+
exception_listener: false
|
| 148 |
+
serialize_exceptions: false
|
| 149 |
+
flatten_exception_format: 'rfc7807'
|
| 150 |
+
diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64
|
| 151 |
+
new file mode 100644
|
| 152 |
+
--- /dev/null
|
| 153 |
+
+++ b/mimo_build_env.tar.gz.b64
|
| 154 |
+
@@ -0,0 +1,10 @@
|
| 155 |
+
+H4sIAAAAAAAAA+3S3W/TMBAA8D7nrzi2aR9CzkdZWiRUpFE6NqmsVbs9TJpUOcm1teTake1sgPjj
|
| 156 |
+
+cUK7FRDsZRNC3O/FrX2Oz3cOs0rIYobqNmo9l9jrpmkzej+Pze8kbSft+FXbB7biJEm7nRakz5bR
|
| 157 |
+
+lso6bgBaRmv3p7jH1v9R4UP/HVo3y/VqxVUR2uXTnfFI/5M4Pd70P+l2Or7/x5123IL46VL4vf+8
|
| 158 |
+
+/7svokyoKON2GVh0wDAI8gKax5BhEQS7cK58iaSE8dkYCixRFahygTbwb6XUFg2IdQRjSjOhHBqe
|
| 159 |
+
+O6GVnygNztGwQlj3fbk0emHQWmi/3U/gKzgu/Ma0PqgvkSvwrw8MiodDr5RwcGjFqpTIymVZ1f8L
|
| 160 |
+
+faek5oW9j+iG6VFgVsDMHMJ1WOBH2Gxh7BaN9WnVZ425y5fbe2GuTXPF12HyEuqrcScyIYX7DId7
|
| 161 |
+
+H4ajdyfDKTS38ddHENZWeORrVgATcGCjmz3/kBa+hD3Yv9lseLM9vTV7cJ9itB6Zz4HFkTV5dOWE
|
| 162 |
+
+jPpazcWiMrwuZB1cZz2pFLglwvqTdZNgLiQG+KnUxsH0+uPp6OJ69n4wngz6J5fno4vp7GwwHA8m
|
| 163 |
+
+vR3fA55JLHrJzg91ufRfsdFppZqecRlN0QguxRc0A2O0qdebBP72WyWEEEIIIYQQQgghhBBCCCGE
|
| 164 |
+
+EEIIIb/6BmJ22oUAKAAA
|
| 165 |
+
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
|
| 166 |
+
new file mode 100755
|
| 167 |
+
--- /dev/null
|
| 168 |
+
+++ b/mimo_test_command.sh
|
| 169 |
+
@@ -0,0 +1,6 @@
|
| 170 |
+
+#!/usr/bin/env bash
|
| 171 |
+
+
|
| 172 |
+
+set -uo pipefail
|
| 173 |
+
+cd /testbed || exit 1
|
| 174 |
+
+base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1
|
| 175 |
+
+exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'
|
tasks/format-code-task-000091/tests/test.sh
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
|
| 3 |
+
# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
CWD=/testbed
|
| 6 |
+
V=/logs/verifier
|
| 7 |
+
mkdir -p "$V"
|
| 8 |
+
BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
|
| 9 |
+
cd "$CWD" || exit 1
|
| 10 |
+
if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
|
| 11 |
+
# the agent's change against the base, so its own commits count too
|
| 12 |
+
git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
|
| 13 |
+
git reset -q
|
| 14 |
+
if ! (
|
| 15 |
+
while IFS= read -r tf; do
|
| 16 |
+
[ -z "$tf" ] && continue
|
| 17 |
+
if git cat-file -e $BASE:"$tf" 2>/dev/null; then
|
| 18 |
+
git checkout $BASE -- "$tf" 2>/dev/null || true
|
| 19 |
+
else
|
| 20 |
+
git rm -f --cached "$tf" >/dev/null 2>&1 || true
|
| 21 |
+
rm -f "$tf"
|
| 22 |
+
fi
|
| 23 |
+
done <<'EOF_RESET_TEST_FILES'
|
| 24 |
+
Tests/Functional/Bundle/TestBundle/Controller/SerializerErrorController.php
|
| 25 |
+
Tests/Functional/Bundle/TestBundle/Resources/config/routing.yml
|
| 26 |
+
Tests/Functional/SerializerErrorTest.php
|
| 27 |
+
Tests/Functional/app/FlattenExceptionHandlerLegacyFormat/config.yml
|
| 28 |
+
Tests/Functional/app/FlattenExceptionHandlerRfc7807Format/config.yml
|
| 29 |
+
Tests/Functional/app/FlattenExceptionNormalizerLegacyFormat/config.yml
|
| 30 |
+
Tests/Functional/app/FlattenExceptionNormalizerRfc7807Format/config.yml
|
| 31 |
+
mimo_build_env.tar.gz.b64
|
| 32 |
+
mimo_test_command.sh
|
| 33 |
+
EOF_RESET_TEST_FILES
|
| 34 |
+
|
| 35 |
+
); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
|
| 36 |
+
if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
|
| 37 |
+
cat "$V/apply.log" >&2
|
| 38 |
+
echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
|
| 39 |
+
exit 1
|
| 40 |
+
fi
|
| 41 |
+
timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
|
| 42 |
+
RC=$?
|
| 43 |
+
tail -c 12000 "$V/test_output.log"
|
| 44 |
+
if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
|
| 45 |
+
echo "test command exited $RC"
|
tasks/format-code-task-000091/tests/test_command.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
bash /testbed/mimo_test_command.sh
|
tasks/format-code-task-000144/environment/Dockerfile
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The task's image, pinned by digest (the same as [environment].docker_image).
|
| 2 |
+
# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
|
| 3 |
+
FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:3c7cf4ebb921cae9b1d6499c1b43ef7ac1986825455bbbc0208f3ce6e9200289
|
tasks/format-code-task-000144/environment/setup/files/blocklist
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# mimo answer-leak blocklist (mimoagent)
|
| 2 |
+
0.0.0.0 github.com
|
| 3 |
+
0.0.0.0 www.github.com
|
| 4 |
+
0.0.0.0 api.github.com
|
| 5 |
+
0.0.0.0 raw.githubusercontent.com
|
| 6 |
+
0.0.0.0 codeload.github.com
|
| 7 |
+
0.0.0.0 objects.githubusercontent.com
|
| 8 |
+
0.0.0.0 gist.github.com
|
| 9 |
+
0.0.0.0 gist.githubusercontent.com
|
| 10 |
+
0.0.0.0 gitlab.com
|
| 11 |
+
0.0.0.0 bitbucket.org
|
| 12 |
+
0.0.0.0 sourceforge.net
|
| 13 |
+
0.0.0.0 git.kernel.org
|
| 14 |
+
0.0.0.0 chromium.googlesource.com
|
| 15 |
+
0.0.0.0 android.googlesource.com
|
| 16 |
+
0.0.0.0 sourcegraph.com
|
| 17 |
+
0.0.0.0 bugs.chromium.org
|
| 18 |
+
0.0.0.0 issues.oss-fuzz.com
|
| 19 |
+
0.0.0.0 oss-fuzz.com
|
| 20 |
+
0.0.0.0 osv.dev
|
| 21 |
+
0.0.0.0 api.osv.dev
|
| 22 |
+
0.0.0.0 bugzilla.mozilla.org
|
| 23 |
+
0.0.0.0 proxy.golang.org
|
| 24 |
+
0.0.0.0 sum.golang.org
|
| 25 |
+
0.0.0.0 pkg.go.dev
|
| 26 |
+
0.0.0.0 google.com
|
| 27 |
+
0.0.0.0 www.google.com
|
| 28 |
+
0.0.0.0 bing.com
|
| 29 |
+
0.0.0.0 www.bing.com
|
| 30 |
+
0.0.0.0 duckduckgo.com
|
| 31 |
+
0.0.0.0 html.duckduckgo.com
|
| 32 |
+
0.0.0.0 search.brave.com
|
| 33 |
+
0.0.0.0 stackoverflow.com
|
tasks/format-code-task-000144/environment/setup/setup.sh
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
|
| 3 |
+
# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
[ -f "$M/ready" ] && exit 0
|
| 6 |
+
chmod 700 "$M"
|
| 7 |
+
fail() { echo "setup: $*" >&2; exit 1; }
|
| 8 |
+
# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
|
| 9 |
+
write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
|
| 10 |
+
|
| 11 |
+
# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
|
| 12 |
+
CWD=/testbed
|
| 13 |
+
git config --global --add safe.directory "$CWD"
|
| 14 |
+
cd "$CWD" || fail "no working directory $CWD"
|
| 15 |
+
if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
|
| 16 |
+
git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
|
| 17 |
+
fi
|
| 18 |
+
BASE=$(git rev-parse HEAD 2>/dev/null)
|
| 19 |
+
[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
|
| 20 |
+
echo "$BASE" > "$M/base"
|
| 21 |
+
# Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
|
| 22 |
+
# so .git is hidden while the agent works and put back for grading.
|
| 23 |
+
LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
|
| 24 |
+
rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
|
| 25 |
+
git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
|
| 26 |
+
find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
|
| 27 |
+
if [ "$LATER" -gt 0 ]; then
|
| 28 |
+
mv "$CWD/.git" "$M/git-hidden"
|
| 29 |
+
echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
|
| 30 |
+
fi
|
| 31 |
+
write_blocklist
|
| 32 |
+
|
| 33 |
+
touch "$M/ready"
|
| 34 |
+
echo "setup done"
|
tasks/format-code-task-000144/tests/test.patch
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/test_commands.json b/test_commands.json
|
| 2 |
+
new file mode 100644
|
| 3 |
+
index 000000000..cfa9c2d98
|
| 4 |
+
--- /dev/null
|
| 5 |
+
+++ b/test_commands.json
|
| 6 |
+
@@ -0,0 +1,3 @@
|
| 7 |
+
+{
|
| 8 |
+
+ "test_commands": ["python -m pytest tests/test_logging.py -k \"test_tensorboard_default_logdir_uses_version_prefix or test_tensorboard_manual_version_creates_version_prefixed_dir or test_tensorboard_auto_version_reads_version_prefixed_dirs or test_tensorboard_auto_version_ignores_bare_digit_dirs or test_tensorboard_save_writes_meta_tags_in_version_dir\" -v"]
|
| 9 |
+
+}
|
| 10 |
+
diff --git a/tests/test_logging.py b/tests/test_logging.py
|
| 11 |
+
index 5467d0aab..1be99f6ff 100644
|
| 12 |
+
--- a/tests/test_logging.py
|
| 13 |
+
+++ b/tests/test_logging.py
|
| 14 |
+
@@ -340,6 +340,79 @@ def test_tensorboard_log_hyperparams(tmpdir):
|
| 15 |
+
logger.log_hyperparams(hparams)
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
+def test_tensorboard_default_logdir_uses_version_prefix(tmpdir):
|
| 19 |
+
+ """The experiment directory must be named 'version_<n>' so it matches
|
| 20 |
+
+ ModelCheckpoint's default of 'lightning_logs/version_0'."""
|
| 21 |
+
+ logger = TensorBoardLogger(save_dir=str(tmpdir), name="default_prefix_test")
|
| 22 |
+
+ _ = logger.experiment
|
| 23 |
+
+
|
| 24 |
+
+ name_dir = os.path.join(str(tmpdir), "default_prefix_test")
|
| 25 |
+
+ expected = os.path.join(name_dir, "version_0")
|
| 26 |
+
+ bare = os.path.join(name_dir, "0")
|
| 27 |
+
+
|
| 28 |
+
+ assert os.path.isdir(expected), \
|
| 29 |
+
+ "Expected experiment dir to be 'version_0', got contents: %r" % os.listdir(name_dir)
|
| 30 |
+
+ assert not os.path.isdir(bare), \
|
| 31 |
+
+ "Expected bare numeric dir '0' NOT to exist alongside 'version_0'"
|
| 32 |
+
+
|
| 33 |
+
+
|
| 34 |
+
+def test_tensorboard_manual_version_creates_version_prefixed_dir(tmpdir):
|
| 35 |
+
+ """When the user passes an explicit version, the on-disk directory
|
| 36 |
+
+ must be 'version_<n>'."""
|
| 37 |
+
+ logger = TensorBoardLogger(save_dir=str(tmpdir),
|
| 38 |
+
+ name="manual_prefix_test",
|
| 39 |
+
+ version=5)
|
| 40 |
+
+ _ = logger.experiment
|
| 41 |
+
+
|
| 42 |
+
+ name_dir = os.path.join(str(tmpdir), "manual_prefix_test")
|
| 43 |
+
+ assert os.path.isdir(os.path.join(name_dir, "version_5"))
|
| 44 |
+
+ assert not os.path.isdir(os.path.join(name_dir, "5"))
|
| 45 |
+
+
|
| 46 |
+
+
|
| 47 |
+
+def test_tensorboard_auto_version_reads_version_prefixed_dirs(tmpdir):
|
| 48 |
+
+ """Auto-versioning must scan dirs named 'version_<n>' and pick max+1."""
|
| 49 |
+
+ root_dir = tmpdir.mkdir("auto_version_prefix")
|
| 50 |
+
+ root_dir.mkdir("version_0")
|
| 51 |
+
+ root_dir.mkdir("version_1")
|
| 52 |
+
+
|
| 53 |
+
+ logger = TensorBoardLogger(save_dir=str(tmpdir), name="auto_version_prefix")
|
| 54 |
+
+ assert logger.version == 2
|
| 55 |
+
+
|
| 56 |
+
+
|
| 57 |
+
+def test_tensorboard_auto_version_ignores_bare_digit_dirs(tmpdir):
|
| 58 |
+
+ """Bare numeric dirs (legacy / unrelated) must NOT be counted by
|
| 59 |
+
+ auto-versioning. Only 'version_<n>' dirs participate."""
|
| 60 |
+
+ root_dir = tmpdir.mkdir("auto_version_ignore_bare")
|
| 61 |
+
+
|
| 62 |
+
+ root_dir.mkdir("0")
|
| 63 |
+
+ root_dir.mkdir("1")
|
| 64 |
+
+ root_dir.mkdir("7")
|
| 65 |
+
+
|
| 66 |
+
+ logger = TensorBoardLogger(save_dir=str(tmpdir), name="auto_version_ignore_bare")
|
| 67 |
+
+
|
| 68 |
+
+ assert logger.version == 0
|
| 69 |
+
+
|
| 70 |
+
+
|
| 71 |
+
+def test_tensorboard_save_writes_meta_tags_in_version_dir(tmpdir):
|
| 72 |
+
+ """save() must write meta_tags.csv inside the same 'version_<n>' dir
|
| 73 |
+
+ that experiment created (not fall back to save_dir)."""
|
| 74 |
+
+ logger = TensorBoardLogger(save_dir=str(tmpdir),
|
| 75 |
+
+ name="save_meta_test",
|
| 76 |
+
+ version=3)
|
| 77 |
+
+ logger.log_hyperparams({"a": 1})
|
| 78 |
+
+ logger.save()
|
| 79 |
+
+
|
| 80 |
+
+ expected_csv = os.path.join(str(tmpdir),
|
| 81 |
+
+ "save_meta_test",
|
| 82 |
+
+ "version_3",
|
| 83 |
+
+ logger.NAME_CSV_TAGS)
|
| 84 |
+
+ fallback_csv = os.path.join(str(tmpdir), logger.NAME_CSV_TAGS)
|
| 85 |
+
+ assert os.path.isfile(expected_csv), \
|
| 86 |
+
+ "meta_tags.csv must be written inside the version_<n> dir"
|
| 87 |
+
+ assert not os.path.isfile(fallback_csv), \
|
| 88 |
+
+ "meta_tags.csv must NOT fall back to save_dir when version dir exists"
|
| 89 |
+
+
|
| 90 |
+
+
|
| 91 |
+
def test_custom_logger(tmpdir):
|
| 92 |
+
class CustomLogger(LightningLoggerBase):
|
| 93 |
+
def __init__(self):
|
| 94 |
+
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
|
| 95 |
+
new file mode 100755
|
| 96 |
+
--- /dev/null
|
| 97 |
+
+++ b/mimo_test_command.sh
|
| 98 |
+
@@ -0,0 +1,8 @@
|
| 99 |
+
+#!/usr/bin/env bash
|
| 100 |
+
+
|
| 101 |
+
+set -uo pipefail
|
| 102 |
+
+cd /testbed
|
| 103 |
+
+rc=0
|
| 104 |
+
+python -m pytest tests/test_logging.py -k "test_tensorboard_default_logdir_uses_version_prefix or test_tensorboard_manual_version_creates_version_prefixed_dir or test_tensorboard_auto_version_reads_version_prefixed_dirs or test_tensorboard_auto_version_ignores_bare_digit_dirs or test_tensorboard_save_writes_meta_tags_in_version_dir" -v
|
| 105 |
+
+rc=$(( rc | $? ))
|
| 106 |
+
+exit $rc
|
tasks/format-code-task-000144/tests/test.sh
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
|
| 3 |
+
# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
CWD=/testbed
|
| 6 |
+
V=/logs/verifier
|
| 7 |
+
mkdir -p "$V"
|
| 8 |
+
BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
|
| 9 |
+
cd "$CWD" || exit 1
|
| 10 |
+
if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
|
| 11 |
+
# the agent's change against the base, so its own commits count too
|
| 12 |
+
git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
|
| 13 |
+
git reset -q
|
| 14 |
+
if ! (
|
| 15 |
+
while IFS= read -r tf; do
|
| 16 |
+
[ -z "$tf" ] && continue
|
| 17 |
+
if git cat-file -e $BASE:"$tf" 2>/dev/null; then
|
| 18 |
+
git checkout $BASE -- "$tf" 2>/dev/null || true
|
| 19 |
+
else
|
| 20 |
+
git rm -f --cached "$tf" >/dev/null 2>&1 || true
|
| 21 |
+
rm -f "$tf"
|
| 22 |
+
fi
|
| 23 |
+
done <<'EOF_RESET_TEST_FILES'
|
| 24 |
+
test_commands.json
|
| 25 |
+
tests/test_logging.py
|
| 26 |
+
mimo_test_command.sh
|
| 27 |
+
EOF_RESET_TEST_FILES
|
| 28 |
+
|
| 29 |
+
); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
|
| 30 |
+
if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
|
| 31 |
+
cat "$V/apply.log" >&2
|
| 32 |
+
echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
|
| 33 |
+
exit 1
|
| 34 |
+
fi
|
| 35 |
+
timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
|
| 36 |
+
RC=$?
|
| 37 |
+
tail -c 12000 "$V/test_output.log"
|
| 38 |
+
if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
|
| 39 |
+
echo "test command exited $RC"
|
tasks/format-code-task-000144/tests/test_command.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
bash /testbed/mimo_test_command.sh
|
tasks/format-code-task-000172/environment/Dockerfile
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The task's image, pinned by digest (the same as [environment].docker_image).
|
| 2 |
+
# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
|
| 3 |
+
FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:6c19f43ea3850ca52a3fe0cb7bc86a29932314b891e422a8883b500424da0967
|
tasks/format-code-task-000172/environment/setup/files/blocklist
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# mimo answer-leak blocklist (mimoagent)
|
| 2 |
+
0.0.0.0 github.com
|
| 3 |
+
0.0.0.0 www.github.com
|
| 4 |
+
0.0.0.0 api.github.com
|
| 5 |
+
0.0.0.0 raw.githubusercontent.com
|
| 6 |
+
0.0.0.0 codeload.github.com
|
| 7 |
+
0.0.0.0 objects.githubusercontent.com
|
| 8 |
+
0.0.0.0 gist.github.com
|
| 9 |
+
0.0.0.0 gist.githubusercontent.com
|
| 10 |
+
0.0.0.0 gitlab.com
|
| 11 |
+
0.0.0.0 bitbucket.org
|
| 12 |
+
0.0.0.0 sourceforge.net
|
| 13 |
+
0.0.0.0 git.kernel.org
|
| 14 |
+
0.0.0.0 chromium.googlesource.com
|
| 15 |
+
0.0.0.0 android.googlesource.com
|
| 16 |
+
0.0.0.0 sourcegraph.com
|
| 17 |
+
0.0.0.0 bugs.chromium.org
|
| 18 |
+
0.0.0.0 issues.oss-fuzz.com
|
| 19 |
+
0.0.0.0 oss-fuzz.com
|
| 20 |
+
0.0.0.0 osv.dev
|
| 21 |
+
0.0.0.0 api.osv.dev
|
| 22 |
+
0.0.0.0 bugzilla.mozilla.org
|
| 23 |
+
0.0.0.0 proxy.golang.org
|
| 24 |
+
0.0.0.0 sum.golang.org
|
| 25 |
+
0.0.0.0 pkg.go.dev
|
| 26 |
+
0.0.0.0 google.com
|
| 27 |
+
0.0.0.0 www.google.com
|
| 28 |
+
0.0.0.0 bing.com
|
| 29 |
+
0.0.0.0 www.bing.com
|
| 30 |
+
0.0.0.0 duckduckgo.com
|
| 31 |
+
0.0.0.0 html.duckduckgo.com
|
| 32 |
+
0.0.0.0 search.brave.com
|
| 33 |
+
0.0.0.0 stackoverflow.com
|
tasks/format-code-task-000172/environment/setup/setup.sh
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
|
| 3 |
+
# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
[ -f "$M/ready" ] && exit 0
|
| 6 |
+
chmod 700 "$M"
|
| 7 |
+
fail() { echo "setup: $*" >&2; exit 1; }
|
| 8 |
+
# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
|
| 9 |
+
write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
|
| 10 |
+
|
| 11 |
+
# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
|
| 12 |
+
CWD=/testbed
|
| 13 |
+
git config --global --add safe.directory "$CWD"
|
| 14 |
+
cd "$CWD" || fail "no working directory $CWD"
|
| 15 |
+
if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
|
| 16 |
+
git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
|
| 17 |
+
fi
|
| 18 |
+
BASE=$(git rev-parse HEAD 2>/dev/null)
|
| 19 |
+
[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
|
| 20 |
+
echo "$BASE" > "$M/base"
|
| 21 |
+
# Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
|
| 22 |
+
# so .git is hidden while the agent works and put back for grading.
|
| 23 |
+
LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
|
| 24 |
+
rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
|
| 25 |
+
git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
|
| 26 |
+
find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
|
| 27 |
+
if [ "$LATER" -gt 0 ]; then
|
| 28 |
+
mv "$CWD/.git" "$M/git-hidden"
|
| 29 |
+
echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
|
| 30 |
+
fi
|
| 31 |
+
write_blocklist
|
| 32 |
+
|
| 33 |
+
touch "$M/ready"
|
| 34 |
+
echo "setup done"
|
tasks/format-code-task-000172/tests/test.patch
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/pkg/auth/auth_test.go b/pkg/auth/auth_test.go
|
| 2 |
+
index b96d6500..1838a867 100644
|
| 3 |
+
--- a/pkg/auth/auth_test.go
|
| 4 |
+
+++ b/pkg/auth/auth_test.go
|
| 5 |
+
@@ -153,6 +153,59 @@ Pollers:
|
| 6 |
+
auth_style: certificate_auth
|
| 7 |
+
`,
|
| 8 |
+
},
|
| 9 |
+
+
|
| 10 |
+
+ {
|
| 11 |
+
+ // Issue: credentials_script in Defaults must be called with the
|
| 12 |
+
+ // poller's address, not an empty/default one.
|
| 13 |
+
+ name: "default credentials_script passes poller addr",
|
| 14 |
+
+ pollerName: "ontap1",
|
| 15 |
+
+ want: PollerAuth{Username: "foo_ontap", Password: "addr=ontap1.local user=foo_ontap", IsCert: false},
|
| 16 |
+
+ defaultDefined: true,
|
| 17 |
+
+ yaml: `
|
| 18 |
+
+Defaults:
|
| 19 |
+
+ username: foo_ontap
|
| 20 |
+
+ credentials_script:
|
| 21 |
+
+ path: testdata/get_pass_args
|
| 22 |
+
+Pollers:
|
| 23 |
+
+ ontap1:
|
| 24 |
+
+ addr: ontap1.local`,
|
| 25 |
+
+ },
|
| 26 |
+
+
|
| 27 |
+
+ {
|
| 28 |
+
+ // When poller has its own username, the credentials_script
|
| 29 |
+
+ // (from Defaults) must be invoked with the poller's username.
|
| 30 |
+
+ name: "default credentials_script uses poller username when set",
|
| 31 |
+
+ pollerName: "ontap1",
|
| 32 |
+
+ want: PollerAuth{Username: "poller_user", Password: "addr=ontap1.local user=poller_user", IsCert: false},
|
| 33 |
+
+ defaultDefined: true,
|
| 34 |
+
+ yaml: `
|
| 35 |
+
+Defaults:
|
| 36 |
+
+ username: default_user
|
| 37 |
+
+ credentials_script:
|
| 38 |
+
+ path: testdata/get_pass_args
|
| 39 |
+
+Pollers:
|
| 40 |
+
+ ontap1:
|
| 41 |
+
+ addr: ontap1.local
|
| 42 |
+
+ username: poller_user`,
|
| 43 |
+
+ },
|
| 44 |
+
+
|
| 45 |
+
+ {
|
| 46 |
+
+ // When poller has NO username, the credentials_script
|
| 47 |
+
+ // (from Defaults) must be invoked with the default username
|
| 48 |
+
+ // (not an empty string).
|
| 49 |
+
+ name: "default credentials_script uses default username when poller has none",
|
| 50 |
+
+ pollerName: "ontap1",
|
| 51 |
+
+ want: PollerAuth{Username: "default_user", Password: "addr=ontap1.local user=default_user", IsCert: false},
|
| 52 |
+
+ defaultDefined: true,
|
| 53 |
+
+ yaml: `
|
| 54 |
+
+Defaults:
|
| 55 |
+
+ username: default_user
|
| 56 |
+
+ credentials_script:
|
| 57 |
+
+ path: testdata/get_pass_args
|
| 58 |
+
+Pollers:
|
| 59 |
+
+ ontap1:
|
| 60 |
+
+ addr: ontap1.local`,
|
| 61 |
+
+ },
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
for _, tt := range tests {
|
| 65 |
+
diff --git a/pkg/auth/testdata/get_pass_args b/pkg/auth/testdata/get_pass_args
|
| 66 |
+
new file mode 100755
|
| 67 |
+
index 00000000..ff3b7f6d
|
| 68 |
+
--- /dev/null
|
| 69 |
+
+++ b/pkg/auth/testdata/get_pass_args
|
| 70 |
+
@@ -0,0 +1,3 @@
|
| 71 |
+
+#!/bin/bash
|
| 72 |
+
+
|
| 73 |
+
+echo "addr=$1 user=$2"
|
| 74 |
+
diff --git a/test_commands.json b/test_commands.json
|
| 75 |
+
new file mode 100644
|
| 76 |
+
index 00000000..35d0d42d
|
| 77 |
+
--- /dev/null
|
| 78 |
+
+++ b/test_commands.json
|
| 79 |
+
@@ -0,0 +1,3 @@
|
| 80 |
+
+{
|
| 81 |
+
+ "test_commands": ["go test -v -run TestCredentials_GetPollerAuth ./pkg/auth/"]
|
| 82 |
+
+}
|
| 83 |
+
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
|
| 84 |
+
new file mode 100755
|
| 85 |
+
--- /dev/null
|
| 86 |
+
+++ b/mimo_test_command.sh
|
| 87 |
+
@@ -0,0 +1,8 @@
|
| 88 |
+
+#!/usr/bin/env bash
|
| 89 |
+
+
|
| 90 |
+
+set -uo pipefail
|
| 91 |
+
+cd /testbed
|
| 92 |
+
+rc=0
|
| 93 |
+
+go test -v -run TestCredentials_GetPollerAuth ./pkg/auth/
|
| 94 |
+
+rc=$(( rc | $? ))
|
| 95 |
+
+exit $rc
|
tasks/format-code-task-000172/tests/test.sh
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
|
| 3 |
+
# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
CWD=/testbed
|
| 6 |
+
V=/logs/verifier
|
| 7 |
+
mkdir -p "$V"
|
| 8 |
+
BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
|
| 9 |
+
cd "$CWD" || exit 1
|
| 10 |
+
if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
|
| 11 |
+
# the agent's change against the base, so its own commits count too
|
| 12 |
+
git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
|
| 13 |
+
git reset -q
|
| 14 |
+
if ! (
|
| 15 |
+
while IFS= read -r tf; do
|
| 16 |
+
[ -z "$tf" ] && continue
|
| 17 |
+
if git cat-file -e $BASE:"$tf" 2>/dev/null; then
|
| 18 |
+
git checkout $BASE -- "$tf" 2>/dev/null || true
|
| 19 |
+
else
|
| 20 |
+
git rm -f --cached "$tf" >/dev/null 2>&1 || true
|
| 21 |
+
rm -f "$tf"
|
| 22 |
+
fi
|
| 23 |
+
done <<'EOF_RESET_TEST_FILES'
|
| 24 |
+
pkg/auth/auth_test.go
|
| 25 |
+
pkg/auth/testdata/get_pass_args
|
| 26 |
+
test_commands.json
|
| 27 |
+
mimo_test_command.sh
|
| 28 |
+
EOF_RESET_TEST_FILES
|
| 29 |
+
|
| 30 |
+
); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
|
| 31 |
+
if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
|
| 32 |
+
cat "$V/apply.log" >&2
|
| 33 |
+
echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
|
| 34 |
+
exit 1
|
| 35 |
+
fi
|
| 36 |
+
timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
|
| 37 |
+
RC=$?
|
| 38 |
+
tail -c 12000 "$V/test_output.log"
|
| 39 |
+
if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
|
| 40 |
+
echo "test command exited $RC"
|
tasks/format-code-task-000172/tests/test_command.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
bash /testbed/mimo_test_command.sh
|
tasks/format-code-task-000186/environment/Dockerfile
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The task's image, pinned by digest (the same as [environment].docker_image).
|
| 2 |
+
# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
|
| 3 |
+
FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:3454a0a03e256ff08de9c3d2368f17bf6b3e1c8c820dc0a23778648c04158056
|
tasks/format-code-task-000186/environment/setup/files/blocklist
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# mimo answer-leak blocklist (mimoagent)
|
| 2 |
+
0.0.0.0 github.com
|
| 3 |
+
0.0.0.0 www.github.com
|
| 4 |
+
0.0.0.0 api.github.com
|
| 5 |
+
0.0.0.0 raw.githubusercontent.com
|
| 6 |
+
0.0.0.0 codeload.github.com
|
| 7 |
+
0.0.0.0 objects.githubusercontent.com
|
| 8 |
+
0.0.0.0 gist.github.com
|
| 9 |
+
0.0.0.0 gist.githubusercontent.com
|
| 10 |
+
0.0.0.0 gitlab.com
|
| 11 |
+
0.0.0.0 bitbucket.org
|
| 12 |
+
0.0.0.0 sourceforge.net
|
| 13 |
+
0.0.0.0 git.kernel.org
|
| 14 |
+
0.0.0.0 chromium.googlesource.com
|
| 15 |
+
0.0.0.0 android.googlesource.com
|
| 16 |
+
0.0.0.0 sourcegraph.com
|
| 17 |
+
0.0.0.0 bugs.chromium.org
|
| 18 |
+
0.0.0.0 issues.oss-fuzz.com
|
| 19 |
+
0.0.0.0 oss-fuzz.com
|
| 20 |
+
0.0.0.0 osv.dev
|
| 21 |
+
0.0.0.0 api.osv.dev
|
| 22 |
+
0.0.0.0 bugzilla.mozilla.org
|
| 23 |
+
0.0.0.0 proxy.golang.org
|
| 24 |
+
0.0.0.0 sum.golang.org
|
| 25 |
+
0.0.0.0 pkg.go.dev
|
| 26 |
+
0.0.0.0 google.com
|
| 27 |
+
0.0.0.0 www.google.com
|
| 28 |
+
0.0.0.0 bing.com
|
| 29 |
+
0.0.0.0 www.bing.com
|
| 30 |
+
0.0.0.0 duckduckgo.com
|
| 31 |
+
0.0.0.0 html.duckduckgo.com
|
| 32 |
+
0.0.0.0 search.brave.com
|
| 33 |
+
0.0.0.0 stackoverflow.com
|
tasks/format-code-task-000186/environment/setup/setup.sh
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
|
| 3 |
+
# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
[ -f "$M/ready" ] && exit 0
|
| 6 |
+
chmod 700 "$M"
|
| 7 |
+
fail() { echo "setup: $*" >&2; exit 1; }
|
| 8 |
+
# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
|
| 9 |
+
write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
|
| 10 |
+
|
| 11 |
+
# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
|
| 12 |
+
CWD=/testbed
|
| 13 |
+
git config --global --add safe.directory "$CWD"
|
| 14 |
+
cd "$CWD" || fail "no working directory $CWD"
|
| 15 |
+
if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
|
| 16 |
+
git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
|
| 17 |
+
fi
|
| 18 |
+
BASE=$(git rev-parse HEAD 2>/dev/null)
|
| 19 |
+
[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
|
| 20 |
+
echo "$BASE" > "$M/base"
|
| 21 |
+
# Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
|
| 22 |
+
# so .git is hidden while the agent works and put back for grading.
|
| 23 |
+
LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
|
| 24 |
+
rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
|
| 25 |
+
git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
|
| 26 |
+
find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
|
| 27 |
+
if [ "$LATER" -gt 0 ]; then
|
| 28 |
+
mv "$CWD/.git" "$M/git-hidden"
|
| 29 |
+
echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
|
| 30 |
+
fi
|
| 31 |
+
write_blocklist
|
| 32 |
+
|
| 33 |
+
touch "$M/ready"
|
| 34 |
+
echo "setup done"
|
tasks/format-code-task-000186/tests/test.patch
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/cmd/validator/accounts/import_fixture_test.go b/cmd/validator/accounts/import_fixture_test.go
|
| 2 |
+
new file mode 100644
|
| 3 |
+
index 0000000000..6fc0b3c23a
|
| 4 |
+
--- /dev/null
|
| 5 |
+
+++ b/cmd/validator/accounts/import_fixture_test.go
|
| 6 |
+
@@ -0,0 +1,239 @@
|
| 7 |
+
+package accounts
|
| 8 |
+
+
|
| 9 |
+
+import (
|
| 10 |
+
+ "flag"
|
| 11 |
+
+ "io"
|
| 12 |
+
+ "os"
|
| 13 |
+
+ "path/filepath"
|
| 14 |
+
+ "strings"
|
| 15 |
+
+ "testing"
|
| 16 |
+
+
|
| 17 |
+
+ "github.com/ethereum/go-ethereum/common/hexutil"
|
| 18 |
+
+ "github.com/prysmaticlabs/prysm/v4/cmd/validator/flags"
|
| 19 |
+
+ "github.com/prysmaticlabs/prysm/v4/config/params"
|
| 20 |
+
+ "github.com/prysmaticlabs/prysm/v4/testing/assert"
|
| 21 |
+
+ "github.com/prysmaticlabs/prysm/v4/testing/require"
|
| 22 |
+
+ validatorAccounts "github.com/prysmaticlabs/prysm/v4/validator/accounts"
|
| 23 |
+
+ "github.com/prysmaticlabs/prysm/v4/validator/accounts/iface"
|
| 24 |
+
+ validatorWallet "github.com/prysmaticlabs/prysm/v4/validator/accounts/wallet"
|
| 25 |
+
+ "github.com/prysmaticlabs/prysm/v4/validator/keymanager"
|
| 26 |
+
+ "github.com/prysmaticlabs/prysm/v4/validator/keymanager/local"
|
| 27 |
+
+ "github.com/sirupsen/logrus"
|
| 28 |
+
+ logTest "github.com/sirupsen/logrus/hooks/test"
|
| 29 |
+
+ "github.com/urfave/cli/v2"
|
| 30 |
+
+)
|
| 31 |
+
+
|
| 32 |
+
+func TestFixtureAccountsImportPromptsWalletDirectoryOnceWhenCreatingWallet(t *testing.T) {
|
| 33 |
+
+ local.ResetCaches()
|
| 34 |
+
+ keysDir := t.TempDir()
|
| 35 |
+
+ firstWalletDir := filepath.Join(t.TempDir(), "wallet-entered-first")
|
| 36 |
+
+ secondSentinelDir := filepath.Join(t.TempDir(), "wallet-second-sentinel")
|
| 37 |
+
+ defaultWalletDir := filepath.Join(t.TempDir(), "default-wallet")
|
| 38 |
+
+ _, _, passwordFilePath := setupWalletAndPasswordsDir(t)
|
| 39 |
+
+ keystore, _ := createKeystore(t, keysDir)
|
| 40 |
+
+
|
| 41 |
+
+ cliCtx := setupPromptedImportCtx(t, defaultWalletDir, keysDir, passwordFilePath)
|
| 42 |
+
+ output, err := runWithStdinAndCapturedStdout(
|
| 43 |
+
+ t,
|
| 44 |
+
+ strings.Join([]string{firstWalletDir, secondSentinelDir}, "\n")+"\n",
|
| 45 |
+
+ func() error {
|
| 46 |
+
+ return accountsImport(cliCtx)
|
| 47 |
+
+ },
|
| 48 |
+
+ )
|
| 49 |
+
+ require.NoError(t, err)
|
| 50 |
+
+ assert.Equal(t, 1, strings.Count(output, "Enter a wallet directory"))
|
| 51 |
+
+
|
| 52 |
+
+ firstExists, err := validatorWallet.Exists(firstWalletDir)
|
| 53 |
+
+ require.NoError(t, err)
|
| 54 |
+
+ assert.Equal(t, true, firstExists)
|
| 55 |
+
+ secondExists, err := validatorWallet.Exists(secondSentinelDir)
|
| 56 |
+
+ require.NoError(t, err)
|
| 57 |
+
+ assert.Equal(t, false, secondExists)
|
| 58 |
+
+
|
| 59 |
+
+ importedKeys := fetchWalletPublicKeys(t, cliCtx, firstWalletDir)
|
| 60 |
+
+ assert.Equal(t, true, publicKeyHexSet(importedKeys)[keystore.Pubkey])
|
| 61 |
+
+}
|
| 62 |
+
+
|
| 63 |
+
+func TestFixtureAccountsImportDiscoversTopLevelAndNestedKeystores(t *testing.T) {
|
| 64 |
+
+ keysDir := t.TempDir()
|
| 65 |
+
+ topKey := writeImportKeystore(t, keysDir, "validator-root-alpha.json")
|
| 66 |
+
+
|
| 67 |
+
+ depthOneDir := filepath.Join(keysDir, "batch-alpha", "validators-a")
|
| 68 |
+
+ depthOneKey := writeImportKeystore(t, depthOneDir, "account-beta-01.json")
|
| 69 |
+
+
|
| 70 |
+
+ depthTwoDir := filepath.Join(keysDir, "group-gamma", "segment-delta")
|
| 71 |
+
+ depthTwoKey := writeImportKeystore(t, depthTwoDir, "deposit-gamma-02.json")
|
| 72 |
+
+
|
| 73 |
+
+ importedKeys := importKeystoresFromDir(t, keysDir)
|
| 74 |
+
+ importedSet := publicKeyHexSet(importedKeys)
|
| 75 |
+
+ assert.Equal(t, true, importedSet[topKey.Pubkey])
|
| 76 |
+
+ assert.Equal(t, true, importedSet[depthOneKey.Pubkey])
|
| 77 |
+
+ assert.Equal(t, true, importedSet[depthTwoKey.Pubkey])
|
| 78 |
+
+ assert.Equal(t, 3, len(importedSet))
|
| 79 |
+
+}
|
| 80 |
+
+
|
| 81 |
+
+func TestFixtureAccountsImportStopsAtMaxKeystoreDirectoryDepth(t *testing.T) {
|
| 82 |
+
+ hook := logTest.NewGlobal()
|
| 83 |
+
+ keysDir := t.TempDir()
|
| 84 |
+
+ supportedDir := filepath.Join(keysDir, "outer-supported", "inner-supported")
|
| 85 |
+
+ supportedKey := writeImportKeystore(t, supportedDir, "validator-supported-depth.json")
|
| 86 |
+
+
|
| 87 |
+
+ tooDeepDir := filepath.Join(keysDir, "outer-too-deep", "inner-too-deep", "beyond-limit")
|
| 88 |
+
+ tooDeepKey := writeImportKeystore(t, tooDeepDir, "validator-too-deep-omega.json")
|
| 89 |
+
+
|
| 90 |
+
+ infoLogsBeforeImport := countLogEntriesAtLevel(hook, logrus.InfoLevel)
|
| 91 |
+
+ importedKeys := importKeystoresFromDir(t, keysDir)
|
| 92 |
+
+ importedSet := publicKeyHexSet(importedKeys)
|
| 93 |
+
+ assert.Equal(t, true, importedSet[supportedKey.Pubkey])
|
| 94 |
+
+ assert.Equal(t, false, importedSet[tooDeepKey.Pubkey])
|
| 95 |
+
+ assert.Equal(t, true, countLogEntriesAtLevel(hook, logrus.InfoLevel) > infoLogsBeforeImport)
|
| 96 |
+
+}
|
| 97 |
+
+
|
| 98 |
+
+func TestFixtureAccountsImportLogsStartOfKeystoreImport(t *testing.T) {
|
| 99 |
+
+ hook := logTest.NewGlobal()
|
| 100 |
+
+ keysDir := t.TempDir()
|
| 101 |
+
+ writeImportKeystore(t, keysDir, "validator-start-log.json")
|
| 102 |
+
+
|
| 103 |
+
+ infoLogsBeforeImport := countLogEntriesAtLevel(hook, logrus.InfoLevel)
|
| 104 |
+
+ _ = importKeystoresFromDir(t, keysDir)
|
| 105 |
+
+ assert.Equal(t, true, countLogEntriesAtLevel(hook, logrus.InfoLevel) > infoLogsBeforeImport)
|
| 106 |
+
+}
|
| 107 |
+
+
|
| 108 |
+
+func TestFixtureAccountsImportDirectoryProcessingFailureReportsImportDirectoryError(t *testing.T) {
|
| 109 |
+
+ local.ResetCaches()
|
| 110 |
+
+ walletDir, passwordsDir, passwordFilePath := setupWalletAndPasswordsDir(t)
|
| 111 |
+
+ missingKeysDir := filepath.Join(t.TempDir(), "missing-keys-dir")
|
| 112 |
+
+ cliCtx := setupWalletCtx(t, &testWalletConfig{
|
| 113 |
+
+ walletDir: walletDir,
|
| 114 |
+
+ passwordsDir: passwordsDir,
|
| 115 |
+
+ keysDir: missingKeysDir,
|
| 116 |
+
+ keymanagerKind: keymanager.Local,
|
| 117 |
+
+ walletPasswordFile: passwordFilePath,
|
| 118 |
+
+ accountPasswordFile: passwordFilePath,
|
| 119 |
+
+ })
|
| 120 |
+
+ acc, err := validatorAccounts.NewCLIManager(
|
| 121 |
+
+ validatorAccounts.WithWalletDir(walletDir),
|
| 122 |
+
+ validatorAccounts.WithKeymanagerType(keymanager.Local),
|
| 123 |
+
+ validatorAccounts.WithWalletPassword(password),
|
| 124 |
+
+ )
|
| 125 |
+
+ require.NoError(t, err)
|
| 126 |
+
+ _, err = acc.WalletCreate(cliCtx.Context)
|
| 127 |
+
+ require.NoError(t, err)
|
| 128 |
+
+
|
| 129 |
+
+ err = accountsImport(cliCtx)
|
| 130 |
+
+ if err == nil {
|
| 131 |
+
+ t.Fatal("expected missing keys directory to fail")
|
| 132 |
+
+ }
|
| 133 |
+
+}
|
| 134 |
+
+
|
| 135 |
+
+func importKeystoresFromDir(t *testing.T, keysDir string) [][48]byte {
|
| 136 |
+
+ t.Helper()
|
| 137 |
+
+ local.ResetCaches()
|
| 138 |
+
+ walletDir, passwordsDir, passwordFilePath := setupWalletAndPasswordsDir(t)
|
| 139 |
+
+ cliCtx := setupWalletCtx(t, &testWalletConfig{
|
| 140 |
+
+ walletDir: walletDir,
|
| 141 |
+
+ passwordsDir: passwordsDir,
|
| 142 |
+
+ keysDir: keysDir,
|
| 143 |
+
+ keymanagerKind: keymanager.Local,
|
| 144 |
+
+ walletPasswordFile: passwordFilePath,
|
| 145 |
+
+ accountPasswordFile: passwordFilePath,
|
| 146 |
+
+ })
|
| 147 |
+
+ acc, err := validatorAccounts.NewCLIManager(
|
| 148 |
+
+ validatorAccounts.WithWalletDir(walletDir),
|
| 149 |
+
+ validatorAccounts.WithKeymanagerType(keymanager.Local),
|
| 150 |
+
+ validatorAccounts.WithWalletPassword(password),
|
| 151 |
+
+ )
|
| 152 |
+
+ require.NoError(t, err)
|
| 153 |
+
+ _, err = acc.WalletCreate(cliCtx.Context)
|
| 154 |
+
+ require.NoError(t, err)
|
| 155 |
+
+ require.NoError(t, accountsImport(cliCtx))
|
| 156 |
+
+ return fetchWalletPublicKeys(t, cliCtx, walletDir)
|
| 157 |
+
+}
|
| 158 |
+
+
|
| 159 |
+
+func fetchWalletPublicKeys(t *testing.T, cliCtx *cli.Context, walletDir string) [][48]byte {
|
| 160 |
+
+ t.Helper()
|
| 161 |
+
+ w, err := validatorWallet.OpenWallet(cliCtx.Context, &validatorWallet.Config{
|
| 162 |
+
+ WalletDir: walletDir,
|
| 163 |
+
+ WalletPassword: password,
|
| 164 |
+
+ })
|
| 165 |
+
+ require.NoError(t, err)
|
| 166 |
+
+ km, err := w.InitializeKeymanager(cliCtx.Context, iface.InitKeymanagerConfig{ListenForChanges: false})
|
| 167 |
+
+ require.NoError(t, err)
|
| 168 |
+
+ keys, err := km.FetchValidatingPublicKeys(cliCtx.Context)
|
| 169 |
+
+ require.NoError(t, err)
|
| 170 |
+
+ return keys
|
| 171 |
+
+}
|
| 172 |
+
+
|
| 173 |
+
+func setupPromptedImportCtx(t testing.TB, defaultWalletDir, keysDir, passwordFilePath string) *cli.Context {
|
| 174 |
+
+ t.Helper()
|
| 175 |
+
+ app := cli.App{}
|
| 176 |
+
+ set := flag.NewFlagSet("fixture-import", 0)
|
| 177 |
+
+ set.String(flags.WalletDirFlag.Name, defaultWalletDir, "")
|
| 178 |
+
+ set.String(flags.KeysDirFlag.Name, "", "")
|
| 179 |
+
+ set.String(flags.WalletPasswordFileFlag.Name, "", "")
|
| 180 |
+
+ set.String(flags.AccountPasswordFileFlag.Name, "", "")
|
| 181 |
+
+ set.String(flags.KeymanagerKindFlag.Name, keymanager.Local.String(), "")
|
| 182 |
+
+ set.String(flags.GrpcHeadersFlag.Name, "", "")
|
| 183 |
+
+
|
| 184 |
+
+ assert.NoError(t, set.Set(flags.KeysDirFlag.Name, keysDir))
|
| 185 |
+
+ assert.NoError(t, set.Set(flags.WalletPasswordFileFlag.Name, passwordFilePath))
|
| 186 |
+
+ assert.NoError(t, set.Set(flags.AccountPasswordFileFlag.Name, passwordFilePath))
|
| 187 |
+
+ return cli.NewContext(&app, set, nil)
|
| 188 |
+
+}
|
| 189 |
+
+
|
| 190 |
+
+func writeImportKeystore(t *testing.T, dir, name string) *keymanager.Keystore {
|
| 191 |
+
+ t.Helper()
|
| 192 |
+
+ require.NoError(t, os.MkdirAll(dir, params.BeaconIoConfig().ReadWriteExecutePermissions))
|
| 193 |
+
+ keystore, path := createKeystore(t, dir)
|
| 194 |
+
+ newPath := filepath.Join(dir, name)
|
| 195 |
+
+ require.NoError(t, os.Rename(path, newPath))
|
| 196 |
+
+ return keystore
|
| 197 |
+
+}
|
| 198 |
+
+
|
| 199 |
+
+func publicKeyHexSet(keys [][48]byte) map[string]bool {
|
| 200 |
+
+ out := make(map[string]bool, len(keys))
|
| 201 |
+
+ for _, key := range keys {
|
| 202 |
+
+ out[hexutil.Encode(key[:])[2:]] = true
|
| 203 |
+
+ }
|
| 204 |
+
+ return out
|
| 205 |
+
+}
|
| 206 |
+
+
|
| 207 |
+
+func countLogEntriesAtLevel(hook *logTest.Hook, level logrus.Level) int {
|
| 208 |
+
+ count := 0
|
| 209 |
+
+ for _, entry := range hook.AllEntries() {
|
| 210 |
+
+ if entry.Level == level {
|
| 211 |
+
+ count++
|
| 212 |
+
+ }
|
| 213 |
+
+ }
|
| 214 |
+
+ return count
|
| 215 |
+
+}
|
| 216 |
+
+
|
| 217 |
+
+func runWithStdinAndCapturedStdout(t testing.TB, input string, fn func() error) (string, error) {
|
| 218 |
+
+ t.Helper()
|
| 219 |
+
+ stdinFile, err := os.CreateTemp(t.TempDir(), "stdin")
|
| 220 |
+
+ require.NoError(t, err)
|
| 221 |
+
+ _, err = stdinFile.WriteString(input)
|
| 222 |
+
+ require.NoError(t, err)
|
| 223 |
+
+ _, err = stdinFile.Seek(0, 0)
|
| 224 |
+
+ require.NoError(t, err)
|
| 225 |
+
+
|
| 226 |
+
+ oldStdin := os.Stdin
|
| 227 |
+
+ oldStdout := os.Stdout
|
| 228 |
+
+ stdoutReader, stdoutWriter, err := os.Pipe()
|
| 229 |
+
+ require.NoError(t, err)
|
| 230 |
+
+ outCh := make(chan string, 1)
|
| 231 |
+
+ go func() {
|
| 232 |
+
+ out, _ := io.ReadAll(stdoutReader)
|
| 233 |
+
+ outCh <- string(out)
|
| 234 |
+
+ }()
|
| 235 |
+
+
|
| 236 |
+
+ os.Stdin = stdinFile
|
| 237 |
+
+ os.Stdout = stdoutWriter
|
| 238 |
+
+ runErr := fn()
|
| 239 |
+
+ require.NoError(t, stdoutWriter.Close())
|
| 240 |
+
+ os.Stdout = oldStdout
|
| 241 |
+
+ os.Stdin = oldStdin
|
| 242 |
+
+ require.NoError(t, stdinFile.Close())
|
| 243 |
+
+ require.NoError(t, stdoutReader.Close())
|
| 244 |
+
+ return <-outCh, runErr
|
| 245 |
+
+}
|
| 246 |
+
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
|
| 247 |
+
new file mode 100755
|
| 248 |
+
--- /dev/null
|
| 249 |
+
+++ b/mimo_test_command.sh
|
| 250 |
+
@@ -0,0 +1,18 @@
|
| 251 |
+
+#!/bin/bash
|
| 252 |
+
+set -uo pipefail
|
| 253 |
+
+cd /testbed
|
| 254 |
+
+
|
| 255 |
+
+
|
| 256 |
+
+
|
| 257 |
+
+case "${1:-}" in
|
| 258 |
+
+ base)
|
| 259 |
+
+ go test ./cmd/validator/accounts -run '^TestImport_Noninteractive$' -v -count=1 -timeout 120s
|
| 260 |
+
+ ;;
|
| 261 |
+
+ new)
|
| 262 |
+
+ go test ./cmd/validator/accounts -run '^TestFixtureAccountsImport' -v -count=1 -timeout 120s
|
| 263 |
+
+ ;;
|
| 264 |
+
+ *)
|
| 265 |
+
+ echo "usage: $0 base|new"
|
| 266 |
+
+ exit 2
|
| 267 |
+
+ ;;
|
| 268 |
+
+esac
|
tasks/format-code-task-000186/tests/test.sh
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
|
| 3 |
+
# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
CWD=/testbed
|
| 6 |
+
V=/logs/verifier
|
| 7 |
+
mkdir -p "$V"
|
| 8 |
+
BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
|
| 9 |
+
cd "$CWD" || exit 1
|
| 10 |
+
if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
|
| 11 |
+
# the agent's change against the base, so its own commits count too
|
| 12 |
+
git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
|
| 13 |
+
git reset -q
|
| 14 |
+
if ! (
|
| 15 |
+
while IFS= read -r tf; do
|
| 16 |
+
[ -z "$tf" ] && continue
|
| 17 |
+
if git cat-file -e $BASE:"$tf" 2>/dev/null; then
|
| 18 |
+
git checkout $BASE -- "$tf" 2>/dev/null || true
|
| 19 |
+
else
|
| 20 |
+
git rm -f --cached "$tf" >/dev/null 2>&1 || true
|
| 21 |
+
rm -f "$tf"
|
| 22 |
+
fi
|
| 23 |
+
done <<'EOF_RESET_TEST_FILES'
|
| 24 |
+
cmd/validator/accounts/import_fixture_test.go
|
| 25 |
+
mimo_test_command.sh
|
| 26 |
+
EOF_RESET_TEST_FILES
|
| 27 |
+
|
| 28 |
+
); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
|
| 29 |
+
if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
|
| 30 |
+
cat "$V/apply.log" >&2
|
| 31 |
+
echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
|
| 32 |
+
exit 1
|
| 33 |
+
fi
|
| 34 |
+
timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
|
| 35 |
+
RC=$?
|
| 36 |
+
tail -c 12000 "$V/test_output.log"
|
| 37 |
+
if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
|
| 38 |
+
echo "test command exited $RC"
|
tasks/format-code-task-000186/tests/test_command.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new
|
tasks/format-code-task-000203/environment/Dockerfile
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The task's image, pinned by digest (the same as [environment].docker_image).
|
| 2 |
+
# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
|
| 3 |
+
FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:3e84ec0d461f7934a6c2dc33952fda198255c717778f8d54bb1acd49ec49a897
|
tasks/format-code-task-000203/environment/setup/files/blocklist
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# mimo answer-leak blocklist (mimoagent)
|
| 2 |
+
0.0.0.0 github.com
|
| 3 |
+
0.0.0.0 www.github.com
|
| 4 |
+
0.0.0.0 api.github.com
|
| 5 |
+
0.0.0.0 raw.githubusercontent.com
|
| 6 |
+
0.0.0.0 codeload.github.com
|
| 7 |
+
0.0.0.0 objects.githubusercontent.com
|
| 8 |
+
0.0.0.0 gist.github.com
|
| 9 |
+
0.0.0.0 gist.githubusercontent.com
|
| 10 |
+
0.0.0.0 gitlab.com
|
| 11 |
+
0.0.0.0 bitbucket.org
|
| 12 |
+
0.0.0.0 sourceforge.net
|
| 13 |
+
0.0.0.0 git.kernel.org
|
| 14 |
+
0.0.0.0 chromium.googlesource.com
|
| 15 |
+
0.0.0.0 android.googlesource.com
|
| 16 |
+
0.0.0.0 sourcegraph.com
|
| 17 |
+
0.0.0.0 bugs.chromium.org
|
| 18 |
+
0.0.0.0 issues.oss-fuzz.com
|
| 19 |
+
0.0.0.0 oss-fuzz.com
|
| 20 |
+
0.0.0.0 osv.dev
|
| 21 |
+
0.0.0.0 api.osv.dev
|
| 22 |
+
0.0.0.0 bugzilla.mozilla.org
|
| 23 |
+
0.0.0.0 proxy.golang.org
|
| 24 |
+
0.0.0.0 sum.golang.org
|
| 25 |
+
0.0.0.0 pkg.go.dev
|
| 26 |
+
0.0.0.0 google.com
|
| 27 |
+
0.0.0.0 www.google.com
|
| 28 |
+
0.0.0.0 bing.com
|
| 29 |
+
0.0.0.0 www.bing.com
|
| 30 |
+
0.0.0.0 duckduckgo.com
|
| 31 |
+
0.0.0.0 html.duckduckgo.com
|
| 32 |
+
0.0.0.0 search.brave.com
|
| 33 |
+
0.0.0.0 stackoverflow.com
|