Harbor format: 502 knowledge_work tasks (part 10)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +61 -0
- tasks/maud-contract143-5264b09c-v4-v2/solution/files/answer.json +7 -0
- tasks/maud-contract143-5264b09c-v4-v2/solution/solve.sh +4 -0
- tasks/maud-contract143-5264b09c-v4-v2/task.toml +47 -0
- tasks/maud-contract143-5264b09c-v4-v2/tests/expected.json +44 -0
- tasks/maud-contract143-5264b09c-v4-v2/tests/grade.py +350 -0
- tasks/maud-contract143-5264b09c-v4-v2/tests/test.sh +4 -0
- tasks/maud-contract143-5264b09c-v4-v2/validation/openenv.json +26 -0
- tasks/maud-contract143-c7d30229-v3/environment/inputs/merger_agreement.docx +3 -0
- tasks/maud-contract143-c7d30229-v3/instruction.md +29 -0
- tasks/maud-contract143-c7d30229-v3/solution/files/answer.json +6 -0
- tasks/maud-contract143-c7d30229-v3/solution/solve.sh +4 -0
- tasks/maud-contract143-c7d30229-v3/task.toml +49 -0
- tasks/maud-contract143-c7d30229-v3/tests/expected.json +32 -0
- tasks/maud-contract143-c7d30229-v3/tests/grade.py +330 -0
- tasks/maud-contract143-c7d30229-v3/tests/test.sh +4 -0
- tasks/maud-contract143-c7d30229-v3/validation/openenv.json +26 -0
- tasks/maud-contract144-26cb2971-v4/environment/inputs/merger_agreement.docx +3 -0
- tasks/maud-contract144-26cb2971-v4/instruction.md +34 -0
- tasks/maud-contract144-26cb2971-v4/solution/files/answer.json +7 -0
- tasks/maud-contract144-26cb2971-v4/solution/solve.sh +4 -0
- tasks/maud-contract144-26cb2971-v4/task.toml +44 -0
- tasks/maud-contract144-26cb2971-v4/tests/expected.json +44 -0
- tasks/maud-contract144-26cb2971-v4/tests/grade.py +350 -0
- tasks/maud-contract144-26cb2971-v4/tests/test.sh +4 -0
- tasks/maud-contract144-26cb2971-v4/validation/openenv.json +26 -0
- tasks/maud-contract145-49595272-v4-v2/environment/inputs/merger_agreement.docx +3 -0
- tasks/maud-contract145-49595272-v4-v2/instruction.md +28 -0
- tasks/maud-contract145-49595272-v4-v2/solution/files/answer.json +6 -0
- tasks/maud-contract145-49595272-v4-v2/solution/solve.sh +4 -0
- tasks/maud-contract145-49595272-v4-v2/task.toml +50 -0
- tasks/maud-contract145-49595272-v4-v2/tests/expected.json +36 -0
- tasks/maud-contract145-49595272-v4-v2/tests/grade.py +350 -0
- tasks/maud-contract145-49595272-v4-v2/tests/test.sh +4 -0
- tasks/maud-contract145-49595272-v4-v2/validation/openenv.json +26 -0
- tasks/maud-contract145-49d06ba4-v4-v2/environment/inputs/merger_agreement.docx +3 -0
- tasks/maud-contract145-49d06ba4-v4-v2/instruction.md +33 -0
- tasks/maud-contract145-49d06ba4-v4-v2/solution/files/answer.json +7 -0
- tasks/maud-contract145-49d06ba4-v4-v2/solution/solve.sh +4 -0
- tasks/maud-contract145-49d06ba4-v4-v2/task.toml +47 -0
- tasks/maud-contract145-49d06ba4-v4-v2/tests/expected.json +44 -0
- tasks/maud-contract145-49d06ba4-v4-v2/tests/grade.py +350 -0
- tasks/maud-contract145-49d06ba4-v4-v2/tests/test.sh +4 -0
- tasks/maud-contract145-49d06ba4-v4-v2/validation/openenv.json +26 -0
- tasks/maud-contract145-f498ec72-v2/environment/inputs/merger_agreement.docx +3 -0
- tasks/maud-contract145-f498ec72-v2/instruction.md +33 -0
- tasks/maud-contract145-f498ec72-v2/solution/files/answer.json +7 -0
- tasks/maud-contract145-f498ec72-v2/solution/solve.sh +4 -0
- tasks/maud-contract145-f498ec72-v2/task.toml +43 -0
- tasks/maud-contract145-f498ec72-v2/tests/expected.json +39 -0
.gitattributes
CHANGED
|
@@ -288,3 +288,64 @@ tasks/maud-contract14-4b5deddf-v2/environment/inputs/merger_agreement.docx filte
|
|
| 288 |
tasks/maud-contract141-4b4a4674-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 289 |
tasks/maud-contract141-5e048673-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 290 |
tasks/maud-contract143-5264b09c-v4-v2/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 288 |
tasks/maud-contract141-4b4a4674-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 289 |
tasks/maud-contract141-5e048673-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 290 |
tasks/maud-contract143-5264b09c-v4-v2/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 291 |
+
tasks/maud-contract143-c7d30229-v3/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 292 |
+
tasks/maud-contract144-26cb2971-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 293 |
+
tasks/maud-contract145-49595272-v4-v2/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 294 |
+
tasks/maud-contract145-49d06ba4-v4-v2/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 295 |
+
tasks/maud-contract145-f498ec72-v2/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 296 |
+
tasks/maud-contract146-fbc0a17b-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 297 |
+
tasks/maud-contract147-1a36b461-v2/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 298 |
+
tasks/maud-contract148-77fcc356-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 299 |
+
tasks/maud-contract16-17230d15-v2/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 300 |
+
tasks/maud-contract16-a3779b87-v3/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 301 |
+
tasks/maud-contract17-7885cdaf-v3/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 302 |
+
tasks/maud-contract23-76b6054b-v3/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 303 |
+
tasks/maud-contract28-3c780c7a-v4-v2/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 304 |
+
tasks/maud-contract28-558ac05f-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 305 |
+
tasks/maud-contract28-6c1119f8-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 306 |
+
tasks/maud-contract29-0b05c42c-v3/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 307 |
+
tasks/maud-contract30-979b1f7b-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 308 |
+
tasks/maud-contract31-0e87721a-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 309 |
+
tasks/maud-contract31-9430a5b0-v4-v2/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 310 |
+
tasks/maud-contract32-20506973-v3/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 311 |
+
tasks/maud-contract32-ffa04025-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 312 |
+
tasks/maud-contract34-3bac585b-v3/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 313 |
+
tasks/maud-contract34-d33c4b68-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 314 |
+
tasks/maud-contract35-35b31950-v3/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 315 |
+
tasks/maud-contract4-b0491678-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 316 |
+
tasks/maud-contract40-aa43195c-v3/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 317 |
+
tasks/maud-contract41-c0bcbbde-v3/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 318 |
+
tasks/maud-contract41-eed498e0-v4-v2/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 319 |
+
tasks/maud-contract42-5c88efe8-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 320 |
+
tasks/maud-contract50-0ce3779f-v4-v2/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 321 |
+
tasks/maud-contract51-6872e901-v4-v2/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 322 |
+
tasks/maud-contract51-f34bbfd2-v2/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 323 |
+
tasks/maud-contract52-40d47f88-v3/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 324 |
+
tasks/maud-contract54-9d9f6627-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 325 |
+
tasks/maud-contract56-6ac32d59-v3/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 326 |
+
tasks/maud-contract56-cb46337f-v2/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 327 |
+
tasks/maud-contract62-349bb8a8-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 328 |
+
tasks/maud-contract62-4737dfed-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 329 |
+
tasks/maud-contract63-20579b4b-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 330 |
+
tasks/maud-contract63-373d2cda-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 331 |
+
tasks/maud-contract66-69915965-v2/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 332 |
+
tasks/maud-contract66-7b4f745c-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 333 |
+
tasks/maud-contract68-cce6b699-v4-v2/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 334 |
+
tasks/maud-contract68-faa79d07-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 335 |
+
tasks/maud-contract69-d1291cd4-v2/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 336 |
+
tasks/maud-contract7-6df02afe-v3/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 337 |
+
tasks/maud-contract71-eabf5adf-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 338 |
+
tasks/maud-contract75-40b8e5a4-v2/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 339 |
+
tasks/maud-contract79-679cf135-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 340 |
+
tasks/maud-contract79-91698620-v2/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 341 |
+
tasks/maud-contract81-b009421d-v3/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 342 |
+
tasks/maud-contract83-b7aff00f-v2/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 343 |
+
tasks/maud-contract86-414f088d-v3/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 344 |
+
tasks/maud-contract86-4419616e-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 345 |
+
tasks/maud-contract87-0b3852fb-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 346 |
+
tasks/maud-contract91-0679cb8a-v3/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 347 |
+
tasks/maud-contract91-1de45597-v4-v2/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 348 |
+
tasks/maud-contract91-8345f72e-v4/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 349 |
+
tasks/maud-contract92-c6e3fbd3-v3/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 350 |
+
tasks/maud-contract92-ec51f913-v5/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
| 351 |
+
tasks/maud-contract99-4826c03f-v3/environment/inputs/merger_agreement.docx filter=lfs diff=lfs merge=lfs -text
|
tasks/maud-contract143-5264b09c-v4-v2/solution/files/answer.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"q1": "Yes",
|
| 3 |
+
"q2": "Yes",
|
| 4 |
+
"q3": "Reasonable best efforts",
|
| 5 |
+
"q4": "\"entitled to\" specific performance",
|
| 6 |
+
"q5": "2 business days or less"
|
| 7 |
+
}
|
tasks/maud-contract143-5264b09c-v4-v2/solution/solve.sh
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
set -eu
|
| 3 |
+
mkdir -p /workspace/outputs
|
| 4 |
+
cp -R /solution/files/. /workspace/outputs/
|
tasks/maud-contract143-5264b09c-v4-v2/task.toml
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
schema_version = "1.3"
|
| 2 |
+
|
| 3 |
+
[task]
|
| 4 |
+
name = "apex-gap/maud-contract143-5264b09c-v4-v2"
|
| 5 |
+
|
| 6 |
+
[metadata.apex_gap]
|
| 7 |
+
capability_tags = ["legal-documents", "docx-io"]
|
| 8 |
+
fix_version = "v4"
|
| 9 |
+
job = "corporate-law"
|
| 10 |
+
source = "theatticusproject/maud"
|
| 11 |
+
source_license = "CC-BY-4.0"
|
| 12 |
+
source_revision = "37d5c3b95d18dcd8404cc5ce3fd5069be062392f"
|
| 13 |
+
source_split = "train (main rows only)"
|
| 14 |
+
source_task_id = "contract_143:Pandemic or other public health event-Answer (Y/N)/<NONE>|Actions taken with consent or approval of Buyer-Answer (Y/N)/<NONE>|Ordinary course efforts standard-Answer/<NONE>|Specific Performance-Answer/<NONE>|Additional matching rights period for modifications (FTR)-Answer/<NONE>"
|
| 15 |
+
|
| 16 |
+
[metadata.apex_gap.rewrite]
|
| 17 |
+
change = "{\"add_conventions\": [\"MAE Definition, Actions taken with consent or approval of Buyer: answer `Yes` when the definition carves out actions taken or omitted by the Target with the Buyer's consent or approval, or at the Buyer's request or direction; a carve-out for any of these forms of Buyer sign-off counts, even if it does not use the words \\\"consent\\\" or \\\"approval\\\".\"], \"correct\": {}, \"evidence\": \"runs/apex-knowledge/task-supply/key-verification/decisions/maud.json\", \"from\": \"runs/apex-knowledge/wave4/maud/tasks/maud-contract143-5264b09c-v4\", \"reason\": \"q2: adjudication: labelling convention added to close an open reading (adjudicator A)\", \"remove\": [], \"rewrite\": {}, \"v1_task_id\": \"maud-contract143-5264b09c-v4\"}"
|
| 18 |
+
|
| 19 |
+
[metadata.openenv_hf_sandbox]
|
| 20 |
+
variant = "apex-gap-hfsandbox-v1"
|
| 21 |
+
task_modified_for_hf_sandbox = true
|
| 22 |
+
network_enabled = true
|
| 23 |
+
|
| 24 |
+
[environment]
|
| 25 |
+
docker_image = "ghcr.io/younesbelkada/apex@sha256:24969c952247033023872f87161a16e067003469506be63783bbaa5d96926bdf"
|
| 26 |
+
workdir = "/workspace"
|
| 27 |
+
cpus = 1
|
| 28 |
+
memory_mb = 4096
|
| 29 |
+
build_timeout_sec = 600
|
| 30 |
+
network_mode = "public"
|
| 31 |
+
|
| 32 |
+
[agent]
|
| 33 |
+
timeout_sec = 1800
|
| 34 |
+
network_mode = "public"
|
| 35 |
+
|
| 36 |
+
[verifier]
|
| 37 |
+
timeout_sec = 600
|
| 38 |
+
network_mode = "public"
|
| 39 |
+
environment_mode = "separate"
|
| 40 |
+
|
| 41 |
+
[verifier.environment]
|
| 42 |
+
network_mode = "public"
|
| 43 |
+
cpus = 1
|
| 44 |
+
memory_mb = 4096
|
| 45 |
+
|
| 46 |
+
[[artifacts]]
|
| 47 |
+
source = "/workspace/outputs"
|
tasks/maud-contract143-5264b09c-v4-v2/tests/expected.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"checks": [
|
| 3 |
+
{
|
| 4 |
+
"id": "q1",
|
| 5 |
+
"type": "answer",
|
| 6 |
+
"field": "q1",
|
| 7 |
+
"kind": "choice",
|
| 8 |
+
"value": "Yes",
|
| 9 |
+
"keep_operators": true
|
| 10 |
+
},
|
| 11 |
+
{
|
| 12 |
+
"id": "q2",
|
| 13 |
+
"type": "answer",
|
| 14 |
+
"field": "q2",
|
| 15 |
+
"kind": "choice",
|
| 16 |
+
"value": "Yes",
|
| 17 |
+
"keep_operators": true
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"id": "q3",
|
| 21 |
+
"type": "answer",
|
| 22 |
+
"field": "q3",
|
| 23 |
+
"kind": "choice",
|
| 24 |
+
"value": "Reasonable best efforts",
|
| 25 |
+
"keep_operators": true
|
| 26 |
+
},
|
| 27 |
+
{
|
| 28 |
+
"id": "q4",
|
| 29 |
+
"type": "answer",
|
| 30 |
+
"field": "q4",
|
| 31 |
+
"kind": "choice",
|
| 32 |
+
"value": "\"entitled to\" specific performance",
|
| 33 |
+
"keep_operators": true
|
| 34 |
+
},
|
| 35 |
+
{
|
| 36 |
+
"id": "q5",
|
| 37 |
+
"type": "answer",
|
| 38 |
+
"field": "q5",
|
| 39 |
+
"kind": "choice",
|
| 40 |
+
"value": "2 business days or less",
|
| 41 |
+
"keep_operators": true
|
| 42 |
+
}
|
| 43 |
+
]
|
| 44 |
+
}
|
tasks/maud-contract143-5264b09c-v4-v2/tests/grade.py
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Deterministic grader shared by converted knowledge-work tasks (v4: grade.py plus keep_operators).
|
| 2 |
+
|
| 3 |
+
Runs inside the separate verifier sandbox. Reads /tests/expected.json, inspects the
|
| 4 |
+
submitted /workspace/outputs tree and writes a binary reward plus per-check details.
|
| 5 |
+
No model calls and no network.
|
| 6 |
+
|
| 7 |
+
expected.json: {"checks": [{"id": ..., "type": ..., ...}, ...]}
|
| 8 |
+
Check types:
|
| 9 |
+
answer field of outputs/answer.json; kind = number|text|choice|date|bool|list
|
| 10 |
+
xlsx_range recalculated outputs/<file> vs tests/<target> over sheet!range (SpreadsheetBench rules)
|
| 11 |
+
xlsx_cell recalculated outputs/<file> sheet!cell vs value with tolerance (optional alt_values)
|
| 12 |
+
file_contains outputs/<file> text (docx/pdf/ics/eml/txt) must contain every needle
|
| 13 |
+
custom tests/<module>.py defines check(spec, outputs_dir, tests_dir) -> (bool, str)
|
| 14 |
+
|
| 15 |
+
Per-check option `keep_operators` (default false): text comparison keeps the comparison signs
|
| 16 |
+
< > = and their combined forms, so "> 5 business days" and "5 business days" differ. Without the
|
| 17 |
+
option every check grades exactly as knowledge/grader/grade.py, which strips them. Converters
|
| 18 |
+
ship this file as tests/grade.py only in builds that set the option (`convert.py --v4`), so
|
| 19 |
+
default builds keep grade.py byte for byte.
|
| 20 |
+
"""
|
| 21 |
+
|
| 22 |
+
import datetime as dt
|
| 23 |
+
import json
|
| 24 |
+
import re
|
| 25 |
+
import shutil
|
| 26 |
+
import subprocess
|
| 27 |
+
import sys
|
| 28 |
+
import tempfile
|
| 29 |
+
import unicodedata
|
| 30 |
+
from pathlib import Path
|
| 31 |
+
|
| 32 |
+
OUT = Path("/workspace/outputs")
|
| 33 |
+
TESTS = Path("/tests")
|
| 34 |
+
LOGS = Path("/logs/verifier")
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def norm_text(v, keep_operators=False):
|
| 38 |
+
v = unicodedata.normalize("NFKC", str(v)).casefold()
|
| 39 |
+
v = re.sub(r"[‘’“”]", "'", v)
|
| 40 |
+
if keep_operators:
|
| 41 |
+
# Each sign becomes its own token, so ">5" and "> 5" agree and "≥" reads as ">=".
|
| 42 |
+
v = v.replace("≥", ">=").replace("≤", "<=").replace("!=", "≠")
|
| 43 |
+
v = re.sub(r"[<>=≠]", lambda m: f" {m.group(0)} ", v)
|
| 44 |
+
v = re.sub(r"[^\w%.$/<>=≠-]+", " ", v)
|
| 45 |
+
else:
|
| 46 |
+
v = re.sub(r"[^\w%.$/-]+", " ", v)
|
| 47 |
+
return " ".join(v.split()).strip(" .")
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def text_norm(check):
|
| 51 |
+
"""norm_text with the check's own options."""
|
| 52 |
+
keep = bool(check.get("keep_operators"))
|
| 53 |
+
return lambda v: norm_text(v, keep_operators=keep)
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def to_number(v):
|
| 57 |
+
if isinstance(v, bool):
|
| 58 |
+
raise ValueError("bool")
|
| 59 |
+
if isinstance(v, (int, float)):
|
| 60 |
+
return float(v)
|
| 61 |
+
s = str(v).strip().replace(",", "").replace("$", "").replace("−", "-")
|
| 62 |
+
neg = s.startswith("(") and s.endswith(")")
|
| 63 |
+
s = s.strip("()").strip()
|
| 64 |
+
pct = s.endswith("%")
|
| 65 |
+
s = s.rstrip("%").strip()
|
| 66 |
+
s = re.sub(r"\s*(usd|dollars|million|billion|thousand|m|bn|k)$", "", s, flags=re.I)
|
| 67 |
+
x = float(s)
|
| 68 |
+
x = -x if neg else x
|
| 69 |
+
return x / 100 if pct else x
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
def number_ok(got, want, rel, abs_):
|
| 73 |
+
try:
|
| 74 |
+
g = to_number(got)
|
| 75 |
+
except (TypeError, ValueError):
|
| 76 |
+
return False
|
| 77 |
+
w = float(want)
|
| 78 |
+
tol = max(abs_, rel * abs(w))
|
| 79 |
+
# "12.5%" may mean the ratio 0.125 or the percent number 12.5; the gold fixes which.
|
| 80 |
+
candidates = [g, g * 100] if isinstance(got, str) and got.strip().endswith("%") else [g]
|
| 81 |
+
return any(abs(c - w) <= tol for c in candidates)
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
def parse_date(v):
|
| 85 |
+
if isinstance(v, (dt.date, dt.datetime)):
|
| 86 |
+
return v if isinstance(v, dt.date) else v.date()
|
| 87 |
+
s = str(v).strip()
|
| 88 |
+
for fmt in ("%Y-%m-%d", "%m/%d/%Y", "%m/%d/%y", "%d %B %Y", "%B %d, %Y", "%b %d, %Y", "%Y/%m/%d"):
|
| 89 |
+
try:
|
| 90 |
+
return dt.datetime.strptime(s, fmt).date()
|
| 91 |
+
except ValueError:
|
| 92 |
+
continue
|
| 93 |
+
raise ValueError(s)
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
def check_answer(check, answers):
|
| 97 |
+
key = check["field"]
|
| 98 |
+
if key not in answers:
|
| 99 |
+
return False, f"missing field {key!r}"
|
| 100 |
+
got, want, kind = answers[key], check["value"], check.get("kind", "text")
|
| 101 |
+
norm_text = text_norm(check)
|
| 102 |
+
if kind == "number":
|
| 103 |
+
ok = number_ok(got, want, check.get("rel_tol", 0.005), check.get("abs_tol", 0.01))
|
| 104 |
+
if not ok and check.get("percent_either"):
|
| 105 |
+
ok = number_ok(got, want * 100, check.get("rel_tol", 0.005), check.get("abs_tol", 0.01) * 100) or (
|
| 106 |
+
number_ok(got, want / 100, check.get("rel_tol", 0.005), check.get("abs_tol", 0.01) / 100)
|
| 107 |
+
)
|
| 108 |
+
elif kind == "date":
|
| 109 |
+
try:
|
| 110 |
+
ok = parse_date(got) == parse_date(want)
|
| 111 |
+
except ValueError:
|
| 112 |
+
ok = False
|
| 113 |
+
elif kind == "bool":
|
| 114 |
+
g = norm_text(got)
|
| 115 |
+
ok = g in {"yes", "true"} if want else g in {"no", "false"}
|
| 116 |
+
elif kind == "choice":
|
| 117 |
+
ok = norm_text(got) == norm_text(want)
|
| 118 |
+
elif kind == "list":
|
| 119 |
+
if not isinstance(got, list):
|
| 120 |
+
return False, f"{key}: expected a JSON list"
|
| 121 |
+
# Filenames may be given with a directory prefix; compare base names.
|
| 122 |
+
base = lambda x: norm_text(str(x).replace("\\", "/").rsplit("/", 1)[-1])
|
| 123 |
+
ok = sorted(base(x) for x in got) == sorted(base(x) for x in want)
|
| 124 |
+
else:
|
| 125 |
+
accepted = check.get("accept", [want])
|
| 126 |
+
ok = norm_text(got) in {norm_text(a) for a in accepted}
|
| 127 |
+
return ok, "" if ok else f"{key}: got {got!r}"
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
# LibreOffice keeps cached formula values on load unless told otherwise; force a full recalculation.
|
| 131 |
+
RECALC_PROFILE = """<?xml version="1.0" encoding="UTF-8"?>
|
| 132 |
+
<oor:items xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
| 133 |
+
<item oor:path="/org.openoffice.Office.Calc/Formula/Load"><prop oor:name="OOXMLRecalcMode" oor:op="fuse"><value>0</value></prop></item>
|
| 134 |
+
<item oor:path="/org.openoffice.Office.Calc/Formula/Load"><prop oor:name="ODFRecalcMode" oor:op="fuse"><value>0</value></prop></item>
|
| 135 |
+
</oor:items>
|
| 136 |
+
"""
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
def recalc(path, tmp):
|
| 140 |
+
dest = Path(tmp) / f"recalc-{len(list(Path(tmp).glob('recalc-*')))}"
|
| 141 |
+
dest.mkdir()
|
| 142 |
+
profile = Path(tmp) / "lo-profile"
|
| 143 |
+
if not profile.exists():
|
| 144 |
+
(profile / "user").mkdir(parents=True)
|
| 145 |
+
(profile / "user" / "registrymodifications.xcu").write_text(RECALC_PROFILE)
|
| 146 |
+
subprocess.run(
|
| 147 |
+
["soffice", f"-env:UserInstallation=file://{profile}", "--headless", "--calc", "--convert-to",
|
| 148 |
+
"xlsx:Calc MS Excel 2007 XML", "--outdir", str(dest), str(path)],
|
| 149 |
+
stdout=subprocess.DEVNULL,
|
| 150 |
+
stderr=subprocess.DEVNULL,
|
| 151 |
+
timeout=180,
|
| 152 |
+
check=False,
|
| 153 |
+
)
|
| 154 |
+
out = dest / (Path(path).stem + ".xlsx")
|
| 155 |
+
return out if out.exists() else Path(path)
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
def cell_value(v):
|
| 159 |
+
if isinstance(v, (int, float)) and not isinstance(v, bool):
|
| 160 |
+
return round(float(v), 2)
|
| 161 |
+
if isinstance(v, dt.datetime):
|
| 162 |
+
return round((v - dt.datetime(1899, 12, 30)).total_seconds() / 86400.0, 0)
|
| 163 |
+
if isinstance(v, dt.time):
|
| 164 |
+
return v.strftime("%H:%M")
|
| 165 |
+
if isinstance(v, str):
|
| 166 |
+
try:
|
| 167 |
+
return round(float(v), 2)
|
| 168 |
+
except ValueError:
|
| 169 |
+
return v.strip()
|
| 170 |
+
return v
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
def time_of(v):
|
| 174 |
+
"""A time or a day fraction in [0, 1) as HH:MM, rounded to the nearest second first. Calc and
|
| 175 |
+
Excel store a time as that fraction; openpyxl returns a time only for time-formatted cells."""
|
| 176 |
+
if isinstance(v, dt.time):
|
| 177 |
+
v = (v.hour * 3600 + v.minute * 60 + v.second + v.microsecond / 1e6) / 86400
|
| 178 |
+
if isinstance(v, (int, float)) and not isinstance(v, bool) and 0 <= v < 1:
|
| 179 |
+
return (dt.datetime(1899, 12, 30) + dt.timedelta(seconds=round(v * 86400))).strftime("%H:%M")
|
| 180 |
+
return None
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
def same_cell(a, b):
|
| 184 |
+
if isinstance(a, dt.time) is not isinstance(b, dt.time):
|
| 185 |
+
n = b if isinstance(a, dt.time) else a
|
| 186 |
+
if time_of(n) is not None: # a time against a plain day fraction
|
| 187 |
+
return time_of(a) == time_of(b)
|
| 188 |
+
a, b = cell_value(a), cell_value(b)
|
| 189 |
+
if a in (None, "") and b in (None, ""):
|
| 190 |
+
return True
|
| 191 |
+
return type(a) is type(b) and a == b
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
ERRORS = {"#NULL!", "#DIV/0!", "#VALUE!", "#REF!", "#NAME?", "#NUM!", "#N/A"}
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
def is_error(v):
|
| 198 |
+
return isinstance(v, str) and (v in ERRORS or v.startswith("Err:"))
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
def cells(rng):
|
| 202 |
+
if ":" not in rng:
|
| 203 |
+
return [rng]
|
| 204 |
+
from openpyxl.utils import range_boundaries, get_column_letter
|
| 205 |
+
|
| 206 |
+
c1, r1, c2, r2 = range_boundaries(rng)
|
| 207 |
+
return [f"{get_column_letter(c)}{r}" for r in range(r1, r2 + 1) for c in range(c1, c2 + 1)]
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
def load(path, tmp):
|
| 211 |
+
import openpyxl
|
| 212 |
+
|
| 213 |
+
return openpyxl.load_workbook(recalc(path, tmp), data_only=True)
|
| 214 |
+
|
| 215 |
+
|
| 216 |
+
def check_xlsx_range(check, tmp, cache):
|
| 217 |
+
sub = OUT / check["file"]
|
| 218 |
+
if not sub.is_file():
|
| 219 |
+
return False, f"missing output {check['file']}"
|
| 220 |
+
if sub not in cache:
|
| 221 |
+
cache[sub] = load(sub, tmp)
|
| 222 |
+
tgt = TESTS / check["target"]
|
| 223 |
+
if tgt not in cache:
|
| 224 |
+
cache[tgt] = load(tgt, tmp)
|
| 225 |
+
got, want = cache[sub], cache[tgt]
|
| 226 |
+
cached = None # the target's stored (Excel-computed) values, read only when Calc errs
|
| 227 |
+
for sheet, rng in check["ranges"]:
|
| 228 |
+
sheet = sheet or want.sheetnames[0]
|
| 229 |
+
if sheet not in got.sheetnames:
|
| 230 |
+
return False, f"sheet {sheet!r} missing"
|
| 231 |
+
for name in cells(rng):
|
| 232 |
+
w = want[sheet][name].value
|
| 233 |
+
if is_error(w):
|
| 234 |
+
# LibreOffice could not evaluate the gold formula (e.g. XLOOKUP, FILTER in Calc 7.4).
|
| 235 |
+
# The value Excel stored is the intended answer.
|
| 236 |
+
if cached is None:
|
| 237 |
+
import openpyxl
|
| 238 |
+
|
| 239 |
+
cached = openpyxl.load_workbook(tgt, data_only=True)
|
| 240 |
+
c = cached[sheet][name].value if sheet in cached.sheetnames else None
|
| 241 |
+
if c is not None and not is_error(c):
|
| 242 |
+
w = c
|
| 243 |
+
if not same_cell(w, got[sheet][name].value):
|
| 244 |
+
return False, f"{sheet}!{name}: want {w!r} got {got[sheet][name].value!r}"
|
| 245 |
+
return True, ""
|
| 246 |
+
|
| 247 |
+
|
| 248 |
+
def check_xlsx_cell(check, tmp, cache):
|
| 249 |
+
sub = OUT / check["file"]
|
| 250 |
+
if not sub.is_file():
|
| 251 |
+
return False, f"missing output {check['file']}"
|
| 252 |
+
if sub not in cache:
|
| 253 |
+
cache[sub] = load(sub, tmp)
|
| 254 |
+
wb = cache[sub]
|
| 255 |
+
if check["sheet"] not in wb.sheetnames:
|
| 256 |
+
return False, f"sheet {check['sheet']!r} missing"
|
| 257 |
+
got = wb[check["sheet"]][check["cell"]].value
|
| 258 |
+
want = check["value"]
|
| 259 |
+
if isinstance(want, (int, float)):
|
| 260 |
+
# alt_values: other accepted golds where the source admits more than one reading.
|
| 261 |
+
ok = got is not None and any(number_ok(got, w, check.get("rel_tol", 0.0), check.get("abs_tol", 0.01))
|
| 262 |
+
for w in [want, *check.get("alt_values", [])])
|
| 263 |
+
else:
|
| 264 |
+
norm = text_norm(check)
|
| 265 |
+
ok = norm(got) == norm(want)
|
| 266 |
+
return ok, "" if ok else f"{check['sheet']}!{check['cell']}: want {want!r} got {got!r}"
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
def text_of(path):
|
| 270 |
+
suffix = path.suffix.lower()
|
| 271 |
+
if suffix == ".docx":
|
| 272 |
+
import docx
|
| 273 |
+
|
| 274 |
+
d = docx.Document(path)
|
| 275 |
+
parts = [p.text for p in d.paragraphs]
|
| 276 |
+
for t in d.tables:
|
| 277 |
+
parts += [c.text for row in t.rows for c in row.cells]
|
| 278 |
+
return "\n".join(parts)
|
| 279 |
+
if suffix == ".pdf":
|
| 280 |
+
import pdfplumber
|
| 281 |
+
|
| 282 |
+
with pdfplumber.open(path) as pdf:
|
| 283 |
+
return "\n".join(page.extract_text() or "" for page in pdf.pages)
|
| 284 |
+
return path.read_text(errors="replace")
|
| 285 |
+
|
| 286 |
+
|
| 287 |
+
def check_file_contains(check, tmp, cache):
|
| 288 |
+
sub = OUT / check["file"]
|
| 289 |
+
if not sub.is_file():
|
| 290 |
+
return False, f"missing output {check['file']}"
|
| 291 |
+
text = text_of(sub)
|
| 292 |
+
hay = text if check.get("case_sensitive") else text.casefold()
|
| 293 |
+
for needle in check["needles"]:
|
| 294 |
+
n = needle if check.get("case_sensitive") else needle.casefold()
|
| 295 |
+
if n not in hay:
|
| 296 |
+
return False, f"{check['file']} lacks {needle!r}"
|
| 297 |
+
return True, ""
|
| 298 |
+
|
| 299 |
+
|
| 300 |
+
def main():
|
| 301 |
+
LOGS.mkdir(parents=True, exist_ok=True)
|
| 302 |
+
reward_path = LOGS / "reward.txt"
|
| 303 |
+
reward_path.write_text("0\n")
|
| 304 |
+
spec = json.loads((TESTS / "expected.json").read_text())
|
| 305 |
+
answers, details = {}, []
|
| 306 |
+
answer_file = OUT / "answer.json"
|
| 307 |
+
if answer_file.is_file():
|
| 308 |
+
try:
|
| 309 |
+
answers = json.loads(answer_file.read_text())
|
| 310 |
+
if not isinstance(answers, dict):
|
| 311 |
+
answers = {}
|
| 312 |
+
except json.JSONDecodeError:
|
| 313 |
+
answers = {}
|
| 314 |
+
tmp = tempfile.mkdtemp()
|
| 315 |
+
cache = {}
|
| 316 |
+
try:
|
| 317 |
+
for check in spec["checks"]:
|
| 318 |
+
try:
|
| 319 |
+
if check["type"] == "answer":
|
| 320 |
+
ok, why = check_answer(check, answers)
|
| 321 |
+
elif check["type"] == "xlsx_range":
|
| 322 |
+
ok, why = check_xlsx_range(check, tmp, cache)
|
| 323 |
+
elif check["type"] == "xlsx_cell":
|
| 324 |
+
ok, why = check_xlsx_cell(check, tmp, cache)
|
| 325 |
+
elif check["type"] == "file_contains":
|
| 326 |
+
ok, why = check_file_contains(check, tmp, cache)
|
| 327 |
+
elif check["type"] == "custom":
|
| 328 |
+
import importlib.util
|
| 329 |
+
|
| 330 |
+
spec_ = importlib.util.spec_from_file_location("custom_check", TESTS / f"{check['module']}.py")
|
| 331 |
+
mod = importlib.util.module_from_spec(spec_)
|
| 332 |
+
spec_.loader.exec_module(mod)
|
| 333 |
+
ok, why = mod.check(check, OUT, TESTS)
|
| 334 |
+
else:
|
| 335 |
+
ok, why = False, f"unknown check type {check['type']}"
|
| 336 |
+
except Exception as exc: # a malformed submission fails the check, not the grader
|
| 337 |
+
ok, why = False, f"{type(exc).__name__}: {exc}"
|
| 338 |
+
details.append({"id": check["id"], "passed": ok, "detail": why})
|
| 339 |
+
finally:
|
| 340 |
+
shutil.rmtree(tmp, ignore_errors=True)
|
| 341 |
+
passed = sum(d["passed"] for d in details)
|
| 342 |
+
total = len(details)
|
| 343 |
+
reward = 1 if total and passed == total else 0
|
| 344 |
+
(LOGS / "details.json").write_text(json.dumps({"passed": passed, "total": total, "checks": details}, indent=1))
|
| 345 |
+
reward_path.write_text(f"{reward}\n")
|
| 346 |
+
print(f"{passed}/{total} checks passed; reward {reward}")
|
| 347 |
+
|
| 348 |
+
|
| 349 |
+
if __name__ == "__main__":
|
| 350 |
+
sys.exit(main())
|
tasks/maud-contract143-5264b09c-v4-v2/tests/test.sh
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
set -eu
|
| 3 |
+
mkdir -p /logs/verifier /workspace/outputs
|
| 4 |
+
exec python3 -B -I /tests/grade.py
|
tasks/maud-contract143-5264b09c-v4-v2/validation/openenv.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"profile": "harbor-semantic-v1",
|
| 3 |
+
"reward_key": "reward",
|
| 4 |
+
"reward": {
|
| 5 |
+
"range": [
|
| 6 |
+
0,
|
| 7 |
+
1
|
| 8 |
+
],
|
| 9 |
+
"oracle_tolerance": 0,
|
| 10 |
+
"floor_margin": 0.1
|
| 11 |
+
},
|
| 12 |
+
"resources": {
|
| 13 |
+
"cpu": 1,
|
| 14 |
+
"memory_mb": 4096,
|
| 15 |
+
"disk_mb": 10240,
|
| 16 |
+
"episode_timeout_s": 1800
|
| 17 |
+
},
|
| 18 |
+
"types": {
|
| 19 |
+
"tags": [
|
| 20 |
+
"knowledge-work",
|
| 21 |
+
"legal-documents",
|
| 22 |
+
"docx-io"
|
| 23 |
+
]
|
| 24 |
+
},
|
| 25 |
+
"requires_credentials": false
|
| 26 |
+
}
|
tasks/maud-contract143-c7d30229-v3/environment/inputs/merger_agreement.docx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:388e895daff6a54e3aa9a3aa350b886996d7523a842951cda1589aad44c7030c
|
| 3 |
+
size 121553
|
tasks/maud-contract143-c7d30229-v3/instruction.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
You are an M&A associate reviewing a merger agreement for a deal-terms summary.
|
| 2 |
+
|
| 3 |
+
The full agreement is `/workspace/inputs/merger_agreement.docx`. Read it and answer each deal-point question below by choosing exactly one of the listed options, copied verbatim.
|
| 4 |
+
|
| 5 |
+
1. **Knowledge Definition** (field `q1`)
|
| 6 |
+
Options: `Actual knowledge`; `Constructive knowledge`
|
| 7 |
+
2. **Agreement provides for matching rights in connection with FTR: Initial matching rights period (FTR)** (field `q2`)
|
| 8 |
+
Options: `2 business days or less`; `3 business days`; `3 calendar days`; `4 business days`; `4 calendar days`; `5 business days`; `5 calendar days`; `Greater than 5 business days`
|
| 9 |
+
3. **Superior Offer Definition: Definition includes asset deals** (field `q4`)
|
| 10 |
+
Options: `"All or substantially all"`; `50%`; `Greater than 50% but not "all or substantially all"`; `Less than 50%`
|
| 11 |
+
4. **Type of Consideration** (field `q5`)
|
| 12 |
+
Options: `All Cash`; `All Stock`; `Mixed Cash/Stock`; `Mixed Cash/Stock: Election`
|
| 13 |
+
|
| 14 |
+
## Terms
|
| 15 |
+
|
| 16 |
+
- **FTR**: fiduciary termination right: the Target's right to terminate the agreement, consistent with the board's fiduciary duties, for example to accept a Superior Offer.
|
| 17 |
+
- **Matching rights**: the Buyer's right to a period in which to match or negotiate against a competing proposal before the Target board makes a COR or exercises an FTR.
|
| 18 |
+
|
| 19 |
+
## Labelling conventions
|
| 20 |
+
|
| 21 |
+
The options follow the ABA Deal Points Study labels used by MAUD.
|
| 22 |
+
|
| 23 |
+
- Knowledge Definition: knowledge is **Constructive** when the definition imputes knowledge based on investigation or inquiry, including "actual knowledge ... after reasonable inquiry" or knowledge the person would reasonably be expected to have. It is **Actual** only when no inquiry is required (for example "actual knowledge, without independent inquiry").
|
| 24 |
+
- Superior Offer Definition, asset and stock deals: the options give the minimum share of the Target's assets (asset deals) or of its stock or voting power (stock deals) that a proposal must cover to qualify as a Superior Offer. `50%` means "50% or more"; `Greater than 50% but not "all or substantially all"` means "more than 50%" or "a majority".
|
| 25 |
+
|
| 26 |
+
## Deliverable
|
| 27 |
+
|
| 28 |
+
Work in `/workspace`. Input files are under `/workspace/inputs/`. Put every deliverable in
|
| 29 |
+
`/workspace/outputs/`; only that directory is graded. Write `/workspace/outputs/answer.json`, a JSON object mapping each field (`q1`, `q2`, `q4`, `q5`) to the chosen option string.
|
tasks/maud-contract143-c7d30229-v3/solution/files/answer.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"q1": "Actual knowledge",
|
| 3 |
+
"q2": "3 business days",
|
| 4 |
+
"q4": "50%",
|
| 5 |
+
"q5": "Mixed Cash/Stock"
|
| 6 |
+
}
|
tasks/maud-contract143-c7d30229-v3/solution/solve.sh
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
set -eu
|
| 3 |
+
mkdir -p /workspace/outputs
|
| 4 |
+
cp -R /solution/files/. /workspace/outputs/
|
tasks/maud-contract143-c7d30229-v3/task.toml
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
schema_version = "1.3"
|
| 2 |
+
|
| 3 |
+
[task]
|
| 4 |
+
name = "apex-gap/maud-contract143-c7d30229-v3"
|
| 5 |
+
|
| 6 |
+
[metadata.apex_gap]
|
| 7 |
+
capability_tags = ["legal-documents", "docx-io"]
|
| 8 |
+
job = "corporate-law"
|
| 9 |
+
source = "theatticusproject/maud"
|
| 10 |
+
source_license = "CC-BY-4.0"
|
| 11 |
+
source_revision = "37d5c3b95d18dcd8404cc5ce3fd5069be062392f"
|
| 12 |
+
source_split = "train (main rows only)"
|
| 13 |
+
source_task_id = "contract_143:Knowledge Definition-Answer/<NONE>|Initial matching rights period (FTR)-Answer/<NONE>|Negative Interim Covenant includes carveout for pandemic responses-Answer (Y/N)/<NONE>|Definition includes asset deals-Answer/<NONE>|Type of Consideration-Answer/<NONE>"
|
| 14 |
+
|
| 15 |
+
[metadata.apex_gap.repair]
|
| 16 |
+
fixes = "{\"q3\": {\"action\": \"drop\", \"reason\": \"Section 6.1(b) excepts only the schedule, the Agreement, 'as may be required by applicable Law' and Parent consent, while 6.1(a)(iii) reads 'applicable Law, (including any COVID-19 Measures)'; the five Yes trajectories attributed that 6.1(a) parenthetical to 6.1(b). But 'Ordinary Course' is defined to exclude 'any commercially reasonable deviations therefrom due to COVID-19 or COVID-19 Measures' and is used six times in 6.1(b) exceptions ((v)(B), (v)(D), (x)(4), (xi)(B), (xii)), so the negative covenants do admit pandemic deviations through the defined term, and MAUD labels an item-level COVID exception Yes elsewhere (contract_100). This is the contract_24 template (identical definition and lead-in) that wave 3 dropped for this question as an unstated MAUD convention.\"}}"
|
| 17 |
+
|
| 18 |
+
[metadata.apex_gap.rewrite]
|
| 19 |
+
change = "{\"add_conventions\": [], \"correct\": {}, \"evidence\": \"runs/apex-knowledge/task-supply/key-verification/decisions/maud.json\", \"from\": \"runs/apex-knowledge/scale1k-import/maud/repair/tasks/maud-contract143-c7d30229-v2\", \"reason\": \"q3: asked but no check grades it (an earlier repair dropped the check)\", \"remove\": [\"q3\"], \"rewrite\": {}, \"v1_task_id\": \"maud-contract143-c7d30229-v2\"}"
|
| 20 |
+
|
| 21 |
+
[metadata.openenv_hf_sandbox]
|
| 22 |
+
variant = "apex-gap-hfsandbox-v1"
|
| 23 |
+
task_modified_for_hf_sandbox = true
|
| 24 |
+
network_enabled = true
|
| 25 |
+
|
| 26 |
+
[environment]
|
| 27 |
+
docker_image = "ghcr.io/younesbelkada/apex@sha256:24969c952247033023872f87161a16e067003469506be63783bbaa5d96926bdf"
|
| 28 |
+
workdir = "/workspace"
|
| 29 |
+
cpus = 1
|
| 30 |
+
memory_mb = 4096
|
| 31 |
+
build_timeout_sec = 600
|
| 32 |
+
network_mode = "public"
|
| 33 |
+
|
| 34 |
+
[agent]
|
| 35 |
+
timeout_sec = 1800
|
| 36 |
+
network_mode = "public"
|
| 37 |
+
|
| 38 |
+
[verifier]
|
| 39 |
+
timeout_sec = 600
|
| 40 |
+
network_mode = "public"
|
| 41 |
+
environment_mode = "separate"
|
| 42 |
+
|
| 43 |
+
[verifier.environment]
|
| 44 |
+
network_mode = "public"
|
| 45 |
+
cpus = 1
|
| 46 |
+
memory_mb = 4096
|
| 47 |
+
|
| 48 |
+
[[artifacts]]
|
| 49 |
+
source = "/workspace/outputs"
|
tasks/maud-contract143-c7d30229-v3/tests/expected.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"checks": [
|
| 3 |
+
{
|
| 4 |
+
"id": "q1",
|
| 5 |
+
"type": "answer",
|
| 6 |
+
"field": "q1",
|
| 7 |
+
"kind": "choice",
|
| 8 |
+
"value": "Actual knowledge"
|
| 9 |
+
},
|
| 10 |
+
{
|
| 11 |
+
"id": "q2",
|
| 12 |
+
"type": "answer",
|
| 13 |
+
"field": "q2",
|
| 14 |
+
"kind": "choice",
|
| 15 |
+
"value": "3 business days"
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"id": "q4",
|
| 19 |
+
"type": "answer",
|
| 20 |
+
"field": "q4",
|
| 21 |
+
"kind": "choice",
|
| 22 |
+
"value": "50%"
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"id": "q5",
|
| 26 |
+
"type": "answer",
|
| 27 |
+
"field": "q5",
|
| 28 |
+
"kind": "choice",
|
| 29 |
+
"value": "Mixed Cash/Stock"
|
| 30 |
+
}
|
| 31 |
+
]
|
| 32 |
+
}
|
tasks/maud-contract143-c7d30229-v3/tests/grade.py
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Deterministic grader shared by converted knowledge-work tasks.
|
| 2 |
+
|
| 3 |
+
Runs inside the separate verifier sandbox. Reads /tests/expected.json, inspects the
|
| 4 |
+
submitted /workspace/outputs tree and writes a binary reward plus per-check details.
|
| 5 |
+
No model calls and no network.
|
| 6 |
+
|
| 7 |
+
expected.json: {"checks": [{"id": ..., "type": ..., ...}, ...]}
|
| 8 |
+
Check types:
|
| 9 |
+
answer field of outputs/answer.json; kind = number|text|choice|date|bool|list
|
| 10 |
+
xlsx_range recalculated outputs/<file> vs tests/<target> over sheet!range (SpreadsheetBench rules)
|
| 11 |
+
xlsx_cell recalculated outputs/<file> sheet!cell vs value with tolerance (optional alt_values)
|
| 12 |
+
file_contains outputs/<file> text (docx/pdf/ics/eml/txt) must contain every needle
|
| 13 |
+
custom tests/<module>.py defines check(spec, outputs_dir, tests_dir) -> (bool, str)
|
| 14 |
+
"""
|
| 15 |
+
|
| 16 |
+
import datetime as dt
|
| 17 |
+
import json
|
| 18 |
+
import re
|
| 19 |
+
import shutil
|
| 20 |
+
import subprocess
|
| 21 |
+
import sys
|
| 22 |
+
import tempfile
|
| 23 |
+
import unicodedata
|
| 24 |
+
from pathlib import Path
|
| 25 |
+
|
| 26 |
+
OUT = Path("/workspace/outputs")
|
| 27 |
+
TESTS = Path("/tests")
|
| 28 |
+
LOGS = Path("/logs/verifier")
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def norm_text(v):
|
| 32 |
+
v = unicodedata.normalize("NFKC", str(v)).casefold()
|
| 33 |
+
v = re.sub(r"[‘’“”]", "'", v)
|
| 34 |
+
v = re.sub(r"[^\w%.$/-]+", " ", v)
|
| 35 |
+
return " ".join(v.split()).strip(" .")
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
def to_number(v):
|
| 39 |
+
if isinstance(v, bool):
|
| 40 |
+
raise ValueError("bool")
|
| 41 |
+
if isinstance(v, (int, float)):
|
| 42 |
+
return float(v)
|
| 43 |
+
s = str(v).strip().replace(",", "").replace("$", "").replace("−", "-")
|
| 44 |
+
neg = s.startswith("(") and s.endswith(")")
|
| 45 |
+
s = s.strip("()").strip()
|
| 46 |
+
pct = s.endswith("%")
|
| 47 |
+
s = s.rstrip("%").strip()
|
| 48 |
+
s = re.sub(r"\s*(usd|dollars|million|billion|thousand|m|bn|k)$", "", s, flags=re.I)
|
| 49 |
+
x = float(s)
|
| 50 |
+
x = -x if neg else x
|
| 51 |
+
return x / 100 if pct else x
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
def number_ok(got, want, rel, abs_):
|
| 55 |
+
try:
|
| 56 |
+
g = to_number(got)
|
| 57 |
+
except (TypeError, ValueError):
|
| 58 |
+
return False
|
| 59 |
+
w = float(want)
|
| 60 |
+
tol = max(abs_, rel * abs(w))
|
| 61 |
+
# "12.5%" may mean the ratio 0.125 or the percent number 12.5; the gold fixes which.
|
| 62 |
+
candidates = [g, g * 100] if isinstance(got, str) and got.strip().endswith("%") else [g]
|
| 63 |
+
return any(abs(c - w) <= tol for c in candidates)
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def parse_date(v):
|
| 67 |
+
if isinstance(v, (dt.date, dt.datetime)):
|
| 68 |
+
return v if isinstance(v, dt.date) else v.date()
|
| 69 |
+
s = str(v).strip()
|
| 70 |
+
for fmt in ("%Y-%m-%d", "%m/%d/%Y", "%m/%d/%y", "%d %B %Y", "%B %d, %Y", "%b %d, %Y", "%Y/%m/%d"):
|
| 71 |
+
try:
|
| 72 |
+
return dt.datetime.strptime(s, fmt).date()
|
| 73 |
+
except ValueError:
|
| 74 |
+
continue
|
| 75 |
+
raise ValueError(s)
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
def check_answer(check, answers):
|
| 79 |
+
key = check["field"]
|
| 80 |
+
if key not in answers:
|
| 81 |
+
return False, f"missing field {key!r}"
|
| 82 |
+
got, want, kind = answers[key], check["value"], check.get("kind", "text")
|
| 83 |
+
if kind == "number":
|
| 84 |
+
ok = number_ok(got, want, check.get("rel_tol", 0.005), check.get("abs_tol", 0.01))
|
| 85 |
+
if not ok and check.get("percent_either"):
|
| 86 |
+
ok = number_ok(got, want * 100, check.get("rel_tol", 0.005), check.get("abs_tol", 0.01) * 100) or (
|
| 87 |
+
number_ok(got, want / 100, check.get("rel_tol", 0.005), check.get("abs_tol", 0.01) / 100)
|
| 88 |
+
)
|
| 89 |
+
elif kind == "date":
|
| 90 |
+
try:
|
| 91 |
+
ok = parse_date(got) == parse_date(want)
|
| 92 |
+
except ValueError:
|
| 93 |
+
ok = False
|
| 94 |
+
elif kind == "bool":
|
| 95 |
+
g = norm_text(got)
|
| 96 |
+
ok = g in {"yes", "true"} if want else g in {"no", "false"}
|
| 97 |
+
elif kind == "choice":
|
| 98 |
+
ok = norm_text(got) == norm_text(want)
|
| 99 |
+
elif kind == "list":
|
| 100 |
+
if not isinstance(got, list):
|
| 101 |
+
return False, f"{key}: expected a JSON list"
|
| 102 |
+
# Filenames may be given with a directory prefix; compare base names.
|
| 103 |
+
base = lambda x: norm_text(str(x).replace("\\", "/").rsplit("/", 1)[-1])
|
| 104 |
+
ok = sorted(base(x) for x in got) == sorted(base(x) for x in want)
|
| 105 |
+
else:
|
| 106 |
+
accepted = check.get("accept", [want])
|
| 107 |
+
ok = norm_text(got) in {norm_text(a) for a in accepted}
|
| 108 |
+
return ok, "" if ok else f"{key}: got {got!r}"
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
# LibreOffice keeps cached formula values on load unless told otherwise; force a full recalculation.
|
| 112 |
+
RECALC_PROFILE = """<?xml version="1.0" encoding="UTF-8"?>
|
| 113 |
+
<oor:items xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
| 114 |
+
<item oor:path="/org.openoffice.Office.Calc/Formula/Load"><prop oor:name="OOXMLRecalcMode" oor:op="fuse"><value>0</value></prop></item>
|
| 115 |
+
<item oor:path="/org.openoffice.Office.Calc/Formula/Load"><prop oor:name="ODFRecalcMode" oor:op="fuse"><value>0</value></prop></item>
|
| 116 |
+
</oor:items>
|
| 117 |
+
"""
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
def recalc(path, tmp):
|
| 121 |
+
dest = Path(tmp) / f"recalc-{len(list(Path(tmp).glob('recalc-*')))}"
|
| 122 |
+
dest.mkdir()
|
| 123 |
+
profile = Path(tmp) / "lo-profile"
|
| 124 |
+
if not profile.exists():
|
| 125 |
+
(profile / "user").mkdir(parents=True)
|
| 126 |
+
(profile / "user" / "registrymodifications.xcu").write_text(RECALC_PROFILE)
|
| 127 |
+
subprocess.run(
|
| 128 |
+
["soffice", f"-env:UserInstallation=file://{profile}", "--headless", "--calc", "--convert-to",
|
| 129 |
+
"xlsx:Calc MS Excel 2007 XML", "--outdir", str(dest), str(path)],
|
| 130 |
+
stdout=subprocess.DEVNULL,
|
| 131 |
+
stderr=subprocess.DEVNULL,
|
| 132 |
+
timeout=180,
|
| 133 |
+
check=False,
|
| 134 |
+
)
|
| 135 |
+
out = dest / (Path(path).stem + ".xlsx")
|
| 136 |
+
return out if out.exists() else Path(path)
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
def cell_value(v):
|
| 140 |
+
if isinstance(v, (int, float)) and not isinstance(v, bool):
|
| 141 |
+
return round(float(v), 2)
|
| 142 |
+
if isinstance(v, dt.datetime):
|
| 143 |
+
return round((v - dt.datetime(1899, 12, 30)).total_seconds() / 86400.0, 0)
|
| 144 |
+
if isinstance(v, dt.time):
|
| 145 |
+
return v.strftime("%H:%M")
|
| 146 |
+
if isinstance(v, str):
|
| 147 |
+
try:
|
| 148 |
+
return round(float(v), 2)
|
| 149 |
+
except ValueError:
|
| 150 |
+
return v.strip()
|
| 151 |
+
return v
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
def time_of(v):
|
| 155 |
+
"""A time or a day fraction in [0, 1) as HH:MM, rounded to the nearest second first. Calc and
|
| 156 |
+
Excel store a time as that fraction; openpyxl returns a time only for time-formatted cells."""
|
| 157 |
+
if isinstance(v, dt.time):
|
| 158 |
+
v = (v.hour * 3600 + v.minute * 60 + v.second + v.microsecond / 1e6) / 86400
|
| 159 |
+
if isinstance(v, (int, float)) and not isinstance(v, bool) and 0 <= v < 1:
|
| 160 |
+
return (dt.datetime(1899, 12, 30) + dt.timedelta(seconds=round(v * 86400))).strftime("%H:%M")
|
| 161 |
+
return None
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
def same_cell(a, b):
|
| 165 |
+
if isinstance(a, dt.time) is not isinstance(b, dt.time):
|
| 166 |
+
n = b if isinstance(a, dt.time) else a
|
| 167 |
+
if time_of(n) is not None: # a time against a plain day fraction
|
| 168 |
+
return time_of(a) == time_of(b)
|
| 169 |
+
a, b = cell_value(a), cell_value(b)
|
| 170 |
+
if a in (None, "") and b in (None, ""):
|
| 171 |
+
return True
|
| 172 |
+
return type(a) is type(b) and a == b
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
ERRORS = {"#NULL!", "#DIV/0!", "#VALUE!", "#REF!", "#NAME?", "#NUM!", "#N/A"}
|
| 176 |
+
|
| 177 |
+
|
| 178 |
+
def is_error(v):
|
| 179 |
+
return isinstance(v, str) and (v in ERRORS or v.startswith("Err:"))
|
| 180 |
+
|
| 181 |
+
|
| 182 |
+
def cells(rng):
|
| 183 |
+
if ":" not in rng:
|
| 184 |
+
return [rng]
|
| 185 |
+
from openpyxl.utils import range_boundaries, get_column_letter
|
| 186 |
+
|
| 187 |
+
c1, r1, c2, r2 = range_boundaries(rng)
|
| 188 |
+
return [f"{get_column_letter(c)}{r}" for r in range(r1, r2 + 1) for c in range(c1, c2 + 1)]
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
def load(path, tmp):
|
| 192 |
+
import openpyxl
|
| 193 |
+
|
| 194 |
+
return openpyxl.load_workbook(recalc(path, tmp), data_only=True)
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
def check_xlsx_range(check, tmp, cache):
|
| 198 |
+
sub = OUT / check["file"]
|
| 199 |
+
if not sub.is_file():
|
| 200 |
+
return False, f"missing output {check['file']}"
|
| 201 |
+
if sub not in cache:
|
| 202 |
+
cache[sub] = load(sub, tmp)
|
| 203 |
+
tgt = TESTS / check["target"]
|
| 204 |
+
if tgt not in cache:
|
| 205 |
+
cache[tgt] = load(tgt, tmp)
|
| 206 |
+
got, want = cache[sub], cache[tgt]
|
| 207 |
+
cached = None # the target's stored (Excel-computed) values, read only when Calc errs
|
| 208 |
+
for sheet, rng in check["ranges"]:
|
| 209 |
+
sheet = sheet or want.sheetnames[0]
|
| 210 |
+
if sheet not in got.sheetnames:
|
| 211 |
+
return False, f"sheet {sheet!r} missing"
|
| 212 |
+
for name in cells(rng):
|
| 213 |
+
w = want[sheet][name].value
|
| 214 |
+
if is_error(w):
|
| 215 |
+
# LibreOffice could not evaluate the gold formula (e.g. XLOOKUP, FILTER in Calc 7.4).
|
| 216 |
+
# The value Excel stored is the intended answer.
|
| 217 |
+
if cached is None:
|
| 218 |
+
import openpyxl
|
| 219 |
+
|
| 220 |
+
cached = openpyxl.load_workbook(tgt, data_only=True)
|
| 221 |
+
c = cached[sheet][name].value if sheet in cached.sheetnames else None
|
| 222 |
+
if c is not None and not is_error(c):
|
| 223 |
+
w = c
|
| 224 |
+
if not same_cell(w, got[sheet][name].value):
|
| 225 |
+
return False, f"{sheet}!{name}: want {w!r} got {got[sheet][name].value!r}"
|
| 226 |
+
return True, ""
|
| 227 |
+
|
| 228 |
+
|
| 229 |
+
def check_xlsx_cell(check, tmp, cache):
|
| 230 |
+
sub = OUT / check["file"]
|
| 231 |
+
if not sub.is_file():
|
| 232 |
+
return False, f"missing output {check['file']}"
|
| 233 |
+
if sub not in cache:
|
| 234 |
+
cache[sub] = load(sub, tmp)
|
| 235 |
+
wb = cache[sub]
|
| 236 |
+
if check["sheet"] not in wb.sheetnames:
|
| 237 |
+
return False, f"sheet {check['sheet']!r} missing"
|
| 238 |
+
got = wb[check["sheet"]][check["cell"]].value
|
| 239 |
+
want = check["value"]
|
| 240 |
+
if isinstance(want, (int, float)):
|
| 241 |
+
# alt_values: other accepted golds where the source admits more than one reading.
|
| 242 |
+
ok = got is not None and any(number_ok(got, w, check.get("rel_tol", 0.0), check.get("abs_tol", 0.01))
|
| 243 |
+
for w in [want, *check.get("alt_values", [])])
|
| 244 |
+
else:
|
| 245 |
+
ok = norm_text(got) == norm_text(want)
|
| 246 |
+
return ok, "" if ok else f"{check['sheet']}!{check['cell']}: want {want!r} got {got!r}"
|
| 247 |
+
|
| 248 |
+
|
| 249 |
+
def text_of(path):
|
| 250 |
+
suffix = path.suffix.lower()
|
| 251 |
+
if suffix == ".docx":
|
| 252 |
+
import docx
|
| 253 |
+
|
| 254 |
+
d = docx.Document(path)
|
| 255 |
+
parts = [p.text for p in d.paragraphs]
|
| 256 |
+
for t in d.tables:
|
| 257 |
+
parts += [c.text for row in t.rows for c in row.cells]
|
| 258 |
+
return "\n".join(parts)
|
| 259 |
+
if suffix == ".pdf":
|
| 260 |
+
import pdfplumber
|
| 261 |
+
|
| 262 |
+
with pdfplumber.open(path) as pdf:
|
| 263 |
+
return "\n".join(page.extract_text() or "" for page in pdf.pages)
|
| 264 |
+
return path.read_text(errors="replace")
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
def check_file_contains(check, tmp, cache):
|
| 268 |
+
sub = OUT / check["file"]
|
| 269 |
+
if not sub.is_file():
|
| 270 |
+
return False, f"missing output {check['file']}"
|
| 271 |
+
text = text_of(sub)
|
| 272 |
+
hay = text if check.get("case_sensitive") else text.casefold()
|
| 273 |
+
for needle in check["needles"]:
|
| 274 |
+
n = needle if check.get("case_sensitive") else needle.casefold()
|
| 275 |
+
if n not in hay:
|
| 276 |
+
return False, f"{check['file']} lacks {needle!r}"
|
| 277 |
+
return True, ""
|
| 278 |
+
|
| 279 |
+
|
| 280 |
+
def main():
|
| 281 |
+
LOGS.mkdir(parents=True, exist_ok=True)
|
| 282 |
+
reward_path = LOGS / "reward.txt"
|
| 283 |
+
reward_path.write_text("0\n")
|
| 284 |
+
spec = json.loads((TESTS / "expected.json").read_text())
|
| 285 |
+
answers, details = {}, []
|
| 286 |
+
answer_file = OUT / "answer.json"
|
| 287 |
+
if answer_file.is_file():
|
| 288 |
+
try:
|
| 289 |
+
answers = json.loads(answer_file.read_text())
|
| 290 |
+
if not isinstance(answers, dict):
|
| 291 |
+
answers = {}
|
| 292 |
+
except json.JSONDecodeError:
|
| 293 |
+
answers = {}
|
| 294 |
+
tmp = tempfile.mkdtemp()
|
| 295 |
+
cache = {}
|
| 296 |
+
try:
|
| 297 |
+
for check in spec["checks"]:
|
| 298 |
+
try:
|
| 299 |
+
if check["type"] == "answer":
|
| 300 |
+
ok, why = check_answer(check, answers)
|
| 301 |
+
elif check["type"] == "xlsx_range":
|
| 302 |
+
ok, why = check_xlsx_range(check, tmp, cache)
|
| 303 |
+
elif check["type"] == "xlsx_cell":
|
| 304 |
+
ok, why = check_xlsx_cell(check, tmp, cache)
|
| 305 |
+
elif check["type"] == "file_contains":
|
| 306 |
+
ok, why = check_file_contains(check, tmp, cache)
|
| 307 |
+
elif check["type"] == "custom":
|
| 308 |
+
import importlib.util
|
| 309 |
+
|
| 310 |
+
spec_ = importlib.util.spec_from_file_location("custom_check", TESTS / f"{check['module']}.py")
|
| 311 |
+
mod = importlib.util.module_from_spec(spec_)
|
| 312 |
+
spec_.loader.exec_module(mod)
|
| 313 |
+
ok, why = mod.check(check, OUT, TESTS)
|
| 314 |
+
else:
|
| 315 |
+
ok, why = False, f"unknown check type {check['type']}"
|
| 316 |
+
except Exception as exc: # a malformed submission fails the check, not the grader
|
| 317 |
+
ok, why = False, f"{type(exc).__name__}: {exc}"
|
| 318 |
+
details.append({"id": check["id"], "passed": ok, "detail": why})
|
| 319 |
+
finally:
|
| 320 |
+
shutil.rmtree(tmp, ignore_errors=True)
|
| 321 |
+
passed = sum(d["passed"] for d in details)
|
| 322 |
+
total = len(details)
|
| 323 |
+
reward = 1 if total and passed == total else 0
|
| 324 |
+
(LOGS / "details.json").write_text(json.dumps({"passed": passed, "total": total, "checks": details}, indent=1))
|
| 325 |
+
reward_path.write_text(f"{reward}\n")
|
| 326 |
+
print(f"{passed}/{total} checks passed; reward {reward}")
|
| 327 |
+
|
| 328 |
+
|
| 329 |
+
if __name__ == "__main__":
|
| 330 |
+
sys.exit(main())
|
tasks/maud-contract143-c7d30229-v3/tests/test.sh
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
set -eu
|
| 3 |
+
mkdir -p /logs/verifier /workspace/outputs
|
| 4 |
+
exec python3 -B -I /tests/grade.py
|
tasks/maud-contract143-c7d30229-v3/validation/openenv.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"profile": "harbor-semantic-v1",
|
| 3 |
+
"reward_key": "reward",
|
| 4 |
+
"reward": {
|
| 5 |
+
"range": [
|
| 6 |
+
0,
|
| 7 |
+
1
|
| 8 |
+
],
|
| 9 |
+
"oracle_tolerance": 0,
|
| 10 |
+
"floor_margin": 0.1
|
| 11 |
+
},
|
| 12 |
+
"resources": {
|
| 13 |
+
"cpu": 1,
|
| 14 |
+
"memory_mb": 4096,
|
| 15 |
+
"disk_mb": 10240,
|
| 16 |
+
"episode_timeout_s": 1800
|
| 17 |
+
},
|
| 18 |
+
"types": {
|
| 19 |
+
"tags": [
|
| 20 |
+
"knowledge-work",
|
| 21 |
+
"legal-documents",
|
| 22 |
+
"docx-io"
|
| 23 |
+
]
|
| 24 |
+
},
|
| 25 |
+
"requires_credentials": false
|
| 26 |
+
}
|
tasks/maud-contract144-26cb2971-v4/environment/inputs/merger_agreement.docx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fda87b4400254d144863abd3197c517b59a733ac610d7dbd578c3bd2c28e8d2a
|
| 3 |
+
size 121971
|
tasks/maud-contract144-26cb2971-v4/instruction.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
You are an M&A associate reviewing a merger agreement for a deal-terms summary.
|
| 2 |
+
|
| 3 |
+
The full agreement is `/workspace/inputs/merger_agreement.docx`. Read it and answer each deal-point question below by choosing exactly one of the listed options, copied verbatim.
|
| 4 |
+
|
| 5 |
+
1. **MAE Definition: Actions taken with consent or approval of Buyer** (field `q1`)
|
| 6 |
+
Options: `No`; `Yes`
|
| 7 |
+
2. **Agreement provides for matching rights in connection with COR: Initial matching rights period (COR)** (field `q2`)
|
| 8 |
+
Options: `2 business days or less`; `3 business days`; `3 calendar days`; `4 business days`; `4 calendar days`; `5 business days`; `Greater than 5 business days`
|
| 9 |
+
3. **Superior Offer Definition: Definition includes asset deals** (field `q3`)
|
| 10 |
+
Options: `"All or substantially all"`; `50%`; `Greater than 50% but not "all or substantially all"`; `Less than 50%`
|
| 11 |
+
4. **MAE Definition: Relational language (MAE carveout)** (field `q4`)
|
| 12 |
+
Options: `No`; `Yes`
|
| 13 |
+
5. **Fiduciary exception: Board determination trigger (no shop)** (field `q5`)
|
| 14 |
+
Options: `Acquisition Proposal only`; `Superior Offer, or Acquisition Proposal reasonably likely/expected to result in a Superior Offer`
|
| 15 |
+
|
| 16 |
+
## Terms
|
| 17 |
+
|
| 18 |
+
- **MAE**: Material Adverse Effect, as defined in the agreement.
|
| 19 |
+
- **COR**: change of recommendation: the Target board withdrawing or changing its recommendation that stockholders approve the deal.
|
| 20 |
+
- **Matching rights**: the Buyer's right to a period in which to match or negotiate against a competing proposal before the Target board makes a COR or exercises an FTR.
|
| 21 |
+
- **Buyer**: the acquirer (often called Parent and Merger Sub in the agreement).
|
| 22 |
+
|
| 23 |
+
## Labelling conventions
|
| 24 |
+
|
| 25 |
+
The options follow the ABA Deal Points Study labels used by MAUD.
|
| 26 |
+
|
| 27 |
+
- For the following MAE Definition matters only (Actions taken with consent or approval of Buyer), answer `Yes` when the definition carves the matter out, so that effects arising from it are excluded from (not taken into account in determining) a Material Adverse Effect, and `No` otherwise.
|
| 28 |
+
- MAE Definition, Relational language (MAE carveout): this question asks whether the MAE definition uses relational language to connect the excluded effects to its carveouts. MAUD's related questions name that language: "resulting from", "arising from/out of", "relating to", "attributable to" or similar words, used for all or some of the carveouts. Answer `Yes` if the carveouts use such language and `No` if they do not. The question does not ask whether relational language is itself carved out.
|
| 29 |
+
- Superior Offer Definition, asset and stock deals: the options give the minimum share of the Target's assets (asset deals) or of its stock or voting power (stock deals) that a proposal must cover to qualify as a Superior Offer. `50%` means "50% or more"; `Greater than 50% but not "all or substantially all"` means "more than 50%" or "a majority".
|
| 30 |
+
|
| 31 |
+
## Deliverable
|
| 32 |
+
|
| 33 |
+
Work in `/workspace`. Input files are under `/workspace/inputs/`. Put every deliverable in
|
| 34 |
+
`/workspace/outputs/`; only that directory is graded. Write `/workspace/outputs/answer.json`, a JSON object mapping each field (`q1` … `q5`) to the chosen option string.
|
tasks/maud-contract144-26cb2971-v4/solution/files/answer.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"q1": "Yes",
|
| 3 |
+
"q2": "5 business days",
|
| 4 |
+
"q3": "Greater than 50% but not \"all or substantially all\"",
|
| 5 |
+
"q4": "Yes",
|
| 6 |
+
"q5": "Superior Offer, or Acquisition Proposal reasonably likely/expected to result in a Superior Offer"
|
| 7 |
+
}
|
tasks/maud-contract144-26cb2971-v4/solution/solve.sh
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
set -eu
|
| 3 |
+
mkdir -p /workspace/outputs
|
| 4 |
+
cp -R /solution/files/. /workspace/outputs/
|
tasks/maud-contract144-26cb2971-v4/task.toml
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
schema_version = "1.3"
|
| 2 |
+
|
| 3 |
+
[task]
|
| 4 |
+
name = "apex-gap/maud-contract144-26cb2971-v4"
|
| 5 |
+
|
| 6 |
+
[metadata.apex_gap]
|
| 7 |
+
capability_tags = ["legal-documents", "docx-io"]
|
| 8 |
+
fix_version = "v4"
|
| 9 |
+
job = "corporate-law"
|
| 10 |
+
source = "theatticusproject/maud"
|
| 11 |
+
source_license = "CC-BY-4.0"
|
| 12 |
+
source_revision = "37d5c3b95d18dcd8404cc5ce3fd5069be062392f"
|
| 13 |
+
source_split = "train (main rows only)"
|
| 14 |
+
source_task_id = "contract_144:Actions taken with consent or approval of Buyer-Answer (Y/N)/<NONE>|Initial matching rights period (COR)-Answer/<NONE>|Definition includes asset deals-Answer/<NONE>|Relational language (MAE carveout)-Answer (Y/N)/<NONE>|Fiduciary exception: Board determination trigger (no shop)-Answer/<NONE>"
|
| 15 |
+
|
| 16 |
+
[metadata.openenv_hf_sandbox]
|
| 17 |
+
variant = "apex-gap-hfsandbox-v1"
|
| 18 |
+
task_modified_for_hf_sandbox = true
|
| 19 |
+
network_enabled = true
|
| 20 |
+
|
| 21 |
+
[environment]
|
| 22 |
+
docker_image = "ghcr.io/younesbelkada/apex@sha256:24969c952247033023872f87161a16e067003469506be63783bbaa5d96926bdf"
|
| 23 |
+
workdir = "/workspace"
|
| 24 |
+
cpus = 1
|
| 25 |
+
memory_mb = 4096
|
| 26 |
+
build_timeout_sec = 600
|
| 27 |
+
network_mode = "public"
|
| 28 |
+
|
| 29 |
+
[agent]
|
| 30 |
+
timeout_sec = 1800
|
| 31 |
+
network_mode = "public"
|
| 32 |
+
|
| 33 |
+
[verifier]
|
| 34 |
+
timeout_sec = 600
|
| 35 |
+
network_mode = "public"
|
| 36 |
+
environment_mode = "separate"
|
| 37 |
+
|
| 38 |
+
[verifier.environment]
|
| 39 |
+
network_mode = "public"
|
| 40 |
+
cpus = 1
|
| 41 |
+
memory_mb = 4096
|
| 42 |
+
|
| 43 |
+
[[artifacts]]
|
| 44 |
+
source = "/workspace/outputs"
|
tasks/maud-contract144-26cb2971-v4/tests/expected.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"checks": [
|
| 3 |
+
{
|
| 4 |
+
"id": "q1",
|
| 5 |
+
"type": "answer",
|
| 6 |
+
"field": "q1",
|
| 7 |
+
"kind": "choice",
|
| 8 |
+
"value": "Yes",
|
| 9 |
+
"keep_operators": true
|
| 10 |
+
},
|
| 11 |
+
{
|
| 12 |
+
"id": "q2",
|
| 13 |
+
"type": "answer",
|
| 14 |
+
"field": "q2",
|
| 15 |
+
"kind": "choice",
|
| 16 |
+
"value": "5 business days",
|
| 17 |
+
"keep_operators": true
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"id": "q3",
|
| 21 |
+
"type": "answer",
|
| 22 |
+
"field": "q3",
|
| 23 |
+
"kind": "choice",
|
| 24 |
+
"value": "Greater than 50% but not \"all or substantially all\"",
|
| 25 |
+
"keep_operators": true
|
| 26 |
+
},
|
| 27 |
+
{
|
| 28 |
+
"id": "q4",
|
| 29 |
+
"type": "answer",
|
| 30 |
+
"field": "q4",
|
| 31 |
+
"kind": "choice",
|
| 32 |
+
"value": "Yes",
|
| 33 |
+
"keep_operators": true
|
| 34 |
+
},
|
| 35 |
+
{
|
| 36 |
+
"id": "q5",
|
| 37 |
+
"type": "answer",
|
| 38 |
+
"field": "q5",
|
| 39 |
+
"kind": "choice",
|
| 40 |
+
"value": "Superior Offer, or Acquisition Proposal reasonably likely/expected to result in a Superior Offer",
|
| 41 |
+
"keep_operators": true
|
| 42 |
+
}
|
| 43 |
+
]
|
| 44 |
+
}
|
tasks/maud-contract144-26cb2971-v4/tests/grade.py
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Deterministic grader shared by converted knowledge-work tasks (v4: grade.py plus keep_operators).
|
| 2 |
+
|
| 3 |
+
Runs inside the separate verifier sandbox. Reads /tests/expected.json, inspects the
|
| 4 |
+
submitted /workspace/outputs tree and writes a binary reward plus per-check details.
|
| 5 |
+
No model calls and no network.
|
| 6 |
+
|
| 7 |
+
expected.json: {"checks": [{"id": ..., "type": ..., ...}, ...]}
|
| 8 |
+
Check types:
|
| 9 |
+
answer field of outputs/answer.json; kind = number|text|choice|date|bool|list
|
| 10 |
+
xlsx_range recalculated outputs/<file> vs tests/<target> over sheet!range (SpreadsheetBench rules)
|
| 11 |
+
xlsx_cell recalculated outputs/<file> sheet!cell vs value with tolerance (optional alt_values)
|
| 12 |
+
file_contains outputs/<file> text (docx/pdf/ics/eml/txt) must contain every needle
|
| 13 |
+
custom tests/<module>.py defines check(spec, outputs_dir, tests_dir) -> (bool, str)
|
| 14 |
+
|
| 15 |
+
Per-check option `keep_operators` (default false): text comparison keeps the comparison signs
|
| 16 |
+
< > = and their combined forms, so "> 5 business days" and "5 business days" differ. Without the
|
| 17 |
+
option every check grades exactly as knowledge/grader/grade.py, which strips them. Converters
|
| 18 |
+
ship this file as tests/grade.py only in builds that set the option (`convert.py --v4`), so
|
| 19 |
+
default builds keep grade.py byte for byte.
|
| 20 |
+
"""
|
| 21 |
+
|
| 22 |
+
import datetime as dt
|
| 23 |
+
import json
|
| 24 |
+
import re
|
| 25 |
+
import shutil
|
| 26 |
+
import subprocess
|
| 27 |
+
import sys
|
| 28 |
+
import tempfile
|
| 29 |
+
import unicodedata
|
| 30 |
+
from pathlib import Path
|
| 31 |
+
|
| 32 |
+
OUT = Path("/workspace/outputs")
|
| 33 |
+
TESTS = Path("/tests")
|
| 34 |
+
LOGS = Path("/logs/verifier")
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def norm_text(v, keep_operators=False):
|
| 38 |
+
v = unicodedata.normalize("NFKC", str(v)).casefold()
|
| 39 |
+
v = re.sub(r"[‘’“”]", "'", v)
|
| 40 |
+
if keep_operators:
|
| 41 |
+
# Each sign becomes its own token, so ">5" and "> 5" agree and "≥" reads as ">=".
|
| 42 |
+
v = v.replace("≥", ">=").replace("≤", "<=").replace("!=", "≠")
|
| 43 |
+
v = re.sub(r"[<>=≠]", lambda m: f" {m.group(0)} ", v)
|
| 44 |
+
v = re.sub(r"[^\w%.$/<>=≠-]+", " ", v)
|
| 45 |
+
else:
|
| 46 |
+
v = re.sub(r"[^\w%.$/-]+", " ", v)
|
| 47 |
+
return " ".join(v.split()).strip(" .")
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def text_norm(check):
|
| 51 |
+
"""norm_text with the check's own options."""
|
| 52 |
+
keep = bool(check.get("keep_operators"))
|
| 53 |
+
return lambda v: norm_text(v, keep_operators=keep)
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def to_number(v):
|
| 57 |
+
if isinstance(v, bool):
|
| 58 |
+
raise ValueError("bool")
|
| 59 |
+
if isinstance(v, (int, float)):
|
| 60 |
+
return float(v)
|
| 61 |
+
s = str(v).strip().replace(",", "").replace("$", "").replace("−", "-")
|
| 62 |
+
neg = s.startswith("(") and s.endswith(")")
|
| 63 |
+
s = s.strip("()").strip()
|
| 64 |
+
pct = s.endswith("%")
|
| 65 |
+
s = s.rstrip("%").strip()
|
| 66 |
+
s = re.sub(r"\s*(usd|dollars|million|billion|thousand|m|bn|k)$", "", s, flags=re.I)
|
| 67 |
+
x = float(s)
|
| 68 |
+
x = -x if neg else x
|
| 69 |
+
return x / 100 if pct else x
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
def number_ok(got, want, rel, abs_):
|
| 73 |
+
try:
|
| 74 |
+
g = to_number(got)
|
| 75 |
+
except (TypeError, ValueError):
|
| 76 |
+
return False
|
| 77 |
+
w = float(want)
|
| 78 |
+
tol = max(abs_, rel * abs(w))
|
| 79 |
+
# "12.5%" may mean the ratio 0.125 or the percent number 12.5; the gold fixes which.
|
| 80 |
+
candidates = [g, g * 100] if isinstance(got, str) and got.strip().endswith("%") else [g]
|
| 81 |
+
return any(abs(c - w) <= tol for c in candidates)
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
def parse_date(v):
|
| 85 |
+
if isinstance(v, (dt.date, dt.datetime)):
|
| 86 |
+
return v if isinstance(v, dt.date) else v.date()
|
| 87 |
+
s = str(v).strip()
|
| 88 |
+
for fmt in ("%Y-%m-%d", "%m/%d/%Y", "%m/%d/%y", "%d %B %Y", "%B %d, %Y", "%b %d, %Y", "%Y/%m/%d"):
|
| 89 |
+
try:
|
| 90 |
+
return dt.datetime.strptime(s, fmt).date()
|
| 91 |
+
except ValueError:
|
| 92 |
+
continue
|
| 93 |
+
raise ValueError(s)
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
def check_answer(check, answers):
|
| 97 |
+
key = check["field"]
|
| 98 |
+
if key not in answers:
|
| 99 |
+
return False, f"missing field {key!r}"
|
| 100 |
+
got, want, kind = answers[key], check["value"], check.get("kind", "text")
|
| 101 |
+
norm_text = text_norm(check)
|
| 102 |
+
if kind == "number":
|
| 103 |
+
ok = number_ok(got, want, check.get("rel_tol", 0.005), check.get("abs_tol", 0.01))
|
| 104 |
+
if not ok and check.get("percent_either"):
|
| 105 |
+
ok = number_ok(got, want * 100, check.get("rel_tol", 0.005), check.get("abs_tol", 0.01) * 100) or (
|
| 106 |
+
number_ok(got, want / 100, check.get("rel_tol", 0.005), check.get("abs_tol", 0.01) / 100)
|
| 107 |
+
)
|
| 108 |
+
elif kind == "date":
|
| 109 |
+
try:
|
| 110 |
+
ok = parse_date(got) == parse_date(want)
|
| 111 |
+
except ValueError:
|
| 112 |
+
ok = False
|
| 113 |
+
elif kind == "bool":
|
| 114 |
+
g = norm_text(got)
|
| 115 |
+
ok = g in {"yes", "true"} if want else g in {"no", "false"}
|
| 116 |
+
elif kind == "choice":
|
| 117 |
+
ok = norm_text(got) == norm_text(want)
|
| 118 |
+
elif kind == "list":
|
| 119 |
+
if not isinstance(got, list):
|
| 120 |
+
return False, f"{key}: expected a JSON list"
|
| 121 |
+
# Filenames may be given with a directory prefix; compare base names.
|
| 122 |
+
base = lambda x: norm_text(str(x).replace("\\", "/").rsplit("/", 1)[-1])
|
| 123 |
+
ok = sorted(base(x) for x in got) == sorted(base(x) for x in want)
|
| 124 |
+
else:
|
| 125 |
+
accepted = check.get("accept", [want])
|
| 126 |
+
ok = norm_text(got) in {norm_text(a) for a in accepted}
|
| 127 |
+
return ok, "" if ok else f"{key}: got {got!r}"
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
# LibreOffice keeps cached formula values on load unless told otherwise; force a full recalculation.
|
| 131 |
+
RECALC_PROFILE = """<?xml version="1.0" encoding="UTF-8"?>
|
| 132 |
+
<oor:items xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
| 133 |
+
<item oor:path="/org.openoffice.Office.Calc/Formula/Load"><prop oor:name="OOXMLRecalcMode" oor:op="fuse"><value>0</value></prop></item>
|
| 134 |
+
<item oor:path="/org.openoffice.Office.Calc/Formula/Load"><prop oor:name="ODFRecalcMode" oor:op="fuse"><value>0</value></prop></item>
|
| 135 |
+
</oor:items>
|
| 136 |
+
"""
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
def recalc(path, tmp):
|
| 140 |
+
dest = Path(tmp) / f"recalc-{len(list(Path(tmp).glob('recalc-*')))}"
|
| 141 |
+
dest.mkdir()
|
| 142 |
+
profile = Path(tmp) / "lo-profile"
|
| 143 |
+
if not profile.exists():
|
| 144 |
+
(profile / "user").mkdir(parents=True)
|
| 145 |
+
(profile / "user" / "registrymodifications.xcu").write_text(RECALC_PROFILE)
|
| 146 |
+
subprocess.run(
|
| 147 |
+
["soffice", f"-env:UserInstallation=file://{profile}", "--headless", "--calc", "--convert-to",
|
| 148 |
+
"xlsx:Calc MS Excel 2007 XML", "--outdir", str(dest), str(path)],
|
| 149 |
+
stdout=subprocess.DEVNULL,
|
| 150 |
+
stderr=subprocess.DEVNULL,
|
| 151 |
+
timeout=180,
|
| 152 |
+
check=False,
|
| 153 |
+
)
|
| 154 |
+
out = dest / (Path(path).stem + ".xlsx")
|
| 155 |
+
return out if out.exists() else Path(path)
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
def cell_value(v):
|
| 159 |
+
if isinstance(v, (int, float)) and not isinstance(v, bool):
|
| 160 |
+
return round(float(v), 2)
|
| 161 |
+
if isinstance(v, dt.datetime):
|
| 162 |
+
return round((v - dt.datetime(1899, 12, 30)).total_seconds() / 86400.0, 0)
|
| 163 |
+
if isinstance(v, dt.time):
|
| 164 |
+
return v.strftime("%H:%M")
|
| 165 |
+
if isinstance(v, str):
|
| 166 |
+
try:
|
| 167 |
+
return round(float(v), 2)
|
| 168 |
+
except ValueError:
|
| 169 |
+
return v.strip()
|
| 170 |
+
return v
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
def time_of(v):
|
| 174 |
+
"""A time or a day fraction in [0, 1) as HH:MM, rounded to the nearest second first. Calc and
|
| 175 |
+
Excel store a time as that fraction; openpyxl returns a time only for time-formatted cells."""
|
| 176 |
+
if isinstance(v, dt.time):
|
| 177 |
+
v = (v.hour * 3600 + v.minute * 60 + v.second + v.microsecond / 1e6) / 86400
|
| 178 |
+
if isinstance(v, (int, float)) and not isinstance(v, bool) and 0 <= v < 1:
|
| 179 |
+
return (dt.datetime(1899, 12, 30) + dt.timedelta(seconds=round(v * 86400))).strftime("%H:%M")
|
| 180 |
+
return None
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
def same_cell(a, b):
|
| 184 |
+
if isinstance(a, dt.time) is not isinstance(b, dt.time):
|
| 185 |
+
n = b if isinstance(a, dt.time) else a
|
| 186 |
+
if time_of(n) is not None: # a time against a plain day fraction
|
| 187 |
+
return time_of(a) == time_of(b)
|
| 188 |
+
a, b = cell_value(a), cell_value(b)
|
| 189 |
+
if a in (None, "") and b in (None, ""):
|
| 190 |
+
return True
|
| 191 |
+
return type(a) is type(b) and a == b
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
ERRORS = {"#NULL!", "#DIV/0!", "#VALUE!", "#REF!", "#NAME?", "#NUM!", "#N/A"}
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
def is_error(v):
|
| 198 |
+
return isinstance(v, str) and (v in ERRORS or v.startswith("Err:"))
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
def cells(rng):
|
| 202 |
+
if ":" not in rng:
|
| 203 |
+
return [rng]
|
| 204 |
+
from openpyxl.utils import range_boundaries, get_column_letter
|
| 205 |
+
|
| 206 |
+
c1, r1, c2, r2 = range_boundaries(rng)
|
| 207 |
+
return [f"{get_column_letter(c)}{r}" for r in range(r1, r2 + 1) for c in range(c1, c2 + 1)]
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
def load(path, tmp):
|
| 211 |
+
import openpyxl
|
| 212 |
+
|
| 213 |
+
return openpyxl.load_workbook(recalc(path, tmp), data_only=True)
|
| 214 |
+
|
| 215 |
+
|
| 216 |
+
def check_xlsx_range(check, tmp, cache):
|
| 217 |
+
sub = OUT / check["file"]
|
| 218 |
+
if not sub.is_file():
|
| 219 |
+
return False, f"missing output {check['file']}"
|
| 220 |
+
if sub not in cache:
|
| 221 |
+
cache[sub] = load(sub, tmp)
|
| 222 |
+
tgt = TESTS / check["target"]
|
| 223 |
+
if tgt not in cache:
|
| 224 |
+
cache[tgt] = load(tgt, tmp)
|
| 225 |
+
got, want = cache[sub], cache[tgt]
|
| 226 |
+
cached = None # the target's stored (Excel-computed) values, read only when Calc errs
|
| 227 |
+
for sheet, rng in check["ranges"]:
|
| 228 |
+
sheet = sheet or want.sheetnames[0]
|
| 229 |
+
if sheet not in got.sheetnames:
|
| 230 |
+
return False, f"sheet {sheet!r} missing"
|
| 231 |
+
for name in cells(rng):
|
| 232 |
+
w = want[sheet][name].value
|
| 233 |
+
if is_error(w):
|
| 234 |
+
# LibreOffice could not evaluate the gold formula (e.g. XLOOKUP, FILTER in Calc 7.4).
|
| 235 |
+
# The value Excel stored is the intended answer.
|
| 236 |
+
if cached is None:
|
| 237 |
+
import openpyxl
|
| 238 |
+
|
| 239 |
+
cached = openpyxl.load_workbook(tgt, data_only=True)
|
| 240 |
+
c = cached[sheet][name].value if sheet in cached.sheetnames else None
|
| 241 |
+
if c is not None and not is_error(c):
|
| 242 |
+
w = c
|
| 243 |
+
if not same_cell(w, got[sheet][name].value):
|
| 244 |
+
return False, f"{sheet}!{name}: want {w!r} got {got[sheet][name].value!r}"
|
| 245 |
+
return True, ""
|
| 246 |
+
|
| 247 |
+
|
| 248 |
+
def check_xlsx_cell(check, tmp, cache):
|
| 249 |
+
sub = OUT / check["file"]
|
| 250 |
+
if not sub.is_file():
|
| 251 |
+
return False, f"missing output {check['file']}"
|
| 252 |
+
if sub not in cache:
|
| 253 |
+
cache[sub] = load(sub, tmp)
|
| 254 |
+
wb = cache[sub]
|
| 255 |
+
if check["sheet"] not in wb.sheetnames:
|
| 256 |
+
return False, f"sheet {check['sheet']!r} missing"
|
| 257 |
+
got = wb[check["sheet"]][check["cell"]].value
|
| 258 |
+
want = check["value"]
|
| 259 |
+
if isinstance(want, (int, float)):
|
| 260 |
+
# alt_values: other accepted golds where the source admits more than one reading.
|
| 261 |
+
ok = got is not None and any(number_ok(got, w, check.get("rel_tol", 0.0), check.get("abs_tol", 0.01))
|
| 262 |
+
for w in [want, *check.get("alt_values", [])])
|
| 263 |
+
else:
|
| 264 |
+
norm = text_norm(check)
|
| 265 |
+
ok = norm(got) == norm(want)
|
| 266 |
+
return ok, "" if ok else f"{check['sheet']}!{check['cell']}: want {want!r} got {got!r}"
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
def text_of(path):
|
| 270 |
+
suffix = path.suffix.lower()
|
| 271 |
+
if suffix == ".docx":
|
| 272 |
+
import docx
|
| 273 |
+
|
| 274 |
+
d = docx.Document(path)
|
| 275 |
+
parts = [p.text for p in d.paragraphs]
|
| 276 |
+
for t in d.tables:
|
| 277 |
+
parts += [c.text for row in t.rows for c in row.cells]
|
| 278 |
+
return "\n".join(parts)
|
| 279 |
+
if suffix == ".pdf":
|
| 280 |
+
import pdfplumber
|
| 281 |
+
|
| 282 |
+
with pdfplumber.open(path) as pdf:
|
| 283 |
+
return "\n".join(page.extract_text() or "" for page in pdf.pages)
|
| 284 |
+
return path.read_text(errors="replace")
|
| 285 |
+
|
| 286 |
+
|
| 287 |
+
def check_file_contains(check, tmp, cache):
|
| 288 |
+
sub = OUT / check["file"]
|
| 289 |
+
if not sub.is_file():
|
| 290 |
+
return False, f"missing output {check['file']}"
|
| 291 |
+
text = text_of(sub)
|
| 292 |
+
hay = text if check.get("case_sensitive") else text.casefold()
|
| 293 |
+
for needle in check["needles"]:
|
| 294 |
+
n = needle if check.get("case_sensitive") else needle.casefold()
|
| 295 |
+
if n not in hay:
|
| 296 |
+
return False, f"{check['file']} lacks {needle!r}"
|
| 297 |
+
return True, ""
|
| 298 |
+
|
| 299 |
+
|
| 300 |
+
def main():
|
| 301 |
+
LOGS.mkdir(parents=True, exist_ok=True)
|
| 302 |
+
reward_path = LOGS / "reward.txt"
|
| 303 |
+
reward_path.write_text("0\n")
|
| 304 |
+
spec = json.loads((TESTS / "expected.json").read_text())
|
| 305 |
+
answers, details = {}, []
|
| 306 |
+
answer_file = OUT / "answer.json"
|
| 307 |
+
if answer_file.is_file():
|
| 308 |
+
try:
|
| 309 |
+
answers = json.loads(answer_file.read_text())
|
| 310 |
+
if not isinstance(answers, dict):
|
| 311 |
+
answers = {}
|
| 312 |
+
except json.JSONDecodeError:
|
| 313 |
+
answers = {}
|
| 314 |
+
tmp = tempfile.mkdtemp()
|
| 315 |
+
cache = {}
|
| 316 |
+
try:
|
| 317 |
+
for check in spec["checks"]:
|
| 318 |
+
try:
|
| 319 |
+
if check["type"] == "answer":
|
| 320 |
+
ok, why = check_answer(check, answers)
|
| 321 |
+
elif check["type"] == "xlsx_range":
|
| 322 |
+
ok, why = check_xlsx_range(check, tmp, cache)
|
| 323 |
+
elif check["type"] == "xlsx_cell":
|
| 324 |
+
ok, why = check_xlsx_cell(check, tmp, cache)
|
| 325 |
+
elif check["type"] == "file_contains":
|
| 326 |
+
ok, why = check_file_contains(check, tmp, cache)
|
| 327 |
+
elif check["type"] == "custom":
|
| 328 |
+
import importlib.util
|
| 329 |
+
|
| 330 |
+
spec_ = importlib.util.spec_from_file_location("custom_check", TESTS / f"{check['module']}.py")
|
| 331 |
+
mod = importlib.util.module_from_spec(spec_)
|
| 332 |
+
spec_.loader.exec_module(mod)
|
| 333 |
+
ok, why = mod.check(check, OUT, TESTS)
|
| 334 |
+
else:
|
| 335 |
+
ok, why = False, f"unknown check type {check['type']}"
|
| 336 |
+
except Exception as exc: # a malformed submission fails the check, not the grader
|
| 337 |
+
ok, why = False, f"{type(exc).__name__}: {exc}"
|
| 338 |
+
details.append({"id": check["id"], "passed": ok, "detail": why})
|
| 339 |
+
finally:
|
| 340 |
+
shutil.rmtree(tmp, ignore_errors=True)
|
| 341 |
+
passed = sum(d["passed"] for d in details)
|
| 342 |
+
total = len(details)
|
| 343 |
+
reward = 1 if total and passed == total else 0
|
| 344 |
+
(LOGS / "details.json").write_text(json.dumps({"passed": passed, "total": total, "checks": details}, indent=1))
|
| 345 |
+
reward_path.write_text(f"{reward}\n")
|
| 346 |
+
print(f"{passed}/{total} checks passed; reward {reward}")
|
| 347 |
+
|
| 348 |
+
|
| 349 |
+
if __name__ == "__main__":
|
| 350 |
+
sys.exit(main())
|
tasks/maud-contract144-26cb2971-v4/tests/test.sh
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
set -eu
|
| 3 |
+
mkdir -p /logs/verifier /workspace/outputs
|
| 4 |
+
exec python3 -B -I /tests/grade.py
|
tasks/maud-contract144-26cb2971-v4/validation/openenv.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"profile": "harbor-semantic-v1",
|
| 3 |
+
"reward_key": "reward",
|
| 4 |
+
"reward": {
|
| 5 |
+
"range": [
|
| 6 |
+
0,
|
| 7 |
+
1
|
| 8 |
+
],
|
| 9 |
+
"oracle_tolerance": 0,
|
| 10 |
+
"floor_margin": 0.1
|
| 11 |
+
},
|
| 12 |
+
"resources": {
|
| 13 |
+
"cpu": 1,
|
| 14 |
+
"memory_mb": 4096,
|
| 15 |
+
"disk_mb": 10240,
|
| 16 |
+
"episode_timeout_s": 1800
|
| 17 |
+
},
|
| 18 |
+
"types": {
|
| 19 |
+
"tags": [
|
| 20 |
+
"knowledge-work",
|
| 21 |
+
"legal-documents",
|
| 22 |
+
"docx-io"
|
| 23 |
+
]
|
| 24 |
+
},
|
| 25 |
+
"requires_credentials": false
|
| 26 |
+
}
|
tasks/maud-contract145-49595272-v4-v2/environment/inputs/merger_agreement.docx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:71543ca276742a8e59a717f6092d610691fa00d9799f37b4e30722d43622a8ed
|
| 3 |
+
size 226343
|
tasks/maud-contract145-49595272-v4-v2/instruction.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
You are an M&A associate reviewing a merger agreement for a deal-terms summary.
|
| 2 |
+
|
| 3 |
+
The full agreement is `/workspace/inputs/merger_agreement.docx`. Read it and answer each deal-point question below by choosing exactly one of the listed options, copied verbatim.
|
| 4 |
+
|
| 5 |
+
1. **MAE Definition: FLS (MAE) Standard** (field `q1`)
|
| 6 |
+
Options: `"Could" (reasonably) be expected to`; `"Would"`; `"Would" (reasonably) be expected to`; `No`; `Other forward-looking standard`
|
| 7 |
+
2. **Specific Performance** (field `q2`)
|
| 8 |
+
Options: `"entitled to seek" specific performance`; `"entitled to" specific performance`
|
| 9 |
+
3. **Negative interim operating covenant: Negative Interim Covenant includes carveout for pandemic responses** (field `q3`)
|
| 10 |
+
Options: `No`; `Yes`
|
| 11 |
+
4. **MAE Definition: Pandemic or other public health event** (field `q4`)
|
| 12 |
+
Options: `No`; `Yes`
|
| 13 |
+
|
| 14 |
+
## Terms
|
| 15 |
+
|
| 16 |
+
- **MAE**: Material Adverse Effect, as defined in the agreement.
|
| 17 |
+
- **FLS**: forward-looking standard: whether the MAE definition also covers effects that would (reasonably) be expected to have a material adverse effect, not only those that have had one.
|
| 18 |
+
|
| 19 |
+
## Labelling conventions
|
| 20 |
+
|
| 21 |
+
The options follow the ABA Deal Points Study labels used by MAUD.
|
| 22 |
+
|
| 23 |
+
- For the following MAE Definition matters only (Pandemic or other public health event; Action prohibited/omission required by the agreement), answer `Yes` when the definition carves the matter out, so that effects arising from it are excluded from (not taken into account in determining) a Material Adverse Effect, and `No` otherwise.
|
| 24 |
+
|
| 25 |
+
## Deliverable
|
| 26 |
+
|
| 27 |
+
Work in `/workspace`. Input files are under `/workspace/inputs/`. Put every deliverable in
|
| 28 |
+
`/workspace/outputs/`; only that directory is graded. Write `/workspace/outputs/answer.json`, a JSON object mapping each field (`q1`, `q2`, `q3`, `q4`) to the chosen option string.
|
tasks/maud-contract145-49595272-v4-v2/solution/files/answer.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"q1": "No",
|
| 3 |
+
"q2": "\"entitled to\" specific performance",
|
| 4 |
+
"q3": "No",
|
| 5 |
+
"q4": "Yes"
|
| 6 |
+
}
|
tasks/maud-contract145-49595272-v4-v2/solution/solve.sh
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
set -eu
|
| 3 |
+
mkdir -p /workspace/outputs
|
| 4 |
+
cp -R /solution/files/. /workspace/outputs/
|
tasks/maud-contract145-49595272-v4-v2/task.toml
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
schema_version = "1.3"
|
| 2 |
+
|
| 3 |
+
[task]
|
| 4 |
+
name = "apex-gap/maud-contract145-49595272-v4-v2"
|
| 5 |
+
|
| 6 |
+
[metadata.apex_gap]
|
| 7 |
+
capability_tags = ["legal-documents", "docx-io"]
|
| 8 |
+
fix_version = "v4"
|
| 9 |
+
job = "corporate-law"
|
| 10 |
+
source = "theatticusproject/maud"
|
| 11 |
+
source_license = "CC-BY-4.0"
|
| 12 |
+
source_revision = "37d5c3b95d18dcd8404cc5ce3fd5069be062392f"
|
| 13 |
+
source_split = "train (main rows only)"
|
| 14 |
+
source_task_id = "contract_145:FLS (MAE) Standard-Answer/<NONE>|Specific Performance-Answer/<NONE>|Negative Interim Covenant includes carveout for pandemic responses-Answer (Y/N)/<NONE>|Pandemic or other public health event-Answer (Y/N)/<NONE>|Action prohibited/omission required by the agreement-Answer/<NONE>"
|
| 15 |
+
|
| 16 |
+
[metadata.apex_gap.repair]
|
| 17 |
+
fixes = "{\"q5\": {\"action\": \"drop\", \"reason\": \"The East MAE definition (Section 8.13(xviii)) excludes (6) 'the identity of, or actions or omissions of, Central, Merger Sub or their respective Affiliates, or any action taken pursuant to or in accordance with this Agreement or at the request of or with the consent of Central' and (7) 'the announcement or pendency of this Agreement (including, for the avoidance of doubt, compliance with or performance of obligations under this Agreement or the transactions contemplated hereby)'. Clause (6) reaches only East's actions (its omission words concern Central and Merger Sub), and all eight attempts relied on its action wording. Clause (7), though, excludes the effects of East's 'compliance with ... obligations under this Agreement', and complying with the Section 4.1(b) covenants ('East shall not and shall not permit any of the East Subsidiaries ... to') means refraining from the actions they prohibit, so Yes is a fair literal reading. MAUD labels compliance carve-outs without failure-to-act wording No (contracts 10, 20, 24, 31, 70 and 117, and contract_81 with this identical clause (7)); its Yes labels rest on explicit wording such as contract_67's '(or the omission of any action) expressly required or permitted by this Agreement'. The instruction states no such convention; it says only to answer Yes 'when the definition carves the matter out'. This follows the scale-1k drop of maud-contract20-2f21b94e-v3 q2 and the wave-3 drop of maud-contract31-39731e45-v3 q5 for compliance-only carve-outs.\"}}"
|
| 18 |
+
|
| 19 |
+
[metadata.apex_gap.rewrite]
|
| 20 |
+
change = "{\"add_conventions\": [], \"correct\": {}, \"evidence\": \"runs/apex-knowledge/task-supply/key-verification/decisions/maud.json\", \"from\": \"runs/apex-knowledge/wave4/maud/repair/tasks/maud-contract145-49595272-v4\", \"reason\": \"q5: asked but no check grades it (an earlier repair dropped the check)\", \"remove\": [\"q5\"], \"rewrite\": {}, \"v1_task_id\": \"maud-contract145-49595272-v4\"}"
|
| 21 |
+
|
| 22 |
+
[metadata.openenv_hf_sandbox]
|
| 23 |
+
variant = "apex-gap-hfsandbox-v1"
|
| 24 |
+
task_modified_for_hf_sandbox = true
|
| 25 |
+
network_enabled = true
|
| 26 |
+
|
| 27 |
+
[environment]
|
| 28 |
+
docker_image = "ghcr.io/younesbelkada/apex@sha256:24969c952247033023872f87161a16e067003469506be63783bbaa5d96926bdf"
|
| 29 |
+
workdir = "/workspace"
|
| 30 |
+
cpus = 1
|
| 31 |
+
memory_mb = 4096
|
| 32 |
+
build_timeout_sec = 600
|
| 33 |
+
network_mode = "public"
|
| 34 |
+
|
| 35 |
+
[agent]
|
| 36 |
+
timeout_sec = 1800
|
| 37 |
+
network_mode = "public"
|
| 38 |
+
|
| 39 |
+
[verifier]
|
| 40 |
+
timeout_sec = 600
|
| 41 |
+
network_mode = "public"
|
| 42 |
+
environment_mode = "separate"
|
| 43 |
+
|
| 44 |
+
[verifier.environment]
|
| 45 |
+
network_mode = "public"
|
| 46 |
+
cpus = 1
|
| 47 |
+
memory_mb = 4096
|
| 48 |
+
|
| 49 |
+
[[artifacts]]
|
| 50 |
+
source = "/workspace/outputs"
|
tasks/maud-contract145-49595272-v4-v2/tests/expected.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"checks": [
|
| 3 |
+
{
|
| 4 |
+
"id": "q1",
|
| 5 |
+
"type": "answer",
|
| 6 |
+
"field": "q1",
|
| 7 |
+
"kind": "choice",
|
| 8 |
+
"value": "No",
|
| 9 |
+
"keep_operators": true
|
| 10 |
+
},
|
| 11 |
+
{
|
| 12 |
+
"id": "q2",
|
| 13 |
+
"type": "answer",
|
| 14 |
+
"field": "q2",
|
| 15 |
+
"kind": "choice",
|
| 16 |
+
"value": "\"entitled to\" specific performance",
|
| 17 |
+
"keep_operators": true
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"id": "q3",
|
| 21 |
+
"type": "answer",
|
| 22 |
+
"field": "q3",
|
| 23 |
+
"kind": "choice",
|
| 24 |
+
"value": "No",
|
| 25 |
+
"keep_operators": true
|
| 26 |
+
},
|
| 27 |
+
{
|
| 28 |
+
"id": "q4",
|
| 29 |
+
"type": "answer",
|
| 30 |
+
"field": "q4",
|
| 31 |
+
"kind": "choice",
|
| 32 |
+
"value": "Yes",
|
| 33 |
+
"keep_operators": true
|
| 34 |
+
}
|
| 35 |
+
]
|
| 36 |
+
}
|
tasks/maud-contract145-49595272-v4-v2/tests/grade.py
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Deterministic grader shared by converted knowledge-work tasks (v4: grade.py plus keep_operators).
|
| 2 |
+
|
| 3 |
+
Runs inside the separate verifier sandbox. Reads /tests/expected.json, inspects the
|
| 4 |
+
submitted /workspace/outputs tree and writes a binary reward plus per-check details.
|
| 5 |
+
No model calls and no network.
|
| 6 |
+
|
| 7 |
+
expected.json: {"checks": [{"id": ..., "type": ..., ...}, ...]}
|
| 8 |
+
Check types:
|
| 9 |
+
answer field of outputs/answer.json; kind = number|text|choice|date|bool|list
|
| 10 |
+
xlsx_range recalculated outputs/<file> vs tests/<target> over sheet!range (SpreadsheetBench rules)
|
| 11 |
+
xlsx_cell recalculated outputs/<file> sheet!cell vs value with tolerance (optional alt_values)
|
| 12 |
+
file_contains outputs/<file> text (docx/pdf/ics/eml/txt) must contain every needle
|
| 13 |
+
custom tests/<module>.py defines check(spec, outputs_dir, tests_dir) -> (bool, str)
|
| 14 |
+
|
| 15 |
+
Per-check option `keep_operators` (default false): text comparison keeps the comparison signs
|
| 16 |
+
< > = and their combined forms, so "> 5 business days" and "5 business days" differ. Without the
|
| 17 |
+
option every check grades exactly as knowledge/grader/grade.py, which strips them. Converters
|
| 18 |
+
ship this file as tests/grade.py only in builds that set the option (`convert.py --v4`), so
|
| 19 |
+
default builds keep grade.py byte for byte.
|
| 20 |
+
"""
|
| 21 |
+
|
| 22 |
+
import datetime as dt
|
| 23 |
+
import json
|
| 24 |
+
import re
|
| 25 |
+
import shutil
|
| 26 |
+
import subprocess
|
| 27 |
+
import sys
|
| 28 |
+
import tempfile
|
| 29 |
+
import unicodedata
|
| 30 |
+
from pathlib import Path
|
| 31 |
+
|
| 32 |
+
OUT = Path("/workspace/outputs")
|
| 33 |
+
TESTS = Path("/tests")
|
| 34 |
+
LOGS = Path("/logs/verifier")
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def norm_text(v, keep_operators=False):
|
| 38 |
+
v = unicodedata.normalize("NFKC", str(v)).casefold()
|
| 39 |
+
v = re.sub(r"[‘’“”]", "'", v)
|
| 40 |
+
if keep_operators:
|
| 41 |
+
# Each sign becomes its own token, so ">5" and "> 5" agree and "≥" reads as ">=".
|
| 42 |
+
v = v.replace("≥", ">=").replace("≤", "<=").replace("!=", "≠")
|
| 43 |
+
v = re.sub(r"[<>=≠]", lambda m: f" {m.group(0)} ", v)
|
| 44 |
+
v = re.sub(r"[^\w%.$/<>=≠-]+", " ", v)
|
| 45 |
+
else:
|
| 46 |
+
v = re.sub(r"[^\w%.$/-]+", " ", v)
|
| 47 |
+
return " ".join(v.split()).strip(" .")
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def text_norm(check):
|
| 51 |
+
"""norm_text with the check's own options."""
|
| 52 |
+
keep = bool(check.get("keep_operators"))
|
| 53 |
+
return lambda v: norm_text(v, keep_operators=keep)
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def to_number(v):
|
| 57 |
+
if isinstance(v, bool):
|
| 58 |
+
raise ValueError("bool")
|
| 59 |
+
if isinstance(v, (int, float)):
|
| 60 |
+
return float(v)
|
| 61 |
+
s = str(v).strip().replace(",", "").replace("$", "").replace("−", "-")
|
| 62 |
+
neg = s.startswith("(") and s.endswith(")")
|
| 63 |
+
s = s.strip("()").strip()
|
| 64 |
+
pct = s.endswith("%")
|
| 65 |
+
s = s.rstrip("%").strip()
|
| 66 |
+
s = re.sub(r"\s*(usd|dollars|million|billion|thousand|m|bn|k)$", "", s, flags=re.I)
|
| 67 |
+
x = float(s)
|
| 68 |
+
x = -x if neg else x
|
| 69 |
+
return x / 100 if pct else x
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
def number_ok(got, want, rel, abs_):
|
| 73 |
+
try:
|
| 74 |
+
g = to_number(got)
|
| 75 |
+
except (TypeError, ValueError):
|
| 76 |
+
return False
|
| 77 |
+
w = float(want)
|
| 78 |
+
tol = max(abs_, rel * abs(w))
|
| 79 |
+
# "12.5%" may mean the ratio 0.125 or the percent number 12.5; the gold fixes which.
|
| 80 |
+
candidates = [g, g * 100] if isinstance(got, str) and got.strip().endswith("%") else [g]
|
| 81 |
+
return any(abs(c - w) <= tol for c in candidates)
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
def parse_date(v):
|
| 85 |
+
if isinstance(v, (dt.date, dt.datetime)):
|
| 86 |
+
return v if isinstance(v, dt.date) else v.date()
|
| 87 |
+
s = str(v).strip()
|
| 88 |
+
for fmt in ("%Y-%m-%d", "%m/%d/%Y", "%m/%d/%y", "%d %B %Y", "%B %d, %Y", "%b %d, %Y", "%Y/%m/%d"):
|
| 89 |
+
try:
|
| 90 |
+
return dt.datetime.strptime(s, fmt).date()
|
| 91 |
+
except ValueError:
|
| 92 |
+
continue
|
| 93 |
+
raise ValueError(s)
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
def check_answer(check, answers):
|
| 97 |
+
key = check["field"]
|
| 98 |
+
if key not in answers:
|
| 99 |
+
return False, f"missing field {key!r}"
|
| 100 |
+
got, want, kind = answers[key], check["value"], check.get("kind", "text")
|
| 101 |
+
norm_text = text_norm(check)
|
| 102 |
+
if kind == "number":
|
| 103 |
+
ok = number_ok(got, want, check.get("rel_tol", 0.005), check.get("abs_tol", 0.01))
|
| 104 |
+
if not ok and check.get("percent_either"):
|
| 105 |
+
ok = number_ok(got, want * 100, check.get("rel_tol", 0.005), check.get("abs_tol", 0.01) * 100) or (
|
| 106 |
+
number_ok(got, want / 100, check.get("rel_tol", 0.005), check.get("abs_tol", 0.01) / 100)
|
| 107 |
+
)
|
| 108 |
+
elif kind == "date":
|
| 109 |
+
try:
|
| 110 |
+
ok = parse_date(got) == parse_date(want)
|
| 111 |
+
except ValueError:
|
| 112 |
+
ok = False
|
| 113 |
+
elif kind == "bool":
|
| 114 |
+
g = norm_text(got)
|
| 115 |
+
ok = g in {"yes", "true"} if want else g in {"no", "false"}
|
| 116 |
+
elif kind == "choice":
|
| 117 |
+
ok = norm_text(got) == norm_text(want)
|
| 118 |
+
elif kind == "list":
|
| 119 |
+
if not isinstance(got, list):
|
| 120 |
+
return False, f"{key}: expected a JSON list"
|
| 121 |
+
# Filenames may be given with a directory prefix; compare base names.
|
| 122 |
+
base = lambda x: norm_text(str(x).replace("\\", "/").rsplit("/", 1)[-1])
|
| 123 |
+
ok = sorted(base(x) for x in got) == sorted(base(x) for x in want)
|
| 124 |
+
else:
|
| 125 |
+
accepted = check.get("accept", [want])
|
| 126 |
+
ok = norm_text(got) in {norm_text(a) for a in accepted}
|
| 127 |
+
return ok, "" if ok else f"{key}: got {got!r}"
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
# LibreOffice keeps cached formula values on load unless told otherwise; force a full recalculation.
|
| 131 |
+
RECALC_PROFILE = """<?xml version="1.0" encoding="UTF-8"?>
|
| 132 |
+
<oor:items xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
| 133 |
+
<item oor:path="/org.openoffice.Office.Calc/Formula/Load"><prop oor:name="OOXMLRecalcMode" oor:op="fuse"><value>0</value></prop></item>
|
| 134 |
+
<item oor:path="/org.openoffice.Office.Calc/Formula/Load"><prop oor:name="ODFRecalcMode" oor:op="fuse"><value>0</value></prop></item>
|
| 135 |
+
</oor:items>
|
| 136 |
+
"""
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
def recalc(path, tmp):
|
| 140 |
+
dest = Path(tmp) / f"recalc-{len(list(Path(tmp).glob('recalc-*')))}"
|
| 141 |
+
dest.mkdir()
|
| 142 |
+
profile = Path(tmp) / "lo-profile"
|
| 143 |
+
if not profile.exists():
|
| 144 |
+
(profile / "user").mkdir(parents=True)
|
| 145 |
+
(profile / "user" / "registrymodifications.xcu").write_text(RECALC_PROFILE)
|
| 146 |
+
subprocess.run(
|
| 147 |
+
["soffice", f"-env:UserInstallation=file://{profile}", "--headless", "--calc", "--convert-to",
|
| 148 |
+
"xlsx:Calc MS Excel 2007 XML", "--outdir", str(dest), str(path)],
|
| 149 |
+
stdout=subprocess.DEVNULL,
|
| 150 |
+
stderr=subprocess.DEVNULL,
|
| 151 |
+
timeout=180,
|
| 152 |
+
check=False,
|
| 153 |
+
)
|
| 154 |
+
out = dest / (Path(path).stem + ".xlsx")
|
| 155 |
+
return out if out.exists() else Path(path)
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
def cell_value(v):
|
| 159 |
+
if isinstance(v, (int, float)) and not isinstance(v, bool):
|
| 160 |
+
return round(float(v), 2)
|
| 161 |
+
if isinstance(v, dt.datetime):
|
| 162 |
+
return round((v - dt.datetime(1899, 12, 30)).total_seconds() / 86400.0, 0)
|
| 163 |
+
if isinstance(v, dt.time):
|
| 164 |
+
return v.strftime("%H:%M")
|
| 165 |
+
if isinstance(v, str):
|
| 166 |
+
try:
|
| 167 |
+
return round(float(v), 2)
|
| 168 |
+
except ValueError:
|
| 169 |
+
return v.strip()
|
| 170 |
+
return v
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
def time_of(v):
|
| 174 |
+
"""A time or a day fraction in [0, 1) as HH:MM, rounded to the nearest second first. Calc and
|
| 175 |
+
Excel store a time as that fraction; openpyxl returns a time only for time-formatted cells."""
|
| 176 |
+
if isinstance(v, dt.time):
|
| 177 |
+
v = (v.hour * 3600 + v.minute * 60 + v.second + v.microsecond / 1e6) / 86400
|
| 178 |
+
if isinstance(v, (int, float)) and not isinstance(v, bool) and 0 <= v < 1:
|
| 179 |
+
return (dt.datetime(1899, 12, 30) + dt.timedelta(seconds=round(v * 86400))).strftime("%H:%M")
|
| 180 |
+
return None
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
def same_cell(a, b):
|
| 184 |
+
if isinstance(a, dt.time) is not isinstance(b, dt.time):
|
| 185 |
+
n = b if isinstance(a, dt.time) else a
|
| 186 |
+
if time_of(n) is not None: # a time against a plain day fraction
|
| 187 |
+
return time_of(a) == time_of(b)
|
| 188 |
+
a, b = cell_value(a), cell_value(b)
|
| 189 |
+
if a in (None, "") and b in (None, ""):
|
| 190 |
+
return True
|
| 191 |
+
return type(a) is type(b) and a == b
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
ERRORS = {"#NULL!", "#DIV/0!", "#VALUE!", "#REF!", "#NAME?", "#NUM!", "#N/A"}
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
def is_error(v):
|
| 198 |
+
return isinstance(v, str) and (v in ERRORS or v.startswith("Err:"))
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
def cells(rng):
|
| 202 |
+
if ":" not in rng:
|
| 203 |
+
return [rng]
|
| 204 |
+
from openpyxl.utils import range_boundaries, get_column_letter
|
| 205 |
+
|
| 206 |
+
c1, r1, c2, r2 = range_boundaries(rng)
|
| 207 |
+
return [f"{get_column_letter(c)}{r}" for r in range(r1, r2 + 1) for c in range(c1, c2 + 1)]
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
def load(path, tmp):
|
| 211 |
+
import openpyxl
|
| 212 |
+
|
| 213 |
+
return openpyxl.load_workbook(recalc(path, tmp), data_only=True)
|
| 214 |
+
|
| 215 |
+
|
| 216 |
+
def check_xlsx_range(check, tmp, cache):
|
| 217 |
+
sub = OUT / check["file"]
|
| 218 |
+
if not sub.is_file():
|
| 219 |
+
return False, f"missing output {check['file']}"
|
| 220 |
+
if sub not in cache:
|
| 221 |
+
cache[sub] = load(sub, tmp)
|
| 222 |
+
tgt = TESTS / check["target"]
|
| 223 |
+
if tgt not in cache:
|
| 224 |
+
cache[tgt] = load(tgt, tmp)
|
| 225 |
+
got, want = cache[sub], cache[tgt]
|
| 226 |
+
cached = None # the target's stored (Excel-computed) values, read only when Calc errs
|
| 227 |
+
for sheet, rng in check["ranges"]:
|
| 228 |
+
sheet = sheet or want.sheetnames[0]
|
| 229 |
+
if sheet not in got.sheetnames:
|
| 230 |
+
return False, f"sheet {sheet!r} missing"
|
| 231 |
+
for name in cells(rng):
|
| 232 |
+
w = want[sheet][name].value
|
| 233 |
+
if is_error(w):
|
| 234 |
+
# LibreOffice could not evaluate the gold formula (e.g. XLOOKUP, FILTER in Calc 7.4).
|
| 235 |
+
# The value Excel stored is the intended answer.
|
| 236 |
+
if cached is None:
|
| 237 |
+
import openpyxl
|
| 238 |
+
|
| 239 |
+
cached = openpyxl.load_workbook(tgt, data_only=True)
|
| 240 |
+
c = cached[sheet][name].value if sheet in cached.sheetnames else None
|
| 241 |
+
if c is not None and not is_error(c):
|
| 242 |
+
w = c
|
| 243 |
+
if not same_cell(w, got[sheet][name].value):
|
| 244 |
+
return False, f"{sheet}!{name}: want {w!r} got {got[sheet][name].value!r}"
|
| 245 |
+
return True, ""
|
| 246 |
+
|
| 247 |
+
|
| 248 |
+
def check_xlsx_cell(check, tmp, cache):
|
| 249 |
+
sub = OUT / check["file"]
|
| 250 |
+
if not sub.is_file():
|
| 251 |
+
return False, f"missing output {check['file']}"
|
| 252 |
+
if sub not in cache:
|
| 253 |
+
cache[sub] = load(sub, tmp)
|
| 254 |
+
wb = cache[sub]
|
| 255 |
+
if check["sheet"] not in wb.sheetnames:
|
| 256 |
+
return False, f"sheet {check['sheet']!r} missing"
|
| 257 |
+
got = wb[check["sheet"]][check["cell"]].value
|
| 258 |
+
want = check["value"]
|
| 259 |
+
if isinstance(want, (int, float)):
|
| 260 |
+
# alt_values: other accepted golds where the source admits more than one reading.
|
| 261 |
+
ok = got is not None and any(number_ok(got, w, check.get("rel_tol", 0.0), check.get("abs_tol", 0.01))
|
| 262 |
+
for w in [want, *check.get("alt_values", [])])
|
| 263 |
+
else:
|
| 264 |
+
norm = text_norm(check)
|
| 265 |
+
ok = norm(got) == norm(want)
|
| 266 |
+
return ok, "" if ok else f"{check['sheet']}!{check['cell']}: want {want!r} got {got!r}"
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
def text_of(path):
|
| 270 |
+
suffix = path.suffix.lower()
|
| 271 |
+
if suffix == ".docx":
|
| 272 |
+
import docx
|
| 273 |
+
|
| 274 |
+
d = docx.Document(path)
|
| 275 |
+
parts = [p.text for p in d.paragraphs]
|
| 276 |
+
for t in d.tables:
|
| 277 |
+
parts += [c.text for row in t.rows for c in row.cells]
|
| 278 |
+
return "\n".join(parts)
|
| 279 |
+
if suffix == ".pdf":
|
| 280 |
+
import pdfplumber
|
| 281 |
+
|
| 282 |
+
with pdfplumber.open(path) as pdf:
|
| 283 |
+
return "\n".join(page.extract_text() or "" for page in pdf.pages)
|
| 284 |
+
return path.read_text(errors="replace")
|
| 285 |
+
|
| 286 |
+
|
| 287 |
+
def check_file_contains(check, tmp, cache):
|
| 288 |
+
sub = OUT / check["file"]
|
| 289 |
+
if not sub.is_file():
|
| 290 |
+
return False, f"missing output {check['file']}"
|
| 291 |
+
text = text_of(sub)
|
| 292 |
+
hay = text if check.get("case_sensitive") else text.casefold()
|
| 293 |
+
for needle in check["needles"]:
|
| 294 |
+
n = needle if check.get("case_sensitive") else needle.casefold()
|
| 295 |
+
if n not in hay:
|
| 296 |
+
return False, f"{check['file']} lacks {needle!r}"
|
| 297 |
+
return True, ""
|
| 298 |
+
|
| 299 |
+
|
| 300 |
+
def main():
|
| 301 |
+
LOGS.mkdir(parents=True, exist_ok=True)
|
| 302 |
+
reward_path = LOGS / "reward.txt"
|
| 303 |
+
reward_path.write_text("0\n")
|
| 304 |
+
spec = json.loads((TESTS / "expected.json").read_text())
|
| 305 |
+
answers, details = {}, []
|
| 306 |
+
answer_file = OUT / "answer.json"
|
| 307 |
+
if answer_file.is_file():
|
| 308 |
+
try:
|
| 309 |
+
answers = json.loads(answer_file.read_text())
|
| 310 |
+
if not isinstance(answers, dict):
|
| 311 |
+
answers = {}
|
| 312 |
+
except json.JSONDecodeError:
|
| 313 |
+
answers = {}
|
| 314 |
+
tmp = tempfile.mkdtemp()
|
| 315 |
+
cache = {}
|
| 316 |
+
try:
|
| 317 |
+
for check in spec["checks"]:
|
| 318 |
+
try:
|
| 319 |
+
if check["type"] == "answer":
|
| 320 |
+
ok, why = check_answer(check, answers)
|
| 321 |
+
elif check["type"] == "xlsx_range":
|
| 322 |
+
ok, why = check_xlsx_range(check, tmp, cache)
|
| 323 |
+
elif check["type"] == "xlsx_cell":
|
| 324 |
+
ok, why = check_xlsx_cell(check, tmp, cache)
|
| 325 |
+
elif check["type"] == "file_contains":
|
| 326 |
+
ok, why = check_file_contains(check, tmp, cache)
|
| 327 |
+
elif check["type"] == "custom":
|
| 328 |
+
import importlib.util
|
| 329 |
+
|
| 330 |
+
spec_ = importlib.util.spec_from_file_location("custom_check", TESTS / f"{check['module']}.py")
|
| 331 |
+
mod = importlib.util.module_from_spec(spec_)
|
| 332 |
+
spec_.loader.exec_module(mod)
|
| 333 |
+
ok, why = mod.check(check, OUT, TESTS)
|
| 334 |
+
else:
|
| 335 |
+
ok, why = False, f"unknown check type {check['type']}"
|
| 336 |
+
except Exception as exc: # a malformed submission fails the check, not the grader
|
| 337 |
+
ok, why = False, f"{type(exc).__name__}: {exc}"
|
| 338 |
+
details.append({"id": check["id"], "passed": ok, "detail": why})
|
| 339 |
+
finally:
|
| 340 |
+
shutil.rmtree(tmp, ignore_errors=True)
|
| 341 |
+
passed = sum(d["passed"] for d in details)
|
| 342 |
+
total = len(details)
|
| 343 |
+
reward = 1 if total and passed == total else 0
|
| 344 |
+
(LOGS / "details.json").write_text(json.dumps({"passed": passed, "total": total, "checks": details}, indent=1))
|
| 345 |
+
reward_path.write_text(f"{reward}\n")
|
| 346 |
+
print(f"{passed}/{total} checks passed; reward {reward}")
|
| 347 |
+
|
| 348 |
+
|
| 349 |
+
if __name__ == "__main__":
|
| 350 |
+
sys.exit(main())
|
tasks/maud-contract145-49595272-v4-v2/tests/test.sh
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
set -eu
|
| 3 |
+
mkdir -p /logs/verifier /workspace/outputs
|
| 4 |
+
exec python3 -B -I /tests/grade.py
|
tasks/maud-contract145-49595272-v4-v2/validation/openenv.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"profile": "harbor-semantic-v1",
|
| 3 |
+
"reward_key": "reward",
|
| 4 |
+
"reward": {
|
| 5 |
+
"range": [
|
| 6 |
+
0,
|
| 7 |
+
1
|
| 8 |
+
],
|
| 9 |
+
"oracle_tolerance": 0,
|
| 10 |
+
"floor_margin": 0.1
|
| 11 |
+
},
|
| 12 |
+
"resources": {
|
| 13 |
+
"cpu": 1,
|
| 14 |
+
"memory_mb": 4096,
|
| 15 |
+
"disk_mb": 10240,
|
| 16 |
+
"episode_timeout_s": 1800
|
| 17 |
+
},
|
| 18 |
+
"types": {
|
| 19 |
+
"tags": [
|
| 20 |
+
"knowledge-work",
|
| 21 |
+
"legal-documents",
|
| 22 |
+
"docx-io"
|
| 23 |
+
]
|
| 24 |
+
},
|
| 25 |
+
"requires_credentials": false
|
| 26 |
+
}
|
tasks/maud-contract145-49d06ba4-v4-v2/environment/inputs/merger_agreement.docx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9ebf8717e5c1a0288806a267507f2824b5473134d3a119c6c2aa3ce9be3162c8
|
| 3 |
+
size 226343
|
tasks/maud-contract145-49d06ba4-v4-v2/instruction.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
You are an M&A associate reviewing a merger agreement for a deal-terms summary.
|
| 2 |
+
|
| 3 |
+
The full agreement is `/workspace/inputs/merger_agreement.docx`. Read it and answer each deal-point question below by choosing exactly one of the listed options, copied verbatim.
|
| 4 |
+
|
| 5 |
+
1. **Ordinary course covenant: Buyer consent requirement (ordinary course)** (field `q1`)
|
| 6 |
+
Options: `Consent may not be unreasonably withheld, conditioned or delayed`; `Flat consent`
|
| 7 |
+
2. **Tail Period & Acquisition Proposal Details: Acquisition Proposal required to be publicly disclosed** (field `q2`)
|
| 8 |
+
Options: `No`; `Yes`
|
| 9 |
+
3. **MAE Definition: Actions taken by Buyer** (field `q3`)
|
| 10 |
+
Options: `No`; `Yes`
|
| 11 |
+
4. **Knowledge Definition limited to one or more identified persons** (field `q4`)
|
| 12 |
+
Options: `No`; `Yes`
|
| 13 |
+
5. **General Antitrust Efforts Standard** (field `q5`)
|
| 14 |
+
Options: `Commercially reasonable efforts`; `Flat standard`; `Reasonable best efforts`
|
| 15 |
+
|
| 16 |
+
## Terms
|
| 17 |
+
|
| 18 |
+
- **MAE**: Material Adverse Effect, as defined in the agreement.
|
| 19 |
+
- **Tail period**: the period after termination during which an acquisition by a third party makes the Target pay the termination fee; the Acquisition Proposal questions concern the proposal that must have been made before termination for that tail provision to apply.
|
| 20 |
+
- **Buyer**: the acquirer (often called Parent and Merger Sub in the agreement).
|
| 21 |
+
|
| 22 |
+
## Labelling conventions
|
| 23 |
+
|
| 24 |
+
The options follow the ABA Deal Points Study labels used by MAUD.
|
| 25 |
+
|
| 26 |
+
- Knowledge Definition: knowledge is **Constructive** when the definition imputes knowledge based on investigation or inquiry, including "actual knowledge ... after reasonable inquiry" or knowledge the person would reasonably be expected to have. It is **Actual** only when no inquiry is required (for example "actual knowledge, without independent inquiry").
|
| 27 |
+
- For the following MAE Definition matters only (Actions taken by Buyer), answer `Yes` when the definition carves the matter out, so that effects arising from it are excluded from (not taken into account in determining) a Material Adverse Effect, and `No` otherwise.
|
| 28 |
+
- Knowledge Definition limited to one or more identified persons: answer `Yes` when the definition limits knowledge to particular individuals named or listed in the agreement or a disclosure schedule, or to the holders of specified offices (for example the chief executive officer and chief financial officer). Answer `No` when it refers only to a general class, such as a party's executive officers, officers or directors, without naming or listing them.
|
| 29 |
+
|
| 30 |
+
## Deliverable
|
| 31 |
+
|
| 32 |
+
Work in `/workspace`. Input files are under `/workspace/inputs/`. Put every deliverable in
|
| 33 |
+
`/workspace/outputs/`; only that directory is graded. Write `/workspace/outputs/answer.json`, a JSON object mapping each field (`q1` … `q5`) to the chosen option string.
|
tasks/maud-contract145-49d06ba4-v4-v2/solution/files/answer.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"q1": "Consent may not be unreasonably withheld, conditioned or delayed",
|
| 3 |
+
"q2": "Yes",
|
| 4 |
+
"q3": "Yes",
|
| 5 |
+
"q4": "No",
|
| 6 |
+
"q5": "Reasonable best efforts"
|
| 7 |
+
}
|
tasks/maud-contract145-49d06ba4-v4-v2/solution/solve.sh
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
set -eu
|
| 3 |
+
mkdir -p /workspace/outputs
|
| 4 |
+
cp -R /solution/files/. /workspace/outputs/
|
tasks/maud-contract145-49d06ba4-v4-v2/task.toml
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
schema_version = "1.3"
|
| 2 |
+
|
| 3 |
+
[task]
|
| 4 |
+
name = "apex-gap/maud-contract145-49d06ba4-v4-v2"
|
| 5 |
+
|
| 6 |
+
[metadata.apex_gap]
|
| 7 |
+
capability_tags = ["legal-documents", "docx-io"]
|
| 8 |
+
fix_version = "v4"
|
| 9 |
+
job = "corporate-law"
|
| 10 |
+
source = "theatticusproject/maud"
|
| 11 |
+
source_license = "CC-BY-4.0"
|
| 12 |
+
source_revision = "37d5c3b95d18dcd8404cc5ce3fd5069be062392f"
|
| 13 |
+
source_split = "train (main rows only)"
|
| 14 |
+
source_task_id = "contract_145:Buyer consent requirement (ordinary course)-Answer/<NONE>|Acquisition Proposal required to be publicly disclosed-Answer (Y/N)/<NONE>|Actions taken by Buyer-Answer (Y/N)/<NONE>|Knowledge Definition limited to one or more identified persons-Answer (Y//<NONE>|General Antitrust Efforts Standard-Answer/<NONE>"
|
| 15 |
+
|
| 16 |
+
[metadata.apex_gap.rewrite]
|
| 17 |
+
change = "{\"add_conventions\": [\"Knowledge Definition limited to one or more identified persons: answer `Yes` when the definition limits knowledge to particular individuals named or listed in the agreement or a disclosure schedule, or to the holders of specified offices (for example the chief executive officer and chief financial officer). Answer `No` when it refers only to a general class, such as a party's executive officers, officers or directors, without naming or listing them.\"], \"correct\": {}, \"evidence\": \"runs/apex-knowledge/task-supply/key-verification/decisions/maud.json\", \"from\": \"runs/apex-knowledge/wave4/maud/tasks/maud-contract145-49d06ba4-v4\", \"reason\": \"q4: adjudication: labelling convention added to close an open reading (adjudicator A)\", \"remove\": [], \"rewrite\": {}, \"v1_task_id\": \"maud-contract145-49d06ba4-v4\"}"
|
| 18 |
+
|
| 19 |
+
[metadata.openenv_hf_sandbox]
|
| 20 |
+
variant = "apex-gap-hfsandbox-v1"
|
| 21 |
+
task_modified_for_hf_sandbox = true
|
| 22 |
+
network_enabled = true
|
| 23 |
+
|
| 24 |
+
[environment]
|
| 25 |
+
docker_image = "ghcr.io/younesbelkada/apex@sha256:24969c952247033023872f87161a16e067003469506be63783bbaa5d96926bdf"
|
| 26 |
+
workdir = "/workspace"
|
| 27 |
+
cpus = 1
|
| 28 |
+
memory_mb = 4096
|
| 29 |
+
build_timeout_sec = 600
|
| 30 |
+
network_mode = "public"
|
| 31 |
+
|
| 32 |
+
[agent]
|
| 33 |
+
timeout_sec = 1800
|
| 34 |
+
network_mode = "public"
|
| 35 |
+
|
| 36 |
+
[verifier]
|
| 37 |
+
timeout_sec = 600
|
| 38 |
+
network_mode = "public"
|
| 39 |
+
environment_mode = "separate"
|
| 40 |
+
|
| 41 |
+
[verifier.environment]
|
| 42 |
+
network_mode = "public"
|
| 43 |
+
cpus = 1
|
| 44 |
+
memory_mb = 4096
|
| 45 |
+
|
| 46 |
+
[[artifacts]]
|
| 47 |
+
source = "/workspace/outputs"
|
tasks/maud-contract145-49d06ba4-v4-v2/tests/expected.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"checks": [
|
| 3 |
+
{
|
| 4 |
+
"id": "q1",
|
| 5 |
+
"type": "answer",
|
| 6 |
+
"field": "q1",
|
| 7 |
+
"kind": "choice",
|
| 8 |
+
"value": "Consent may not be unreasonably withheld, conditioned or delayed",
|
| 9 |
+
"keep_operators": true
|
| 10 |
+
},
|
| 11 |
+
{
|
| 12 |
+
"id": "q2",
|
| 13 |
+
"type": "answer",
|
| 14 |
+
"field": "q2",
|
| 15 |
+
"kind": "choice",
|
| 16 |
+
"value": "Yes",
|
| 17 |
+
"keep_operators": true
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"id": "q3",
|
| 21 |
+
"type": "answer",
|
| 22 |
+
"field": "q3",
|
| 23 |
+
"kind": "choice",
|
| 24 |
+
"value": "Yes",
|
| 25 |
+
"keep_operators": true
|
| 26 |
+
},
|
| 27 |
+
{
|
| 28 |
+
"id": "q4",
|
| 29 |
+
"type": "answer",
|
| 30 |
+
"field": "q4",
|
| 31 |
+
"kind": "choice",
|
| 32 |
+
"value": "No",
|
| 33 |
+
"keep_operators": true
|
| 34 |
+
},
|
| 35 |
+
{
|
| 36 |
+
"id": "q5",
|
| 37 |
+
"type": "answer",
|
| 38 |
+
"field": "q5",
|
| 39 |
+
"kind": "choice",
|
| 40 |
+
"value": "Reasonable best efforts",
|
| 41 |
+
"keep_operators": true
|
| 42 |
+
}
|
| 43 |
+
]
|
| 44 |
+
}
|
tasks/maud-contract145-49d06ba4-v4-v2/tests/grade.py
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Deterministic grader shared by converted knowledge-work tasks (v4: grade.py plus keep_operators).
|
| 2 |
+
|
| 3 |
+
Runs inside the separate verifier sandbox. Reads /tests/expected.json, inspects the
|
| 4 |
+
submitted /workspace/outputs tree and writes a binary reward plus per-check details.
|
| 5 |
+
No model calls and no network.
|
| 6 |
+
|
| 7 |
+
expected.json: {"checks": [{"id": ..., "type": ..., ...}, ...]}
|
| 8 |
+
Check types:
|
| 9 |
+
answer field of outputs/answer.json; kind = number|text|choice|date|bool|list
|
| 10 |
+
xlsx_range recalculated outputs/<file> vs tests/<target> over sheet!range (SpreadsheetBench rules)
|
| 11 |
+
xlsx_cell recalculated outputs/<file> sheet!cell vs value with tolerance (optional alt_values)
|
| 12 |
+
file_contains outputs/<file> text (docx/pdf/ics/eml/txt) must contain every needle
|
| 13 |
+
custom tests/<module>.py defines check(spec, outputs_dir, tests_dir) -> (bool, str)
|
| 14 |
+
|
| 15 |
+
Per-check option `keep_operators` (default false): text comparison keeps the comparison signs
|
| 16 |
+
< > = and their combined forms, so "> 5 business days" and "5 business days" differ. Without the
|
| 17 |
+
option every check grades exactly as knowledge/grader/grade.py, which strips them. Converters
|
| 18 |
+
ship this file as tests/grade.py only in builds that set the option (`convert.py --v4`), so
|
| 19 |
+
default builds keep grade.py byte for byte.
|
| 20 |
+
"""
|
| 21 |
+
|
| 22 |
+
import datetime as dt
|
| 23 |
+
import json
|
| 24 |
+
import re
|
| 25 |
+
import shutil
|
| 26 |
+
import subprocess
|
| 27 |
+
import sys
|
| 28 |
+
import tempfile
|
| 29 |
+
import unicodedata
|
| 30 |
+
from pathlib import Path
|
| 31 |
+
|
| 32 |
+
OUT = Path("/workspace/outputs")
|
| 33 |
+
TESTS = Path("/tests")
|
| 34 |
+
LOGS = Path("/logs/verifier")
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def norm_text(v, keep_operators=False):
|
| 38 |
+
v = unicodedata.normalize("NFKC", str(v)).casefold()
|
| 39 |
+
v = re.sub(r"[‘’“”]", "'", v)
|
| 40 |
+
if keep_operators:
|
| 41 |
+
# Each sign becomes its own token, so ">5" and "> 5" agree and "≥" reads as ">=".
|
| 42 |
+
v = v.replace("≥", ">=").replace("≤", "<=").replace("!=", "≠")
|
| 43 |
+
v = re.sub(r"[<>=≠]", lambda m: f" {m.group(0)} ", v)
|
| 44 |
+
v = re.sub(r"[^\w%.$/<>=≠-]+", " ", v)
|
| 45 |
+
else:
|
| 46 |
+
v = re.sub(r"[^\w%.$/-]+", " ", v)
|
| 47 |
+
return " ".join(v.split()).strip(" .")
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def text_norm(check):
|
| 51 |
+
"""norm_text with the check's own options."""
|
| 52 |
+
keep = bool(check.get("keep_operators"))
|
| 53 |
+
return lambda v: norm_text(v, keep_operators=keep)
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def to_number(v):
|
| 57 |
+
if isinstance(v, bool):
|
| 58 |
+
raise ValueError("bool")
|
| 59 |
+
if isinstance(v, (int, float)):
|
| 60 |
+
return float(v)
|
| 61 |
+
s = str(v).strip().replace(",", "").replace("$", "").replace("−", "-")
|
| 62 |
+
neg = s.startswith("(") and s.endswith(")")
|
| 63 |
+
s = s.strip("()").strip()
|
| 64 |
+
pct = s.endswith("%")
|
| 65 |
+
s = s.rstrip("%").strip()
|
| 66 |
+
s = re.sub(r"\s*(usd|dollars|million|billion|thousand|m|bn|k)$", "", s, flags=re.I)
|
| 67 |
+
x = float(s)
|
| 68 |
+
x = -x if neg else x
|
| 69 |
+
return x / 100 if pct else x
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
def number_ok(got, want, rel, abs_):
|
| 73 |
+
try:
|
| 74 |
+
g = to_number(got)
|
| 75 |
+
except (TypeError, ValueError):
|
| 76 |
+
return False
|
| 77 |
+
w = float(want)
|
| 78 |
+
tol = max(abs_, rel * abs(w))
|
| 79 |
+
# "12.5%" may mean the ratio 0.125 or the percent number 12.5; the gold fixes which.
|
| 80 |
+
candidates = [g, g * 100] if isinstance(got, str) and got.strip().endswith("%") else [g]
|
| 81 |
+
return any(abs(c - w) <= tol for c in candidates)
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
def parse_date(v):
|
| 85 |
+
if isinstance(v, (dt.date, dt.datetime)):
|
| 86 |
+
return v if isinstance(v, dt.date) else v.date()
|
| 87 |
+
s = str(v).strip()
|
| 88 |
+
for fmt in ("%Y-%m-%d", "%m/%d/%Y", "%m/%d/%y", "%d %B %Y", "%B %d, %Y", "%b %d, %Y", "%Y/%m/%d"):
|
| 89 |
+
try:
|
| 90 |
+
return dt.datetime.strptime(s, fmt).date()
|
| 91 |
+
except ValueError:
|
| 92 |
+
continue
|
| 93 |
+
raise ValueError(s)
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
def check_answer(check, answers):
|
| 97 |
+
key = check["field"]
|
| 98 |
+
if key not in answers:
|
| 99 |
+
return False, f"missing field {key!r}"
|
| 100 |
+
got, want, kind = answers[key], check["value"], check.get("kind", "text")
|
| 101 |
+
norm_text = text_norm(check)
|
| 102 |
+
if kind == "number":
|
| 103 |
+
ok = number_ok(got, want, check.get("rel_tol", 0.005), check.get("abs_tol", 0.01))
|
| 104 |
+
if not ok and check.get("percent_either"):
|
| 105 |
+
ok = number_ok(got, want * 100, check.get("rel_tol", 0.005), check.get("abs_tol", 0.01) * 100) or (
|
| 106 |
+
number_ok(got, want / 100, check.get("rel_tol", 0.005), check.get("abs_tol", 0.01) / 100)
|
| 107 |
+
)
|
| 108 |
+
elif kind == "date":
|
| 109 |
+
try:
|
| 110 |
+
ok = parse_date(got) == parse_date(want)
|
| 111 |
+
except ValueError:
|
| 112 |
+
ok = False
|
| 113 |
+
elif kind == "bool":
|
| 114 |
+
g = norm_text(got)
|
| 115 |
+
ok = g in {"yes", "true"} if want else g in {"no", "false"}
|
| 116 |
+
elif kind == "choice":
|
| 117 |
+
ok = norm_text(got) == norm_text(want)
|
| 118 |
+
elif kind == "list":
|
| 119 |
+
if not isinstance(got, list):
|
| 120 |
+
return False, f"{key}: expected a JSON list"
|
| 121 |
+
# Filenames may be given with a directory prefix; compare base names.
|
| 122 |
+
base = lambda x: norm_text(str(x).replace("\\", "/").rsplit("/", 1)[-1])
|
| 123 |
+
ok = sorted(base(x) for x in got) == sorted(base(x) for x in want)
|
| 124 |
+
else:
|
| 125 |
+
accepted = check.get("accept", [want])
|
| 126 |
+
ok = norm_text(got) in {norm_text(a) for a in accepted}
|
| 127 |
+
return ok, "" if ok else f"{key}: got {got!r}"
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
# LibreOffice keeps cached formula values on load unless told otherwise; force a full recalculation.
|
| 131 |
+
RECALC_PROFILE = """<?xml version="1.0" encoding="UTF-8"?>
|
| 132 |
+
<oor:items xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
| 133 |
+
<item oor:path="/org.openoffice.Office.Calc/Formula/Load"><prop oor:name="OOXMLRecalcMode" oor:op="fuse"><value>0</value></prop></item>
|
| 134 |
+
<item oor:path="/org.openoffice.Office.Calc/Formula/Load"><prop oor:name="ODFRecalcMode" oor:op="fuse"><value>0</value></prop></item>
|
| 135 |
+
</oor:items>
|
| 136 |
+
"""
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
def recalc(path, tmp):
|
| 140 |
+
dest = Path(tmp) / f"recalc-{len(list(Path(tmp).glob('recalc-*')))}"
|
| 141 |
+
dest.mkdir()
|
| 142 |
+
profile = Path(tmp) / "lo-profile"
|
| 143 |
+
if not profile.exists():
|
| 144 |
+
(profile / "user").mkdir(parents=True)
|
| 145 |
+
(profile / "user" / "registrymodifications.xcu").write_text(RECALC_PROFILE)
|
| 146 |
+
subprocess.run(
|
| 147 |
+
["soffice", f"-env:UserInstallation=file://{profile}", "--headless", "--calc", "--convert-to",
|
| 148 |
+
"xlsx:Calc MS Excel 2007 XML", "--outdir", str(dest), str(path)],
|
| 149 |
+
stdout=subprocess.DEVNULL,
|
| 150 |
+
stderr=subprocess.DEVNULL,
|
| 151 |
+
timeout=180,
|
| 152 |
+
check=False,
|
| 153 |
+
)
|
| 154 |
+
out = dest / (Path(path).stem + ".xlsx")
|
| 155 |
+
return out if out.exists() else Path(path)
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
def cell_value(v):
|
| 159 |
+
if isinstance(v, (int, float)) and not isinstance(v, bool):
|
| 160 |
+
return round(float(v), 2)
|
| 161 |
+
if isinstance(v, dt.datetime):
|
| 162 |
+
return round((v - dt.datetime(1899, 12, 30)).total_seconds() / 86400.0, 0)
|
| 163 |
+
if isinstance(v, dt.time):
|
| 164 |
+
return v.strftime("%H:%M")
|
| 165 |
+
if isinstance(v, str):
|
| 166 |
+
try:
|
| 167 |
+
return round(float(v), 2)
|
| 168 |
+
except ValueError:
|
| 169 |
+
return v.strip()
|
| 170 |
+
return v
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
def time_of(v):
|
| 174 |
+
"""A time or a day fraction in [0, 1) as HH:MM, rounded to the nearest second first. Calc and
|
| 175 |
+
Excel store a time as that fraction; openpyxl returns a time only for time-formatted cells."""
|
| 176 |
+
if isinstance(v, dt.time):
|
| 177 |
+
v = (v.hour * 3600 + v.minute * 60 + v.second + v.microsecond / 1e6) / 86400
|
| 178 |
+
if isinstance(v, (int, float)) and not isinstance(v, bool) and 0 <= v < 1:
|
| 179 |
+
return (dt.datetime(1899, 12, 30) + dt.timedelta(seconds=round(v * 86400))).strftime("%H:%M")
|
| 180 |
+
return None
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
def same_cell(a, b):
|
| 184 |
+
if isinstance(a, dt.time) is not isinstance(b, dt.time):
|
| 185 |
+
n = b if isinstance(a, dt.time) else a
|
| 186 |
+
if time_of(n) is not None: # a time against a plain day fraction
|
| 187 |
+
return time_of(a) == time_of(b)
|
| 188 |
+
a, b = cell_value(a), cell_value(b)
|
| 189 |
+
if a in (None, "") and b in (None, ""):
|
| 190 |
+
return True
|
| 191 |
+
return type(a) is type(b) and a == b
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
ERRORS = {"#NULL!", "#DIV/0!", "#VALUE!", "#REF!", "#NAME?", "#NUM!", "#N/A"}
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
def is_error(v):
|
| 198 |
+
return isinstance(v, str) and (v in ERRORS or v.startswith("Err:"))
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
def cells(rng):
|
| 202 |
+
if ":" not in rng:
|
| 203 |
+
return [rng]
|
| 204 |
+
from openpyxl.utils import range_boundaries, get_column_letter
|
| 205 |
+
|
| 206 |
+
c1, r1, c2, r2 = range_boundaries(rng)
|
| 207 |
+
return [f"{get_column_letter(c)}{r}" for r in range(r1, r2 + 1) for c in range(c1, c2 + 1)]
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
def load(path, tmp):
|
| 211 |
+
import openpyxl
|
| 212 |
+
|
| 213 |
+
return openpyxl.load_workbook(recalc(path, tmp), data_only=True)
|
| 214 |
+
|
| 215 |
+
|
| 216 |
+
def check_xlsx_range(check, tmp, cache):
|
| 217 |
+
sub = OUT / check["file"]
|
| 218 |
+
if not sub.is_file():
|
| 219 |
+
return False, f"missing output {check['file']}"
|
| 220 |
+
if sub not in cache:
|
| 221 |
+
cache[sub] = load(sub, tmp)
|
| 222 |
+
tgt = TESTS / check["target"]
|
| 223 |
+
if tgt not in cache:
|
| 224 |
+
cache[tgt] = load(tgt, tmp)
|
| 225 |
+
got, want = cache[sub], cache[tgt]
|
| 226 |
+
cached = None # the target's stored (Excel-computed) values, read only when Calc errs
|
| 227 |
+
for sheet, rng in check["ranges"]:
|
| 228 |
+
sheet = sheet or want.sheetnames[0]
|
| 229 |
+
if sheet not in got.sheetnames:
|
| 230 |
+
return False, f"sheet {sheet!r} missing"
|
| 231 |
+
for name in cells(rng):
|
| 232 |
+
w = want[sheet][name].value
|
| 233 |
+
if is_error(w):
|
| 234 |
+
# LibreOffice could not evaluate the gold formula (e.g. XLOOKUP, FILTER in Calc 7.4).
|
| 235 |
+
# The value Excel stored is the intended answer.
|
| 236 |
+
if cached is None:
|
| 237 |
+
import openpyxl
|
| 238 |
+
|
| 239 |
+
cached = openpyxl.load_workbook(tgt, data_only=True)
|
| 240 |
+
c = cached[sheet][name].value if sheet in cached.sheetnames else None
|
| 241 |
+
if c is not None and not is_error(c):
|
| 242 |
+
w = c
|
| 243 |
+
if not same_cell(w, got[sheet][name].value):
|
| 244 |
+
return False, f"{sheet}!{name}: want {w!r} got {got[sheet][name].value!r}"
|
| 245 |
+
return True, ""
|
| 246 |
+
|
| 247 |
+
|
| 248 |
+
def check_xlsx_cell(check, tmp, cache):
|
| 249 |
+
sub = OUT / check["file"]
|
| 250 |
+
if not sub.is_file():
|
| 251 |
+
return False, f"missing output {check['file']}"
|
| 252 |
+
if sub not in cache:
|
| 253 |
+
cache[sub] = load(sub, tmp)
|
| 254 |
+
wb = cache[sub]
|
| 255 |
+
if check["sheet"] not in wb.sheetnames:
|
| 256 |
+
return False, f"sheet {check['sheet']!r} missing"
|
| 257 |
+
got = wb[check["sheet"]][check["cell"]].value
|
| 258 |
+
want = check["value"]
|
| 259 |
+
if isinstance(want, (int, float)):
|
| 260 |
+
# alt_values: other accepted golds where the source admits more than one reading.
|
| 261 |
+
ok = got is not None and any(number_ok(got, w, check.get("rel_tol", 0.0), check.get("abs_tol", 0.01))
|
| 262 |
+
for w in [want, *check.get("alt_values", [])])
|
| 263 |
+
else:
|
| 264 |
+
norm = text_norm(check)
|
| 265 |
+
ok = norm(got) == norm(want)
|
| 266 |
+
return ok, "" if ok else f"{check['sheet']}!{check['cell']}: want {want!r} got {got!r}"
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
def text_of(path):
|
| 270 |
+
suffix = path.suffix.lower()
|
| 271 |
+
if suffix == ".docx":
|
| 272 |
+
import docx
|
| 273 |
+
|
| 274 |
+
d = docx.Document(path)
|
| 275 |
+
parts = [p.text for p in d.paragraphs]
|
| 276 |
+
for t in d.tables:
|
| 277 |
+
parts += [c.text for row in t.rows for c in row.cells]
|
| 278 |
+
return "\n".join(parts)
|
| 279 |
+
if suffix == ".pdf":
|
| 280 |
+
import pdfplumber
|
| 281 |
+
|
| 282 |
+
with pdfplumber.open(path) as pdf:
|
| 283 |
+
return "\n".join(page.extract_text() or "" for page in pdf.pages)
|
| 284 |
+
return path.read_text(errors="replace")
|
| 285 |
+
|
| 286 |
+
|
| 287 |
+
def check_file_contains(check, tmp, cache):
|
| 288 |
+
sub = OUT / check["file"]
|
| 289 |
+
if not sub.is_file():
|
| 290 |
+
return False, f"missing output {check['file']}"
|
| 291 |
+
text = text_of(sub)
|
| 292 |
+
hay = text if check.get("case_sensitive") else text.casefold()
|
| 293 |
+
for needle in check["needles"]:
|
| 294 |
+
n = needle if check.get("case_sensitive") else needle.casefold()
|
| 295 |
+
if n not in hay:
|
| 296 |
+
return False, f"{check['file']} lacks {needle!r}"
|
| 297 |
+
return True, ""
|
| 298 |
+
|
| 299 |
+
|
| 300 |
+
def main():
|
| 301 |
+
LOGS.mkdir(parents=True, exist_ok=True)
|
| 302 |
+
reward_path = LOGS / "reward.txt"
|
| 303 |
+
reward_path.write_text("0\n")
|
| 304 |
+
spec = json.loads((TESTS / "expected.json").read_text())
|
| 305 |
+
answers, details = {}, []
|
| 306 |
+
answer_file = OUT / "answer.json"
|
| 307 |
+
if answer_file.is_file():
|
| 308 |
+
try:
|
| 309 |
+
answers = json.loads(answer_file.read_text())
|
| 310 |
+
if not isinstance(answers, dict):
|
| 311 |
+
answers = {}
|
| 312 |
+
except json.JSONDecodeError:
|
| 313 |
+
answers = {}
|
| 314 |
+
tmp = tempfile.mkdtemp()
|
| 315 |
+
cache = {}
|
| 316 |
+
try:
|
| 317 |
+
for check in spec["checks"]:
|
| 318 |
+
try:
|
| 319 |
+
if check["type"] == "answer":
|
| 320 |
+
ok, why = check_answer(check, answers)
|
| 321 |
+
elif check["type"] == "xlsx_range":
|
| 322 |
+
ok, why = check_xlsx_range(check, tmp, cache)
|
| 323 |
+
elif check["type"] == "xlsx_cell":
|
| 324 |
+
ok, why = check_xlsx_cell(check, tmp, cache)
|
| 325 |
+
elif check["type"] == "file_contains":
|
| 326 |
+
ok, why = check_file_contains(check, tmp, cache)
|
| 327 |
+
elif check["type"] == "custom":
|
| 328 |
+
import importlib.util
|
| 329 |
+
|
| 330 |
+
spec_ = importlib.util.spec_from_file_location("custom_check", TESTS / f"{check['module']}.py")
|
| 331 |
+
mod = importlib.util.module_from_spec(spec_)
|
| 332 |
+
spec_.loader.exec_module(mod)
|
| 333 |
+
ok, why = mod.check(check, OUT, TESTS)
|
| 334 |
+
else:
|
| 335 |
+
ok, why = False, f"unknown check type {check['type']}"
|
| 336 |
+
except Exception as exc: # a malformed submission fails the check, not the grader
|
| 337 |
+
ok, why = False, f"{type(exc).__name__}: {exc}"
|
| 338 |
+
details.append({"id": check["id"], "passed": ok, "detail": why})
|
| 339 |
+
finally:
|
| 340 |
+
shutil.rmtree(tmp, ignore_errors=True)
|
| 341 |
+
passed = sum(d["passed"] for d in details)
|
| 342 |
+
total = len(details)
|
| 343 |
+
reward = 1 if total and passed == total else 0
|
| 344 |
+
(LOGS / "details.json").write_text(json.dumps({"passed": passed, "total": total, "checks": details}, indent=1))
|
| 345 |
+
reward_path.write_text(f"{reward}\n")
|
| 346 |
+
print(f"{passed}/{total} checks passed; reward {reward}")
|
| 347 |
+
|
| 348 |
+
|
| 349 |
+
if __name__ == "__main__":
|
| 350 |
+
sys.exit(main())
|
tasks/maud-contract145-49d06ba4-v4-v2/tests/test.sh
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
set -eu
|
| 3 |
+
mkdir -p /logs/verifier /workspace/outputs
|
| 4 |
+
exec python3 -B -I /tests/grade.py
|
tasks/maud-contract145-49d06ba4-v4-v2/validation/openenv.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"profile": "harbor-semantic-v1",
|
| 3 |
+
"reward_key": "reward",
|
| 4 |
+
"reward": {
|
| 5 |
+
"range": [
|
| 6 |
+
0,
|
| 7 |
+
1
|
| 8 |
+
],
|
| 9 |
+
"oracle_tolerance": 0,
|
| 10 |
+
"floor_margin": 0.1
|
| 11 |
+
},
|
| 12 |
+
"resources": {
|
| 13 |
+
"cpu": 1,
|
| 14 |
+
"memory_mb": 4096,
|
| 15 |
+
"disk_mb": 10240,
|
| 16 |
+
"episode_timeout_s": 1800
|
| 17 |
+
},
|
| 18 |
+
"types": {
|
| 19 |
+
"tags": [
|
| 20 |
+
"knowledge-work",
|
| 21 |
+
"legal-documents",
|
| 22 |
+
"docx-io"
|
| 23 |
+
]
|
| 24 |
+
},
|
| 25 |
+
"requires_credentials": false
|
| 26 |
+
}
|
tasks/maud-contract145-f498ec72-v2/environment/inputs/merger_agreement.docx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a03ea8186d5a2a11088efb94171a0788fe543f354a7d77d49049b1028ab303f3
|
| 3 |
+
size 226343
|
tasks/maud-contract145-f498ec72-v2/instruction.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
You are an M&A associate reviewing a merger agreement for a deal-terms summary.
|
| 2 |
+
|
| 3 |
+
The full agreement is `/workspace/inputs/merger_agreement.docx`. Read it and answer each deal-point question below by choosing exactly one of the listed options, copied verbatim.
|
| 4 |
+
|
| 5 |
+
1. **Fiduciary exception: Board determination trigger (no shop)** (field `q1`)
|
| 6 |
+
Options: `Acquisition Proposal only`; `Superior Offer, or Acquisition Proposal reasonably likely/expected to result in a Superior Offer`
|
| 7 |
+
2. **Agreement provides for matching rights in connection with COR: Additional matching rights period for modifications (COR)** (field `q2`)
|
| 8 |
+
Options: `2 business days or less`; `3 business days`; `3 days`; `4 business days`; `5 business days`; `> 5 business days`; `None`
|
| 9 |
+
3. **Superior Offer Definition: Definition includes stock deals** (field `q3`)
|
| 10 |
+
Options: `"All or substantially all"`; `50%`; `Greater than 50% but not "all or substantially all"`; `Less than 50%`
|
| 11 |
+
4. **Negative interim operating covenant: Buyer consent requirement (negative interim covenant)** (field `q4`)
|
| 12 |
+
Options: `Consent may not be unreasonably withheld, conditioned or delayed`; `Flat consent`
|
| 13 |
+
5. **MAE Definition: Actions required under transaction agreement** (field `q5`)
|
| 14 |
+
Options: `No`; `Yes`
|
| 15 |
+
|
| 16 |
+
## Terms
|
| 17 |
+
|
| 18 |
+
- **MAE**: Material Adverse Effect, as defined in the agreement.
|
| 19 |
+
- **COR**: change of recommendation: the Target board withdrawing or changing its recommendation that stockholders approve the deal.
|
| 20 |
+
- **Matching rights**: the Buyer's right to a period in which to match or negotiate against a competing proposal before the Target board makes a COR or exercises an FTR.
|
| 21 |
+
- **Buyer**: the acquirer (often called Parent and Merger Sub in the agreement).
|
| 22 |
+
|
| 23 |
+
## Labelling conventions
|
| 24 |
+
|
| 25 |
+
The options follow the ABA Deal Points Study labels used by MAUD.
|
| 26 |
+
|
| 27 |
+
- MAE Definition, Yes/No matter questions: answer `Yes` when the definition carves the matter out, so that effects arising from it are excluded from (not taken into account in determining) a Material Adverse Effect, and `No` otherwise.
|
| 28 |
+
- Superior Offer Definition, asset and stock deals: the options give the minimum share of the Target's assets (asset deals) or of its stock or voting power (stock deals) that a proposal must cover to qualify as a Superior Offer. `50%` means "50% or more"; `Greater than 50% but not "all or substantially all"` means "more than 50%" or "a majority".
|
| 29 |
+
|
| 30 |
+
## Deliverable
|
| 31 |
+
|
| 32 |
+
Work in `/workspace`. Input files are under `/workspace/inputs/`. Put every deliverable in
|
| 33 |
+
`/workspace/outputs/`; only that directory is graded. Write `/workspace/outputs/answer.json`, a JSON object mapping each field (`q1` … `q5`) to the chosen option string.
|
tasks/maud-contract145-f498ec72-v2/solution/files/answer.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"q1": "Superior Offer, or Acquisition Proposal reasonably likely/expected to result in a Superior Offer",
|
| 3 |
+
"q2": "2 business days or less",
|
| 4 |
+
"q3": "\"All or substantially all\"",
|
| 5 |
+
"q4": "Consent may not be unreasonably withheld, conditioned or delayed",
|
| 6 |
+
"q5": "Yes"
|
| 7 |
+
}
|
tasks/maud-contract145-f498ec72-v2/solution/solve.sh
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
set -eu
|
| 3 |
+
mkdir -p /workspace/outputs
|
| 4 |
+
cp -R /solution/files/. /workspace/outputs/
|
tasks/maud-contract145-f498ec72-v2/task.toml
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
schema_version = "1.3"
|
| 2 |
+
|
| 3 |
+
[task]
|
| 4 |
+
name = "apex-gap/maud-contract145-f498ec72-v2"
|
| 5 |
+
|
| 6 |
+
[metadata.apex_gap]
|
| 7 |
+
capability_tags = ["legal-documents", "docx-io"]
|
| 8 |
+
job = "corporate-law"
|
| 9 |
+
source = "theatticusproject/maud"
|
| 10 |
+
source_license = "CC-BY-4.0"
|
| 11 |
+
source_revision = "37d5c3b95d18dcd8404cc5ce3fd5069be062392f"
|
| 12 |
+
source_split = "train (main rows only)"
|
| 13 |
+
source_task_id = "contract_145:Fiduciary exception: Board determination trigger (no shop)-Answer/<NONE>|Additional matching rights period for modifications (COR)-Answer/<NONE>|Definition includes stock deals-Answer/<NONE>|Buyer consent requirement (negative interim covenant)-Answer/<NONE>|Actions required under transaction agreement-Answer (Y/N)/<NONE>"
|
| 14 |
+
|
| 15 |
+
[metadata.openenv_hf_sandbox]
|
| 16 |
+
variant = "apex-gap-hfsandbox-v1"
|
| 17 |
+
task_modified_for_hf_sandbox = true
|
| 18 |
+
network_enabled = true
|
| 19 |
+
|
| 20 |
+
[environment]
|
| 21 |
+
docker_image = "ghcr.io/younesbelkada/apex@sha256:24969c952247033023872f87161a16e067003469506be63783bbaa5d96926bdf"
|
| 22 |
+
workdir = "/workspace"
|
| 23 |
+
cpus = 1
|
| 24 |
+
memory_mb = 4096
|
| 25 |
+
build_timeout_sec = 600
|
| 26 |
+
network_mode = "public"
|
| 27 |
+
|
| 28 |
+
[agent]
|
| 29 |
+
timeout_sec = 1800
|
| 30 |
+
network_mode = "public"
|
| 31 |
+
|
| 32 |
+
[verifier]
|
| 33 |
+
timeout_sec = 600
|
| 34 |
+
network_mode = "public"
|
| 35 |
+
environment_mode = "separate"
|
| 36 |
+
|
| 37 |
+
[verifier.environment]
|
| 38 |
+
network_mode = "public"
|
| 39 |
+
cpus = 1
|
| 40 |
+
memory_mb = 4096
|
| 41 |
+
|
| 42 |
+
[[artifacts]]
|
| 43 |
+
source = "/workspace/outputs"
|
tasks/maud-contract145-f498ec72-v2/tests/expected.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"checks": [
|
| 3 |
+
{
|
| 4 |
+
"id": "q1",
|
| 5 |
+
"type": "answer",
|
| 6 |
+
"field": "q1",
|
| 7 |
+
"kind": "choice",
|
| 8 |
+
"value": "Superior Offer, or Acquisition Proposal reasonably likely/expected to result in a Superior Offer"
|
| 9 |
+
},
|
| 10 |
+
{
|
| 11 |
+
"id": "q2",
|
| 12 |
+
"type": "answer",
|
| 13 |
+
"field": "q2",
|
| 14 |
+
"kind": "choice",
|
| 15 |
+
"value": "2 business days or less"
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"id": "q3",
|
| 19 |
+
"type": "answer",
|
| 20 |
+
"field": "q3",
|
| 21 |
+
"kind": "choice",
|
| 22 |
+
"value": "\"All or substantially all\""
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"id": "q4",
|
| 26 |
+
"type": "answer",
|
| 27 |
+
"field": "q4",
|
| 28 |
+
"kind": "choice",
|
| 29 |
+
"value": "Consent may not be unreasonably withheld, conditioned or delayed"
|
| 30 |
+
},
|
| 31 |
+
{
|
| 32 |
+
"id": "q5",
|
| 33 |
+
"type": "answer",
|
| 34 |
+
"field": "q5",
|
| 35 |
+
"kind": "choice",
|
| 36 |
+
"value": "Yes"
|
| 37 |
+
}
|
| 38 |
+
]
|
| 39 |
+
}
|