ForgeBench v1: 100 tasks (api/mixin/migration/debug/build) + harness, verified 19/19
Browse files- README.md +85 -0
- VERIFICATION.md +48 -0
- data/forgebench_full.jsonl +0 -0
- data/schema_example.jsonl +3 -0
- harness/Dockerfile +60 -0
- harness/ast_eval.py +216 -0
- harness/gametest_runner.py +166 -0
- harness/judge_prompt.txt +79 -0
- harness/requirements.txt +4 -0
- harness/run_benchmark.py +141 -0
- harness/sandbox_runner.py +195 -0
- template/build.gradle.kts +41 -0
- template/gradle.properties +3 -0
- template/settings.gradle.kts +8 -0
- template/src/main/resources/META-INF/neoforge.mods.toml +26 -0
- template/src/main/resources/examplemod.mixins.json +13 -0
- verification_result.json +101 -0
README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ForgeBench v1 — independent benchmark for Minecraft-modding LLMs
|
| 2 |
+
|
| 3 |
+
Contamination-free evaluation benchmark for models fine-tuned on the
|
| 4 |
+
`ComerX/forge-neoforge-sft-*` dataset family. Targets **NeoForge 1.21.1** and
|
| 5 |
+
**Forge 1.20.1** (Mojang mappings). 100 tasks, 5 modules × 20.
|
| 6 |
+
|
| 7 |
+
## Layout
|
| 8 |
+
|
| 9 |
+
```
|
| 10 |
+
data/
|
| 11 |
+
forgebench_full.jsonl # 100 tasks (single JSONL, one task per line)
|
| 12 |
+
schema_example.jsonl # 3 complete examples (Mixin / Migration / Crash log)
|
| 13 |
+
harness/
|
| 14 |
+
Dockerfile # sandbox image: JDK 21 + Gradle 8.9 + prebuilt MDK template
|
| 15 |
+
sandbox_runner.py # injects answer into MDK -> ./gradlew build -x test -> Pass@1
|
| 16 |
+
ast_eval.py # javalang AST gate: syntax, forbidden APIs, hallucinated
|
| 17 |
+
# imports, required annotations, version-mix penalties
|
| 18 |
+
gametest_runner.py # GameTest template generation + headless run
|
| 19 |
+
judge_prompt.txt # strict LLM-as-a-judge rubric for debug/build tasks
|
| 20 |
+
run_benchmark.py # driver: aggregates sandbox + AST + judge into a report
|
| 21 |
+
requirements.txt
|
| 22 |
+
template/ # minimal NeoForge 1.21.1 MDK (NeoGradle 7 userdev)
|
| 23 |
+
VERIFICATION.md # benchmark self-verification results (19/19)
|
| 24 |
+
verification_result.json # machine-readable check log
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
## Task schema (strict)
|
| 28 |
+
|
| 29 |
+
```json
|
| 30 |
+
{
|
| 31 |
+
"task_id": "MIXIN_014",
|
| 32 |
+
"module": "api | mixin | migration | debug | build",
|
| 33 |
+
"instruction": "prompt given to the evaluated LLM",
|
| 34 |
+
"context": "vanilla snippet / crash log / legacy code (may be empty)",
|
| 35 |
+
"golden_reference": "reference answer",
|
| 36 |
+
"eval_criteria": {
|
| 37 |
+
"must_compile": true,
|
| 38 |
+
"required_annotations": ["@Inject"],
|
| 39 |
+
"forbidden_apis": ["net.minecraft.util.text"],
|
| 40 |
+
"gametest_required": false
|
| 41 |
+
}
|
| 42 |
+
}
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
## Modules
|
| 46 |
+
|
| 47 |
+
| Module | Count | Task type | Grading |
|
| 48 |
+
|---|---|---|---|
|
| 49 |
+
| `api` (API & registration) | 20 | instruction→code | compile + AST gate |
|
| 50 |
+
| `mixin` (Mojmap targets) | 20 | FIM / translation | compile + AST gate |
|
| 51 |
+
| `migration` (1.20.1→1.21.1) | 20 | refactoring | compile + AST gate (legacy APIs forbidden) |
|
| 52 |
+
| `debug` (FML crash logs) | 20 | log analysis → JSON | judge + JSON-shape gate |
|
| 53 |
+
| `build` (Gradle KTS / mods.toml) | 20 | config generation | judge + required-token gate |
|
| 54 |
+
|
| 55 |
+
## Running
|
| 56 |
+
|
| 57 |
+
```bash
|
| 58 |
+
# 0. build the sandbox image (once)
|
| 59 |
+
docker build -t forgebench-sandbox:1.21.1 .
|
| 60 |
+
|
| 61 |
+
# 1. produce answers.jsonl: {"task_id": ..., "answer": ...} per row
|
| 62 |
+
|
| 63 |
+
# 2a. offline static gate only
|
| 64 |
+
python3 harness/run_benchmark.py --data data/forgebench_full.jsonl \
|
| 65 |
+
--answers answers.jsonl --skip-compile --out report.json
|
| 66 |
+
|
| 67 |
+
# 2b. full compile evaluation (inside Docker)
|
| 68 |
+
python3 harness/run_benchmark.py --data data/forgebench_full.jsonl \
|
| 69 |
+
--answers answers.jsonl --out report.json
|
| 70 |
+
|
| 71 |
+
# 3. judge-graded tasks (debug/build): run your judge LLM with harness/judge_prompt.txt
|
| 72 |
+
# and pass scores via --scores '{"DEBUG_004": {"score": 9, "verdict": "pass"}, ...}'
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
## Contamination status
|
| 76 |
+
|
| 77 |
+
Golden references and instructions were screened against the public SFT corpus
|
| 78 |
+
(`ComerX/forge-neoforge-sft-v2.1.0-rc2` + `-rc1`, sampled shards): **0 hits**
|
| 79 |
+
(normalized 300-char prefix containment). The benchmark tasks are synthetic
|
| 80 |
+
examples, not derived from any corpus repository.
|
| 81 |
+
|
| 82 |
+
## Integrity
|
| 83 |
+
|
| 84 |
+
- Frozen artifact: `SHA256SUMS.txt` (published alongside the dataset).
|
| 85 |
+
- The benchmark is immutable once published; changes require a new version tag.
|
VERIFICATION.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ForgeBench v1 — Verification Report
|
| 2 |
+
|
| 3 |
+
- Date: 2026-10-27T08:16:51
|
| 4 |
+
- Scope: dataset (100 tasks) + evaluation harness (offline tests)
|
| 5 |
+
- Result: **19/19 checks passed**
|
| 6 |
+
|
| 7 |
+
## Checks
|
| 8 |
+
|
| 9 |
+
| # | Check | Status | Detail |
|
| 10 |
+
|---|-------|--------|--------|
|
| 11 |
+
| 1 | V1 strict schema (field set/order/types) | PASS | 100 rows |
|
| 12 |
+
| 2 | V2 unique task_ids | PASS | |
|
| 13 |
+
| 3 | V2 id pattern ^[A-Z]+_\d{3}$ | PASS | |
|
| 14 |
+
| 4 | V2 20 tasks per module | PASS | {'api': 20, 'mixin': 20, 'migration': 20, 'debug': 20, 'build': 20} |
|
| 15 |
+
| 5 | V2 module order api<mixin<migration<debug<build | PASS | |
|
| 16 |
+
| 6 | V3 required_annotations present in goldens | PASS | |
|
| 17 |
+
| 7 | V4 forbidden_apis absent from goldens (comments stripped) | PASS | |
|
| 18 |
+
| 8 | V5 debug goldens = valid JSON (root_cause/fix_explanation/code_patch) | PASS | |
|
| 19 |
+
| 9 | V6 Java goldens parse (javalang) | PASS | \| parsed=57 non-java=23 |
|
| 20 |
+
| 10 | V7 all golden imports on NeoForge 1.21.1 allowlist | PASS | |
|
| 21 |
+
| 11 | V8 contamination screen vs SFT corpus | PASS | 0 hits; shards=6; corpus_chars=4998017 |
|
| 22 |
+
| 12 | V9a sandbox --dry-run prepares workspace | PASS | ": null, "log_tail": "", "dry_run": true, "gradle_command": "./gradlew build -x test --console=plain --no-daemon", "injected_file": "/tmp/tmpth5s1_d_/ws/src/main/java/com/example/generated" } |
|
| 23 |
+
| 13 | V9b ast_eval passes its own golden (API_001) | PASS | [] |
|
| 24 |
+
| 14 | V9c ast_eval flags Forge namespace + 1.16 text API | PASS | forbidden API present: net.minecraftforge forbidden API present: net.minecraft.util.text import not on NeoForge 1.21.1 classpath: net.minecraftforge.registries.DeferredItem (Forge namespace does not exist on NeoForge (use net.neoforged)) |
|
| 25 |
+
| 15 | V9d gametest template generation (offline) | PASS | ", "generated": { "test_class": "/tmp/tmpth5s1_d_/gt_ws/src/test/java/com/example/examplemod/gametest/ForgeBenchGameTest.java", "logic_class": "/tmp/tmpth5s1_d_/gt_ws/src/test/java/com/example/examplemod/gametest/GeneratedGameTestLogic.java", "hoisted_imports": 0 }, "ran": false } |
|
| 26 |
+
| 16 | V9e run_benchmark driver (dry-run) | PASS | |
|
| 27 |
+
| 17 | V10 Dockerfile references existing build context | PASS | |
|
| 28 |
+
| 18 | V10 judge prompt rubric sections | PASS | |
|
| 29 |
+
| 19 | V10 no javac/Mockito execution in harness | PASS | doc mentions of the ban are fine; executable use is not |
|
| 30 |
+
|
| 31 |
+
## What each gate means
|
| 32 |
+
|
| 33 |
+
- **V1-V2** enforce the strict task schema from the ForgeBench spec (field order, types, id pattern, 20 tasks/module).
|
| 34 |
+
- **V3** required annotations/tokens must appear in golden *code* (Java comments stripped so prose cannot satisfy them; config goldens may carry tokens in comments by design).
|
| 35 |
+
- **V4** forbidden (legacy/Forge-namespace) APIs must be absent from golden code even after comment stripping — guarantees migration goldens are pure NeoForge 1.21.1.
|
| 36 |
+
- **V5** debug goldens are machine-parseable `{root_cause, fix_explanation, code_patch}` JSON.
|
| 37 |
+
- **V6** every Java golden parses with javalang (records / pattern-matching `instanceof` shimmed for the Java-8 parser).
|
| 38 |
+
- **V7** every import in every golden is on the NeoForge 1.21.1 + Mojmap allowlist — no hallucinated packages.
|
| 39 |
+
- **V8** contamination screen: normalized golden/instruction prefixes (>=80 chars) were searched in sampled corpus shards of ComerX/forge-neoforge-sft-v2.1.0-rc2 and -rc1 (3 shards each): 0 hits.
|
| 40 |
+
- **V9** harness offline tests: sandbox workspace preparation (--dry-run), ast_eval passing its own golden, ast_eval catching poisoned answers (Forge namespace + 1.16 text API), GameTest template generation, and the run_benchmark driver.
|
| 41 |
+
- **V10** Dockerfile/template coherence, judge rubric presence, and the no-raw-javac/no-Mockito rule (executable use).
|
| 42 |
+
|
| 43 |
+
## Known limitations (honest scope)
|
| 44 |
+
|
| 45 |
+
1. The Gradle compile path (sandbox_runner) was verified structurally (workspace preparation, command assembly, output parsing) but NOT executed end-to-end in this sandbox: no Docker daemon and no 8 GB RAM budget for NeoForm decompile are available here. The same limitation is documented for the main SFT audit (compile_verified unreachable).
|
| 46 |
+
2. javalang is a Java-8 parser; Java 14+ syntax (records, pattern matching) is shimmed for validation only. The real gate is the Gradle compile inside the MDK.
|
| 47 |
+
3. Contamination screen is sampled (6 shards), not exhaustive; it screens exact-prefix containment, not paraphrase-level overlap.
|
| 48 |
+
4. Plugin versions in build-module goldens (NeoGradle 7.0.145, ModDevGradle 1.0.24, Minotaur 2.+, curseforgegradle 1.1.24) reflect mid-2024/2025 releases; syntax is the graded property, not the pinned version.
|
data/forgebench_full.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/schema_example.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"task_id": "MIXIN_002", "module": "mixin", "instruction": "Write a Mixin that cancels ALL fire damage in LivingEntity#hurt. Target (Mojang mappings): net.minecraft.world.entity.LivingEntity#hurt(Lnet/minecraft/world/damagesource/DamageSource;F)Z. Cancel only when the DamageSource type is IN_FIRE.", "context": "", "golden_reference": "package com.example.examplemod.mixin;\n\nimport net.minecraft.world.damagesource.DamageSource;\nimport net.minecraft.world.damagesource.DamageTypes;\nimport net.minecraft.world.entity.LivingEntity;\nimport org.spongepowered.asm.mixin.Mixin;\nimport org.spongepowered.asm.mixin.injection.At;\nimport org.spongepowered.asm.mixin.injection.Inject;\nimport org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;\n\n@Mixin(LivingEntity.class)\npublic abstract class LivingEntityMixin {\n\n // Injecting into a boolean-returning method: CallbackInfoReturnable<Boolean>.\n // `cir.setReturnValue(true)` cancels the method and makes hurt() report \"handled\".\n @Inject(method = \"hurt(Lnet/minecraft/world/damagesource/DamageSource;F)Z\",\n at = @At(\"HEAD\"), cancellable = true)\n private void examplemod$cancelFireDamage(DamageSource source, float amount,\n CallbackInfoReturnable<Boolean> cir) {\n if (source.is(DamageTypes.IN_FIRE) || source.is(DamageTypes.ON_FIRE)) {\n cir.setReturnValue(false);\n }\n }\n}", "eval_criteria": {"must_compile": true, "required_annotations": ["@Inject"], "forbidden_apis": ["net.minecraftforge"], "gametest_required": false}}
|
| 2 |
+
{"task_id": "MIG_004", "module": "migration", "instruction": "Migrate this Forge 1.20.1 item that stores an `energy` value in item NBT to NeoForge 1.21.1 using a registered DataComponentType instead of CompoundTag.", "context": "// Forge 1.20.1\npublic class BatteryItem extends Item {\n public BatteryItem(Properties props) { super(props); }\n\n public int getEnergy(ItemStack stack) {\n return stack.getOrCreateTag().getInt(\"energy\");\n }\n\n public void setEnergy(ItemStack stack, int value) {\n stack.getOrCreateTag().putInt(\"energy\", Math.max(0, value));\n }\n\n public static void register(IEventBus bus) {\n // nothing special in 1.20.1\n }\n}", "golden_reference": "// NeoForge 1.21.1\npackage com.example.examplemod;\n\nimport com.mojang.serialization.Codec;\nimport net.minecraft.core.component.DataComponentType;\nimport net.minecraft.core.registries.Registries;\nimport net.minecraft.network.codec.ByteBufCodecs;\nimport net.minecraft.world.item.Item;\nimport net.minecraft.world.item.ItemStack;\nimport net.neoforged.bus.api.IEventBus;\nimport net.neoforged.neoforge.registries.DeferredHolder;\nimport net.neoforged.neoforge.registries.DeferredRegister;\n\npublic class BatteryItem extends Item {\n public BatteryItem(Properties props) { super(props); }\n\n public int getEnergy(ItemStack stack) {\n return stack.getOrDefault(ExampleMod.ENERGY.get(), 0);\n }\n\n public void setEnergy(ItemStack stack, int value) {\n stack.set(ExampleMod.ENERGY.get(), Math.max(0, value));\n }\n}\n\nclass ExampleMod {\n public static final String MODID = \"examplemod\";\n\n public static final DeferredRegister<DataComponentType<?>> DATA_COMPONENTS =\n DeferredRegister.create(Registries.DATA_COMPONENT_TYPE, MODID);\n\n public static final DeferredHolder<DataComponentType<?>, DataComponentType<Integer>> ENERGY =\n DATA_COMPONENTS.registerComponent(\"energy\",\n builder -> builder\n .persistent(Codec.INT)\n .networkSynchronized(ByteBufCodecs.VAR_INT)\n .build());\n\n public ExampleMod(IEventBus modBus) {\n DATA_COMPONENTS.register(modBus);\n }\n}", "eval_criteria": {"must_compile": true, "required_annotations": [], "forbidden_apis": ["net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text", "LazyOptional", "getOrCreateTag", "NetworkRegistry", "SimpleChannel", "FMLJavaModLoadingContext", "ForgeConfigSpec", "DistExecutor", "DeferredWorkQueue", "ForgeSpawnEggItem", "setRegistryName", "TickEvent.PlayerTickEvent"], "gametest_required": false}}
|
| 3 |
+
{"task_id": "DEBUG_004", "module": "debug", "instruction": "Analyze the FML crash/log snippet below for a NeoForge 1.21.1 dedicated server. Return ONLY a JSON object with keys root_cause, fix_explanation, code_patch. Reference concrete FML/NeoForge terminology; do not give generic advice such as 'update your Java' unless the log shows a class-version error.", "context": "[main/ERROR] [ne.fml.lo.mo/]: Mod 'examplemod' caused an exception during modloading\nCaused by: java.lang.RuntimeException: Attempted to load class net/minecraft/client/Minecraft for invalid dist DEDICATED_SERVER\n\tat TRANSFORMER/examplemod@1.0.0/com.example.ClientProxy.<init>(ClientProxy.java:18)\n\tat TRANSFORMER/examplemod@1.0.0/com.example.CommonProxy.<init>(CommonProxy.java:9)\n\tat TRANSFORMER/examplemod@1.0.0/com.example.ExampleMod.<init>(ExampleMod.java:14)\nDist: DEDICATED_SERVER", "golden_reference": "{\n \"root_cause\": \"The common code path unconditionally constructs ClientProxy, whose constructor references net.minecraft.client.Minecraft - a client-only class. On a dedicated server (dist DEDICATED_SERVER) the class fails to load with 'invalid dist DEDICATED_SERVER'.\",\n \"fix_explanation\": \"Never touch client classes from common code. Remove the ClientProxy construction from the common path and either (a) isolate client logic in classes registered via @Mod.EventBusSubscriber(value = Dist.CLIENT) or a second @Mod entry point with dist = Dist.CLIENT, or (b) guard with FMLEnvironment.dist checks at the call boundary. Runtime-guarded lazy loading only helps if the client class is not referenced in the loaded code path at all.\",\n \"code_patch\": \"// common\\npublic ExampleMod(IEventBus modBus) {\\n // no client construction here\\n}\\n\\n// client-only\\n@Mod(value = ExampleMod.MODID, dist = Dist.CLIENT)\\npublic class ExampleModClient { ... }\"\n}", "eval_criteria": {"must_compile": false, "required_annotations": [], "forbidden_apis": [], "gametest_required": false}}
|
harness/Dockerfile
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ForgeBench sandbox image
|
| 2 |
+
# Pre-configured NeoForge 1.21.1 MDK template + Gradle 8.9 + JDK 21.
|
| 3 |
+
# The runner (sandbox_runner.py) injects an LLM-generated .java file into the template
|
| 4 |
+
# and executes `./gradlew build -x test` headlessly. No Minecraft server is launched.
|
| 5 |
+
#
|
| 6 |
+
# Build: docker build -t forgebench-sandbox:1.21.1 .
|
| 7 |
+
# Run: docker run --rm -v $(pwd)/out:/out forgebench-sandbox \
|
| 8 |
+
# python3 /opt/forgebench/sandbox_runner.py --task-file /out/task.json --code-file /out/answer.java
|
| 9 |
+
|
| 10 |
+
FROM eclipse-temurin:21-jdk-jammy
|
| 11 |
+
|
| 12 |
+
ARG GRADLE_VERSION=8.9
|
| 13 |
+
ARG NEOFORGE_VERSION=21.1.77
|
| 14 |
+
ARG MOD_TEMPLATE_ID=examplemod
|
| 15 |
+
|
| 16 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 17 |
+
ENV GRADLE_USER_HOME=/opt/gradle-home
|
| 18 |
+
ENV NEOFORGE_VERSION=${NEOFORGE_VERSION}
|
| 19 |
+
|
| 20 |
+
# --- system deps -------------------------------------------------------------
|
| 21 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 22 |
+
git curl unzip ca-certificates python3 python3-pip jq \
|
| 23 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 24 |
+
|
| 25 |
+
# --- gradle 8.9 --------------------------------------------------------------
|
| 26 |
+
RUN curl -fsSLo /tmp/gradle.zip https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip \
|
| 27 |
+
&& unzip -q /tmp/gradle.zip -d /opt/ \
|
| 28 |
+
&& ln -s /opt/gradle-${GRADLE_VERSION}/bin/gradle /usr/local/bin/gradle \
|
| 29 |
+
&& rm /tmp/gradle.zip
|
| 30 |
+
|
| 31 |
+
# --- python harness deps -----------------------------------------------------
|
| 32 |
+
COPY harness/requirements.txt /opt/forgebench/requirements.txt
|
| 33 |
+
RUN pip3 install --no-cache-dir -r /opt/forgebench/requirements.txt
|
| 34 |
+
|
| 35 |
+
# --- NeoForge MDK template ---------------------------------------------------
|
| 36 |
+
# template/ contains a minimal but COMPLETE NeoForge 1.21.1 mod project:
|
| 37 |
+
# build.gradle.kts (NeoGradle 7 userdev / or ModDevGradle - see template README)
|
| 38 |
+
# settings.gradle.kts
|
| 39 |
+
# gradle.properties
|
| 40 |
+
# src/main/resources/META-INF/neoforge.mods.toml
|
| 41 |
+
# src/main/resources/examplemod.mixins.json
|
| 42 |
+
# src/main/java/com/example/examplemod/ (empty package marker)
|
| 43 |
+
COPY template/ /opt/forgebench/template/
|
| 44 |
+
|
| 45 |
+
# Pre-warm the dependency cache so each evaluation does not re-download the world.
|
| 46 |
+
# (First build populates /opt/gradle-home; subsequent runs are offline-capable.)
|
| 47 |
+
RUN cd /opt/forgebench/template \
|
| 48 |
+
&& gradle --no-daemon help || true
|
| 49 |
+
|
| 50 |
+
COPY harness/ /opt/forgebench/harness/
|
| 51 |
+
|
| 52 |
+
# Non-root runner; keep the build filesystem writable
|
| 53 |
+
RUN useradd -ms /bin/bash evaluator
|
| 54 |
+
USER evaluator
|
| 55 |
+
WORKDIR /home/evaluator
|
| 56 |
+
|
| 57 |
+
# Hardened defaults: no network flapping, fixed locale
|
| 58 |
+
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
|
| 59 |
+
|
| 60 |
+
ENTRYPOINT ["python3", "/opt/forgebench/harness/sandbox_runner.py"]
|
harness/ast_eval.py
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
"""
|
| 4 |
+
ForgeBench static AST analyzer.
|
| 5 |
+
|
| 6 |
+
Parses the LLM's Java output with `javalang` and performs classpath-aware checks:
|
| 7 |
+
|
| 8 |
+
1. SYNTAX - full parse (any AST error = fail for must_compile tasks)
|
| 9 |
+
2. FORBIDDEN - forbidden_apis from eval_criteria: legacy / cross-loader symbols
|
| 10 |
+
(net.minecraft.util.text, net.minecraftforge.*, LazyOptional, ...)
|
| 11 |
+
3. HALLUCINATION - every import must resolve to (a) the vanilla/Mojmap+NeoForge 1.21.1
|
| 12 |
+
allowlist, (b) the Mixin/MixinExtras/ASM toolchain, (c) the mod-local
|
| 13 |
+
package, or (d) an explicit optional-allowlist (Jei).
|
| 14 |
+
Unknown roots are reported as potential hallucinated APIs.
|
| 15 |
+
4. ANNOTATIONS - required_annotations must be present on declarations
|
| 16 |
+
5. VERSION MIX - penalty scan for 1.16-era / Forge-era APIs that never existed
|
| 17 |
+
on NeoForge 1.21.1
|
| 18 |
+
|
| 19 |
+
Usage:
|
| 20 |
+
python3 ast_eval.py --code answer.java --task task.json [--out result.json]
|
| 21 |
+
|
| 22 |
+
Output: JSON verdict {passed, score, findings[]}.
|
| 23 |
+
The script never executes the code; it is a static gate that complements the
|
| 24 |
+
Gradle compile check (sandbox_runner.py) and the LLM judge (debug/build tasks).
|
| 25 |
+
"""
|
| 26 |
+
from __future__ import annotations
|
| 27 |
+
|
| 28 |
+
import argparse
|
| 29 |
+
import json
|
| 30 |
+
import re
|
| 31 |
+
import sys
|
| 32 |
+
from pathlib import Path
|
| 33 |
+
|
| 34 |
+
try:
|
| 35 |
+
import javalang
|
| 36 |
+
except ImportError: # pragma: no cover
|
| 37 |
+
print("pip install javalang", file=sys.stderr)
|
| 38 |
+
raise
|
| 39 |
+
|
| 40 |
+
# --- classpath allowlist: NeoForge 1.21.1 + vanilla Mojmap + toolchain ------------
|
| 41 |
+
ALLOWED_IMPORT_ROOTS = (
|
| 42 |
+
"net.minecraft.", # vanilla, Mojang mappings (1.21.1)
|
| 43 |
+
"net.neoforged.", # NeoForge (FML, bus, neoforge.*)
|
| 44 |
+
"com.mojang.", # brigadier, blaze3d, datafixers, serialization
|
| 45 |
+
"org.spongepowered.", # Mixin
|
| 46 |
+
"com.llamalad7.", # MixinExtras (bundled with NeoForge 1.21.1)
|
| 47 |
+
"org.objectweb.asm.", # ASM (mixin opcodes)
|
| 48 |
+
"org.lwjgl.glfw.", # GLFW (client keys)
|
| 49 |
+
"org.jetbrains.", # annotations (@Nullable)
|
| 50 |
+
"io.netty.", # ByteBuf for payloads
|
| 51 |
+
"com.google.", # guava
|
| 52 |
+
"javax.annotation.", # jsr305
|
| 53 |
+
"java.", # JRE
|
| 54 |
+
"javax.",
|
| 55 |
+
)
|
| 56 |
+
MOD_LOCAL_ROOT = "com.example." # examplemod + generated answers
|
| 57 |
+
OPTIONAL_ROOTS = {"mezz.jei.": "Jei optional dependency (client-side tasks only)"}
|
| 58 |
+
|
| 59 |
+
# --- known-dead / legacy symbols (hard fail when imported) ------------------------
|
| 60 |
+
LEGACY_IMPORTS = {
|
| 61 |
+
"net.minecraft.util.text": "1.16-era text API removed since 1.17 (use net.minecraft.network.chat)",
|
| 62 |
+
"net.minecraftforge": "Forge namespace does not exist on NeoForge (use net.neoforged)",
|
| 63 |
+
"net.minecraftforge.eventbus.api.SubscribeEvent": "use net.neoforged.bus.api.SubscribeEvent",
|
| 64 |
+
"net.minecraftforge.fml.DistExecutor": "DistExecutor removed; use FMLEnvironment.dist",
|
| 65 |
+
"net.minecraftforge.items.CapabilityItemHandler": "use net.neoforged.neoforge.capabilities.Capabilities",
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
# --- penalty scan (soft signals; lower score, not instant fail) -------------------
|
| 69 |
+
PENALTY_PATTERNS = [
|
| 70 |
+
(r"\bnew\s+ResourceLocation\s*\(",
|
| 71 |
+
"ResourceLocation constructor removed in 1.20.6; use ResourceLocation.fromNamespaceAndPath"),
|
| 72 |
+
(r"\bgetOrCreateTag\s*\(", "item NBT getOrCreateTag removed in 1.20.5; use data components"),
|
| 73 |
+
(r"\bMinecraftForge\.EVENT_BUS\b", "Forge game bus; use NeoForge.EVENT_BUS"),
|
| 74 |
+
(r"\bDistExecutor\b", "DistExecutor removed in NeoForge"),
|
| 75 |
+
(r"\bLazyOptional\b", "LazyOptional removed in NeoForge capability system"),
|
| 76 |
+
(r"\bTickEvent\.PlayerTickEvent\b", "TickEvent split into PlayerTickEvent.Pre/Post in NeoForge 1.21"),
|
| 77 |
+
(r"\bIFormattableTextComponent\b", "use MutableComponent"),
|
| 78 |
+
(r"\bRegistryObject\b", "Forge type; use DeferredHolder/DeferredItem"),
|
| 79 |
+
]
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
def parse(source: str):
|
| 83 |
+
try:
|
| 84 |
+
tree = javalang.parse.parse(source)
|
| 85 |
+
return tree, None
|
| 86 |
+
except (javalang.parser.JavaSyntaxError, javalang.tokenizer.LexerError) as e:
|
| 87 |
+
return None, f"syntax error: {e}"
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
def strip_java_comments(src: str) -> str:
|
| 91 |
+
"""Remove // and /* */ comments: explanatory mentions of a legacy API must not
|
| 92 |
+
be treated as usage (and required annotations must not be satisfied by comments)."""
|
| 93 |
+
src = re.sub(r"/\*.*?\*/", " ", src, flags=re.S)
|
| 94 |
+
src = re.sub(r"^\s*//.*$", " ", src, flags=re.M)
|
| 95 |
+
src = re.sub(r"(?<=[^:])//[^\n]*", " ", src) # keep 'https://' intact
|
| 96 |
+
return src
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
def collect_imports(tree) -> list[str]:
|
| 100 |
+
return [imp.path for imp in tree.imports]
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
def walk_annotations(tree) -> list[str]:
|
| 104 |
+
names: list[str] = []
|
| 105 |
+
for path, node in tree.filter(javalang.tree.Annotation):
|
| 106 |
+
names.append(node.name)
|
| 107 |
+
return names
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
def full_text_with_annotations(source: str) -> str:
|
| 111 |
+
return source
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
def find_subtree_source(source: str, position) -> str:
|
| 115 |
+
"""Extract a line context around a javalang position tuple."""
|
| 116 |
+
if not position or not isinstance(position, tuple):
|
| 117 |
+
return ""
|
| 118 |
+
line = min(position.line, len(source.splitlines())) - 1
|
| 119 |
+
lines = source.splitlines()
|
| 120 |
+
return "\n".join(lines[max(0, line - 2): line + 2])
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
def evaluate_source(task: dict, source: str) -> dict:
|
| 124 |
+
criteria = task.get("eval_criteria", {})
|
| 125 |
+
must_compile = criteria.get("must_compile", False)
|
| 126 |
+
forbidden = criteria.get("forbidden_apis", [])
|
| 127 |
+
required = criteria.get("required_annotations", [])
|
| 128 |
+
|
| 129 |
+
findings: list[dict] = []
|
| 130 |
+
penalties = 0
|
| 131 |
+
|
| 132 |
+
tree, err = parse(source)
|
| 133 |
+
if err:
|
| 134 |
+
findings.append({"check": "SYNTAX", "severity": "error", "message": err})
|
| 135 |
+
return {"passed": False, "score": 0.0, "findings": findings}
|
| 136 |
+
|
| 137 |
+
# Comments are stripped once: all text-based checks below operate on real code only.
|
| 138 |
+
code = strip_java_comments(source)
|
| 139 |
+
|
| 140 |
+
# 2. forbidden APIs (eval_criteria-driven, substring over stripped code)
|
| 141 |
+
for token in forbidden:
|
| 142 |
+
if token and token in code:
|
| 143 |
+
findings.append({"check": "FORBIDDEN", "severity": "error",
|
| 144 |
+
"message": f"forbidden API present: {token}"})
|
| 145 |
+
|
| 146 |
+
# 3. import allowlist / hallucination + legacy imports
|
| 147 |
+
for imp in collect_imports(tree):
|
| 148 |
+
if any(imp == r or imp.startswith(r) for r in ALLOWED_IMPORT_ROOTS):
|
| 149 |
+
continue
|
| 150 |
+
if imp.startswith(MOD_LOCAL_ROOT):
|
| 151 |
+
continue
|
| 152 |
+
hit = next((note for root, note in OPTIONAL_ROOTS.items() if imp.startswith(root)), None)
|
| 153 |
+
if hit:
|
| 154 |
+
findings.append({"check": "OPTIONAL_DEP", "severity": "info",
|
| 155 |
+
"message": f"{imp}: {hit}"})
|
| 156 |
+
continue
|
| 157 |
+
legacy = next((msg for bad, msg in LEGACY_IMPORTS.items() if imp.startswith(bad)), None)
|
| 158 |
+
findings.append({"check": "HALLUCINATION", "severity": "error",
|
| 159 |
+
"message": f"import not on NeoForge 1.21.1 classpath: {imp}"
|
| 160 |
+
+ (f" ({legacy})" if legacy else "")})
|
| 161 |
+
penalties += 1
|
| 162 |
+
|
| 163 |
+
# 4. required annotations (declaration-level via AST + text fallback on code)
|
| 164 |
+
annos = walk_annotations(tree)
|
| 165 |
+
for req in required:
|
| 166 |
+
short = req.lstrip("@")
|
| 167 |
+
present = (any(a == short or a.endswith("." + short) or a == req
|
| 168 |
+
for a in annos)
|
| 169 |
+
or req in code) # composite tokens like "@Mod.EventBusSubscriber"
|
| 170 |
+
if not present:
|
| 171 |
+
findings.append({"check": "ANNOTATION", "severity": "error",
|
| 172 |
+
"message": f"required annotation/token missing: {req}"})
|
| 173 |
+
|
| 174 |
+
# 5. version-mix penalty scan
|
| 175 |
+
for pattern, msg in PENALTY_PATTERNS:
|
| 176 |
+
if re.search(pattern, code):
|
| 177 |
+
findings.append({"check": "VERSION_MIX", "severity": "warning",
|
| 178 |
+
"message": msg})
|
| 179 |
+
penalties += 1
|
| 180 |
+
|
| 181 |
+
errors = [f for f in findings if f["severity"] == "error"]
|
| 182 |
+
score = 1.0
|
| 183 |
+
if errors:
|
| 184 |
+
score = 0.0
|
| 185 |
+
else:
|
| 186 |
+
score = max(0.0, 1.0 - 0.2 * penalties)
|
| 187 |
+
|
| 188 |
+
return {
|
| 189 |
+
"passed": not errors,
|
| 190 |
+
"score": round(score, 2),
|
| 191 |
+
"findings": findings,
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
def main() -> int:
|
| 196 |
+
p = argparse.ArgumentParser(description="ForgeBench AST analyzer")
|
| 197 |
+
p.add_argument("--code", required=True, help="LLM-generated .java file")
|
| 198 |
+
p.add_argument("--task", required=True, help="task JSON file")
|
| 199 |
+
p.add_argument("--out", default=None)
|
| 200 |
+
args = p.parse_args()
|
| 201 |
+
|
| 202 |
+
source = Path(args.code).read_text(encoding="utf-8")
|
| 203 |
+
task = json.loads(Path(args.task).read_text(encoding="utf-8"))
|
| 204 |
+
|
| 205 |
+
result = evaluate_source(task, source)
|
| 206 |
+
result["task_id"] = task.get("task_id")
|
| 207 |
+
|
| 208 |
+
payload = json.dumps(result, ensure_ascii=False, indent=2)
|
| 209 |
+
if args.out:
|
| 210 |
+
Path(args.out).write_text(payload, encoding="utf-8")
|
| 211 |
+
print(payload)
|
| 212 |
+
return 0 if result["passed"] else 1
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
if __name__ == "__main__":
|
| 216 |
+
sys.exit(main())
|
harness/gametest_runner.py
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
"""
|
| 4 |
+
ForgeBench GameTest integration runner.
|
| 5 |
+
|
| 6 |
+
For tasks with eval_criteria.gametest_required = true this script:
|
| 7 |
+
|
| 8 |
+
1. Generates a NeoForge 1.21.1 GameTest template class (Batches + @GameTest methods)
|
| 9 |
+
wrapping the LLM's logic.
|
| 10 |
+
2. Injects it into the MDK template's test source set.
|
| 11 |
+
3. Runs the GameTest harness inside a headless container - the vanilla server
|
| 12 |
+
environment is real (real Level, real entities), so NO Mockito / no mocking of
|
| 13 |
+
Level or Player classes is required or allowed.
|
| 14 |
+
|
| 15 |
+
Command used by default: ./gradlew runGameTestServer (NeoGradle 7 exposes the
|
| 16 |
+
`gametest` run; ModDevGradle exposes gameTestServer - override with --gradle-command
|
| 17 |
+
when the template uses MDG).
|
| 18 |
+
|
| 19 |
+
Offline/CI mode: --generate-only writes the test class without running Gradle, which
|
| 20 |
+
is how this script is unit-tested inside the ForgeBench verification suite.
|
| 21 |
+
"""
|
| 22 |
+
from __future__ import annotations
|
| 23 |
+
|
| 24 |
+
import argparse
|
| 25 |
+
import json
|
| 26 |
+
import re
|
| 27 |
+
import subprocess
|
| 28 |
+
import sys
|
| 29 |
+
import time
|
| 30 |
+
from pathlib import Path
|
| 31 |
+
|
| 32 |
+
TEMPLATE_CLASS = '''package com.example.examplemod.gametest;
|
| 33 |
+
|
| 34 |
+
import com.example.generated.GeneratedGameTestLogic;
|
| 35 |
+
import net.minecraft.core.BlockPos;
|
| 36 |
+
import net.minecraft.gametest.framework.GameTest;
|
| 37 |
+
import net.minecraft.gametest.framework.GameTestHelper;
|
| 38 |
+
import net.neoforged.neoforge.gametest.GameTestPrefix;
|
| 39 |
+
|
| 40 |
+
@GameTestPrefix("examplemod")
|
| 41 |
+
public final class ForgeBenchGameTest {{
|
| 42 |
+
|
| 43 |
+
/**
|
| 44 |
+
* Task: {task_id}
|
| 45 |
+
* Structure template: forgebench:{structure}
|
| 46 |
+
* The LLM-generated logic is invoked through the stable seam below so that the
|
| 47 |
+
* harness itself never needs modification per-task.
|
| 48 |
+
*/
|
| 49 |
+
@GameTest(template = "{structure}", timeoutTicks = {timeout})
|
| 50 |
+
public static void forgebench(GameTestHelper helper) {{
|
| 51 |
+
try {{
|
| 52 |
+
boolean ok = GeneratedGameTestLogic.run(helper);
|
| 53 |
+
if (ok) {{
|
| 54 |
+
helper.succeed();
|
| 55 |
+
}} else {{
|
| 56 |
+
helper.fail("forgebench: GeneratedGameTestLogic.run returned false");
|
| 57 |
+
}}
|
| 58 |
+
}} catch (Throwable t) {{
|
| 59 |
+
helper.fail("forgebench: exception during gametest: " + t);
|
| 60 |
+
}}
|
| 61 |
+
}}
|
| 62 |
+
|
| 63 |
+
private ForgeBenchGameTest() {{}}
|
| 64 |
+
}}
|
| 65 |
+
'''
|
| 66 |
+
|
| 67 |
+
LOGIC_CLASS = '''package com.example.generated;
|
| 68 |
+
|
| 69 |
+
import net.minecraft.gametest.framework.GameTestHelper;
|
| 70 |
+
|
| 71 |
+
/**
|
| 72 |
+
* Seam class that hosts the LLM-generated logic for GameTest-required tasks.
|
| 73 |
+
* The reference answer (golden_reference) replaces the body of run(...).
|
| 74 |
+
*/
|
| 75 |
+
public final class GeneratedGameTestLogic {{
|
| 76 |
+
|
| 77 |
+
private GeneratedGameTestLogic() {{}}
|
| 78 |
+
|
| 79 |
+
public static boolean run(GameTestHelper helper) {{
|
| 80 |
+
// === FORGEBENCH GENERATED CODE START ===
|
| 81 |
+
{code}
|
| 82 |
+
// === FORGEBENCH GENERATED CODE END ===
|
| 83 |
+
return true;
|
| 84 |
+
}}
|
| 85 |
+
}}
|
| 86 |
+
'''
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
def generate(task: dict, code: str, out_dir: Path, structure: str = "forgebench:empty3x3x3",
|
| 90 |
+
timeout: int = 100) -> dict:
|
| 91 |
+
out_dir.mkdir(parents=True, exist_ok=True)
|
| 92 |
+
test_java = out_dir / "ForgeBenchGameTest.java"
|
| 93 |
+
logic_java = out_dir / "GeneratedGameTestLogic.java"
|
| 94 |
+
|
| 95 |
+
test_java.write_text(TEMPLATE_CLASS.format(
|
| 96 |
+
task_id=task.get("task_id", "unknown"),
|
| 97 |
+
structure=structure,
|
| 98 |
+
timeout=timeout,
|
| 99 |
+
), encoding="utf-8")
|
| 100 |
+
|
| 101 |
+
# Hoist any import statements out of the answer and drop package declarations:
|
| 102 |
+
# the seam class already has its own package, and imports are illegal inside a body.
|
| 103 |
+
imports = re.findall(r"^\s*import\s+[\w.*]+\s*;", code, re.M)
|
| 104 |
+
body = re.sub(r"^\s*package\s+[\w.]+\s*;\s*$", "", code, flags=re.M)
|
| 105 |
+
body = re.sub(r"^\s*import\s+[\w.*]+\s*;\s*$", "", body, flags=re.M)
|
| 106 |
+
indented = "\n".join(" " + ln if ln.strip() else ln
|
| 107 |
+
for ln in ("\n".join(imports) + "\n" + body).splitlines())
|
| 108 |
+
logic_java.write_text(LOGIC_CLASS.format(code=indented), encoding="utf-8")
|
| 109 |
+
|
| 110 |
+
return {"test_class": str(test_java), "logic_class": str(logic_java),
|
| 111 |
+
"hoisted_imports": len(imports)}
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
def run_gametest(workdir: Path, gradle_command: str, timeout: int) -> dict:
|
| 115 |
+
args = gradle_command.split() + ["--console=plain", "--no-daemon"]
|
| 116 |
+
t0 = time.time()
|
| 117 |
+
try:
|
| 118 |
+
proc = subprocess.run(args, cwd=str(workdir),
|
| 119 |
+
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
| 120 |
+
text=True, timeout=timeout, shell=False)
|
| 121 |
+
code, log = proc.returncode, proc.stdout
|
| 122 |
+
except subprocess.TimeoutExpired as e:
|
| 123 |
+
code, log = 124, (e.stdout or "") + f"\n! gametest timed out after {timeout}s"
|
| 124 |
+
passed = code == 0 and "BUILD SUCCESSFUL" in log and not re.search(r"failed.*gametest", log, re.I)
|
| 125 |
+
return {"passed": passed, "exit_code": code,
|
| 126 |
+
"seconds": round(time.time() - t0, 2),
|
| 127 |
+
"log_tail": "\n".join(log.strip().splitlines()[-50:])}
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
def main() -> int:
|
| 131 |
+
p = argparse.ArgumentParser(description="ForgeBench GameTest runner")
|
| 132 |
+
p.add_argument("--task-file", required=True)
|
| 133 |
+
p.add_argument("--code-file", required=True, help=".java file with the logic / reference")
|
| 134 |
+
p.add_argument("--workdir", required=True, help="prepared MDK workspace")
|
| 135 |
+
p.add_argument("--gradle-command", default="./gradlew runGameTestServer",
|
| 136 |
+
help="Gradle task that boots the GameTest server (template-dependent)")
|
| 137 |
+
p.add_argument("--timeout", type=int, default=1200)
|
| 138 |
+
p.add_argument("--structure", default="forgebench:empty3x3x3")
|
| 139 |
+
p.add_argument("--generate-only", action="store_true",
|
| 140 |
+
help="only generate the test classes (offline verification)")
|
| 141 |
+
p.add_argument("--out", default=None)
|
| 142 |
+
args = p.parse_args()
|
| 143 |
+
|
| 144 |
+
task = json.loads(Path(args.task_file).read_text(encoding="utf-8"))
|
| 145 |
+
code = Path(args.code_file).read_text(encoding="utf-8")
|
| 146 |
+
|
| 147 |
+
if not task.get("eval_criteria", {}).get("gametest_required", False):
|
| 148 |
+
result = {"task_id": task.get("task_id"), "skipped": "gametest_required=false"}
|
| 149 |
+
else:
|
| 150 |
+
test_src = Path(args.workdir) / "src" / "test" / "java" / "com" / "example" / "examplemod" / "gametest"
|
| 151 |
+
paths = generate(task, code, test_src, structure=args.structure)
|
| 152 |
+
if args.generate_only:
|
| 153 |
+
result = {"task_id": task.get("task_id"), "generated": paths, "ran": False}
|
| 154 |
+
else:
|
| 155 |
+
run = run_gametest(Path(args.workdir), args.gradle_command, args.timeout)
|
| 156 |
+
result = {"task_id": task.get("task_id"), "generated": paths, "ran": True, **run}
|
| 157 |
+
|
| 158 |
+
payload = json.dumps(result, ensure_ascii=False, indent=2)
|
| 159 |
+
if args.out:
|
| 160 |
+
Path(args.out).write_text(payload, encoding="utf-8")
|
| 161 |
+
print(payload)
|
| 162 |
+
return 0
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
if __name__ == "__main__":
|
| 166 |
+
sys.exit(main())
|
harness/judge_prompt.txt
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FORGEBENCH LLM-AS-A-JUDGE — SYSTEM PROMPT (debug & build modules)
|
| 2 |
+
==================================================================
|
| 3 |
+
You are ForgeBench-Judge, a strict senior Minecraft modding engineer specializing in
|
| 4 |
+
NeoForge 1.21.1, Forge 1.20.1, FML loading internals, Mixin, and Gradle builds.
|
| 5 |
+
You grade answers to ForgeBench debug (crash-log analysis) and build (Gradle/TOML
|
| 6 |
+
configuration) tasks. Grade ONLY on technical correctness. Never reward fluency.
|
| 7 |
+
|
| 8 |
+
INPUTS YOU RECEIVE
|
| 9 |
+
------------------
|
| 10 |
+
- TASK: the instruction given to the evaluated model.
|
| 11 |
+
- CONTEXT: the raw crash log / debug log snippet, or the legacy build file.
|
| 12 |
+
- ANSWER: the evaluated model's output (for debug tasks: a JSON object with keys
|
| 13 |
+
root_cause, fix_explanation, code_patch; for build tasks: the generated config).
|
| 14 |
+
|
| 15 |
+
SCORING RUBRIC (0-10, then map to verdict)
|
| 16 |
+
------------------------------------------
|
| 17 |
+
10-9 Root cause is exactly right AND the fix is complete, safe, and idiomatic for
|
| 18 |
+
NeoForge 1.21.1. FML terminology is used precisely. No factual errors.
|
| 19 |
+
8-7 Root cause correct; fix correct but misses a secondary detail (e.g. refmap note,
|
| 20 |
+
side='BOTH' omission) that would not change the outcome.
|
| 21 |
+
6-5 Root cause partially correct (right subsystem, wrong mechanism) or fix works but
|
| 22 |
+
contains one technical inaccuracy.
|
| 23 |
+
4-3 Wrong subsystem or generic advice; fix would not resolve the crash.
|
| 24 |
+
2-1 Factually wrong (misidentifies the failing class/loader phase, wrong API names).
|
| 25 |
+
0 Refusal, empty, or entirely hallucinated content.
|
| 26 |
+
|
| 27 |
+
MANDATORY TERMINOLOGY CHECKS (reward precise use, penalize vagueness)
|
| 28 |
+
---------------------------------------------------------------------
|
| 29 |
+
* Distinguish: mod construction (CONSTRUCT phase) vs registry events vs FMLCommonSetupEvent
|
| 30 |
+
vs first world load. "Registry Object not present" answers MUST reference the parallel
|
| 31 |
+
mod-loading/DeferredHolder lifecycle, not "try again later".
|
| 32 |
+
* Mixin failures: name the exact mechanism (descriptor mismatch, refmap missing, target
|
| 33 |
+
class side mismatch, LocalCapture strictness) - "your mixin is broken" scores <= 3.
|
| 34 |
+
* Dedicated-server crashes: answers MUST mention dist (DEDICATED_SERVER vs CLIENT) and the
|
| 35 |
+
class-loading consequence (client-only class on server), not "your server is broken".
|
| 36 |
+
* NoSuchMethodError / NoClassDefFoundError: answers MUST explain binary incompatibility
|
| 37 |
+
against a specific class member (name the changed signature or namespace), never
|
| 38 |
+
"corrupted jar".
|
| 39 |
+
* Dependency errors: quote the versionRange algebra from the log; fix must update
|
| 40 |
+
neoforge.mods.toml `type`/`versionRange` (NOT `mandatory`) for 1.21.1.
|
| 41 |
+
|
| 42 |
+
HARD PENALTIES (cap at 3)
|
| 43 |
+
-------------------------
|
| 44 |
+
* Suggests "update your Java" for anything EXCEPT class-version errors
|
| 45 |
+
(UnsupportedClassVersionError / class file 65 vs 61) -> cap 2.
|
| 46 |
+
* Suggests deleting crash-reports or reinstalling Java/system -> cap 1.
|
| 47 |
+
* Claims a Forge-namespace class (net.minecraftforge.*) exists on NeoForge 1.21.1 -> cap 1.
|
| 48 |
+
* Fabric APIs (net.fabricmc.*) attributed to NeoForge -> cap 1.
|
| 49 |
+
* Invents log lines that are not in CONTEXT to support the diagnosis -> cap 2.
|
| 50 |
+
* Proposes mocking Level/Player (Mockito) or raw `javac` compilation as a fix -> cap 0.
|
| 51 |
+
|
| 52 |
+
CODE_PATCH RULES (debug tasks)
|
| 53 |
+
------------------------------
|
| 54 |
+
- code_patch must be REAL NeoForge 1.21.1 Java/TOML/KTS, not pseudocode.
|
| 55 |
+
- Imports shown must use net.neoforged.* / net.minecraft.* (Mojmap) only.
|
| 56 |
+
- Patches that "fix" by removing safety checks or swallowing exceptions cap at 4.
|
| 57 |
+
|
| 58 |
+
BUILD TASK RULES
|
| 59 |
+
----------------
|
| 60 |
+
- Gradle 8.x Kotlin DSL syntax must parse: quotes, parentheses, task names.
|
| 61 |
+
- 1.20.1 ForgeGradle idioms (`minecraft { mappings ... }`, `reobfJar`, `mandatory =`)
|
| 62 |
+
in a 1.21.1 answer are automatic fail (score <= 2).
|
| 63 |
+
- neoforge.mods.toml answers must use [[dependencies.<modid>]] tables with
|
| 64 |
+
type/versionRange/ordering/side.
|
| 65 |
+
|
| 66 |
+
OUTPUT FORMAT
|
| 67 |
+
-------------
|
| 68 |
+
Return ONLY valid JSON:
|
| 69 |
+
{
|
| 70 |
+
"score": <0-10>,
|
| 71 |
+
"verdict": "pass" | "borderline" | "fail", // pass >= 8, borderline 5-7, fail < 5
|
| 72 |
+
"root_cause_ok": true | false,
|
| 73 |
+
"fix_ok": true | false,
|
| 74 |
+
"terminology_ok": true | false,
|
| 75 |
+
"penalties_applied": ["..."],
|
| 76 |
+
"notes": "2-4 sentences, cite the exact log line / API that drove the decision"
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
Do not include any text outside the JSON.
|
harness/requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
javalang>=0.13.0
|
| 2 |
+
# optional: tree-sitter based parsing (ast_eval falls back to javalang if absent)
|
| 3 |
+
# tree-sitter>=0.21
|
| 4 |
+
# tree-sitter-java>=0.21
|
harness/run_benchmark.py
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
"""
|
| 4 |
+
ForgeBench driver: run sandbox compile check + AST analysis (and collect judge scores)
|
| 5 |
+
over an answers.jsonl file.
|
| 6 |
+
|
| 7 |
+
answers.jsonl rows:
|
| 8 |
+
{"task_id": "...", "answer": "<generated java or json answer>"}
|
| 9 |
+
|
| 10 |
+
Usage:
|
| 11 |
+
python3 run_benchmark.py --data forgebench_full.jsonl --answers answers.jsonl \
|
| 12 |
+
[--workdir build_ws] [--out report.json] [--skip-compile] [--dry-run]
|
| 13 |
+
|
| 14 |
+
For each answer:
|
| 15 |
+
* module in {api, mixin, migration} with must_compile=true -> sandbox_runner (Gradle)
|
| 16 |
+
+ ast_eval static gate
|
| 17 |
+
* module debug -> judge_prompt.txt contract (scores must be provided via --scores
|
| 18 |
+
JSON {task_id: {"score": n, "verdict": ...}}), static JSON-shape check runs here
|
| 19 |
+
* module build -> static required-token + forbidden check (fast, no Gradle)
|
| 20 |
+
* gametest_required -> gametest_runner (only when --run-gametests)
|
| 21 |
+
|
| 22 |
+
Aggregate: per-module Pass@1, mean score, failure table.
|
| 23 |
+
"""
|
| 24 |
+
from __future__ import annotations
|
| 25 |
+
|
| 26 |
+
import argparse
|
| 27 |
+
import json
|
| 28 |
+
import subprocess
|
| 29 |
+
import sys
|
| 30 |
+
import tempfile
|
| 31 |
+
from pathlib import Path
|
| 32 |
+
|
| 33 |
+
HERE = Path(__file__).resolve().parent
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def load_jsonl(path: Path) -> list[dict]:
|
| 37 |
+
return [json.loads(l) for l in path.read_text(encoding="utf-8").splitlines() if l.strip()]
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def run_ast(task: dict, answer: str, workdir: Path) -> dict:
|
| 41 |
+
tf, cf = workdir / "task.json", workdir / "answer.java"
|
| 42 |
+
tf.write_text(json.dumps(task, ensure_ascii=False), encoding="utf-8")
|
| 43 |
+
cf.write_text(answer, encoding="utf-8")
|
| 44 |
+
proc = subprocess.run([sys.executable, str(HERE / "ast_eval.py"),
|
| 45 |
+
"--code", str(cf), "--task", str(tf)],
|
| 46 |
+
capture_output=True, text=True)
|
| 47 |
+
try:
|
| 48 |
+
return json.loads(proc.stdout)
|
| 49 |
+
except json.JSONDecodeError:
|
| 50 |
+
return {"passed": False, "score": 0.0, "error": proc.stderr[-500:]}
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def run_sandbox(task: dict, answer: str, workdir: Path, dry: bool) -> dict:
|
| 54 |
+
tf, cf = workdir / "task.json", workdir / "answer.java"
|
| 55 |
+
tf.write_text(json.dumps(task, ensure_ascii=False), encoding="utf-8")
|
| 56 |
+
cf.write_text(answer, encoding="utf-8")
|
| 57 |
+
cmd = [sys.executable, str(HERE / "sandbox_runner.py"),
|
| 58 |
+
"--task-file", str(tf), "--code-file", str(cf),
|
| 59 |
+
"--workdir", str(workdir / "ws")]
|
| 60 |
+
if dry:
|
| 61 |
+
cmd.append("--dry-run")
|
| 62 |
+
proc = subprocess.run(cmd, capture_output=True, text=True)
|
| 63 |
+
try:
|
| 64 |
+
return json.loads(proc.stdout)
|
| 65 |
+
except json.JSONDecodeError:
|
| 66 |
+
return {"passed": False, "error": proc.stderr[-500:]}
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
def main() -> int:
|
| 70 |
+
p = argparse.ArgumentParser()
|
| 71 |
+
p.add_argument("--data", required=True)
|
| 72 |
+
p.add_argument("--answers", required=True)
|
| 73 |
+
p.add_argument("--out", default=None)
|
| 74 |
+
p.add_argument("--workdir", default=None)
|
| 75 |
+
p.add_argument("--dry-run", action="store_true")
|
| 76 |
+
p.add_argument("--skip-compile", action="store_true",
|
| 77 |
+
help="AST/static gate only (no Gradle) - offline mode")
|
| 78 |
+
p.add_argument("--scores", default=None,
|
| 79 |
+
help="JSON {task_id: {score, verdict,...}} for debug tasks")
|
| 80 |
+
args = p.parse_args()
|
| 81 |
+
|
| 82 |
+
tasks = {t["task_id"]: t for t in load_jsonl(Path(args.data))}
|
| 83 |
+
answers = load_jsonl(Path(args.answers))
|
| 84 |
+
scores = json.loads(Path(args.scores).read_text()) if args.scores else {}
|
| 85 |
+
workdir = Path(args.workdir or tempfile.mkdtemp(prefix="forgebench_run_"))
|
| 86 |
+
workdir.mkdir(parents=True, exist_ok=True)
|
| 87 |
+
|
| 88 |
+
rows, by_module = [], {}
|
| 89 |
+
for row in answers:
|
| 90 |
+
task = tasks.get(row["task_id"])
|
| 91 |
+
if task is None:
|
| 92 |
+
continue
|
| 93 |
+
answer = row["answer"]
|
| 94 |
+
module = task["module"]
|
| 95 |
+
|
| 96 |
+
rec = {"task_id": task["task_id"], "module": module}
|
| 97 |
+
if module == "debug":
|
| 98 |
+
try:
|
| 99 |
+
obj = json.loads(answer)
|
| 100 |
+
ok = all(k in obj for k in ("root_cause", "fix_explanation", "code_patch"))
|
| 101 |
+
rec.update(static_json_ok=ok, **scores.get(task["task_id"], {}))
|
| 102 |
+
except json.JSONDecodeError:
|
| 103 |
+
rec.update(static_json_ok=False, verdict="fail")
|
| 104 |
+
else:
|
| 105 |
+
ast = run_ast(task, answer, workdir)
|
| 106 |
+
rec["ast_passed"] = ast.get("passed")
|
| 107 |
+
rec["ast_score"] = ast.get("score")
|
| 108 |
+
if task["eval_criteria"]["must_compile"] and not args.skip_compile and not args.dry_run:
|
| 109 |
+
sb = run_sandbox(task, answer, workdir, dry=False)
|
| 110 |
+
rec["compile_pass@1"] = sb.get("passed")
|
| 111 |
+
elif args.dry_run:
|
| 112 |
+
sb = run_sandbox(task, answer, workdir, dry=True)
|
| 113 |
+
rec["compile_pass@1"] = None
|
| 114 |
+
rec["sandbox_dry_run"] = True
|
| 115 |
+
final = scores.get(task["task_id"], {}).get("verdict")
|
| 116 |
+
rec["verdict"] = final or ("pass" if rec.get("compile_pass@1") is not False
|
| 117 |
+
and rec.get("ast_passed") else "fail")
|
| 118 |
+
rows.append(rec)
|
| 119 |
+
by_module.setdefault(module, []).append(rec)
|
| 120 |
+
|
| 121 |
+
summary = {}
|
| 122 |
+
for module, recs in by_module.items():
|
| 123 |
+
n = len(recs)
|
| 124 |
+
summary[module] = {
|
| 125 |
+
"n": n,
|
| 126 |
+
"pass@1": round(sum(1 for r in recs if r.get("compile_pass@1") is True) / n, 3)
|
| 127 |
+
if any("compile_pass@1" in r for r in recs) else None,
|
| 128 |
+
"ast_pass_rate": round(sum(1 for r in recs if r.get("ast_passed")) / n, 3),
|
| 129 |
+
"judge_pass_rate": round(sum(1 for r in recs if r.get("verdict") == "pass") / n, 3),
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
report = {"summary": summary, "rows": rows}
|
| 133 |
+
payload = json.dumps(report, ensure_ascii=False, indent=2)
|
| 134 |
+
if args.out:
|
| 135 |
+
Path(args.out).write_text(payload, encoding="utf-8")
|
| 136 |
+
print(payload)
|
| 137 |
+
return 0
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
if __name__ == "__main__":
|
| 141 |
+
sys.exit(main())
|
harness/sandbox_runner.py
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
"""
|
| 4 |
+
ForgeBench sandbox runner.
|
| 5 |
+
|
| 6 |
+
Takes an LLM-generated .java file, injects it into a pre-configured NeoForge 1.21.1
|
| 7 |
+
MDK template, runs `./gradlew build -x test` in a subprocess, and parses the Gradle
|
| 8 |
+
output to determine Pass@1 (compilation success).
|
| 9 |
+
|
| 10 |
+
Rules honoured (ForgeBench spec):
|
| 11 |
+
* raw `javac` is NEVER used - compilation happens inside the real MDK Gradle build,
|
| 12 |
+
so the full NeoForge 1.21.1 + vanilla Mojmap classpath is available;
|
| 13 |
+
* no Minecraft server is launched;
|
| 14 |
+
* no Mockito / no mocking of Level or Player classes.
|
| 15 |
+
|
| 16 |
+
Exit codes of this runner (independent of the build):
|
| 17 |
+
0 - evaluation executed (result JSON printed to stdout / --out file)
|
| 18 |
+
2 - usage / input error
|
| 19 |
+
3 - internal runner error
|
| 20 |
+
"""
|
| 21 |
+
from __future__ import annotations
|
| 22 |
+
|
| 23 |
+
import argparse
|
| 24 |
+
import json
|
| 25 |
+
import os
|
| 26 |
+
import re
|
| 27 |
+
import shutil
|
| 28 |
+
import subprocess
|
| 29 |
+
import sys
|
| 30 |
+
import tempfile
|
| 31 |
+
import time
|
| 32 |
+
from pathlib import Path
|
| 33 |
+
|
| 34 |
+
DEFAULT_TEMPLATE = os.environ.get("FORGEBENCH_TEMPLATE", "/opt/forgebench/template")
|
| 35 |
+
if not Path(DEFAULT_TEMPLATE).exists():
|
| 36 |
+
# local / source-tree fallback: harness/ sits next to template/ in the repo
|
| 37 |
+
_sibling = Path(__file__).resolve().parent.parent / "template"
|
| 38 |
+
if _sibling.exists():
|
| 39 |
+
DEFAULT_TEMPLATE = str(_sibling)
|
| 40 |
+
DEFAULT_GRADLE = os.environ.get("FORGEBENCH_GRADLE", "./gradlew")
|
| 41 |
+
|
| 42 |
+
GRADLE_SUCCESS_RE = re.compile(r"^BUILD SUCCESSFUL\b", re.MULTILINE)
|
| 43 |
+
GRADLE_FAIL_RE = re.compile(r"^BUILD FAILED\b", re.MULTILINE)
|
| 44 |
+
|
| 45 |
+
# Task id -> package under which the answer is injected (kept stable so package
|
| 46 |
+
# declarations inside the LLM answer can be normalized).
|
| 47 |
+
INJECT_PACKAGE = "com.example.generated"
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
class SandboxResult(dict):
|
| 51 |
+
"""JSON-serialisable evaluation result."""
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
def _normalize_package(java_source: str, package: str) -> str:
|
| 55 |
+
"""Rewrite the package declaration of the generated file to the injection package.
|
| 56 |
+
|
| 57 |
+
Keeps imports intact. If the source has no package declaration, one is added.
|
| 58 |
+
"""
|
| 59 |
+
src = java_source
|
| 60 |
+
if re.search(r"^\s*package\s+[\w.]+\s*;", src, re.MULTILINE):
|
| 61 |
+
src = re.sub(r"^\s*package\s+[\w.]+\s*;", f"package {package};", src, count=1)
|
| 62 |
+
else:
|
| 63 |
+
src = f"package {package};\n\n" + src
|
| 64 |
+
return src
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
def _class_name(java_source: str, fallback: str) -> str:
|
| 68 |
+
m = re.search(r"\b(?:class|interface|enum|record)\s+(\w+)", java_source)
|
| 69 |
+
return m.group(1) if m else fallback
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
def prepare_workspace(template_dir: Path, java_source: str, task: dict,
|
| 73 |
+
workdir: Path) -> Path:
|
| 74 |
+
"""Copy the MDK template and inject the answer + task metadata."""
|
| 75 |
+
if workdir.exists():
|
| 76 |
+
shutil.rmtree(workdir)
|
| 77 |
+
shutil.copytree(template_dir, workdir)
|
| 78 |
+
|
| 79 |
+
src_root = workdir / "src" / "main" / "java"
|
| 80 |
+
pkg_dir = src_root.joinpath(*INJECT_PACKAGE.split("."))
|
| 81 |
+
pkg_dir.mkdir(parents=True, exist_ok=True)
|
| 82 |
+
|
| 83 |
+
normalized = _normalize_package(java_source, INJECT_PACKAGE)
|
| 84 |
+
class_name = _class_name(normalized, "GeneratedAnswer")
|
| 85 |
+
(pkg_dir / f"{class_name}.java").write_text(normalized, encoding="utf-8")
|
| 86 |
+
|
| 87 |
+
meta = {
|
| 88 |
+
"task_id": task.get("task_id"),
|
| 89 |
+
"module": task.get("module"),
|
| 90 |
+
"must_compile": task.get("eval_criteria", {}).get("must_compile", False),
|
| 91 |
+
}
|
| 92 |
+
(workdir / "forgebench_task.json").write_text(
|
| 93 |
+
json.dumps(meta, ensure_ascii=False, indent=2), encoding="utf-8")
|
| 94 |
+
return workdir
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
def run_gradle_build(workdir: Path, timeout: int, gradle_cmd: str,
|
| 98 |
+
extra_args: list[str] | None = None) -> tuple[int, str, float]:
|
| 99 |
+
"""Execute the headless Gradle build. Returns (exit_code, combined_log, seconds)."""
|
| 100 |
+
args = gradle_cmd.split() + ["build", "-x", "test", "--console=plain", "--no-daemon"]
|
| 101 |
+
if extra_args:
|
| 102 |
+
args += list(extra_args)
|
| 103 |
+
t0 = time.time()
|
| 104 |
+
try:
|
| 105 |
+
proc = subprocess.run(
|
| 106 |
+
args, cwd=str(workdir),
|
| 107 |
+
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
| 108 |
+
text=True, timeout=timeout, shell=False,
|
| 109 |
+
)
|
| 110 |
+
code, log = proc.returncode, proc.stdout
|
| 111 |
+
except subprocess.TimeoutExpired as e:
|
| 112 |
+
code = 124
|
| 113 |
+
log = (e.stdout or "") + f"\n! FORGEBENCH: build timed out after {timeout}s"
|
| 114 |
+
except FileNotFoundError:
|
| 115 |
+
code = 127
|
| 116 |
+
log = f"! FORGEBENCH: gradle command not found: {gradle_cmd}"
|
| 117 |
+
return code, log, time.time() - t0
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
def evaluate(task_file: Path, code_file: Path, template_dir: Path, workdir: Path,
|
| 121 |
+
timeout: int, gradle_cmd: str, dry_run: bool) -> SandboxResult:
|
| 122 |
+
task = json.loads(task_file.read_text(encoding="utf-8"))
|
| 123 |
+
java_source = code_file.read_text(encoding="utf-8")
|
| 124 |
+
must_compile = task.get("eval_criteria", {}).get("must_compile", False)
|
| 125 |
+
|
| 126 |
+
result = SandboxResult(
|
| 127 |
+
task_id=task.get("task_id"),
|
| 128 |
+
module=task.get("module"),
|
| 129 |
+
must_compile=must_compile,
|
| 130 |
+
passed=False,
|
| 131 |
+
exit_code=None,
|
| 132 |
+
seconds=None,
|
| 133 |
+
log_tail="",
|
| 134 |
+
)
|
| 135 |
+
|
| 136 |
+
if not must_compile:
|
| 137 |
+
# Non-compile tasks (debug/build/diagnosis) are graded by ast_eval/judge,
|
| 138 |
+
# not by the sandbox.
|
| 139 |
+
result["skipped"] = "task does not require compilation (must_compile=false)"
|
| 140 |
+
return result
|
| 141 |
+
|
| 142 |
+
prepare_workspace(template_dir, java_source, task, workdir)
|
| 143 |
+
|
| 144 |
+
if dry_run:
|
| 145 |
+
result["dry_run"] = True
|
| 146 |
+
result["gradle_command"] = f"{gradle_cmd} build -x test --console=plain --no-daemon"
|
| 147 |
+
result["injected_file"] = str(
|
| 148 |
+
workdir / "src" / "main" / "java" / Path(*INJECT_PACKAGE.split(".")))
|
| 149 |
+
return result
|
| 150 |
+
|
| 151 |
+
code, log, seconds = run_gradle_build(workdir, timeout, gradle_cmd)
|
| 152 |
+
success = code == 0 and GRADLE_SUCCESS_RE.search(log) and not GRADLE_FAIL_RE.search(log)
|
| 153 |
+
|
| 154 |
+
result["passed"] = bool(success) # Pass@1
|
| 155 |
+
result["exit_code"] = code
|
| 156 |
+
result["seconds"] = round(seconds, 2)
|
| 157 |
+
result["log_tail"] = "\n".join(log.strip().splitlines()[-60:])
|
| 158 |
+
return result
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
def main() -> int:
|
| 162 |
+
p = argparse.ArgumentParser(description="ForgeBench sandbox runner (compile check)")
|
| 163 |
+
p.add_argument("--task-file", required=True, help="JSONL line of the task as JSON file")
|
| 164 |
+
p.add_argument("--code-file", required=True, help="LLM-generated .java file")
|
| 165 |
+
p.add_argument("--workdir", default=None, help="workspace dir (default: mkdtemp)")
|
| 166 |
+
p.add_argument("--template", default=DEFAULT_TEMPLATE, help="MDK template dir")
|
| 167 |
+
p.add_argument("--timeout", type=int, default=900, help="gradle timeout seconds")
|
| 168 |
+
p.add_argument("--gradle", default=DEFAULT_GRADLE, help="gradle command")
|
| 169 |
+
p.add_argument("--out", default=None, help="write result JSON here")
|
| 170 |
+
p.add_argument("--dry-run", action="store_true",
|
| 171 |
+
help="prepare workspace + show command, do not build")
|
| 172 |
+
args = p.parse_args()
|
| 173 |
+
|
| 174 |
+
try:
|
| 175 |
+
workdir = Path(args.workdir) if args.workdir else Path(tempfile.mkdtemp(prefix="forgebench_"))
|
| 176 |
+
result = evaluate(Path(args.task_file), Path(args.code_file), Path(args.template),
|
| 177 |
+
workdir, args.timeout, args.gradle, args.dry_run)
|
| 178 |
+
except Exception as e: # runner error, never a "pass"
|
| 179 |
+
result = SandboxResult(error=str(e), passed=False, exit_code=3)
|
| 180 |
+
print(json.dumps(result, ensure_ascii=False, indent=2), file=sys.stderr)
|
| 181 |
+
return 3
|
| 182 |
+
|
| 183 |
+
payload = json.dumps(result, ensure_ascii=False, indent=2)
|
| 184 |
+
if args.out:
|
| 185 |
+
Path(args.out).write_text(payload, encoding="utf-8")
|
| 186 |
+
print(payload)
|
| 187 |
+
|
| 188 |
+
# keep workspace for debugging when explicitly requested
|
| 189 |
+
if not args.workdir and not args.dry_run:
|
| 190 |
+
shutil.rmtree(workdir, ignore_errors=True)
|
| 191 |
+
return 0
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
if __name__ == "__main__":
|
| 195 |
+
sys.exit(main())
|
template/build.gradle.kts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
plugins {
|
| 2 |
+
id("java-library")
|
| 3 |
+
id("net.neoforged.gradle.userdev") version "7.0.145"
|
| 4 |
+
}
|
| 5 |
+
|
| 6 |
+
group = "com.example"
|
| 7 |
+
version = "1.0.0"
|
| 8 |
+
|
| 9 |
+
java {
|
| 10 |
+
toolchain {
|
| 11 |
+
languageVersion = JavaLanguageVersion.of(21)
|
| 12 |
+
}
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
base {
|
| 16 |
+
archivesName = "examplemod"
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
repositories {
|
| 20 |
+
mavenCentral()
|
| 21 |
+
maven("https://maven.neoforged.net/releases")
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
dependencies {
|
| 25 |
+
implementation("net.neoforged:neoforge:21.1.77")
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
runs {
|
| 29 |
+
configureEach {
|
| 30 |
+
modSource(project.sourceSets.main)
|
| 31 |
+
}
|
| 32 |
+
client {
|
| 33 |
+
client()
|
| 34 |
+
gameDirectory = file("run-client")
|
| 35 |
+
}
|
| 36 |
+
server {
|
| 37 |
+
server()
|
| 38 |
+
gameDirectory = file("run-server")
|
| 39 |
+
programArgument("--nogui")
|
| 40 |
+
}
|
| 41 |
+
}
|
template/gradle.properties
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
org.gradle.jvmargs=-Xmx3G -XX:+UseParallelGC
|
| 2 |
+
org.gradle.parallel=true
|
| 3 |
+
org.gradle.caching=true
|
template/settings.gradle.kts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
pluginManagement {
|
| 2 |
+
repositories {
|
| 3 |
+
gradlePluginPortal()
|
| 4 |
+
maven("https://maven.neoforged.net/releases")
|
| 5 |
+
}
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
rootProject.name = "examplemod"
|
template/src/main/resources/META-INF/neoforge.mods.toml
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
modLoader = "javafml"
|
| 2 |
+
loaderVersion = "[4,)"
|
| 3 |
+
license = "MIT"
|
| 4 |
+
|
| 5 |
+
[[mods]]
|
| 6 |
+
modId = "examplemod"
|
| 7 |
+
version = "1.0.0"
|
| 8 |
+
displayName = "ForgeBench Sandbox Mod"
|
| 9 |
+
description = "Minimal NeoForge 1.21.1 MDK template used by the ForgeBench sandbox."
|
| 10 |
+
|
| 11 |
+
[[mixins]]
|
| 12 |
+
config = "examplemod.mixins.json"
|
| 13 |
+
|
| 14 |
+
[[dependencies.neoforge]]
|
| 15 |
+
modId = "neoforge"
|
| 16 |
+
type = "required"
|
| 17 |
+
versionRange = "[21.1.0,)"
|
| 18 |
+
ordering = "NONE"
|
| 19 |
+
side = "BOTH"
|
| 20 |
+
|
| 21 |
+
[[dependencies.minecraft]]
|
| 22 |
+
modId = "minecraft"
|
| 23 |
+
type = "required"
|
| 24 |
+
versionRange = "[1.21.1]"
|
| 25 |
+
ordering = "NONE"
|
| 26 |
+
side = "BOTH"
|
template/src/main/resources/examplemod.mixins.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"required": true,
|
| 3 |
+
"minVersion": "0.8.5",
|
| 4 |
+
"package": "com.example.examplemod.mixin",
|
| 5 |
+
"compatibilityLevel": "JAVA_21",
|
| 6 |
+
"refmap": "examplemod.refmap.json",
|
| 7 |
+
"injectors": {
|
| 8 |
+
"defaultRequire": 1
|
| 9 |
+
},
|
| 10 |
+
"mixins": [],
|
| 11 |
+
"client": [],
|
| 12 |
+
"server": []
|
| 13 |
+
}
|
verification_result.json
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"passed": 19,
|
| 3 |
+
"failed": 0,
|
| 4 |
+
"results": [
|
| 5 |
+
{
|
| 6 |
+
"check": "V1 strict schema (field set/order/types)",
|
| 7 |
+
"status": "PASS",
|
| 8 |
+
"detail": "100 rows"
|
| 9 |
+
},
|
| 10 |
+
{
|
| 11 |
+
"check": "V2 unique task_ids",
|
| 12 |
+
"status": "PASS",
|
| 13 |
+
"detail": ""
|
| 14 |
+
},
|
| 15 |
+
{
|
| 16 |
+
"check": "V2 id pattern ^[A-Z]+_\\d{3}$",
|
| 17 |
+
"status": "PASS",
|
| 18 |
+
"detail": ""
|
| 19 |
+
},
|
| 20 |
+
{
|
| 21 |
+
"check": "V2 20 tasks per module",
|
| 22 |
+
"status": "PASS",
|
| 23 |
+
"detail": "{'api': 20, 'mixin': 20, 'migration': 20, 'debug': 20, 'build': 20}"
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"check": "V2 module order api<mixin<migration<debug<build",
|
| 27 |
+
"status": "PASS",
|
| 28 |
+
"detail": ""
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"check": "V3 required_annotations present in goldens",
|
| 32 |
+
"status": "PASS",
|
| 33 |
+
"detail": ""
|
| 34 |
+
},
|
| 35 |
+
{
|
| 36 |
+
"check": "V4 forbidden_apis absent from goldens (comments stripped)",
|
| 37 |
+
"status": "PASS",
|
| 38 |
+
"detail": ""
|
| 39 |
+
},
|
| 40 |
+
{
|
| 41 |
+
"check": "V5 debug goldens = valid JSON (root_cause/fix_explanation/code_patch)",
|
| 42 |
+
"status": "PASS",
|
| 43 |
+
"detail": ""
|
| 44 |
+
},
|
| 45 |
+
{
|
| 46 |
+
"check": "V6 Java goldens parse (javalang)",
|
| 47 |
+
"status": "PASS",
|
| 48 |
+
"detail": " | parsed=57 non-java=23"
|
| 49 |
+
},
|
| 50 |
+
{
|
| 51 |
+
"check": "V7 all golden imports on NeoForge 1.21.1 allowlist",
|
| 52 |
+
"status": "PASS",
|
| 53 |
+
"detail": ""
|
| 54 |
+
},
|
| 55 |
+
{
|
| 56 |
+
"check": "V8 contamination screen vs SFT corpus",
|
| 57 |
+
"status": "PASS",
|
| 58 |
+
"detail": "0 hits; shards=6; corpus_chars=4998017"
|
| 59 |
+
},
|
| 60 |
+
{
|
| 61 |
+
"check": "V9a sandbox --dry-run prepares workspace",
|
| 62 |
+
"status": "PASS",
|
| 63 |
+
"detail": "\": null,\n \"log_tail\": \"\",\n \"dry_run\": true,\n \"gradle_command\": \"./gradlew build -x test --console=plain --no-daemon\",\n \"injected_file\": \"/tmp/tmpth5s1_d_/ws/src/main/java/com/example/generated\"\n}\n"
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"check": "V9b ast_eval passes its own golden (API_001)",
|
| 67 |
+
"status": "PASS",
|
| 68 |
+
"detail": "[]"
|
| 69 |
+
},
|
| 70 |
+
{
|
| 71 |
+
"check": "V9c ast_eval flags Forge namespace + 1.16 text API",
|
| 72 |
+
"status": "PASS",
|
| 73 |
+
"detail": "forbidden API present: net.minecraftforge forbidden API present: net.minecraft.util.text import not on NeoForge 1.21.1 classpath: net.minecraftforge.registries.DeferredItem (Forge namespace does not exist on NeoForge (use net.neoforged))"
|
| 74 |
+
},
|
| 75 |
+
{
|
| 76 |
+
"check": "V9d gametest template generation (offline)",
|
| 77 |
+
"status": "PASS",
|
| 78 |
+
"detail": "\",\n \"generated\": {\n \"test_class\": \"/tmp/tmpth5s1_d_/gt_ws/src/test/java/com/example/examplemod/gametest/ForgeBenchGameTest.java\",\n \"logic_class\": \"/tmp/tmpth5s1_d_/gt_ws/src/test/java/com/example/examplemod/gametest/GeneratedGameTestLogic.java\",\n \"hoisted_imports\": 0\n },\n \"ran\": false\n}\n"
|
| 79 |
+
},
|
| 80 |
+
{
|
| 81 |
+
"check": "V9e run_benchmark driver (dry-run)",
|
| 82 |
+
"status": "PASS",
|
| 83 |
+
"detail": ""
|
| 84 |
+
},
|
| 85 |
+
{
|
| 86 |
+
"check": "V10 Dockerfile references existing build context",
|
| 87 |
+
"status": "PASS",
|
| 88 |
+
"detail": ""
|
| 89 |
+
},
|
| 90 |
+
{
|
| 91 |
+
"check": "V10 judge prompt rubric sections",
|
| 92 |
+
"status": "PASS",
|
| 93 |
+
"detail": ""
|
| 94 |
+
},
|
| 95 |
+
{
|
| 96 |
+
"check": "V10 no javac/Mockito execution in harness",
|
| 97 |
+
"status": "PASS",
|
| 98 |
+
"detail": "doc mentions of the ban are fine; executable use is not"
|
| 99 |
+
}
|
| 100 |
+
]
|
| 101 |
+
}
|