Marquis03 commited on
Commit
ae3d397
·
verified ·
1 Parent(s): 8fec55b

Upload folder using huggingface_hub (part 50)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +17 -0
  2. zhujun3753--i-octree.5b640e0/tests/programgym_task.json +167 -0
  3. zhujun3753--i-octree.5b640e0/tests/test.sh +82 -0
  4. zhujun3753--i-octree.5b640e0/tests/workspace.tar.gz +3 -0
  5. zingerlittlebee--netop.90b92f0/environment/Dockerfile +59 -0
  6. zingerlittlebee--netop.90b92f0/environment/download.sh +910 -0
  7. zingerlittlebee--netop.90b92f0/environment/executable +3 -0
  8. zingerlittlebee--netop.90b92f0/environment/harbor_prepare_download_env.sh +37 -0
  9. zingerlittlebee--netop.90b92f0/environment/workspace.tar.gz +3 -0
  10. zingerlittlebee--netop.90b92f0/instruction.md +98 -0
  11. zingerlittlebee--netop.90b92f0/solution/solve.sh +33 -0
  12. zingerlittlebee--netop.90b92f0/task.toml +69 -0
  13. zingerlittlebee--netop.90b92f0/tests/Dockerfile +68 -0
  14. zingerlittlebee--netop.90b92f0/tests/blobs/tests/generated_module_01.tar.gz +3 -0
  15. zingerlittlebee--netop.90b92f0/tests/blobs/tests/generated_module_02.tar.gz +3 -0
  16. zingerlittlebee--netop.90b92f0/tests/blobs/tests/generated_module_03.tar.gz +3 -0
  17. zingerlittlebee--netop.90b92f0/tests/blobs/tests/generated_module_04.tar.gz +3 -0
  18. zingerlittlebee--netop.90b92f0/tests/download.sh +910 -0
  19. zingerlittlebee--netop.90b92f0/tests/executable +3 -0
  20. zingerlittlebee--netop.90b92f0/tests/harbor_prepare_download_env.sh +37 -0
  21. zingerlittlebee--netop.90b92f0/tests/programgym_evaluator.py +1201 -0
  22. zingerlittlebee--netop.90b92f0/tests/programgym_task.json +0 -0
  23. zingerlittlebee--netop.90b92f0/tests/test.sh +82 -0
  24. zingerlittlebee--netop.90b92f0/tests/workspace.tar.gz +3 -0
  25. zju-fast-lab--lbfgs-lite.a96c50e/environment/Dockerfile +66 -0
  26. zju-fast-lab--lbfgs-lite.a96c50e/environment/docker-compose.yaml +11 -0
  27. zju-fast-lab--lbfgs-lite.a96c50e/environment/download.sh +63 -0
  28. zju-fast-lab--lbfgs-lite.a96c50e/environment/executable +3 -0
  29. zju-fast-lab--lbfgs-lite.a96c50e/environment/harbor_configure_apt_mirror.sh +37 -0
  30. zju-fast-lab--lbfgs-lite.a96c50e/environment/harbor_prepare_download_env.sh +34 -0
  31. zju-fast-lab--lbfgs-lite.a96c50e/environment/workspace.tar.gz +3 -0
  32. zju-fast-lab--lbfgs-lite.a96c50e/instruction.md +98 -0
  33. zju-fast-lab--lbfgs-lite.a96c50e/solution/solve.sh +33 -0
  34. zju-fast-lab--lbfgs-lite.a96c50e/task.toml +69 -0
  35. zju-fast-lab--lbfgs-lite.a96c50e/tests/Dockerfile +74 -0
  36. zju-fast-lab--lbfgs-lite.a96c50e/tests/blobs/tests/generated_module_01.tar.gz +3 -0
  37. zju-fast-lab--lbfgs-lite.a96c50e/tests/blobs/tests/generated_module_02.tar.gz +3 -0
  38. zju-fast-lab--lbfgs-lite.a96c50e/tests/docker-compose.yaml +11 -0
  39. zju-fast-lab--lbfgs-lite.a96c50e/tests/download.sh +63 -0
  40. zju-fast-lab--lbfgs-lite.a96c50e/tests/executable +3 -0
  41. zju-fast-lab--lbfgs-lite.a96c50e/tests/harbor_configure_apt_mirror.sh +37 -0
  42. zju-fast-lab--lbfgs-lite.a96c50e/tests/harbor_prepare_download_env.sh +34 -0
  43. zju-fast-lab--lbfgs-lite.a96c50e/tests/programgym_evaluator.py +1201 -0
  44. zju-fast-lab--lbfgs-lite.a96c50e/tests/programgym_task.json +302 -0
  45. zju-fast-lab--lbfgs-lite.a96c50e/tests/test.sh +82 -0
  46. zju-fast-lab--lbfgs-lite.a96c50e/tests/workspace.tar.gz +3 -0
  47. zlthinker--stba.c0034d6/environment/Dockerfile +64 -0
  48. zlthinker--stba.c0034d6/environment/docker-compose.yaml +11 -0
  49. zlthinker--stba.c0034d6/environment/download.sh +45 -0
  50. zlthinker--stba.c0034d6/environment/executable +3 -0
.gitattributes CHANGED
@@ -2966,3 +2966,20 @@ zhihu--kids.509cd95/environment/executable filter=lfs diff=lfs merge=lfs -text
2966
  zhihu--kids.509cd95/tests/executable filter=lfs diff=lfs merge=lfs -text
2967
  zhujun3753--i-octree.5b640e0/environment/executable filter=lfs diff=lfs merge=lfs -text
2968
  zhujun3753--i-octree.5b640e0/tests/executable filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2966
  zhihu--kids.509cd95/tests/executable filter=lfs diff=lfs merge=lfs -text
2967
  zhujun3753--i-octree.5b640e0/environment/executable filter=lfs diff=lfs merge=lfs -text
2968
  zhujun3753--i-octree.5b640e0/tests/executable filter=lfs diff=lfs merge=lfs -text
2969
+ zingerlittlebee--netop.90b92f0/environment/executable filter=lfs diff=lfs merge=lfs -text
2970
+ zingerlittlebee--netop.90b92f0/tests/executable filter=lfs diff=lfs merge=lfs -text
2971
+ zju-fast-lab--lbfgs-lite.a96c50e/environment/executable filter=lfs diff=lfs merge=lfs -text
2972
+ zju-fast-lab--lbfgs-lite.a96c50e/tests/executable filter=lfs diff=lfs merge=lfs -text
2973
+ zlthinker--stba.c0034d6/environment/executable filter=lfs diff=lfs merge=lfs -text
2974
+ zlthinker--stba.c0034d6/tests/executable filter=lfs diff=lfs merge=lfs -text
2975
+ zmeadows--lldbg.7ef5c06/environment/executable filter=lfs diff=lfs merge=lfs -text
2976
+ zmeadows--lldbg.7ef5c06/tests/executable filter=lfs diff=lfs merge=lfs -text
2977
+ zouuup--landrun.5ed4a3d/environment/executable filter=lfs diff=lfs merge=lfs -text
2978
+ zouuup--landrun.5ed4a3d/tests/executable filter=lfs diff=lfs merge=lfs -text
2979
+ zserge--lorca.36a77ca/environment/executable filter=lfs diff=lfs merge=lfs -text
2980
+ zserge--lorca.36a77ca/tests/executable filter=lfs diff=lfs merge=lfs -text
2981
+ zserge--metric.b0b64cb/environment/executable filter=lfs diff=lfs merge=lfs -text
2982
+ zserge--metric.b0b64cb/tests/executable filter=lfs diff=lfs merge=lfs -text
2983
+ zsummer--log4z.972eac4/environment/executable filter=lfs diff=lfs merge=lfs -text
2984
+ zsummer--log4z.972eac4/tests/executable filter=lfs diff=lfs merge=lfs -text
2985
+ ztrue--tracerr.9e268b2/environment/executable filter=lfs diff=lfs merge=lfs -text
zhujun3753--i-octree.5b640e0/tests/programgym_task.json ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "branches": {
3
+ "generated_module_01": {
4
+ "ignore_reason": "",
5
+ "ignored": false,
6
+ "ignored_tests": [],
7
+ "tests": [
8
+ "eval.tests.test_octree_byte_format.test_banner_appears_only_once_in_stream",
9
+ "eval.tests.test_octree_byte_format.test_banner_line_has_exactly_one_trailing_space",
10
+ "eval.tests.test_octree_byte_format.test_every_round_caption_line_is_unpadded",
11
+ "eval.tests.test_octree_byte_format.test_no_blank_lines_in_stream",
12
+ "eval.tests.test_octree_byte_format.test_progress_marker_is_the_literal_second_line",
13
+ "eval.tests.test_octree_byte_format.test_stdout_decodes_as_clean_utf8",
14
+ "eval.tests.test_octree_byte_format.test_stream_ends_with_single_trailing_newline",
15
+ "eval.tests.test_octree_byte_format.test_stream_uses_unix_line_endings",
16
+ "eval.tests.test_octree_isolation.test_args_ignored_stdout_identical_to_plain",
17
+ "eval.tests.test_octree_isolation.test_completion_caption_present_under_args",
18
+ "eval.tests.test_octree_isolation.test_cwd_independent_iteration_stream",
19
+ "eval.tests.test_octree_isolation.test_no_residue_in_working_directory",
20
+ "eval.tests.test_octree_isolation.test_shutdown_caption_after_cwd_change",
21
+ "eval.tests.test_octree_isolation.test_stderr_empty_under_args",
22
+ "eval.tests.test_octree_stdout.test_all_100_test_iterations_present",
23
+ "eval.tests.test_octree_stdout.test_banner_precedes_testing_marker",
24
+ "eval.tests.test_octree_stdout.test_completion_marker_not_present_in_stderr",
25
+ "eval.tests.test_octree_stdout.test_every_iteration_art_line_has_total_100",
26
+ "eval.tests.test_octree_stdout.test_every_line_matches_expected_caption_grammar",
27
+ "eval.tests.test_octree_stdout.test_expected_returncode_one",
28
+ "eval.tests.test_octree_stdout.test_final_iteration_is_100_over_100",
29
+ "eval.tests.test_octree_stdout.test_finished_marker_after_rounds",
30
+ "eval.tests.test_octree_stdout.test_finished_marks_loop_end",
31
+ "eval.tests.test_octree_stdout.test_first_iteration_is_1_over_100",
32
+ "eval.tests.test_octree_stdout.test_iteration_count_is_exactly_100",
33
+ "eval.tests.test_octree_stdout.test_iteration_markers_are_contiguous_no_gap",
34
+ "eval.tests.test_octree_stdout.test_iteration_markers_preceded_by_exactly_one_testing_marker",
35
+ "eval.tests.test_octree_stdout.test_iterations_numbered_monotonically",
36
+ "eval.tests.test_octree_stdout.test_no_assert_output_from_octree",
37
+ "eval.tests.test_octree_stdout.test_no_duplicate_testing_marker",
38
+ "eval.tests.test_octree_stdout.test_no_numeric_garbage_leaks_to_stdout",
39
+ "eval.tests.test_octree_stdout.test_returncode_not_zero_when_completed",
40
+ "eval.tests.test_octree_stdout.test_run_completes_within_bounded_time",
41
+ "eval.tests.test_octree_stdout.test_run_executable_actually_runs",
42
+ "eval.tests.test_octree_stdout.test_second_line_is_testing_marker",
43
+ "eval.tests.test_octree_stdout.test_shutdown_is_last_caption",
44
+ "eval.tests.test_octree_stdout.test_stderr_is_empty",
45
+ "eval.tests.test_octree_stdout.test_stdout_first_line_is_banner",
46
+ "eval.tests.test_octree_stdout.test_stdout_has_testing_marker",
47
+ "eval.tests.test_octree_stdout.test_stdout_is_not_empty",
48
+ "eval.tests.test_octree_stdout.test_stdout_last_line_thread_shutdown",
49
+ "eval.tests.test_octree_stdout.test_stdout_line_count_matches_golden",
50
+ "eval.tests.test_octree_stdout.test_stdout_matches_golden_byte_for_byte",
51
+ "eval.tests.test_octree_stdout.test_testing_precedes_first_iteration"
52
+ ]
53
+ },
54
+ "generated_module_02": {
55
+ "ignore_reason": "",
56
+ "ignored": false,
57
+ "ignored_tests": [],
58
+ "tests": [
59
+ "eval.tests.test_time_compare.test_completion_contract_has_exit_one_and_full_output",
60
+ "eval.tests.test_time_compare.test_every_stdout_line_matches_known_shape",
61
+ "eval.tests.test_time_compare.test_extracted_progress_numbers_are_exactly_1_to_100",
62
+ "eval.tests.test_time_compare.test_finished_message_occurs_exactly_once",
63
+ "eval.tests.test_time_compare.test_finished_message_reports_full_count",
64
+ "eval.tests.test_time_compare.test_finished_message_uses_count_100",
65
+ "eval.tests.test_time_compare.test_first_line_announces_multithreaded_start",
66
+ "eval.tests.test_time_compare.test_first_progress_marker_is_test_1",
67
+ "eval.tests.test_time_compare.test_full_stdout_matches_normalized_golden",
68
+ "eval.tests.test_time_compare.test_golden_asset_is_wellformed",
69
+ "eval.tests.test_time_compare.test_hardcoded_output_dir_not_created_on_host",
70
+ "eval.tests.test_time_compare.test_header_pair_is_exactly_the_first_two_lines",
71
+ "eval.tests.test_time_compare.test_help_flag_runs_the_full_experiment",
72
+ "eval.tests.test_time_compare.test_invocations_are_mutually_byte_stable",
73
+ "eval.tests.test_time_compare.test_invocations_keep_exit_code_and_stdout[args0]",
74
+ "eval.tests.test_time_compare.test_invocations_keep_exit_code_and_stdout[args1]",
75
+ "eval.tests.test_time_compare.test_invocations_keep_exit_code_and_stdout[args2]",
76
+ "eval.tests.test_time_compare.test_invocations_keep_exit_code_and_stdout[args3]",
77
+ "eval.tests.test_time_compare.test_invocations_keep_exit_code_and_stdout[args4]",
78
+ "eval.tests.test_time_compare.test_invocations_keep_exit_code_and_stdout[args5]",
79
+ "eval.tests.test_time_compare.test_invocations_keep_exit_code_and_stdout[args6]",
80
+ "eval.tests.test_time_compare.test_invocations_keep_exit_code_and_stdout[args7]",
81
+ "eval.tests.test_time_compare.test_invocations_keep_exit_code_and_stdout[args8]",
82
+ "eval.tests.test_time_compare.test_last_progress_marker_is_test_100",
83
+ "eval.tests.test_time_compare.test_no_output_after_terminal_banner",
84
+ "eval.tests.test_time_compare.test_no_output_files_created_in_cwd",
85
+ "eval.tests.test_time_compare.test_only_expected_line_shapes_present",
86
+ "eval.tests.test_time_compare.test_preamble_ordering",
87
+ "eval.tests.test_time_compare.test_progress_count_matches_suffix_count",
88
+ "eval.tests.test_time_compare.test_progress_lines_are_contiguous_in_output",
89
+ "eval.tests.test_time_compare.test_progress_marker_format_has_no_spaces",
90
+ "eval.tests.test_time_compare.test_progress_markers_exactly_one_hundred",
91
+ "eval.tests.test_time_compare.test_progress_markers_run_from_one_to_hundred",
92
+ "eval.tests.test_time_compare.test_progress_markers_share_denominator_100",
93
+ "eval.tests.test_time_compare.test_raw_stdout_contains_only_ascii_printable_and_newline",
94
+ "eval.tests.test_time_compare.test_raw_stdout_ends_with_single_trailing_newline",
95
+ "eval.tests.test_time_compare.test_raw_stdout_line_count_is_stable_across_runs",
96
+ "eval.tests.test_time_compare.test_reference_capture_satisfies_full_contract",
97
+ "eval.tests.test_time_compare.test_rerun_stdout_is_stable_and_full",
98
+ "eval.tests.test_time_compare.test_run_from_empty_dir_matches_reference",
99
+ "eval.tests.test_time_compare.test_run_ignores_stdin[devnull]",
100
+ "eval.tests.test_time_compare.test_run_ignores_stdin[empty_feed]",
101
+ "eval.tests.test_time_compare.test_run_is_independent_of_working_directory",
102
+ "eval.tests.test_time_compare.test_second_line_is_testing_header",
103
+ "eval.tests.test_time_compare.test_sequential_runs_produce_identical_stdout",
104
+ "eval.tests.test_time_compare.test_stderr_is_empty_while_stdout_full",
105
+ "eval.tests.test_time_compare.test_stdout_has_no_blank_lines",
106
+ "eval.tests.test_time_compare.test_stdout_has_no_float_timing_tokens",
107
+ "eval.tests.test_time_compare.test_summary_lines_close_the_output",
108
+ "eval.tests.test_time_compare.test_terminal_banner_is_last_line",
109
+ "eval.tests.test_time_compare.test_terminal_banner_occurs_exactly_once"
110
+ ]
111
+ }
112
+ },
113
+ "commit": "5b640e05dab23230207dd849eb1549b5074d1a0e",
114
+ "data_source": "synthetic_programgym",
115
+ "difficulty": "easy",
116
+ "difficulty_score": 1.962179852908768,
117
+ "eval_clean_hashes": [
118
+ "e8b3fc4dd0aa379c92445049ada5a6531f8620d7c78d1551ed9f9b6453db6231"
119
+ ],
120
+ "input_record": {
121
+ "commit": "5b640e05dab23230207dd849eb1549b5074d1a0e",
122
+ "difficulty": "easy",
123
+ "difficulty_code_lines": 4583,
124
+ "difficulty_has_tests": false,
125
+ "difficulty_product_code_lines": 4583,
126
+ "difficulty_runtime_deps": 1,
127
+ "difficulty_score": 1.962179852908768,
128
+ "difficulty_test_code_lines": 562,
129
+ "full_name": "zhujun3753/i-octree",
130
+ "input_joern_zip": "cpp_joern/zhujun3753__i-octree.zip",
131
+ "joern_status": true,
132
+ "joern_time": 21.955141172045842,
133
+ "language": "cpp",
134
+ "pb_match": [
135
+ {
136
+ "pb_fullname": "duckdb/duckdb",
137
+ "rank": 857,
138
+ "similarity": 0.4272080063819885
139
+ }
140
+ ],
141
+ "repo_path": "cpp/zhujun3753__i-octree",
142
+ "source": "commit:5b640e05dab23230207dd849eb1549b5074d1a0e",
143
+ "status": "done",
144
+ "url": "https://github.com/zhujun3753/i-octree"
145
+ },
146
+ "instance_id": "zhujun3753__i-octree.5b640e0",
147
+ "language": "cpp",
148
+ "module_iterations": [
149
+ {
150
+ "actual_iterations": 2,
151
+ "branch_name": "generated_module_01",
152
+ "iteration_limit": 5,
153
+ "module_index": 1,
154
+ "module_kind": "source",
155
+ "termination_reason": "module_coverage_threshold_reached"
156
+ },
157
+ {
158
+ "actual_iterations": 5,
159
+ "branch_name": "generated_module_02",
160
+ "iteration_limit": 5,
161
+ "module_index": 2,
162
+ "module_kind": "source",
163
+ "termination_reason": "early_stopping"
164
+ }
165
+ ],
166
+ "repository": "zhujun3753/i-octree"
167
+ }
zhujun3753--i-octree.5b640e0/tests/test.sh ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # Verifier exec may not inherit image ENV (Modal/gVisor, login-shell resets).
5
+ export PATH="/usr/local/go/bin:/go/bin:/usr/local/cargo/bin:/root/.cargo/bin:${PATH}"
6
+
7
+ mkdir -p /logs/verifier /logs/artifacts
8
+
9
+ write_failure() {
10
+ local code="$1"
11
+ local details="$2"
12
+ python3 - "$code" "$details" <<'PY'
13
+ import json
14
+ import sys
15
+ from pathlib import Path
16
+
17
+ code, details = sys.argv[1:3]
18
+ try:
19
+ metadata = json.loads(Path("/tests/programgym_task.json").read_text())
20
+ n_tests = sum(
21
+ len([
22
+ name for name in info.get("tests", [])
23
+ if name not in {item.get("name") for item in info.get("ignored_tests", [])}
24
+ ])
25
+ for branch, info in metadata.get("branches", {}).items()
26
+ if not info.get("ignored")
27
+ )
28
+ except Exception:
29
+ n_tests = 0
30
+ result = {
31
+ "test_results": [],
32
+ "error_code": code,
33
+ "error_details": details,
34
+ "log": [],
35
+ "solution_branch": "submission",
36
+ "test_branches": [],
37
+ "test_branch_errors": {
38
+ "__infra__": [{"error_code": code, "error_details": details}]
39
+ },
40
+ "executable_hash": None,
41
+ "warnings": [],
42
+ }
43
+ diagnostics = {
44
+ "pass_rate": 0.0,
45
+ "resolved": 0,
46
+ "n_passed": 0,
47
+ "n_tests": n_tests,
48
+ "n_branch_errors": 1,
49
+ "infra_error": 1,
50
+ "executable_hash_present": 0,
51
+ }
52
+ Path("/logs/verifier/programgym_eval.json").write_text(
53
+ json.dumps(result, indent=2, sort_keys=True)
54
+ )
55
+ Path("/logs/verifier/harbor_diagnostics.json").write_text(
56
+ json.dumps(diagnostics, indent=2, sort_keys=True)
57
+ )
58
+ Path("/logs/verifier/reward.json").write_text(
59
+ json.dumps(
60
+ {"reward": 0.0, "resolved": 0.0, "almost_resolved": 0.0},
61
+ indent=2,
62
+ sort_keys=True,
63
+ )
64
+ )
65
+ Path("/logs/verifier/reward.txt").write_text("0.0")
66
+ Path("/logs/verifier/programgym_eval.log").write_text(details)
67
+ PY
68
+ }
69
+
70
+ if ! command -v python3 >/dev/null 2>&1; then
71
+ write_failure "missing_python3" "python3 is required in the cleanroom image"
72
+ exit 0
73
+ fi
74
+
75
+ if ! python3 /tests/programgym_evaluator.py; then
76
+ if [ ! -s /logs/verifier/reward.txt ]; then
77
+ write_failure "evaluator_crashed" \
78
+ "programgym_evaluator.py exited non-zero with no reward written"
79
+ fi
80
+ fi
81
+
82
+ exit 0
zhujun3753--i-octree.5b640e0/tests/workspace.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:56dab3bb7e5599088db15ba5f324719e578b53bca6921feb04c1628356598bfc
3
+ size 1955
zingerlittlebee--netop.90b92f0/environment/Dockerfile ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM rust:1.97.1-bookworm
2
+ ENV DEBIAN_FRONTEND=noninteractive
3
+ ENV RUSTUP_DIST_SERVER="https://static.rust-lang.org"
4
+ ENV RUSTUP_UPDATE_ROOT="https://static.rust-lang.org/rustup"
5
+ ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
6
+ ENV CARGO_REGISTRIES_CRATES_IO_INDEX="sparse+https://index.crates.io/"
7
+ ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
8
+ ENV GOPROXY="https://proxy.golang.org,direct"
9
+ ENV GOSUMDB=sum.golang.google.cn
10
+ ENV GOTOOLCHAIN=auto
11
+ ENV UV_INSECURE_HOST=""
12
+ ENV UV_INDEX_URL="https://pypi.org/simple"
13
+ ENV UV_CACHE_DIR=/workspace/.cache/uv
14
+ ENV npm_config_registry="https://registry.npmjs.org/"
15
+ ENV npm_config_strict_ssl=false
16
+ ENV npm_config_cache=/workspace/.cache/npm
17
+ ENV PIP_INDEX_URL="https://pypi.org/simple"
18
+ ENV PIP_TRUSTED_HOST=""
19
+ ENV HOME=/workspace
20
+ ENV XDG_CACHE_HOME=/workspace/.cache
21
+ ENV PIP_CACHE_DIR=/workspace/.cache/pip
22
+ ENV PYTHONUSERBASE=/workspace/.local
23
+ ENV CARGO_HOME=/usr/local/cargo
24
+ ENV RUSTUP_HOME=/usr/local/rustup
25
+ ENV RUSTUP_TOOLCHAIN=1.97.1
26
+ ENV PROGRAMGYM_RUST_TOOLCHAIN=1.97.1
27
+ ENV PATH=/usr/local/cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
28
+ ENV PAGER=cat
29
+ ENV MANPAGER=cat
30
+ ENV LESS=-R
31
+ ENV TQDM_DISABLE=1
32
+ RUN apt-get update && apt-get install -y --no-install-recommends apt=2.6.1 bash=5.2.15-2+b13 build-essential=12.9 ca-certificates=20250419~deb12u1 cmake=3.25.1-1 git=1:2.39.5-0+deb12u3 make=4.3-4.1 pkg-config=1.8.1-1 python3=3.11.2-1+b1 python3-pip=23.0.1+dfsg-1 python3-dev=3.11.2-1+b1 autoconf=2.71-3 automake=1:1.16.5-1.3 gettext=0.21-12 file=1:5.44-3 binutils=2.40-2 libtool=2.4.7-7~deb12u1 libncurses-dev=6.4-4 meson=1.0.1-5 ninja-build=1.11.1-2~deb12u1 curl=7.88.1-10+deb12u15 wget=1.21.3-1+deb12u1 xz-utils=5.4.1-1+deb12u1 zstd=1.5.4+dfsg2-5 bzip2=1.0.8-5+b1 zip=3.0-13 unzip=6.0-28+deb12u1 patch=2.7.6-7 grep=3.8-5 python3-pytest python3-pytest-xdist python3-coverage && rm -rf /var/lib/apt/lists/*
33
+ RUN rustup component add llvm-tools-preview --toolchain 1.97.1
34
+ RUN RUST_SYSROOT="$(rustc --print sysroot)"; RUST_HOST="$(rustc -vV | sed -n 's/^host: //p')"; test -x "$RUST_SYSROOT/lib/rustlib/$RUST_HOST/bin/llvm-profdata"; test -x "$RUST_SYSROOT/lib/rustlib/$RUST_HOST/bin/llvm-cov"
35
+ RUN rustc --version && cargo --version && rustup show active-toolchain
36
+ WORKDIR /workspace
37
+ ADD workspace.tar.gz /workspace/
38
+ COPY executable /workspace/executable
39
+ COPY download.sh /tmp/programgym-download.sh
40
+ RUN chmod 755 /tmp/programgym-download.sh
41
+ COPY harbor_prepare_download_env.sh /tmp/harbor_prepare_download_env.sh
42
+ RUN chmod 755 /tmp/harbor_prepare_download_env.sh \
43
+ && /bin/bash /tmp/harbor_prepare_download_env.sh \
44
+ && rm -f /tmp/programgym-download.sh \
45
+ && rm -f /tmp/harbor_prepare_download_env.sh
46
+ ENV BASH_ENV=/etc/profile.d/programgym_download_env.sh
47
+ RUN chmod 111 /workspace/executable
48
+ WORKDIR /workspace
49
+ # Harbor synthetic ProgramGym adapter: run the agent as an unprivileged user.
50
+ # Keep tool/runtime state under /home/agent and reserve /workspace for the
51
+ # submission handed to the separate verifier. Keep the reference executable
52
+ # execute-only; the oracle temporarily restores owner read permission.
53
+ RUN id -u agent >/dev/null 2>&1 || useradd -m -s /bin/bash agent
54
+ RUN mkdir -p /home/agent \
55
+ && chown -R agent:agent /home/agent /workspace \
56
+ && chown agent:agent /workspace/executable \
57
+ && chmod 111 /workspace/executable
58
+ ENV HOME=/home/agent
59
+ WORKDIR /workspace
zingerlittlebee--netop.90b92f0/environment/download.sh ADDED
@@ -0,0 +1,910 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # netop - ProgramGym download stage
3
+ # Sources: installs the native libpcap development headers and prefetches every
4
+ # Cargo dependency into the cargo registry cache. Does not compile or link.
5
+ # This script is sourced, not executed: it must be source-safe and idempotent.
6
+
7
+ set -u
8
+
9
+ # Path where we build the standalone generated Cargo project (owned by this script).
10
+ GEN_DIR="${TMPDIR:-/tmp}/netop_download_gen"
11
+ rm -rf "$GEN_DIR"
12
+ mkdir -p "$GEN_DIR/src"
13
+
14
+ # ---------------------------------------------------------------------------
15
+ # Install native dependencies needed to build the `pcap` crate.
16
+ # `libpcap-dev` provides the headers/libpcap that the pcap build needs.
17
+ # ---------------------------------------------------------------------------
18
+ export DEBIAN_FRONTEND=noninteractive
19
+ if command -v apt-get >/dev/null 2>&1; then
20
+ apt-get update
21
+ apt-get install -y --no-install-recommends libpcap-dev
22
+ fi
23
+
24
+ # ---------------------------------------------------------------------------
25
+ # Generate a standalone Cargo project from inline data (no repo files read).
26
+ # Cargo.toml mirrors the repository manifest; Cargo.lock is the pinned lock so
27
+ # `cargo fetch --locked` downloads exactly the versions the offline build needs.
28
+ # ---------------------------------------------------------------------------
29
+ cat > "$GEN_DIR/Cargo.toml" <<'EOF'
30
+ [package]
31
+ name = "netop"
32
+ version = "0.1.4"
33
+ edition = "2021"
34
+
35
+ [dependencies]
36
+ netraffic = "0.1.0"
37
+ crossterm = "0.27.0"
38
+ chrono = "0.4"
39
+ clap = { version = "4.4.11", features = ["derive"] }
40
+ ratatui = "0.25.0"
41
+ EOF
42
+
43
+ # Empty stub so the generated manifest has a valid package layout.
44
+ cat > "$GEN_DIR/src/main.rs" <<'EOF'
45
+ fn main() {}
46
+ EOF
47
+
48
+ cat > "$GEN_DIR/Cargo.lock" <<'EOF'
49
+ # This file is automatically @generated by Cargo.
50
+ # It is not intended for manual editing.
51
+ version = 3
52
+
53
+ [[package]]
54
+ name = "ahash"
55
+ version = "0.8.6"
56
+ source = "registry+https://github.com/rust-lang/crates.io-index"
57
+ checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a"
58
+ dependencies = [
59
+ "cfg-if",
60
+ "once_cell",
61
+ "version_check",
62
+ "zerocopy",
63
+ ]
64
+
65
+ [[package]]
66
+ name = "aho-corasick"
67
+ version = "0.7.18"
68
+ source = "registry+https://github.com/rust-lang/crates.io-index"
69
+ checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
70
+ dependencies = [
71
+ "memchr",
72
+ ]
73
+
74
+ [[package]]
75
+ name = "allocator-api2"
76
+ version = "0.2.16"
77
+ source = "registry+https://github.com/rust-lang/crates.io-index"
78
+ checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5"
79
+
80
+ [[package]]
81
+ name = "anstream"
82
+ version = "0.6.5"
83
+ source = "registry+https://github.com/rust-lang/crates.io-index"
84
+ checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6"
85
+ dependencies = [
86
+ "anstyle",
87
+ "anstyle-parse",
88
+ "anstyle-query",
89
+ "anstyle-wincon",
90
+ "colorchoice",
91
+ "utf8parse",
92
+ ]
93
+
94
+ [[package]]
95
+ name = "anstyle"
96
+ version = "1.0.0"
97
+ source = "registry+https://github.com/rust-lang/crates.io-index"
98
+ checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d"
99
+
100
+ [[package]]
101
+ name = "anstyle-parse"
102
+ version = "0.2.0"
103
+ source = "registry+https://github.com/rust-lang/crates.io-index"
104
+ checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee"
105
+ dependencies = [
106
+ "utf8parse",
107
+ ]
108
+
109
+ [[package]]
110
+ name = "anstyle-query"
111
+ version = "1.0.0"
112
+ source = "registry+https://github.com/rust-lang/crates.io-index"
113
+ checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b"
114
+ dependencies = [
115
+ "windows-sys 0.48.0",
116
+ ]
117
+
118
+ [[package]]
119
+ name = "anstyle-wincon"
120
+ version = "3.0.2"
121
+ source = "registry+https://github.com/rust-lang/crates.io-index"
122
+ checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7"
123
+ dependencies = [
124
+ "anstyle",
125
+ "windows-sys 0.52.0",
126
+ ]
127
+
128
+ [[package]]
129
+ name = "autocfg"
130
+ version = "1.1.0"
131
+ source = "registry+https://github.com/rust-lang/crates.io-index"
132
+ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
133
+
134
+ [[package]]
135
+ name = "bitflags"
136
+ version = "1.3.2"
137
+ source = "registry+https://github.com/rust-lang/crates.io-index"
138
+ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
139
+
140
+ [[package]]
141
+ name = "bitflags"
142
+ version = "2.4.1"
143
+ source = "registry+https://github.com/rust-lang/crates.io-index"
144
+ checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
145
+
146
+ [[package]]
147
+ name = "cassowary"
148
+ version = "0.3.0"
149
+ source = "registry+https://github.com/rust-lang/crates.io-index"
150
+ checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
151
+
152
+ [[package]]
153
+ name = "cc"
154
+ version = "1.0.73"
155
+ source = "registry+https://github.com/rust-lang/crates.io-index"
156
+ checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
157
+
158
+ [[package]]
159
+ name = "cfg-if"
160
+ version = "1.0.0"
161
+ source = "registry+https://github.com/rust-lang/crates.io-index"
162
+ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
163
+
164
+ [[package]]
165
+ name = "chrono"
166
+ version = "0.4.19"
167
+ source = "registry+https://github.com/rust-lang/crates.io-index"
168
+ checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
169
+ dependencies = [
170
+ "libc",
171
+ "num-integer",
172
+ "num-traits",
173
+ "time",
174
+ "winapi",
175
+ ]
176
+
177
+ [[package]]
178
+ name = "clap"
179
+ version = "4.4.11"
180
+ source = "registry+https://github.com/rust-lang/crates.io-index"
181
+ checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2"
182
+ dependencies = [
183
+ "clap_builder",
184
+ "clap_derive",
185
+ ]
186
+
187
+ [[package]]
188
+ name = "clap_builder"
189
+ version = "4.4.11"
190
+ source = "registry+https://github.com/rust-lang/crates.io-index"
191
+ checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb"
192
+ dependencies = [
193
+ "anstream",
194
+ "anstyle",
195
+ "clap_lex",
196
+ "strsim",
197
+ ]
198
+
199
+ [[package]]
200
+ name = "clap_derive"
201
+ version = "4.4.7"
202
+ source = "registry+https://github.com/rust-lang/crates.io-index"
203
+ checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442"
204
+ dependencies = [
205
+ "heck",
206
+ "proc-macro2",
207
+ "quote",
208
+ "syn 2.0.41",
209
+ ]
210
+
211
+ [[package]]
212
+ name = "clap_lex"
213
+ version = "0.6.0"
214
+ source = "registry+https://github.com/rust-lang/crates.io-index"
215
+ checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1"
216
+
217
+ [[package]]
218
+ name = "colorchoice"
219
+ version = "1.0.0"
220
+ source = "registry+https://github.com/rust-lang/crates.io-index"
221
+ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
222
+
223
+ [[package]]
224
+ name = "crossterm"
225
+ version = "0.27.0"
226
+ source = "registry+https://github.com/rust-lang/crates.io-index"
227
+ checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df"
228
+ dependencies = [
229
+ "bitflags 2.4.1",
230
+ "crossterm_winapi",
231
+ "libc",
232
+ "mio",
233
+ "parking_lot",
234
+ "signal-hook",
235
+ "signal-hook-mio",
236
+ "winapi",
237
+ ]
238
+
239
+ [[package]]
240
+ name = "crossterm_winapi"
241
+ version = "0.9.1"
242
+ source = "registry+https://github.com/rust-lang/crates.io-index"
243
+ checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b"
244
+ dependencies = [
245
+ "winapi",
246
+ ]
247
+
248
+ [[package]]
249
+ name = "either"
250
+ version = "1.9.0"
251
+ source = "registry+https://github.com/rust-lang/crates.io-index"
252
+ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
253
+
254
+ [[package]]
255
+ name = "errno"
256
+ version = "0.2.8"
257
+ source = "registry+https://github.com/rust-lang/crates.io-index"
258
+ checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
259
+ dependencies = [
260
+ "errno-dragonfly",
261
+ "libc",
262
+ "winapi",
263
+ ]
264
+
265
+ [[package]]
266
+ name = "errno-dragonfly"
267
+ version = "0.1.2"
268
+ source = "registry+https://github.com/rust-lang/crates.io-index"
269
+ checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
270
+ dependencies = [
271
+ "cc",
272
+ "libc",
273
+ ]
274
+
275
+ [[package]]
276
+ name = "hashbrown"
277
+ version = "0.14.3"
278
+ source = "registry+https://github.com/rust-lang/crates.io-index"
279
+ checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
280
+ dependencies = [
281
+ "ahash",
282
+ "allocator-api2",
283
+ ]
284
+
285
+ [[package]]
286
+ name = "heck"
287
+ version = "0.4.1"
288
+ source = "registry+https://github.com/rust-lang/crates.io-index"
289
+ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
290
+
291
+ [[package]]
292
+ name = "indoc"
293
+ version = "2.0.4"
294
+ source = "registry+https://github.com/rust-lang/crates.io-index"
295
+ checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8"
296
+
297
+ [[package]]
298
+ name = "itertools"
299
+ version = "0.12.0"
300
+ source = "registry+https://github.com/rust-lang/crates.io-index"
301
+ checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0"
302
+ dependencies = [
303
+ "either",
304
+ ]
305
+
306
+ [[package]]
307
+ name = "libc"
308
+ version = "0.2.144"
309
+ source = "registry+https://github.com/rust-lang/crates.io-index"
310
+ checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1"
311
+
312
+ [[package]]
313
+ name = "libloading"
314
+ version = "0.6.7"
315
+ source = "registry+https://github.com/rust-lang/crates.io-index"
316
+ checksum = "351a32417a12d5f7e82c368a66781e307834dae04c6ce0cd4456d52989229883"
317
+ dependencies = [
318
+ "cfg-if",
319
+ "winapi",
320
+ ]
321
+
322
+ [[package]]
323
+ name = "lock_api"
324
+ version = "0.4.7"
325
+ source = "registry+https://github.com/rust-lang/crates.io-index"
326
+ checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53"
327
+ dependencies = [
328
+ "autocfg",
329
+ "scopeguard",
330
+ ]
331
+
332
+ [[package]]
333
+ name = "log"
334
+ version = "0.4.17"
335
+ source = "registry+https://github.com/rust-lang/crates.io-index"
336
+ checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
337
+ dependencies = [
338
+ "cfg-if",
339
+ ]
340
+
341
+ [[package]]
342
+ name = "lru"
343
+ version = "0.12.1"
344
+ source = "registry+https://github.com/rust-lang/crates.io-index"
345
+ checksum = "2994eeba8ed550fd9b47a0b38f0242bc3344e496483c6180b69139cc2fa5d1d7"
346
+ dependencies = [
347
+ "hashbrown",
348
+ ]
349
+
350
+ [[package]]
351
+ name = "memchr"
352
+ version = "2.5.0"
353
+ source = "registry+https://github.com/rust-lang/crates.io-index"
354
+ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
355
+
356
+ [[package]]
357
+ name = "mio"
358
+ version = "0.8.3"
359
+ source = "registry+https://github.com/rust-lang/crates.io-index"
360
+ checksum = "713d550d9b44d89174e066b7a6217ae06234c10cb47819a88290d2b353c31799"
361
+ dependencies = [
362
+ "libc",
363
+ "log",
364
+ "wasi 0.11.0+wasi-snapshot-preview1",
365
+ "windows-sys 0.36.1",
366
+ ]
367
+
368
+ [[package]]
369
+ name = "netop"
370
+ version = "0.1.4"
371
+ dependencies = [
372
+ "chrono",
373
+ "clap",
374
+ "crossterm",
375
+ "netraffic",
376
+ "ratatui",
377
+ ]
378
+
379
+ [[package]]
380
+ name = "netraffic"
381
+ version = "0.1.0"
382
+ source = "registry+https://github.com/rust-lang/crates.io-index"
383
+ checksum = "4f47d0b38a2382c7fe5ccadab3dd79ae3937e7dced62cde9837d6bc1a283b05f"
384
+ dependencies = [
385
+ "pcap",
386
+ ]
387
+
388
+ [[package]]
389
+ name = "num-integer"
390
+ version = "0.1.45"
391
+ source = "registry+https://github.com/rust-lang/crates.io-index"
392
+ checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
393
+ dependencies = [
394
+ "autocfg",
395
+ "num-traits",
396
+ ]
397
+
398
+ [[package]]
399
+ name = "num-traits"
400
+ version = "0.2.15"
401
+ source = "registry+https://github.com/rust-lang/crates.io-index"
402
+ checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
403
+ dependencies = [
404
+ "autocfg",
405
+ ]
406
+
407
+ [[package]]
408
+ name = "once_cell"
409
+ version = "1.19.0"
410
+ source = "registry+https://github.com/rust-lang/crates.io-index"
411
+ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
412
+
413
+ [[package]]
414
+ name = "parking_lot"
415
+ version = "0.12.1"
416
+ source = "registry+https://github.com/rust-lang/crates.io-index"
417
+ checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
418
+ dependencies = [
419
+ "lock_api",
420
+ "parking_lot_core",
421
+ ]
422
+
423
+ [[package]]
424
+ name = "parking_lot_core"
425
+ version = "0.9.3"
426
+ source = "registry+https://github.com/rust-lang/crates.io-index"
427
+ checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929"
428
+ dependencies = [
429
+ "cfg-if",
430
+ "libc",
431
+ "redox_syscall",
432
+ "smallvec",
433
+ "windows-sys 0.36.1",
434
+ ]
435
+
436
+ [[package]]
437
+ name = "paste"
438
+ version = "1.0.14"
439
+ source = "registry+https://github.com/rust-lang/crates.io-index"
440
+ checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
441
+
442
+ [[package]]
443
+ name = "pcap"
444
+ version = "0.9.2"
445
+ source = "registry+https://github.com/rust-lang/crates.io-index"
446
+ checksum = "42d1868a121e5f1d78134be7148b778d5352f28b7be30e7f993c3439671f0190"
447
+ dependencies = [
448
+ "errno",
449
+ "libc",
450
+ "libloading",
451
+ "regex",
452
+ "widestring",
453
+ "winapi",
454
+ ]
455
+
456
+ [[package]]
457
+ name = "proc-macro2"
458
+ version = "1.0.70"
459
+ source = "registry+https://github.com/rust-lang/crates.io-index"
460
+ checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b"
461
+ dependencies = [
462
+ "unicode-ident",
463
+ ]
464
+
465
+ [[package]]
466
+ name = "quote"
467
+ version = "1.0.28"
468
+ source = "registry+https://github.com/rust-lang/crates.io-index"
469
+ checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488"
470
+ dependencies = [
471
+ "proc-macro2",
472
+ ]
473
+
474
+ [[package]]
475
+ name = "ratatui"
476
+ version = "0.25.0"
477
+ source = "registry+https://github.com/rust-lang/crates.io-index"
478
+ checksum = "a5659e52e4ba6e07b2dad9f1158f578ef84a73762625ddb51536019f34d180eb"
479
+ dependencies = [
480
+ "bitflags 2.4.1",
481
+ "cassowary",
482
+ "crossterm",
483
+ "indoc",
484
+ "itertools",
485
+ "lru",
486
+ "paste",
487
+ "stability",
488
+ "strum",
489
+ "unicode-segmentation",
490
+ "unicode-width",
491
+ ]
492
+
493
+ [[package]]
494
+ name = "redox_syscall"
495
+ version = "0.2.13"
496
+ source = "registry+https://github.com/rust-lang/crates.io-index"
497
+ checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
498
+ dependencies = [
499
+ "bitflags 1.3.2",
500
+ ]
501
+
502
+ [[package]]
503
+ name = "regex"
504
+ version = "1.5.6"
505
+ source = "registry+https://github.com/rust-lang/crates.io-index"
506
+ checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1"
507
+ dependencies = [
508
+ "aho-corasick",
509
+ "memchr",
510
+ "regex-syntax",
511
+ ]
512
+
513
+ [[package]]
514
+ name = "regex-syntax"
515
+ version = "0.6.26"
516
+ source = "registry+https://github.com/rust-lang/crates.io-index"
517
+ checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64"
518
+
519
+ [[package]]
520
+ name = "rustversion"
521
+ version = "1.0.14"
522
+ source = "registry+https://github.com/rust-lang/crates.io-index"
523
+ checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
524
+
525
+ [[package]]
526
+ name = "scopeguard"
527
+ version = "1.1.0"
528
+ source = "registry+https://github.com/rust-lang/crates.io-index"
529
+ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
530
+
531
+ [[package]]
532
+ name = "signal-hook"
533
+ version = "0.3.17"
534
+ source = "registry+https://github.com/rust-lang/crates.io-index"
535
+ checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801"
536
+ dependencies = [
537
+ "libc",
538
+ "signal-hook-registry",
539
+ ]
540
+
541
+ [[package]]
542
+ name = "signal-hook-mio"
543
+ version = "0.2.3"
544
+ source = "registry+https://github.com/rust-lang/crates.io-index"
545
+ checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af"
546
+ dependencies = [
547
+ "libc",
548
+ "mio",
549
+ "signal-hook",
550
+ ]
551
+
552
+ [[package]]
553
+ name = "signal-hook-registry"
554
+ version = "1.4.0"
555
+ source = "registry+https://github.com/rust-lang/crates.io-index"
556
+ checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0"
557
+ dependencies = [
558
+ "libc",
559
+ ]
560
+
561
+ [[package]]
562
+ name = "smallvec"
563
+ version = "1.8.0"
564
+ source = "registry+https://github.com/rust-lang/crates.io-index"
565
+ checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83"
566
+
567
+ [[package]]
568
+ name = "stability"
569
+ version = "0.1.1"
570
+ source = "registry+https://github.com/rust-lang/crates.io-index"
571
+ checksum = "ebd1b177894da2a2d9120208c3386066af06a488255caabc5de8ddca22dbc3ce"
572
+ dependencies = [
573
+ "quote",
574
+ "syn 1.0.109",
575
+ ]
576
+
577
+ [[package]]
578
+ name = "strsim"
579
+ version = "0.10.0"
580
+ source = "registry+https://github.com/rust-lang/crates.io-index"
581
+ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
582
+
583
+ [[package]]
584
+ name = "strum"
585
+ version = "0.25.0"
586
+ source = "registry+https://github.com/rust-lang/crates.io-index"
587
+ checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125"
588
+ dependencies = [
589
+ "strum_macros",
590
+ ]
591
+
592
+ [[package]]
593
+ name = "strum_macros"
594
+ version = "0.25.3"
595
+ source = "registry+https://github.com/rust-lang/crates.io-index"
596
+ checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0"
597
+ dependencies = [
598
+ "heck",
599
+ "proc-macro2",
600
+ "quote",
601
+ "rustversion",
602
+ "syn 2.0.41",
603
+ ]
604
+
605
+ [[package]]
606
+ name = "syn"
607
+ version = "1.0.109"
608
+ source = "registry+https://github.com/rust-lang/crates.io-index"
609
+ checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
610
+ dependencies = [
611
+ "proc-macro2",
612
+ "quote",
613
+ "unicode-ident",
614
+ ]
615
+
616
+ [[package]]
617
+ name = "syn"
618
+ version = "2.0.41"
619
+ source = "registry+https://github.com/rust-lang/crates.io-index"
620
+ checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269"
621
+ dependencies = [
622
+ "proc-macro2",
623
+ "quote",
624
+ "unicode-ident",
625
+ ]
626
+
627
+ [[package]]
628
+ name = "time"
629
+ version = "0.1.44"
630
+ source = "registry+https://github.com/rust-lang/crates.io-index"
631
+ checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
632
+ dependencies = [
633
+ "libc",
634
+ "wasi 0.10.0+wasi-snapshot-preview1",
635
+ "winapi",
636
+ ]
637
+
638
+ [[package]]
639
+ name = "unicode-ident"
640
+ version = "1.0.1"
641
+ source = "registry+https://github.com/rust-lang/crates.io-index"
642
+ checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c"
643
+
644
+ [[package]]
645
+ name = "unicode-segmentation"
646
+ version = "1.10.1"
647
+ source = "registry+https://github.com/rust-lang/crates.io-index"
648
+ checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
649
+
650
+ [[package]]
651
+ name = "unicode-width"
652
+ version = "0.1.9"
653
+ source = "registry+https://github.com/rust-lang/crates.io-index"
654
+ checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
655
+
656
+ [[package]]
657
+ name = "utf8parse"
658
+ version = "0.2.1"
659
+ source = "registry+https://github.com/rust-lang/crates.io-index"
660
+ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
661
+
662
+ [[package]]
663
+ name = "version_check"
664
+ version = "0.9.4"
665
+ source = "registry+https://github.com/rust-lang/crates.io-index"
666
+ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
667
+
668
+ [[package]]
669
+ name = "wasi"
670
+ version = "0.10.0+wasi-snapshot-preview1"
671
+ source = "registry+https://github.com/rust-lang/crates.io-index"
672
+ checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
673
+
674
+ [[package]]
675
+ name = "wasi"
676
+ version = "0.11.0+wasi-snapshot-preview1"
677
+ source = "registry+https://github.com/rust-lang/crates.io-index"
678
+ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
679
+
680
+ [[package]]
681
+ name = "widestring"
682
+ version = "0.2.2"
683
+ source = "registry+https://github.com/rust-lang/crates.io-index"
684
+ checksum = "7157704c2e12e3d2189c507b7482c52820a16dfa4465ba91add92f266667cadb"
685
+
686
+ [[package]]
687
+ name = "winapi"
688
+ version = "0.3.9"
689
+ source = "registry+https://github.com/rust-lang/crates.io-index"
690
+ checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
691
+ dependencies = [
692
+ "winapi-i686-pc-windows-gnu",
693
+ "winapi-x86_64-pc-windows-gnu",
694
+ ]
695
+
696
+ [[package]]
697
+ name = "winapi-i686-pc-windows-gnu"
698
+ version = "0.4.0"
699
+ source = "registry+https://github.com/rust-lang/crates.io-index"
700
+ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
701
+
702
+ [[package]]
703
+ name = "winapi-x86_64-pc-windows-gnu"
704
+ version = "0.4.0"
705
+ source = "registry+https://github.com/rust-lang/crates.io-index"
706
+ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
707
+
708
+ [[package]]
709
+ name = "windows-sys"
710
+ version = "0.36.1"
711
+ source = "registry+https://github.com/rust-lang/crates.io-index"
712
+ checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
713
+ dependencies = [
714
+ "windows_aarch64_msvc 0.36.1",
715
+ "windows_i686_gnu 0.36.1",
716
+ "windows_i686_msvc 0.36.1",
717
+ "windows_x86_64_gnu 0.36.1",
718
+ "windows_x86_64_msvc 0.36.1",
719
+ ]
720
+
721
+ [[package]]
722
+ name = "windows-sys"
723
+ version = "0.48.0"
724
+ source = "registry+https://github.com/rust-lang/crates.io-index"
725
+ checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
726
+ dependencies = [
727
+ "windows-targets 0.48.0",
728
+ ]
729
+
730
+ [[package]]
731
+ name = "windows-sys"
732
+ version = "0.52.0"
733
+ source = "registry+https://github.com/rust-lang/crates.io-index"
734
+ checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
735
+ dependencies = [
736
+ "windows-targets 0.52.0",
737
+ ]
738
+
739
+ [[package]]
740
+ name = "windows-targets"
741
+ version = "0.48.0"
742
+ source = "registry+https://github.com/rust-lang/crates.io-index"
743
+ checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5"
744
+ dependencies = [
745
+ "windows_aarch64_gnullvm 0.48.0",
746
+ "windows_aarch64_msvc 0.48.0",
747
+ "windows_i686_gnu 0.48.0",
748
+ "windows_i686_msvc 0.48.0",
749
+ "windows_x86_64_gnu 0.48.0",
750
+ "windows_x86_64_gnullvm 0.48.0",
751
+ "windows_x86_64_msvc 0.48.0",
752
+ ]
753
+
754
+ [[package]]
755
+ name = "windows-targets"
756
+ version = "0.52.0"
757
+ source = "registry+https://github.com/rust-lang/crates.io-index"
758
+ checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
759
+ dependencies = [
760
+ "windows_aarch64_gnullvm 0.52.0",
761
+ "windows_aarch64_msvc 0.52.0",
762
+ "windows_i686_gnu 0.52.0",
763
+ "windows_i686_msvc 0.52.0",
764
+ "windows_x86_64_gnu 0.52.0",
765
+ "windows_x86_64_gnullvm 0.52.0",
766
+ "windows_x86_64_msvc 0.52.0",
767
+ ]
768
+
769
+ [[package]]
770
+ name = "windows_aarch64_gnullvm"
771
+ version = "0.48.0"
772
+ source = "registry+https://github.com/rust-lang/crates.io-index"
773
+ checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
774
+
775
+ [[package]]
776
+ name = "windows_aarch64_gnullvm"
777
+ version = "0.52.0"
778
+ source = "registry+https://github.com/rust-lang/crates.io-index"
779
+ checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
780
+
781
+ [[package]]
782
+ name = "windows_aarch64_msvc"
783
+ version = "0.36.1"
784
+ source = "registry+https://github.com/rust-lang/crates.io-index"
785
+ checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
786
+
787
+ [[package]]
788
+ name = "windows_aarch64_msvc"
789
+ version = "0.48.0"
790
+ source = "registry+https://github.com/rust-lang/crates.io-index"
791
+ checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
792
+
793
+ [[package]]
794
+ name = "windows_aarch64_msvc"
795
+ version = "0.52.0"
796
+ source = "registry+https://github.com/rust-lang/crates.io-index"
797
+ checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
798
+
799
+ [[package]]
800
+ name = "windows_i686_gnu"
801
+ version = "0.36.1"
802
+ source = "registry+https://github.com/rust-lang/crates.io-index"
803
+ checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
804
+
805
+ [[package]]
806
+ name = "windows_i686_gnu"
807
+ version = "0.48.0"
808
+ source = "registry+https://github.com/rust-lang/crates.io-index"
809
+ checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
810
+
811
+ [[package]]
812
+ name = "windows_i686_gnu"
813
+ version = "0.52.0"
814
+ source = "registry+https://github.com/rust-lang/crates.io-index"
815
+ checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
816
+
817
+ [[package]]
818
+ name = "windows_i686_msvc"
819
+ version = "0.36.1"
820
+ source = "registry+https://github.com/rust-lang/crates.io-index"
821
+ checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
822
+
823
+ [[package]]
824
+ name = "windows_i686_msvc"
825
+ version = "0.48.0"
826
+ source = "registry+https://github.com/rust-lang/crates.io-index"
827
+ checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
828
+
829
+ [[package]]
830
+ name = "windows_i686_msvc"
831
+ version = "0.52.0"
832
+ source = "registry+https://github.com/rust-lang/crates.io-index"
833
+ checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
834
+
835
+ [[package]]
836
+ name = "windows_x86_64_gnu"
837
+ version = "0.36.1"
838
+ source = "registry+https://github.com/rust-lang/crates.io-index"
839
+ checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
840
+
841
+ [[package]]
842
+ name = "windows_x86_64_gnu"
843
+ version = "0.48.0"
844
+ source = "registry+https://github.com/rust-lang/crates.io-index"
845
+ checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
846
+
847
+ [[package]]
848
+ name = "windows_x86_64_gnu"
849
+ version = "0.52.0"
850
+ source = "registry+https://github.com/rust-lang/crates.io-index"
851
+ checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
852
+
853
+ [[package]]
854
+ name = "windows_x86_64_gnullvm"
855
+ version = "0.48.0"
856
+ source = "registry+https://github.com/rust-lang/crates.io-index"
857
+ checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
858
+
859
+ [[package]]
860
+ name = "windows_x86_64_gnullvm"
861
+ version = "0.52.0"
862
+ source = "registry+https://github.com/rust-lang/crates.io-index"
863
+ checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
864
+
865
+ [[package]]
866
+ name = "windows_x86_64_msvc"
867
+ version = "0.36.1"
868
+ source = "registry+https://github.com/rust-lang/crates.io-index"
869
+ checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
870
+
871
+ [[package]]
872
+ name = "windows_x86_64_msvc"
873
+ version = "0.48.0"
874
+ source = "registry+https://github.com/rust-lang/crates.io-index"
875
+ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
876
+
877
+ [[package]]
878
+ name = "windows_x86_64_msvc"
879
+ version = "0.52.0"
880
+ source = "registry+https://github.com/rust-lang/crates.io-index"
881
+ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
882
+
883
+ [[package]]
884
+ name = "zerocopy"
885
+ version = "0.7.31"
886
+ source = "registry+https://github.com/rust-lang/crates.io-index"
887
+ checksum = "1c4061bedbb353041c12f413700357bec76df2c7e2ca8e4df8bac24c6bf68e3d"
888
+ dependencies = [
889
+ "zerocopy-derive",
890
+ ]
891
+
892
+ [[package]]
893
+ name = "zerocopy-derive"
894
+ version = "0.7.31"
895
+ source = "registry+https://github.com/rust-lang/crates.io-index"
896
+ checksum = "b3c129550b3e6de3fd0ba67ba5c81818f9805e58b8d7fee80a3a59d2c9fc601a"
897
+ dependencies = [
898
+ "proc-macro2",
899
+ "quote",
900
+ "syn 2.0.41",
901
+ ]
902
+ EOF
903
+
904
+ # ---------------------------------------------------------------------------
905
+ # Prefetch all cargo dependencies into the shared cargo registry cache using
906
+ # the generated manifest + pinned lock. Runs from GEN_DIR (never repo root).
907
+ # ---------------------------------------------------------------------------
908
+ export CARGO_BUILD_JOBS=4
909
+ cd "$GEN_DIR"
910
+ cargo fetch --manifest-path "$GEN_DIR/Cargo.toml" --locked
zingerlittlebee--netop.90b92f0/environment/executable ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:acfc3335a8c76b465ee2ab1b72dbe5edf88bf7769bafd96366a8a8de9047ed48
3
+ size 1918848
zingerlittlebee--netop.90b92f0/environment/harbor_prepare_download_env.sh ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ command -v cargo
4
+ command -v rustc
5
+ command -v rustup
6
+ cd /workspace
7
+ set -a
8
+ source /tmp/programgym-download.sh
9
+ set +a
10
+ python3 - <<'PY' > /etc/profile.d/programgym_download_env.sh
11
+ import os
12
+ import shlex
13
+
14
+ ignored = {
15
+ "ALL_PROXY",
16
+ "HTTP_PROXY",
17
+ "HTTPS_PROXY",
18
+ "NO_PROXY",
19
+ "OLDPWD",
20
+ "PIP_PROXY",
21
+ "PWD",
22
+ "SHLVL",
23
+ "_",
24
+ "all_proxy",
25
+ "http_proxy",
26
+ "https_proxy",
27
+ "no_proxy",
28
+ "pip_proxy",
29
+ }
30
+ for key in sorted(os.environ):
31
+ if key in ignored or key.startswith("BASH_FUNC_"):
32
+ continue
33
+ value = os.environ[key]
34
+ if "\n" in value:
35
+ continue
36
+ print(f"export {key}={shlex.quote(value)}")
37
+ PY
zingerlittlebee--netop.90b92f0/environment/workspace.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2217133c121b94deac9f3ce52d93d322e3eeab11d5af5de2b73947aa98f36a86
3
+ size 11338
zingerlittlebee--netop.90b92f0/instruction.md ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ You are a helpful assistant that can interact with a computer.
2
+
3
+ This is a reverse-engineering benchmark. You are given a compiled binary and its documentation.
4
+ Your job is to write a new, original codebase from scratch that produces an executable with identical behavior.
5
+ You must figure out the behavior solely by running and interacting with the provided binary.
6
+ Writing original code based on observed behavior is the entire point of this benchmark.
7
+
8
+ Any approach that shortcuts this — finding existing source code, wrapping the binary,
9
+ or installing the original tool — does not count as a solution. It will be detected by an
10
+ automated judge, marked as a disqualification, and scored as a failure.
11
+ The trace will be posted to an online wall of shame.
12
+
13
+ <RULES>
14
+ ## What is not allowed
15
+
16
+ ### 1. Obtaining source code
17
+
18
+ The only source of truth about what the executable does is the executable itself and its
19
+ bundled documentation. You must not search the internet, package registries, or any external
20
+ source for information about this project's source code. Even if you recognize what the
21
+ executable is, you must reimplement it from behavioral observation alone.
22
+
23
+ This includes but is not limited to:
24
+ - Cloning or browsing the original GitHub repository, its forks, or mirrors
25
+ - Downloading the project from package registries: `cargo install <project>`, `go get github.com/<org>/<project>`, `pip install <project>`, `apt-get source <project>`, `npm install <project>`, etc.
26
+ - Fetching source tarballs from project websites (e.g., `curl https://lua.org/ftp/lua-5.5.0.tar.gz`)
27
+ - Using a package manager to download the project as a dependency and then reading its cached source (e.g., navigating into `~/.cargo/registry/src/` or `$(go env GOPATH)/pkg/mod/`)
28
+ - Searching the web for the project's source code or implementation details
29
+
30
+ ### 2. Wrapping or reusing the original binary
31
+
32
+ Your submission must be a genuine reimplementation. The provided `./executable` is for
33
+ observation only — your final solution must not depend on it or any other pre-built version
34
+ of the same tool at runtime.
35
+
36
+ This includes but is not limited to:
37
+ - Writing a wrapper script that delegates to the original binary (e.g., `exec zstd "$@"`)
38
+ - Installing the tool from a package manager and shimming to it (e.g., `apt-get install nnn && cp $(which nnn) ./executable`)
39
+ - Writing a `compile.sh` that simply makes the provided binary executable (`chmod +x ./executable`) or copies it (`cp ./executable ./executable`)
40
+ - Building a binary whose main function shells out to an external tool (e.g., `Command::new("miniserve").args(args).exec()`)
41
+ - Re-linking prebuilt `.o` object files found in the workspace without writing new source code
42
+
43
+ ### 3. Binary analysis of the provided executable
44
+
45
+ All information about the provided `./executable` must be obtained by interacting with it
46
+ through its normal user interface (CLI flags, stdin/stdout, etc.).
47
+ - You MUST NOT decompile `./executable` or use disassemblers (objdump, Ghidra, etc.) on it
48
+ - You MUST NOT use strace, ltrace, or similar tracing/instrumentation tools on `./executable`
49
+
50
+ Note: this restriction applies ONLY to the provided `./executable`. You are free to use any
51
+ analysis tools on binaries that you produce yourself during development.
52
+
53
+ ## What IS allowed
54
+
55
+ - Running the executable with any inputs, flags, and arguments to observe its behavior
56
+ - Reading any documentation files bundled in the workspace
57
+ </RULES>
58
+
59
+ ## Task context
60
+
61
+ We want to write the source code for a given executable.
62
+ The executable is located at `./executable` in the workspace root.
63
+
64
+ You also have access to the existing documentation.
65
+
66
+ ## Your task
67
+
68
+ Implement the source code to generate an executable of exactly identical behavior as the original.
69
+
70
+ No project-specific dependencies are pre-installed.
71
+ You do NOT have access to the internet.
72
+ **IMPORTANT**: Make sure that the executable(s) and everything else that is an artifact is not committed, i.e., is in your `.gitignore` file.
73
+ Finally, commit your changes.
74
+
75
+ Make sure that you have a `./compile.sh` file that produces an executable `./executable` in the workspace root.
76
+ `compile.sh` should be executable and should install any dependencies needed to compile the executable.
77
+ If your compile.sh fails to compile on a fresh checkout, your task has failed.
78
+
79
+ ## Important: This is a reverse-engineering benchmark
80
+
81
+ Your goal is to write original code from scratch that reproduces the executable's behavior.
82
+ The only way to learn what the executable does is to run it and read its bundled documentation.
83
+
84
+ Any attempt to obtain source code — whether successful or not — or to wrap/reuse the
85
+ provided binary will be detected by an automated judge, disqualified, and scored as zero.
86
+ See the full rules in the system prompt above. Key points:
87
+
88
+ - Do NOT search the internet, clone repos, or download the project from any package registry
89
+ - Do NOT wrap, shim, or delegate to the provided `./executable` or any installed version of the same tool
90
+ - Do NOT decompile the provided `./executable` or use strace/ltrace on it (analyzing your own binaries is fine)
91
+ - You SHOULD extensively test the executable to understand its behavior before writing code.
92
+ If you are dealing with a TUI, tmux/libtmux has been installed to help you test/inspect/it.
93
+
94
+ ## Recommended Workflow
95
+
96
+ 1. Explore all documentation files
97
+ 2. Play with the executable to understand its behavior (however, you MUST NOT decompile `./executable` or perform any other form of binary or strace/ltrace analysis on it)
98
+ 3. Write the source code to implement the behavior
zingerlittlebee--netop.90b92f0/solution/solve.sh ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # Oracle-only ceiling check. The reference is execute-only for normal agents;
3
+ # because the oracle runs as the owning `agent` user it can temporarily add read
4
+ # permission and encode the binary for Harbor's normal artifact handoff.
5
+ set -euo pipefail
6
+ test -f ./executable
7
+ chmod u+r ./executable
8
+ python3 - <<'PY'
9
+ import base64
10
+ from pathlib import Path
11
+
12
+ Path(".programgym_oracle_reference").write_bytes(
13
+ base64.b64encode(Path("executable").read_bytes())
14
+ )
15
+ PY
16
+ chmod u-r ./executable
17
+ cat > compile.sh <<'EOF'
18
+ #!/usr/bin/env bash
19
+ set -euo pipefail
20
+ if [ -f ./.programgym_oracle_reference ]; then
21
+ python3 - <<'PY'
22
+ import base64
23
+ from pathlib import Path
24
+
25
+ Path("executable").write_bytes(
26
+ base64.b64decode(Path(".programgym_oracle_reference").read_bytes())
27
+ )
28
+ PY
29
+ fi
30
+ test -f ./executable
31
+ chmod +x ./executable
32
+ EOF
33
+ chmod +x compile.sh
zingerlittlebee--netop.90b92f0/task.toml ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.3"
2
+ source = "ProgramGym"
3
+ artifacts = [
4
+ "/logs/verifier/programgym_eval.json",
5
+ "/logs/verifier/harbor_diagnostics.json",
6
+ "/logs/verifier/programgym_eval.log",
7
+ "/logs/verifier/reward.json",
8
+ "/logs/verifier/reward.txt",
9
+ # Keep agent/runtime state out of the submission handoff. In particular,
10
+ # Claude Code installs an absolute symlink under .local/bin; transferring it
11
+ # makes Python's safe tar extraction reject the entire workspace archive.
12
+ { source = "/workspace", exclude = [
13
+ "executable",
14
+ ".git",
15
+ ".bashrc",
16
+ ".cache",
17
+ ".cc-switch",
18
+ ".claude",
19
+ ".local",
20
+ ] },
21
+ ]
22
+
23
+ [task]
24
+ name = "programgym/zingerlittlebee--netop.90b92f0"
25
+ description = "Synthetic ProgramGym cleanroom reconstruction task for ZingerLittleBee/netop"
26
+ authors = [{ name = "Harbor ProgramGym Synthetic Adapter" }]
27
+ keywords = ["programgym", "synthetic", "reverse-engineering", "cleanroom", "rust"]
28
+
29
+ [metadata]
30
+ source = "ProgramGym"
31
+ instance_id = "ZingerLittleBee__netop.90b92f0"
32
+ repository = "ZingerLittleBee/netop"
33
+ commit = "90b92f050cddb940dcc88276ef086b7441ee2284"
34
+ language = "rust"
35
+ difficulty = "easy"
36
+ difficulty_score = 1.6207604899942059
37
+ test_branches = 4
38
+ test_count = 510
39
+
40
+ [agent]
41
+ timeout_sec = 14400
42
+ user = "agent"
43
+ network_mode = "allowlist"
44
+ allowed_hosts = ["api.anthropic.com", "api.openai.com"]
45
+
46
+ [verifier]
47
+ timeout_sec = 7200
48
+ user = "root"
49
+ environment_mode = "separate"
50
+
51
+ [verifier.env]
52
+ PROGRAMGYM_XDIST_WORKERS = "8"
53
+
54
+ [verifier.environment]
55
+ build_timeout_sec = 1800
56
+ cpus = 8
57
+ memory_mb = 16384
58
+ storage_mb = 30720
59
+ gpus = 0
60
+ workdir = "/workspace"
61
+
62
+ [environment]
63
+ network_mode = "public"
64
+ build_timeout_sec = 1800
65
+ cpus = 8
66
+ memory_mb = 16384
67
+ storage_mb = 30720
68
+ gpus = 0
69
+ workdir = "/workspace"
zingerlittlebee--netop.90b92f0/tests/Dockerfile ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM rust:1.97.1-bookworm
2
+ ENV DEBIAN_FRONTEND=noninteractive
3
+ ENV RUSTUP_DIST_SERVER="https://static.rust-lang.org"
4
+ ENV RUSTUP_UPDATE_ROOT="https://static.rust-lang.org/rustup"
5
+ ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
6
+ ENV CARGO_REGISTRIES_CRATES_IO_INDEX="sparse+https://index.crates.io/"
7
+ ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
8
+ ENV GOPROXY="https://proxy.golang.org,direct"
9
+ ENV GOSUMDB=sum.golang.google.cn
10
+ ENV GOTOOLCHAIN=auto
11
+ ENV UV_INSECURE_HOST=""
12
+ ENV UV_INDEX_URL="https://pypi.org/simple"
13
+ ENV UV_CACHE_DIR=/workspace/.cache/uv
14
+ ENV npm_config_registry="https://registry.npmjs.org/"
15
+ ENV npm_config_strict_ssl=false
16
+ ENV npm_config_cache=/workspace/.cache/npm
17
+ ENV PIP_INDEX_URL="https://pypi.org/simple"
18
+ ENV PIP_TRUSTED_HOST=""
19
+ ENV HOME=/workspace
20
+ ENV XDG_CACHE_HOME=/workspace/.cache
21
+ ENV PIP_CACHE_DIR=/workspace/.cache/pip
22
+ ENV PYTHONUSERBASE=/workspace/.local
23
+ ENV CARGO_HOME=/usr/local/cargo
24
+ ENV RUSTUP_HOME=/usr/local/rustup
25
+ ENV RUSTUP_TOOLCHAIN=1.97.1
26
+ ENV PROGRAMGYM_RUST_TOOLCHAIN=1.97.1
27
+ ENV PATH=/usr/local/cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
28
+ ENV PAGER=cat
29
+ ENV MANPAGER=cat
30
+ ENV LESS=-R
31
+ ENV TQDM_DISABLE=1
32
+ RUN apt-get update && apt-get install -y --no-install-recommends apt=2.6.1 bash=5.2.15-2+b13 build-essential=12.9 ca-certificates=20250419~deb12u1 cmake=3.25.1-1 git=1:2.39.5-0+deb12u3 make=4.3-4.1 pkg-config=1.8.1-1 python3=3.11.2-1+b1 python3-pip=23.0.1+dfsg-1 python3-dev=3.11.2-1+b1 autoconf=2.71-3 automake=1:1.16.5-1.3 gettext=0.21-12 file=1:5.44-3 binutils=2.40-2 libtool=2.4.7-7~deb12u1 libncurses-dev=6.4-4 meson=1.0.1-5 ninja-build=1.11.1-2~deb12u1 curl=7.88.1-10+deb12u15 wget=1.21.3-1+deb12u1 xz-utils=5.4.1-1+deb12u1 zstd=1.5.4+dfsg2-5 bzip2=1.0.8-5+b1 zip=3.0-13 unzip=6.0-28+deb12u1 patch=2.7.6-7 grep=3.8-5 python3-pytest python3-pytest-xdist python3-coverage && rm -rf /var/lib/apt/lists/*
33
+ RUN rustup component add llvm-tools-preview --toolchain 1.97.1
34
+ RUN RUST_SYSROOT="$(rustc --print sysroot)"; RUST_HOST="$(rustc -vV | sed -n 's/^host: //p')"; test -x "$RUST_SYSROOT/lib/rustlib/$RUST_HOST/bin/llvm-profdata"; test -x "$RUST_SYSROOT/lib/rustlib/$RUST_HOST/bin/llvm-cov"
35
+ RUN rustc --version && cargo --version && rustup show active-toolchain
36
+ WORKDIR /workspace
37
+ ADD workspace.tar.gz /workspace/
38
+ COPY executable /workspace/executable
39
+ COPY download.sh /tmp/programgym-download.sh
40
+ RUN chmod 755 /tmp/programgym-download.sh
41
+ COPY harbor_prepare_download_env.sh /tmp/harbor_prepare_download_env.sh
42
+ RUN chmod 755 /tmp/harbor_prepare_download_env.sh \
43
+ && /bin/bash /tmp/harbor_prepare_download_env.sh \
44
+ && rm -f /tmp/programgym-download.sh \
45
+ && rm -f /tmp/harbor_prepare_download_env.sh
46
+ ENV BASH_ENV=/etc/profile.d/programgym_download_env.sh
47
+ RUN chmod 111 /workspace/executable
48
+ WORKDIR /workspace
49
+ # Harbor uses tests/ as the separate verifier build context. Start with the
50
+ # same toolchain as the agent, then remove every cleanroom workspace artifact.
51
+ RUN rm -rf /workspace/* /workspace/.[!.]* 2>/dev/null || true \
52
+ && mkdir -p /workspace /tests
53
+
54
+ # Synthetic cleanroom Dockerfiles commonly install Ubuntu's pytest-xdist 2.5.0.
55
+ # Installing a newer pytest alone leaves that apt package importable and creates
56
+ # an incompatible mixed apt/pip stack (xdist 2.5 imports the removed py.log).
57
+ # Install and constrain the verifier test runner as one coherent pip toolchain.
58
+ RUN printf 'pytest<9\n' > /etc/pip-constraint.txt
59
+ ENV PIP_CONSTRAINT=/etc/pip-constraint.txt
60
+ RUN python3 -m pip install --break-system-packages \
61
+ --no-cache-dir --disable-pip-version-check \
62
+ 'pytest<9' 'pytest-xdist>=3,<4' pytest-rerunfailures pytest-timeout
63
+
64
+ COPY test.sh /tests/test.sh
65
+ COPY programgym_evaluator.py /tests/programgym_evaluator.py
66
+ COPY programgym_task.json /tests/programgym_task.json
67
+ COPY blobs/ /tests/blobs/
68
+ RUN chmod +x /tests/test.sh
zingerlittlebee--netop.90b92f0/tests/blobs/tests/generated_module_01.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b4a8a7e245610e7d71bbe577ed8e13be766c8768dfea22d882a3e06fcb9f39f9
3
+ size 12200
zingerlittlebee--netop.90b92f0/tests/blobs/tests/generated_module_02.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7ec79697e94b8614319fd3d8c1fe22bb75ba34e947b7781a8b29b049b664f3c0
3
+ size 23386
zingerlittlebee--netop.90b92f0/tests/blobs/tests/generated_module_03.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d39225d1d6ef7813d7af98adfba82554d5146efff4219074e6aad13533eec054
3
+ size 20786
zingerlittlebee--netop.90b92f0/tests/blobs/tests/generated_module_04.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:149ae9f01c020918e0c7bca536245bb379a1caf37cdfb48cc9bfd435d72bed67
3
+ size 16695
zingerlittlebee--netop.90b92f0/tests/download.sh ADDED
@@ -0,0 +1,910 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # netop - ProgramGym download stage
3
+ # Sources: installs the native libpcap development headers and prefetches every
4
+ # Cargo dependency into the cargo registry cache. Does not compile or link.
5
+ # This script is sourced, not executed: it must be source-safe and idempotent.
6
+
7
+ set -u
8
+
9
+ # Path where we build the standalone generated Cargo project (owned by this script).
10
+ GEN_DIR="${TMPDIR:-/tmp}/netop_download_gen"
11
+ rm -rf "$GEN_DIR"
12
+ mkdir -p "$GEN_DIR/src"
13
+
14
+ # ---------------------------------------------------------------------------
15
+ # Install native dependencies needed to build the `pcap` crate.
16
+ # `libpcap-dev` provides the headers/libpcap that the pcap build needs.
17
+ # ---------------------------------------------------------------------------
18
+ export DEBIAN_FRONTEND=noninteractive
19
+ if command -v apt-get >/dev/null 2>&1; then
20
+ apt-get update
21
+ apt-get install -y --no-install-recommends libpcap-dev
22
+ fi
23
+
24
+ # ---------------------------------------------------------------------------
25
+ # Generate a standalone Cargo project from inline data (no repo files read).
26
+ # Cargo.toml mirrors the repository manifest; Cargo.lock is the pinned lock so
27
+ # `cargo fetch --locked` downloads exactly the versions the offline build needs.
28
+ # ---------------------------------------------------------------------------
29
+ cat > "$GEN_DIR/Cargo.toml" <<'EOF'
30
+ [package]
31
+ name = "netop"
32
+ version = "0.1.4"
33
+ edition = "2021"
34
+
35
+ [dependencies]
36
+ netraffic = "0.1.0"
37
+ crossterm = "0.27.0"
38
+ chrono = "0.4"
39
+ clap = { version = "4.4.11", features = ["derive"] }
40
+ ratatui = "0.25.0"
41
+ EOF
42
+
43
+ # Empty stub so the generated manifest has a valid package layout.
44
+ cat > "$GEN_DIR/src/main.rs" <<'EOF'
45
+ fn main() {}
46
+ EOF
47
+
48
+ cat > "$GEN_DIR/Cargo.lock" <<'EOF'
49
+ # This file is automatically @generated by Cargo.
50
+ # It is not intended for manual editing.
51
+ version = 3
52
+
53
+ [[package]]
54
+ name = "ahash"
55
+ version = "0.8.6"
56
+ source = "registry+https://github.com/rust-lang/crates.io-index"
57
+ checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a"
58
+ dependencies = [
59
+ "cfg-if",
60
+ "once_cell",
61
+ "version_check",
62
+ "zerocopy",
63
+ ]
64
+
65
+ [[package]]
66
+ name = "aho-corasick"
67
+ version = "0.7.18"
68
+ source = "registry+https://github.com/rust-lang/crates.io-index"
69
+ checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
70
+ dependencies = [
71
+ "memchr",
72
+ ]
73
+
74
+ [[package]]
75
+ name = "allocator-api2"
76
+ version = "0.2.16"
77
+ source = "registry+https://github.com/rust-lang/crates.io-index"
78
+ checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5"
79
+
80
+ [[package]]
81
+ name = "anstream"
82
+ version = "0.6.5"
83
+ source = "registry+https://github.com/rust-lang/crates.io-index"
84
+ checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6"
85
+ dependencies = [
86
+ "anstyle",
87
+ "anstyle-parse",
88
+ "anstyle-query",
89
+ "anstyle-wincon",
90
+ "colorchoice",
91
+ "utf8parse",
92
+ ]
93
+
94
+ [[package]]
95
+ name = "anstyle"
96
+ version = "1.0.0"
97
+ source = "registry+https://github.com/rust-lang/crates.io-index"
98
+ checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d"
99
+
100
+ [[package]]
101
+ name = "anstyle-parse"
102
+ version = "0.2.0"
103
+ source = "registry+https://github.com/rust-lang/crates.io-index"
104
+ checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee"
105
+ dependencies = [
106
+ "utf8parse",
107
+ ]
108
+
109
+ [[package]]
110
+ name = "anstyle-query"
111
+ version = "1.0.0"
112
+ source = "registry+https://github.com/rust-lang/crates.io-index"
113
+ checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b"
114
+ dependencies = [
115
+ "windows-sys 0.48.0",
116
+ ]
117
+
118
+ [[package]]
119
+ name = "anstyle-wincon"
120
+ version = "3.0.2"
121
+ source = "registry+https://github.com/rust-lang/crates.io-index"
122
+ checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7"
123
+ dependencies = [
124
+ "anstyle",
125
+ "windows-sys 0.52.0",
126
+ ]
127
+
128
+ [[package]]
129
+ name = "autocfg"
130
+ version = "1.1.0"
131
+ source = "registry+https://github.com/rust-lang/crates.io-index"
132
+ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
133
+
134
+ [[package]]
135
+ name = "bitflags"
136
+ version = "1.3.2"
137
+ source = "registry+https://github.com/rust-lang/crates.io-index"
138
+ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
139
+
140
+ [[package]]
141
+ name = "bitflags"
142
+ version = "2.4.1"
143
+ source = "registry+https://github.com/rust-lang/crates.io-index"
144
+ checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
145
+
146
+ [[package]]
147
+ name = "cassowary"
148
+ version = "0.3.0"
149
+ source = "registry+https://github.com/rust-lang/crates.io-index"
150
+ checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
151
+
152
+ [[package]]
153
+ name = "cc"
154
+ version = "1.0.73"
155
+ source = "registry+https://github.com/rust-lang/crates.io-index"
156
+ checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
157
+
158
+ [[package]]
159
+ name = "cfg-if"
160
+ version = "1.0.0"
161
+ source = "registry+https://github.com/rust-lang/crates.io-index"
162
+ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
163
+
164
+ [[package]]
165
+ name = "chrono"
166
+ version = "0.4.19"
167
+ source = "registry+https://github.com/rust-lang/crates.io-index"
168
+ checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
169
+ dependencies = [
170
+ "libc",
171
+ "num-integer",
172
+ "num-traits",
173
+ "time",
174
+ "winapi",
175
+ ]
176
+
177
+ [[package]]
178
+ name = "clap"
179
+ version = "4.4.11"
180
+ source = "registry+https://github.com/rust-lang/crates.io-index"
181
+ checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2"
182
+ dependencies = [
183
+ "clap_builder",
184
+ "clap_derive",
185
+ ]
186
+
187
+ [[package]]
188
+ name = "clap_builder"
189
+ version = "4.4.11"
190
+ source = "registry+https://github.com/rust-lang/crates.io-index"
191
+ checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb"
192
+ dependencies = [
193
+ "anstream",
194
+ "anstyle",
195
+ "clap_lex",
196
+ "strsim",
197
+ ]
198
+
199
+ [[package]]
200
+ name = "clap_derive"
201
+ version = "4.4.7"
202
+ source = "registry+https://github.com/rust-lang/crates.io-index"
203
+ checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442"
204
+ dependencies = [
205
+ "heck",
206
+ "proc-macro2",
207
+ "quote",
208
+ "syn 2.0.41",
209
+ ]
210
+
211
+ [[package]]
212
+ name = "clap_lex"
213
+ version = "0.6.0"
214
+ source = "registry+https://github.com/rust-lang/crates.io-index"
215
+ checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1"
216
+
217
+ [[package]]
218
+ name = "colorchoice"
219
+ version = "1.0.0"
220
+ source = "registry+https://github.com/rust-lang/crates.io-index"
221
+ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
222
+
223
+ [[package]]
224
+ name = "crossterm"
225
+ version = "0.27.0"
226
+ source = "registry+https://github.com/rust-lang/crates.io-index"
227
+ checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df"
228
+ dependencies = [
229
+ "bitflags 2.4.1",
230
+ "crossterm_winapi",
231
+ "libc",
232
+ "mio",
233
+ "parking_lot",
234
+ "signal-hook",
235
+ "signal-hook-mio",
236
+ "winapi",
237
+ ]
238
+
239
+ [[package]]
240
+ name = "crossterm_winapi"
241
+ version = "0.9.1"
242
+ source = "registry+https://github.com/rust-lang/crates.io-index"
243
+ checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b"
244
+ dependencies = [
245
+ "winapi",
246
+ ]
247
+
248
+ [[package]]
249
+ name = "either"
250
+ version = "1.9.0"
251
+ source = "registry+https://github.com/rust-lang/crates.io-index"
252
+ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
253
+
254
+ [[package]]
255
+ name = "errno"
256
+ version = "0.2.8"
257
+ source = "registry+https://github.com/rust-lang/crates.io-index"
258
+ checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
259
+ dependencies = [
260
+ "errno-dragonfly",
261
+ "libc",
262
+ "winapi",
263
+ ]
264
+
265
+ [[package]]
266
+ name = "errno-dragonfly"
267
+ version = "0.1.2"
268
+ source = "registry+https://github.com/rust-lang/crates.io-index"
269
+ checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
270
+ dependencies = [
271
+ "cc",
272
+ "libc",
273
+ ]
274
+
275
+ [[package]]
276
+ name = "hashbrown"
277
+ version = "0.14.3"
278
+ source = "registry+https://github.com/rust-lang/crates.io-index"
279
+ checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
280
+ dependencies = [
281
+ "ahash",
282
+ "allocator-api2",
283
+ ]
284
+
285
+ [[package]]
286
+ name = "heck"
287
+ version = "0.4.1"
288
+ source = "registry+https://github.com/rust-lang/crates.io-index"
289
+ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
290
+
291
+ [[package]]
292
+ name = "indoc"
293
+ version = "2.0.4"
294
+ source = "registry+https://github.com/rust-lang/crates.io-index"
295
+ checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8"
296
+
297
+ [[package]]
298
+ name = "itertools"
299
+ version = "0.12.0"
300
+ source = "registry+https://github.com/rust-lang/crates.io-index"
301
+ checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0"
302
+ dependencies = [
303
+ "either",
304
+ ]
305
+
306
+ [[package]]
307
+ name = "libc"
308
+ version = "0.2.144"
309
+ source = "registry+https://github.com/rust-lang/crates.io-index"
310
+ checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1"
311
+
312
+ [[package]]
313
+ name = "libloading"
314
+ version = "0.6.7"
315
+ source = "registry+https://github.com/rust-lang/crates.io-index"
316
+ checksum = "351a32417a12d5f7e82c368a66781e307834dae04c6ce0cd4456d52989229883"
317
+ dependencies = [
318
+ "cfg-if",
319
+ "winapi",
320
+ ]
321
+
322
+ [[package]]
323
+ name = "lock_api"
324
+ version = "0.4.7"
325
+ source = "registry+https://github.com/rust-lang/crates.io-index"
326
+ checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53"
327
+ dependencies = [
328
+ "autocfg",
329
+ "scopeguard",
330
+ ]
331
+
332
+ [[package]]
333
+ name = "log"
334
+ version = "0.4.17"
335
+ source = "registry+https://github.com/rust-lang/crates.io-index"
336
+ checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
337
+ dependencies = [
338
+ "cfg-if",
339
+ ]
340
+
341
+ [[package]]
342
+ name = "lru"
343
+ version = "0.12.1"
344
+ source = "registry+https://github.com/rust-lang/crates.io-index"
345
+ checksum = "2994eeba8ed550fd9b47a0b38f0242bc3344e496483c6180b69139cc2fa5d1d7"
346
+ dependencies = [
347
+ "hashbrown",
348
+ ]
349
+
350
+ [[package]]
351
+ name = "memchr"
352
+ version = "2.5.0"
353
+ source = "registry+https://github.com/rust-lang/crates.io-index"
354
+ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
355
+
356
+ [[package]]
357
+ name = "mio"
358
+ version = "0.8.3"
359
+ source = "registry+https://github.com/rust-lang/crates.io-index"
360
+ checksum = "713d550d9b44d89174e066b7a6217ae06234c10cb47819a88290d2b353c31799"
361
+ dependencies = [
362
+ "libc",
363
+ "log",
364
+ "wasi 0.11.0+wasi-snapshot-preview1",
365
+ "windows-sys 0.36.1",
366
+ ]
367
+
368
+ [[package]]
369
+ name = "netop"
370
+ version = "0.1.4"
371
+ dependencies = [
372
+ "chrono",
373
+ "clap",
374
+ "crossterm",
375
+ "netraffic",
376
+ "ratatui",
377
+ ]
378
+
379
+ [[package]]
380
+ name = "netraffic"
381
+ version = "0.1.0"
382
+ source = "registry+https://github.com/rust-lang/crates.io-index"
383
+ checksum = "4f47d0b38a2382c7fe5ccadab3dd79ae3937e7dced62cde9837d6bc1a283b05f"
384
+ dependencies = [
385
+ "pcap",
386
+ ]
387
+
388
+ [[package]]
389
+ name = "num-integer"
390
+ version = "0.1.45"
391
+ source = "registry+https://github.com/rust-lang/crates.io-index"
392
+ checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
393
+ dependencies = [
394
+ "autocfg",
395
+ "num-traits",
396
+ ]
397
+
398
+ [[package]]
399
+ name = "num-traits"
400
+ version = "0.2.15"
401
+ source = "registry+https://github.com/rust-lang/crates.io-index"
402
+ checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
403
+ dependencies = [
404
+ "autocfg",
405
+ ]
406
+
407
+ [[package]]
408
+ name = "once_cell"
409
+ version = "1.19.0"
410
+ source = "registry+https://github.com/rust-lang/crates.io-index"
411
+ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
412
+
413
+ [[package]]
414
+ name = "parking_lot"
415
+ version = "0.12.1"
416
+ source = "registry+https://github.com/rust-lang/crates.io-index"
417
+ checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
418
+ dependencies = [
419
+ "lock_api",
420
+ "parking_lot_core",
421
+ ]
422
+
423
+ [[package]]
424
+ name = "parking_lot_core"
425
+ version = "0.9.3"
426
+ source = "registry+https://github.com/rust-lang/crates.io-index"
427
+ checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929"
428
+ dependencies = [
429
+ "cfg-if",
430
+ "libc",
431
+ "redox_syscall",
432
+ "smallvec",
433
+ "windows-sys 0.36.1",
434
+ ]
435
+
436
+ [[package]]
437
+ name = "paste"
438
+ version = "1.0.14"
439
+ source = "registry+https://github.com/rust-lang/crates.io-index"
440
+ checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
441
+
442
+ [[package]]
443
+ name = "pcap"
444
+ version = "0.9.2"
445
+ source = "registry+https://github.com/rust-lang/crates.io-index"
446
+ checksum = "42d1868a121e5f1d78134be7148b778d5352f28b7be30e7f993c3439671f0190"
447
+ dependencies = [
448
+ "errno",
449
+ "libc",
450
+ "libloading",
451
+ "regex",
452
+ "widestring",
453
+ "winapi",
454
+ ]
455
+
456
+ [[package]]
457
+ name = "proc-macro2"
458
+ version = "1.0.70"
459
+ source = "registry+https://github.com/rust-lang/crates.io-index"
460
+ checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b"
461
+ dependencies = [
462
+ "unicode-ident",
463
+ ]
464
+
465
+ [[package]]
466
+ name = "quote"
467
+ version = "1.0.28"
468
+ source = "registry+https://github.com/rust-lang/crates.io-index"
469
+ checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488"
470
+ dependencies = [
471
+ "proc-macro2",
472
+ ]
473
+
474
+ [[package]]
475
+ name = "ratatui"
476
+ version = "0.25.0"
477
+ source = "registry+https://github.com/rust-lang/crates.io-index"
478
+ checksum = "a5659e52e4ba6e07b2dad9f1158f578ef84a73762625ddb51536019f34d180eb"
479
+ dependencies = [
480
+ "bitflags 2.4.1",
481
+ "cassowary",
482
+ "crossterm",
483
+ "indoc",
484
+ "itertools",
485
+ "lru",
486
+ "paste",
487
+ "stability",
488
+ "strum",
489
+ "unicode-segmentation",
490
+ "unicode-width",
491
+ ]
492
+
493
+ [[package]]
494
+ name = "redox_syscall"
495
+ version = "0.2.13"
496
+ source = "registry+https://github.com/rust-lang/crates.io-index"
497
+ checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
498
+ dependencies = [
499
+ "bitflags 1.3.2",
500
+ ]
501
+
502
+ [[package]]
503
+ name = "regex"
504
+ version = "1.5.6"
505
+ source = "registry+https://github.com/rust-lang/crates.io-index"
506
+ checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1"
507
+ dependencies = [
508
+ "aho-corasick",
509
+ "memchr",
510
+ "regex-syntax",
511
+ ]
512
+
513
+ [[package]]
514
+ name = "regex-syntax"
515
+ version = "0.6.26"
516
+ source = "registry+https://github.com/rust-lang/crates.io-index"
517
+ checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64"
518
+
519
+ [[package]]
520
+ name = "rustversion"
521
+ version = "1.0.14"
522
+ source = "registry+https://github.com/rust-lang/crates.io-index"
523
+ checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
524
+
525
+ [[package]]
526
+ name = "scopeguard"
527
+ version = "1.1.0"
528
+ source = "registry+https://github.com/rust-lang/crates.io-index"
529
+ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
530
+
531
+ [[package]]
532
+ name = "signal-hook"
533
+ version = "0.3.17"
534
+ source = "registry+https://github.com/rust-lang/crates.io-index"
535
+ checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801"
536
+ dependencies = [
537
+ "libc",
538
+ "signal-hook-registry",
539
+ ]
540
+
541
+ [[package]]
542
+ name = "signal-hook-mio"
543
+ version = "0.2.3"
544
+ source = "registry+https://github.com/rust-lang/crates.io-index"
545
+ checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af"
546
+ dependencies = [
547
+ "libc",
548
+ "mio",
549
+ "signal-hook",
550
+ ]
551
+
552
+ [[package]]
553
+ name = "signal-hook-registry"
554
+ version = "1.4.0"
555
+ source = "registry+https://github.com/rust-lang/crates.io-index"
556
+ checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0"
557
+ dependencies = [
558
+ "libc",
559
+ ]
560
+
561
+ [[package]]
562
+ name = "smallvec"
563
+ version = "1.8.0"
564
+ source = "registry+https://github.com/rust-lang/crates.io-index"
565
+ checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83"
566
+
567
+ [[package]]
568
+ name = "stability"
569
+ version = "0.1.1"
570
+ source = "registry+https://github.com/rust-lang/crates.io-index"
571
+ checksum = "ebd1b177894da2a2d9120208c3386066af06a488255caabc5de8ddca22dbc3ce"
572
+ dependencies = [
573
+ "quote",
574
+ "syn 1.0.109",
575
+ ]
576
+
577
+ [[package]]
578
+ name = "strsim"
579
+ version = "0.10.0"
580
+ source = "registry+https://github.com/rust-lang/crates.io-index"
581
+ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
582
+
583
+ [[package]]
584
+ name = "strum"
585
+ version = "0.25.0"
586
+ source = "registry+https://github.com/rust-lang/crates.io-index"
587
+ checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125"
588
+ dependencies = [
589
+ "strum_macros",
590
+ ]
591
+
592
+ [[package]]
593
+ name = "strum_macros"
594
+ version = "0.25.3"
595
+ source = "registry+https://github.com/rust-lang/crates.io-index"
596
+ checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0"
597
+ dependencies = [
598
+ "heck",
599
+ "proc-macro2",
600
+ "quote",
601
+ "rustversion",
602
+ "syn 2.0.41",
603
+ ]
604
+
605
+ [[package]]
606
+ name = "syn"
607
+ version = "1.0.109"
608
+ source = "registry+https://github.com/rust-lang/crates.io-index"
609
+ checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
610
+ dependencies = [
611
+ "proc-macro2",
612
+ "quote",
613
+ "unicode-ident",
614
+ ]
615
+
616
+ [[package]]
617
+ name = "syn"
618
+ version = "2.0.41"
619
+ source = "registry+https://github.com/rust-lang/crates.io-index"
620
+ checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269"
621
+ dependencies = [
622
+ "proc-macro2",
623
+ "quote",
624
+ "unicode-ident",
625
+ ]
626
+
627
+ [[package]]
628
+ name = "time"
629
+ version = "0.1.44"
630
+ source = "registry+https://github.com/rust-lang/crates.io-index"
631
+ checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
632
+ dependencies = [
633
+ "libc",
634
+ "wasi 0.10.0+wasi-snapshot-preview1",
635
+ "winapi",
636
+ ]
637
+
638
+ [[package]]
639
+ name = "unicode-ident"
640
+ version = "1.0.1"
641
+ source = "registry+https://github.com/rust-lang/crates.io-index"
642
+ checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c"
643
+
644
+ [[package]]
645
+ name = "unicode-segmentation"
646
+ version = "1.10.1"
647
+ source = "registry+https://github.com/rust-lang/crates.io-index"
648
+ checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
649
+
650
+ [[package]]
651
+ name = "unicode-width"
652
+ version = "0.1.9"
653
+ source = "registry+https://github.com/rust-lang/crates.io-index"
654
+ checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
655
+
656
+ [[package]]
657
+ name = "utf8parse"
658
+ version = "0.2.1"
659
+ source = "registry+https://github.com/rust-lang/crates.io-index"
660
+ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
661
+
662
+ [[package]]
663
+ name = "version_check"
664
+ version = "0.9.4"
665
+ source = "registry+https://github.com/rust-lang/crates.io-index"
666
+ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
667
+
668
+ [[package]]
669
+ name = "wasi"
670
+ version = "0.10.0+wasi-snapshot-preview1"
671
+ source = "registry+https://github.com/rust-lang/crates.io-index"
672
+ checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
673
+
674
+ [[package]]
675
+ name = "wasi"
676
+ version = "0.11.0+wasi-snapshot-preview1"
677
+ source = "registry+https://github.com/rust-lang/crates.io-index"
678
+ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
679
+
680
+ [[package]]
681
+ name = "widestring"
682
+ version = "0.2.2"
683
+ source = "registry+https://github.com/rust-lang/crates.io-index"
684
+ checksum = "7157704c2e12e3d2189c507b7482c52820a16dfa4465ba91add92f266667cadb"
685
+
686
+ [[package]]
687
+ name = "winapi"
688
+ version = "0.3.9"
689
+ source = "registry+https://github.com/rust-lang/crates.io-index"
690
+ checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
691
+ dependencies = [
692
+ "winapi-i686-pc-windows-gnu",
693
+ "winapi-x86_64-pc-windows-gnu",
694
+ ]
695
+
696
+ [[package]]
697
+ name = "winapi-i686-pc-windows-gnu"
698
+ version = "0.4.0"
699
+ source = "registry+https://github.com/rust-lang/crates.io-index"
700
+ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
701
+
702
+ [[package]]
703
+ name = "winapi-x86_64-pc-windows-gnu"
704
+ version = "0.4.0"
705
+ source = "registry+https://github.com/rust-lang/crates.io-index"
706
+ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
707
+
708
+ [[package]]
709
+ name = "windows-sys"
710
+ version = "0.36.1"
711
+ source = "registry+https://github.com/rust-lang/crates.io-index"
712
+ checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
713
+ dependencies = [
714
+ "windows_aarch64_msvc 0.36.1",
715
+ "windows_i686_gnu 0.36.1",
716
+ "windows_i686_msvc 0.36.1",
717
+ "windows_x86_64_gnu 0.36.1",
718
+ "windows_x86_64_msvc 0.36.1",
719
+ ]
720
+
721
+ [[package]]
722
+ name = "windows-sys"
723
+ version = "0.48.0"
724
+ source = "registry+https://github.com/rust-lang/crates.io-index"
725
+ checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
726
+ dependencies = [
727
+ "windows-targets 0.48.0",
728
+ ]
729
+
730
+ [[package]]
731
+ name = "windows-sys"
732
+ version = "0.52.0"
733
+ source = "registry+https://github.com/rust-lang/crates.io-index"
734
+ checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
735
+ dependencies = [
736
+ "windows-targets 0.52.0",
737
+ ]
738
+
739
+ [[package]]
740
+ name = "windows-targets"
741
+ version = "0.48.0"
742
+ source = "registry+https://github.com/rust-lang/crates.io-index"
743
+ checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5"
744
+ dependencies = [
745
+ "windows_aarch64_gnullvm 0.48.0",
746
+ "windows_aarch64_msvc 0.48.0",
747
+ "windows_i686_gnu 0.48.0",
748
+ "windows_i686_msvc 0.48.0",
749
+ "windows_x86_64_gnu 0.48.0",
750
+ "windows_x86_64_gnullvm 0.48.0",
751
+ "windows_x86_64_msvc 0.48.0",
752
+ ]
753
+
754
+ [[package]]
755
+ name = "windows-targets"
756
+ version = "0.52.0"
757
+ source = "registry+https://github.com/rust-lang/crates.io-index"
758
+ checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
759
+ dependencies = [
760
+ "windows_aarch64_gnullvm 0.52.0",
761
+ "windows_aarch64_msvc 0.52.0",
762
+ "windows_i686_gnu 0.52.0",
763
+ "windows_i686_msvc 0.52.0",
764
+ "windows_x86_64_gnu 0.52.0",
765
+ "windows_x86_64_gnullvm 0.52.0",
766
+ "windows_x86_64_msvc 0.52.0",
767
+ ]
768
+
769
+ [[package]]
770
+ name = "windows_aarch64_gnullvm"
771
+ version = "0.48.0"
772
+ source = "registry+https://github.com/rust-lang/crates.io-index"
773
+ checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
774
+
775
+ [[package]]
776
+ name = "windows_aarch64_gnullvm"
777
+ version = "0.52.0"
778
+ source = "registry+https://github.com/rust-lang/crates.io-index"
779
+ checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
780
+
781
+ [[package]]
782
+ name = "windows_aarch64_msvc"
783
+ version = "0.36.1"
784
+ source = "registry+https://github.com/rust-lang/crates.io-index"
785
+ checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
786
+
787
+ [[package]]
788
+ name = "windows_aarch64_msvc"
789
+ version = "0.48.0"
790
+ source = "registry+https://github.com/rust-lang/crates.io-index"
791
+ checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
792
+
793
+ [[package]]
794
+ name = "windows_aarch64_msvc"
795
+ version = "0.52.0"
796
+ source = "registry+https://github.com/rust-lang/crates.io-index"
797
+ checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
798
+
799
+ [[package]]
800
+ name = "windows_i686_gnu"
801
+ version = "0.36.1"
802
+ source = "registry+https://github.com/rust-lang/crates.io-index"
803
+ checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
804
+
805
+ [[package]]
806
+ name = "windows_i686_gnu"
807
+ version = "0.48.0"
808
+ source = "registry+https://github.com/rust-lang/crates.io-index"
809
+ checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
810
+
811
+ [[package]]
812
+ name = "windows_i686_gnu"
813
+ version = "0.52.0"
814
+ source = "registry+https://github.com/rust-lang/crates.io-index"
815
+ checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
816
+
817
+ [[package]]
818
+ name = "windows_i686_msvc"
819
+ version = "0.36.1"
820
+ source = "registry+https://github.com/rust-lang/crates.io-index"
821
+ checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
822
+
823
+ [[package]]
824
+ name = "windows_i686_msvc"
825
+ version = "0.48.0"
826
+ source = "registry+https://github.com/rust-lang/crates.io-index"
827
+ checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
828
+
829
+ [[package]]
830
+ name = "windows_i686_msvc"
831
+ version = "0.52.0"
832
+ source = "registry+https://github.com/rust-lang/crates.io-index"
833
+ checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
834
+
835
+ [[package]]
836
+ name = "windows_x86_64_gnu"
837
+ version = "0.36.1"
838
+ source = "registry+https://github.com/rust-lang/crates.io-index"
839
+ checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
840
+
841
+ [[package]]
842
+ name = "windows_x86_64_gnu"
843
+ version = "0.48.0"
844
+ source = "registry+https://github.com/rust-lang/crates.io-index"
845
+ checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
846
+
847
+ [[package]]
848
+ name = "windows_x86_64_gnu"
849
+ version = "0.52.0"
850
+ source = "registry+https://github.com/rust-lang/crates.io-index"
851
+ checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
852
+
853
+ [[package]]
854
+ name = "windows_x86_64_gnullvm"
855
+ version = "0.48.0"
856
+ source = "registry+https://github.com/rust-lang/crates.io-index"
857
+ checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
858
+
859
+ [[package]]
860
+ name = "windows_x86_64_gnullvm"
861
+ version = "0.52.0"
862
+ source = "registry+https://github.com/rust-lang/crates.io-index"
863
+ checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
864
+
865
+ [[package]]
866
+ name = "windows_x86_64_msvc"
867
+ version = "0.36.1"
868
+ source = "registry+https://github.com/rust-lang/crates.io-index"
869
+ checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
870
+
871
+ [[package]]
872
+ name = "windows_x86_64_msvc"
873
+ version = "0.48.0"
874
+ source = "registry+https://github.com/rust-lang/crates.io-index"
875
+ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
876
+
877
+ [[package]]
878
+ name = "windows_x86_64_msvc"
879
+ version = "0.52.0"
880
+ source = "registry+https://github.com/rust-lang/crates.io-index"
881
+ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
882
+
883
+ [[package]]
884
+ name = "zerocopy"
885
+ version = "0.7.31"
886
+ source = "registry+https://github.com/rust-lang/crates.io-index"
887
+ checksum = "1c4061bedbb353041c12f413700357bec76df2c7e2ca8e4df8bac24c6bf68e3d"
888
+ dependencies = [
889
+ "zerocopy-derive",
890
+ ]
891
+
892
+ [[package]]
893
+ name = "zerocopy-derive"
894
+ version = "0.7.31"
895
+ source = "registry+https://github.com/rust-lang/crates.io-index"
896
+ checksum = "b3c129550b3e6de3fd0ba67ba5c81818f9805e58b8d7fee80a3a59d2c9fc601a"
897
+ dependencies = [
898
+ "proc-macro2",
899
+ "quote",
900
+ "syn 2.0.41",
901
+ ]
902
+ EOF
903
+
904
+ # ---------------------------------------------------------------------------
905
+ # Prefetch all cargo dependencies into the shared cargo registry cache using
906
+ # the generated manifest + pinned lock. Runs from GEN_DIR (never repo root).
907
+ # ---------------------------------------------------------------------------
908
+ export CARGO_BUILD_JOBS=4
909
+ cd "$GEN_DIR"
910
+ cargo fetch --manifest-path "$GEN_DIR/Cargo.toml" --locked
zingerlittlebee--netop.90b92f0/tests/executable ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:acfc3335a8c76b465ee2ab1b72dbe5edf88bf7769bafd96366a8a8de9047ed48
3
+ size 1918848
zingerlittlebee--netop.90b92f0/tests/harbor_prepare_download_env.sh ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ command -v cargo
4
+ command -v rustc
5
+ command -v rustup
6
+ cd /workspace
7
+ set -a
8
+ source /tmp/programgym-download.sh
9
+ set +a
10
+ python3 - <<'PY' > /etc/profile.d/programgym_download_env.sh
11
+ import os
12
+ import shlex
13
+
14
+ ignored = {
15
+ "ALL_PROXY",
16
+ "HTTP_PROXY",
17
+ "HTTPS_PROXY",
18
+ "NO_PROXY",
19
+ "OLDPWD",
20
+ "PIP_PROXY",
21
+ "PWD",
22
+ "SHLVL",
23
+ "_",
24
+ "all_proxy",
25
+ "http_proxy",
26
+ "https_proxy",
27
+ "no_proxy",
28
+ "pip_proxy",
29
+ }
30
+ for key in sorted(os.environ):
31
+ if key in ignored or key.startswith("BASH_FUNC_"):
32
+ continue
33
+ value = os.environ[key]
34
+ if "\n" in value:
35
+ continue
36
+ print(f"export {key}={shlex.quote(value)}")
37
+ PY
zingerlittlebee--netop.90b92f0/tests/programgym_evaluator.py ADDED
@@ -0,0 +1,1201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """In-place ProgramGym evaluator.
3
+
4
+ Mirrors ProgramGym's ``Evaluator`` pipeline as closely as a single-container,
5
+ no-Docker-in-Docker host allows. Run from ``tests/test.sh`` inside the agent's
6
+ cleanroom container after Harbor flips the verifier-phase network policy.
7
+
8
+ Differences from ``programgym.eval.eval.Evaluator`` that are structural to
9
+ running in one container:
10
+
11
+ * No fresh container per branch. ``snapshot_workspace`` / ``restore_workspace``
12
+ copy a post-compile workspace snapshot to a temp directory and restore it
13
+ before each branch; ``cleanup_lingering_processes`` kills leftover branch
14
+ processes between attempts to approximate the fresh-container boundary.
15
+ * No ``docker commit``. The post-compile workspace snapshot serves the same
16
+ role as the committed image upstream.
17
+ * Hidden test blobs are fetched on demand from HuggingFace via
18
+ ``huggingface_hub.snapshot_download`` (matching ``programgym.utils.blob_store``)
19
+ rather than being pre-staged into ``/tests/blobs/``. Override with
20
+ ``PROGRAMGYM_BLOB_DIR`` for offline reruns.
21
+
22
+ Everything else (eval_clean_hashes scrub, deterministic synthetic git seed,
23
+ ``compile.sh`` then stash + hash the executable, best-effort
24
+ ``pytest-rerunfailures``, per-branch test-tar overlay, executable hash
25
+ ``--max-worker-restart=4``, xdist worker-crash retry with serial fallback,
26
+ best-of-N attempt selection, active vs ignored test bookkeeping, scoring) is
27
+ preserved.
28
+ """
29
+
30
+ from __future__ import annotations
31
+
32
+ import hashlib
33
+ import json
34
+ import os
35
+ import re
36
+ import shlex
37
+ import shutil
38
+ import signal
39
+ import subprocess
40
+ import tempfile
41
+ import time
42
+ import traceback
43
+ import xml.etree.ElementTree as ET
44
+ from pathlib import Path
45
+ from typing import Any
46
+
47
+ WORKSPACE = Path(os.environ.get("PROGRAMGYM_WORKSPACE", "/workspace"))
48
+ STASHED_EXECUTABLE = Path("/opt/programgym-stashed-executable-do-not-modify")
49
+ METADATA_PATH = Path(
50
+ os.environ.get("PROGRAMGYM_METADATA", "/tests/programgym_task.json")
51
+ )
52
+ LOG_DIR = Path(os.environ.get("PROGRAMGYM_LOG_DIR", "/logs/verifier"))
53
+ WORKER_CRASH_PHRASE = "worker '"
54
+ XDIST_COLLAPSE_MARKERS = (
55
+ "maximum crashed workers reached",
56
+ "xdist: maximum crashed",
57
+ )
58
+
59
+ DEFAULT_HF_REPO_ID = "programgym/ProgramGym-Tests"
60
+ DEFAULT_HF_REVISION = "main"
61
+
62
+ # Oracle agent handoff files (see solution/solve.sh). Must not appear in the
63
+ # post-compile workspace snapshot or they pollute tree-scanning tests (dutree).
64
+ _ORACLE_HANDOFF_NAMES = (".programgym_oracle_reference",)
65
+
66
+ _TOOLCHAIN_BIN_DIR_CANDIDATES = (
67
+ "/usr/local/go/bin",
68
+ "/go/bin",
69
+ "/usr/local/cargo/bin",
70
+ "/root/.cargo/bin",
71
+ "/root/.ghcup/bin",
72
+ )
73
+
74
+
75
+ def toolchain_bin_dirs() -> list[str]:
76
+ """Return toolchain bin directories that exist on this image."""
77
+ candidates = list(_TOOLCHAIN_BIN_DIR_CANDIDATES)
78
+ candidates.extend(
79
+ str(path)
80
+ for path in sorted(Path("/usr/lib").glob("go-*/bin"))
81
+ if _is_accessible_dir(path)
82
+ )
83
+ seen: set[str] = set()
84
+ present: list[str] = []
85
+ for path in candidates:
86
+ if path in seen:
87
+ continue
88
+ seen.add(path)
89
+ if _is_accessible_dir(path):
90
+ present.append(path)
91
+ return present
92
+
93
+
94
+ def _is_accessible_dir(path: str | Path) -> bool:
95
+ """Return whether path is a directory without failing on protected homes."""
96
+ try:
97
+ return Path(path).is_dir()
98
+ except OSError:
99
+ return False
100
+
101
+
102
+ def bootstrap_toolchain_path() -> str:
103
+ """Prepend discovered toolchain dirs to PATH (idempotent)."""
104
+ prepend = toolchain_bin_dirs()
105
+ current_parts = [part for part in os.environ.get("PATH", "").split(":") if part]
106
+ merged: list[str] = []
107
+ for path in prepend + current_parts:
108
+ if path not in merged:
109
+ merged.append(path)
110
+ new_path = ":".join(merged)
111
+ os.environ["PATH"] = new_path
112
+ return new_path
113
+
114
+
115
+ def _bash_login_command(command: str) -> str:
116
+ """Run ``command`` under bash -lc with an explicit PATH export."""
117
+ path = bootstrap_toolchain_path()
118
+ return f"export PATH={shlex.quote(path)}; {command}"
119
+
120
+
121
+ def sha256(path: Path) -> str:
122
+ h = hashlib.sha256()
123
+ with path.open("rb") as f:
124
+ for chunk in iter(lambda: f.read(1024 * 1024), b""):
125
+ h.update(chunk)
126
+ return h.hexdigest()
127
+
128
+
129
+ def write_json(path: Path, data: dict[str, Any]) -> None:
130
+ tmp = path.with_suffix(path.suffix + ".tmp")
131
+ tmp.write_text(json.dumps(data, indent=2, sort_keys=True))
132
+ tmp.replace(path)
133
+
134
+
135
+ def _read_log_tail(path: Path | None, max_bytes: int = 65536) -> str:
136
+ if path is None or not path.exists():
137
+ return ""
138
+ data = path.read_bytes()
139
+ if len(data) <= max_bytes:
140
+ return data.decode(errors="replace")
141
+ return data[-max_bytes:].decode(errors="replace")
142
+
143
+
144
+ def _close_pipes(proc: subprocess.Popen[Any]) -> None:
145
+ for stream in (proc.stdout, proc.stderr):
146
+ if stream is not None:
147
+ try:
148
+ stream.close()
149
+ except OSError:
150
+ pass
151
+
152
+
153
+ def _terminate_process_tree(proc: subprocess.Popen[Any]) -> None:
154
+ try:
155
+ os.killpg(proc.pid, signal.SIGKILL)
156
+ except ProcessLookupError:
157
+ pass
158
+ try:
159
+ proc.kill()
160
+ except ProcessLookupError:
161
+ pass
162
+
163
+
164
+ _PKILL_PATTERNS = (
165
+ f"{WORKSPACE}/eval/",
166
+ f"{WORKSPACE}/tests/",
167
+ "tail -f",
168
+ "development.log",
169
+ " less ",
170
+ " less$",
171
+ "/less ",
172
+ )
173
+
174
+
175
+ def _pkill_aggressive() -> str:
176
+ """Best-effort kill of branch pytest/subprocess trees (Modal gVisor fallback)."""
177
+ notes: list[str] = []
178
+ workspace = str(WORKSPACE)
179
+ patterns = list(_PKILL_PATTERNS) + [
180
+ f"pytest.*{workspace}",
181
+ f"xdist.*{workspace}",
182
+ ]
183
+ for pattern in patterns:
184
+ result = subprocess.run(
185
+ ["pkill", "-9", "-f", pattern],
186
+ capture_output=True,
187
+ text=True,
188
+ )
189
+ notes.append(f"pkill -9 -f {pattern!r}: rc={result.returncode}")
190
+ return "\n".join(notes)
191
+
192
+
193
+ def run_step(
194
+ command: str,
195
+ cwd: Path,
196
+ *,
197
+ timeout: int,
198
+ env: dict[str, str] | None = None,
199
+ step: str,
200
+ accept_failure: bool = False,
201
+ log_output: bool | None = None,
202
+ max_output_bytes: int = 65536,
203
+ ) -> dict[str, Any]:
204
+ if log_output is None:
205
+ log_output = step == "run_tests" or timeout >= 60
206
+
207
+ started = time.monotonic()
208
+ stdout_path: Path | None = None
209
+ stderr_path: Path | None = None
210
+ stdout_f = None
211
+ stderr_f = None
212
+
213
+ if log_output:
214
+ LOG_DIR.mkdir(parents=True, exist_ok=True)
215
+ log_id = f"{step}-{int(started * 1000)}"
216
+ stdout_path = LOG_DIR / f"run-step-{log_id}.stdout.log"
217
+ stderr_path = LOG_DIR / f"run-step-{log_id}.stderr.log"
218
+ stdout_f = stdout_path.open("w", encoding="utf-8")
219
+ stderr_f = stderr_path.open("w", encoding="utf-8")
220
+ popen_stdout: Any = stdout_f
221
+ popen_stderr: Any = stderr_f
222
+ else:
223
+ popen_stdout = subprocess.PIPE
224
+ popen_stderr = subprocess.PIPE
225
+
226
+ proc = subprocess.Popen(
227
+ ["bash", "-lc", _bash_login_command(command)],
228
+ cwd=cwd,
229
+ env={**os.environ, **(env or {})},
230
+ stdout=popen_stdout,
231
+ stderr=popen_stderr,
232
+ start_new_session=True,
233
+ text=True,
234
+ )
235
+ timed_out = False
236
+ stdout = ""
237
+ stderr = ""
238
+ try:
239
+ if log_output:
240
+ proc.wait(timeout=timeout)
241
+ else:
242
+ stdout, stderr = proc.communicate(timeout=timeout)
243
+ except subprocess.TimeoutExpired:
244
+ timed_out = True
245
+ _terminate_process_tree(proc)
246
+ cleanup_lingering_processes(aggressive=True)
247
+ try:
248
+ proc.wait(timeout=5)
249
+ except subprocess.TimeoutExpired:
250
+ proc.kill()
251
+ if not log_output:
252
+ _close_pipes(proc)
253
+ finally:
254
+ if stdout_f is not None:
255
+ stdout_f.close()
256
+ if stderr_f is not None:
257
+ stderr_f.close()
258
+
259
+ if timed_out:
260
+ if log_output:
261
+ output = _read_log_tail(stdout_path, max_output_bytes) + _read_log_tail(
262
+ stderr_path, max_output_bytes
263
+ )
264
+ else:
265
+ output = ""
266
+ entry = {
267
+ "step": step,
268
+ "command": command,
269
+ "wall_time": time.monotonic() - started,
270
+ "output": output,
271
+ "returncode": 124,
272
+ "exception_info": f"timed out after {timeout}s",
273
+ }
274
+ else:
275
+ if log_output:
276
+ output = _read_log_tail(stdout_path, max_output_bytes) + _read_log_tail(
277
+ stderr_path, max_output_bytes
278
+ )
279
+ else:
280
+ output = stdout + stderr
281
+ entry = {
282
+ "step": step,
283
+ "command": command,
284
+ "wall_time": time.monotonic() - started,
285
+ "output": output,
286
+ "returncode": proc.returncode,
287
+ "exception_info": "",
288
+ }
289
+ if entry["returncode"] and not accept_failure:
290
+ raise RuntimeError(
291
+ f"{step} failed: {entry['exception_info'] or entry['output']}"
292
+ )
293
+ return entry
294
+
295
+
296
+ def cleanup_lingering_processes(*, aggressive: bool = False) -> dict[str, Any]:
297
+ started = time.monotonic()
298
+ patterns = [
299
+ str(WORKSPACE / "executable"),
300
+ f"{WORKSPACE}/eval/",
301
+ f"{WORKSPACE}/tests/",
302
+ # lazygit --logs/-l tests spawn `tail -f` outside /workspace/.
303
+ "tail -f",
304
+ "development.log",
305
+ ]
306
+ killed: list[int] = []
307
+ proc_root = Path("/proc")
308
+ proc_available = proc_root.exists()
309
+ if proc_available:
310
+ for proc_dir in proc_root.iterdir():
311
+ if not proc_dir.name.isdigit():
312
+ continue
313
+ pid = int(proc_dir.name)
314
+ if pid in {os.getpid(), os.getppid()}:
315
+ continue
316
+ try:
317
+ raw = (proc_dir / "cmdline").read_bytes()
318
+ except (FileNotFoundError, PermissionError, ProcessLookupError):
319
+ continue
320
+ cmdline = raw.replace(b"\0", b" ").decode(errors="replace")
321
+ if not any(pattern in cmdline for pattern in patterns):
322
+ continue
323
+ try:
324
+ os.kill(pid, signal.SIGKILL)
325
+ except (PermissionError, ProcessLookupError):
326
+ continue
327
+ killed.append(pid)
328
+ pkill_output = ""
329
+ if aggressive or not proc_available:
330
+ pkill_output = _pkill_aggressive()
331
+ output_parts = []
332
+ if killed:
333
+ output_parts.append("\n".join(str(pid) for pid in killed))
334
+ if pkill_output:
335
+ output_parts.append(pkill_output)
336
+ return {
337
+ "step": "cleanup_lingering_processes",
338
+ "command": "kill leftover branch processes referencing the workspace",
339
+ "wall_time": time.monotonic() - started,
340
+ "output": "\n".join(output_parts),
341
+ "returncode": 0,
342
+ "exception_info": "",
343
+ }
344
+
345
+
346
+ def extract_trusted_blob(tar_path: Path, dest: Path) -> None:
347
+ import tarfile
348
+
349
+ with tarfile.open(tar_path, "r:gz") as tf:
350
+ try:
351
+ tf.extractall(dest, filter="fully_trusted")
352
+ except TypeError:
353
+ tf.extractall(dest)
354
+
355
+
356
+ def find_results_xml() -> Path | None:
357
+ """Return the junit xml path if pytest wrote one."""
358
+ for candidate in (WORKSPACE / "eval" / "results.xml", WORKSPACE / "results.xml"):
359
+ if candidate.exists():
360
+ return candidate
361
+ return None
362
+
363
+
364
+ def remove_oracle_handoff_artifacts() -> list[str]:
365
+ """Drop oracle-agent handoff files from /workspace before snapshot/restore."""
366
+ removed: list[str] = []
367
+ for name in _ORACLE_HANDOFF_NAMES:
368
+ path = WORKSPACE / name
369
+ if path.exists():
370
+ if path.is_dir():
371
+ shutil.rmtree(path)
372
+ else:
373
+ path.unlink()
374
+ removed.append(name)
375
+ return removed
376
+
377
+
378
+ def _remove_tree(path: Path) -> None:
379
+ """Remove a file or directory tree, with a shell fallback for overlay races."""
380
+ if path.is_symlink() or path.is_file():
381
+ path.unlink(missing_ok=True)
382
+ return
383
+ if not path.is_dir():
384
+ path.unlink(missing_ok=True)
385
+ return
386
+ for attempt in range(3):
387
+ try:
388
+ shutil.rmtree(path)
389
+ if not path.exists():
390
+ return
391
+ except OSError:
392
+ if attempt == 2:
393
+ run_step(
394
+ f"rm -rf {shlex.quote(str(path))}",
395
+ path.parent,
396
+ timeout=120,
397
+ step="clear_workspace_fallback",
398
+ accept_failure=True,
399
+ )
400
+ if not path.exists():
401
+ return
402
+ raise
403
+
404
+
405
+ def ensure_workspace_dir() -> None:
406
+ """Guarantee WORKSPACE exists as a writable directory (not a symlink/file)."""
407
+ if WORKSPACE.exists() and not WORKSPACE.is_dir():
408
+ if WORKSPACE.is_symlink() or WORKSPACE.is_file():
409
+ WORKSPACE.unlink()
410
+ else:
411
+ shutil.rmtree(WORKSPACE)
412
+ WORKSPACE.mkdir(parents=True, exist_ok=True)
413
+
414
+
415
+ def clear_workspace() -> None:
416
+ ensure_workspace_dir()
417
+ for path in list(WORKSPACE.iterdir()):
418
+ _remove_tree(path)
419
+
420
+
421
+ def restore_reference_executable() -> None:
422
+ """Write the stashed reference binary into /workspace after a branch overlay.
423
+
424
+ Branch blobs may ship ``executable`` as a dangling symlink into
425
+ ``target/release/...``; ``shutil.copy2`` would follow it and raise
426
+ ``FileNotFoundError``. Drop whatever the blob left and copy the stashed
427
+ reference as a regular file.
428
+ """
429
+ ensure_workspace_dir()
430
+ if not STASHED_EXECUTABLE.is_file():
431
+ raise FileNotFoundError(
432
+ f"missing stashed reference executable at {STASHED_EXECUTABLE}"
433
+ )
434
+ dest = WORKSPACE / "executable"
435
+ if dest.exists() or dest.is_symlink():
436
+ if dest.is_dir():
437
+ shutil.rmtree(dest)
438
+ else:
439
+ dest.unlink(missing_ok=True)
440
+ shutil.copy2(STASHED_EXECUTABLE, dest)
441
+ dest.chmod(0o755)
442
+
443
+
444
+ def snapshot_workspace(dest: Path) -> None:
445
+ if dest.exists():
446
+ shutil.rmtree(dest)
447
+ shutil.copytree(WORKSPACE, dest, symlinks=True)
448
+
449
+
450
+ def restore_workspace(source: Path) -> None:
451
+ clear_workspace()
452
+ shutil.copytree(source, WORKSPACE, dirs_exist_ok=True, symlinks=True)
453
+ ensure_workspace_dir()
454
+
455
+
456
+ def remove_hashed_files(root: Path, hashes: set[str]) -> list[str]:
457
+ removed: list[str] = []
458
+ for path in root.rglob("*"):
459
+ if path.is_file() and not path.is_symlink():
460
+ try:
461
+ if sha256(path) in hashes:
462
+ path.unlink()
463
+ removed.append(str(path.relative_to(root)))
464
+ except OSError:
465
+ continue
466
+ return removed
467
+
468
+
469
+ def branch_tests(branch_info: dict[str, Any]) -> list[str]:
470
+ ignored = {
471
+ item["name"] for item in branch_info.get("ignored_tests", []) if "name" in item
472
+ }
473
+ return [name for name in branch_info.get("tests", []) if name not in ignored]
474
+
475
+
476
+ def ignored_tests(metadata: dict[str, Any]) -> set[str]:
477
+ result: set[str] = set()
478
+ for branch, info in metadata.get("branches", {}).items():
479
+ result.update(
480
+ f"{branch}/{item['name']}"
481
+ for item in info.get("ignored_tests", [])
482
+ if "name" in item
483
+ )
484
+ return result
485
+
486
+
487
+ def active_tests(metadata: dict[str, Any]) -> set[str]:
488
+ active: set[str] = set()
489
+ for branch, info in metadata.get("branches", {}).items():
490
+ if info.get("ignored"):
491
+ continue
492
+ ignored = {
493
+ item["name"] for item in info.get("ignored_tests", []) if "name" in item
494
+ }
495
+ active.update(
496
+ f"{branch}/{name}" for name in info.get("tests", []) if name not in ignored
497
+ )
498
+ return active
499
+
500
+
501
+ def inject_not_run(
502
+ result: dict[str, Any], branch: str, tests: list[str], error_code: str
503
+ ) -> None:
504
+ result["test_results"].extend(
505
+ {
506
+ "name": name,
507
+ "branch": branch,
508
+ "status": "not_run",
509
+ "extra": {"error_code": error_code},
510
+ }
511
+ for name in tests
512
+ )
513
+
514
+
515
+ def testcase_name(case: ET.Element) -> str:
516
+ classname = case.attrib.get("classname", "")
517
+ name = case.attrib.get("name", "")
518
+ return f"{classname}.{name}" if classname else name
519
+
520
+
521
+ # Only these tags under <testcase> represent a result. <system-out> /
522
+ # <system-err> are stdout/stderr captures and must not be treated as results
523
+ # (a leading <system-out> followed by <failure> would otherwise be classified
524
+ # as a stdout-only "passed").
525
+ JUNIT_RESULT_TAGS = {"skipped", "failure", "error"}
526
+
527
+
528
+ def parse_junit(
529
+ raw_xml: str, branch: str, expected: list[str], ignored: set[str]
530
+ ) -> tuple[list[dict[str, Any]], list[str]]:
531
+ root = ET.fromstring(raw_xml)
532
+ got: set[str] = set()
533
+ results: list[dict[str, Any]] = []
534
+ for case in root.iter("testcase"):
535
+ name = testcase_name(case)
536
+ got.add(name)
537
+ extra: dict[str, Any] = {}
538
+ if "time" in case.attrib:
539
+ try:
540
+ extra["time"] = float(case.attrib["time"])
541
+ except ValueError:
542
+ extra["time"] = case.attrib["time"]
543
+ result_children = [c for c in case if c.tag in JUNIT_RESULT_TAGS]
544
+ # Collapse duplicate same-tag result children. Pytest's
545
+ # "pytest.internal" pseudo-test sometimes emits two identical <error>
546
+ # entries; treating that as a system_error would over-flag a real
547
+ # single failure. Mirrors upstream eval.py:816-820.
548
+ if len(result_children) > 1 and len({c.tag for c in result_children}) == 1:
549
+ result_children = [result_children[0]]
550
+ if not result_children:
551
+ status = "passed"
552
+ elif len(result_children) != 1:
553
+ status = "system_error"
554
+ extra["error_details"] = (
555
+ f"Expected 1 result for {name}, got {len(result_children)}: "
556
+ f"{[c.tag for c in result_children]}"
557
+ )
558
+ else:
559
+ first = result_children[0]
560
+ status = first.tag # "skipped" | "failure" | "error"
561
+ extra["message"] = first.attrib.get("message") or ""
562
+ if first.text:
563
+ extra["text"] = first.text
564
+ results.append(
565
+ {"name": name, "branch": branch, "status": status, "extra": extra}
566
+ )
567
+
568
+ active_expected = [name for name in expected if name not in ignored]
569
+ missing = [name for name in active_expected if name not in got]
570
+ results.extend(
571
+ {
572
+ "name": name,
573
+ "branch": branch,
574
+ "status": "not_run",
575
+ "extra": {"error_code": "missing_from_junit_xml"},
576
+ }
577
+ for name in missing
578
+ )
579
+ unexpected = got - set(expected) - ignored
580
+ warnings = (
581
+ [f"Branch {branch}: {len(unexpected)} test(s) in JUnit XML not in tests.json"]
582
+ if unexpected
583
+ else []
584
+ )
585
+ return results, warnings
586
+
587
+
588
+ def count_worker_crashes(raw_xml: str) -> int:
589
+ if WORKER_CRASH_PHRASE not in raw_xml:
590
+ return 0
591
+ try:
592
+ root = ET.fromstring(raw_xml)
593
+ except ET.ParseError:
594
+ return 0
595
+ crashes = 0
596
+ for case in root.iter("testcase"):
597
+ for child in case:
598
+ text = (child.get("message") or "") + " " + (child.text or "")
599
+ if (
600
+ child.tag in {"error", "failure"}
601
+ and WORKER_CRASH_PHRASE in text
602
+ and "crashed" in text
603
+ ):
604
+ crashes += 1
605
+ break
606
+ return crashes
607
+
608
+
609
+ def run_output_indicates_xdist_collapse(output: str) -> bool:
610
+ lower = output.lower()
611
+ return any(marker in lower for marker in XDIST_COLLAPSE_MARKERS)
612
+
613
+
614
+ def count_junit_failures(raw_xml: str) -> int:
615
+ try:
616
+ root = ET.fromstring(raw_xml)
617
+ except ET.ParseError:
618
+ return 0
619
+ failures = 0
620
+ for case in root.iter("testcase"):
621
+ for child in case:
622
+ if child.tag in {"failure", "error"}:
623
+ failures += 1
624
+ break
625
+ return failures
626
+
627
+
628
+ def count_junit_passed(raw_xml: str) -> int:
629
+ try:
630
+ root = ET.fromstring(raw_xml)
631
+ except ET.ParseError:
632
+ return 0
633
+ passed = 0
634
+ for case in root.iter("testcase"):
635
+ if not any(child.tag in JUNIT_RESULT_TAGS for child in case):
636
+ passed += 1
637
+ return passed
638
+
639
+
640
+ def branch_attempt_metrics(
641
+ raw_xml: str, *, run_output: str, expected_tests: int
642
+ ) -> tuple[int, int, int, int]:
643
+ """Return (crashes, n_testcases, failures, missing_from_xml)."""
644
+ crashes = count_worker_crashes(raw_xml)
645
+ if run_output_indicates_xdist_collapse(run_output):
646
+ crashes = max(crashes, 1)
647
+ n_tests = count_testcases(raw_xml)
648
+ failures = count_junit_failures(raw_xml)
649
+ missing = max(0, expected_tests - n_tests)
650
+ return crashes, n_tests, failures, missing
651
+
652
+
653
+ def needs_serial_retry(
654
+ *,
655
+ serial: bool,
656
+ crashes: int,
657
+ missing: int,
658
+ failures: int,
659
+ n_tests: int,
660
+ expected_tests: int,
661
+ run_output: str,
662
+ ) -> bool:
663
+ if serial:
664
+ return False
665
+ high_failure_rate = (
666
+ expected_tests > 0 and n_tests >= expected_tests and failures / n_tests >= 0.8
667
+ )
668
+ return (
669
+ crashes > 0
670
+ or missing > 0
671
+ or high_failure_rate
672
+ or run_output_indicates_xdist_collapse(run_output)
673
+ )
674
+
675
+
676
+ def count_testcases(raw_xml: str) -> int:
677
+ try:
678
+ return sum(1 for _ in ET.fromstring(raw_xml).iter("testcase"))
679
+ except ET.ParseError:
680
+ return 0
681
+
682
+
683
+ def scored_results(
684
+ result: dict[str, Any], metadata: dict[str, Any]
685
+ ) -> list[dict[str, Any]]:
686
+ active = active_tests(metadata)
687
+ by_key = {
688
+ f"{test['branch']}/{test['name']}": test
689
+ for test in result["test_results"]
690
+ if f"{test['branch']}/{test['name']}" in active
691
+ }
692
+ return [
693
+ by_key.get(
694
+ key,
695
+ {
696
+ "branch": key.split("/", 1)[0],
697
+ "name": key.split("/", 1)[1],
698
+ "status": "not_run",
699
+ "extra": {"error_code": "missing_from_results"},
700
+ },
701
+ )
702
+ for key in sorted(active)
703
+ ]
704
+
705
+
706
+ def summarize(result: dict[str, Any], metadata: dict[str, Any]) -> dict[str, Any]:
707
+ scored = scored_results(result, metadata)
708
+ n_passed = sum(t["status"] == "passed" for t in scored)
709
+ n_tests = len(scored)
710
+ pass_rate = n_passed / n_tests if n_tests else 0.0
711
+ # Multi-key reward: Harbor's default Mean aggregates each key independently
712
+ # (see harbor.metrics.base.aggregate_reward_dicts), so mean("resolved") is
713
+ # the proportion of tasks scoring a perfect pass-rate and mean of
714
+ # "almost_resolved" is the proportion scoring >= 0.95. "reward" stays the
715
+ # per-task pass-rate whose mean is the overall mean reward.
716
+ return {
717
+ "reward": pass_rate,
718
+ "resolved": 1.0 if pass_rate >= 1.0 else 0.0,
719
+ "almost_resolved": 1.0 if pass_rate >= 0.95 else 0.0,
720
+ }
721
+
722
+
723
+ def diagnostics(result: dict[str, Any], metadata: dict[str, Any]) -> dict[str, Any]:
724
+ scored = scored_results(result, metadata)
725
+ n_passed = sum(t["status"] == "passed" for t in scored)
726
+ n_tests = len(scored)
727
+ pass_rate = n_passed / n_tests if n_tests else 0.0
728
+ return {
729
+ "pass_rate": pass_rate,
730
+ "resolved": int(
731
+ bool(
732
+ n_tests
733
+ and n_passed == n_tests
734
+ and not result["test_branch_errors"]
735
+ and not result["error_code"]
736
+ )
737
+ ),
738
+ "n_passed": n_passed,
739
+ "n_tests": n_tests,
740
+ "n_branch_errors": len(result["test_branch_errors"]),
741
+ "infra_error": int(bool(result["error_code"] or result["test_branch_errors"])),
742
+ "executable_hash_present": int(bool(result.get("executable_hash"))),
743
+ }
744
+
745
+
746
+ def use_script_pty() -> bool:
747
+ return os.environ.get("PROGRAMGYM_SCRIPT_PTY", "").strip() == "1"
748
+
749
+
750
+ def script_pty_available() -> bool:
751
+ return shutil.which("script") is not None
752
+
753
+
754
+ def branch_env(
755
+ *,
756
+ serial: bool,
757
+ has_rerunfailures: bool,
758
+ extras: dict[str, str] | None = None,
759
+ ) -> dict[str, str]:
760
+ addopts = ["--max-worker-restart=4"]
761
+ # A serial fallback is already a complete second execution. Re-running each
762
+ # failing test two more times makes large, failure-heavy suites prohibitively
763
+ # slow and adds little signal.
764
+ if has_rerunfailures and not serial:
765
+ addopts.extend(["--reruns=2", "--reruns-delay=1"])
766
+ env = {
767
+ "PYTEST_ADDOPTS": " ".join(addopts),
768
+ # Match upstream non-TTY regression environments (dirble log format, etc.).
769
+ "NO_COLOR": "1",
770
+ "TERM": "dumb",
771
+ "CLICOLOR": "0",
772
+ "CLICOLOR_FORCE": "0",
773
+ "COLORTERM": "",
774
+ }
775
+ if extras:
776
+ env.update(extras)
777
+ xdist_workers = os.environ.get("PROGRAMGYM_XDIST_WORKERS")
778
+ if serial:
779
+ xdist_workers = "1"
780
+ if xdist_workers:
781
+ env["PYTEST_XDIST_AUTO_NUM_WORKERS"] = xdist_workers
782
+ return env
783
+
784
+
785
+ _SERIAL_RUN_SH = ".programgym_run_serial.sh"
786
+ # ``eval/run.sh`` usually passes ``-n auto`` on the command line, which overrides
787
+ # ``PYTEST_ADDOPTS``. Rewrite to ``-n 0`` in a verifier-local copy for retries.
788
+ _RUN_SH_XDIST_RE = re.compile(r"-n\s*(?:auto|\d+)")
789
+
790
+
791
+ def prepare_serial_run_sh(run_sh: Path) -> Path:
792
+ """Write a serial-only copy of ``eval/run.sh`` with xdist disabled."""
793
+ serial_sh = run_sh.with_name(_SERIAL_RUN_SH)
794
+ patched = _RUN_SH_XDIST_RE.sub("-n 0", run_sh.read_text())
795
+ serial_sh.write_text(patched)
796
+ serial_sh.chmod(0o755)
797
+ return serial_sh
798
+
799
+
800
+ def run_tests_command(*, serial: bool) -> str:
801
+ if serial:
802
+ inner = f"chmod +x ./eval/{_SERIAL_RUN_SH} && ./eval/{_SERIAL_RUN_SH}"
803
+ else:
804
+ inner = "chmod +x ./eval/run.sh && ./eval/run.sh"
805
+ if use_script_pty() and script_pty_available():
806
+ return f"script -q -c {shlex.quote(inner)} /dev/null"
807
+ return inner
808
+
809
+
810
+ BAKED_BLOB_DIR = Path(os.environ.get("PROGRAMGYM_BAKED_BLOB_DIR", "/tests/blobs"))
811
+
812
+
813
+ def resolve_blob_dir(instance_id: str, metadata: dict[str, Any]) -> Path:
814
+ """Locate the per-instance blob directory.
815
+
816
+ Resolution order:
817
+
818
+ 1. ``/tests/blobs/`` if pre-fetched into the task at generation time
819
+ (``programgym-adapter --download-blobs``). Verifier-only mount, so
820
+ agent never sees these.
821
+ 2. ``PROGRAMGYM_BLOB_DIR`` env override pointing at an HF-cache-shaped
822
+ tree on disk (``<dir>/<instance_id>/tests/<branch>.tar.gz``). Useful
823
+ for offline reruns sharing a cache across many tasks.
824
+ 3. ``huggingface_hub.snapshot_download`` from
825
+ ``programgym/ProgramGym-Tests`` (default repo, ``main`` revision).
826
+
827
+ The returned directory contains ``tests/<branch>.tar.gz`` per active
828
+ branch — same shape as ``programgym/ProgramGym-Tests/<instance_id>/``
829
+ on HF.
830
+ """
831
+ if BAKED_BLOB_DIR.exists() and (BAKED_BLOB_DIR / "tests").exists():
832
+ return BAKED_BLOB_DIR
833
+
834
+ local = os.environ.get("PROGRAMGYM_BLOB_DIR", "").strip()
835
+ if local:
836
+ candidate = Path(local) / instance_id
837
+ if candidate.exists():
838
+ return candidate
839
+ raise FileNotFoundError(
840
+ f"PROGRAMGYM_BLOB_DIR set but {candidate} does not exist"
841
+ )
842
+
843
+ repo_id = os.environ.get("PROGRAMGYM_HF_REPO") or metadata.get(
844
+ "hf_repo_id", DEFAULT_HF_REPO_ID
845
+ )
846
+ revision = os.environ.get("PROGRAMGYM_HF_REVISION") or metadata.get(
847
+ "hf_revision", DEFAULT_HF_REVISION
848
+ )
849
+
850
+ from huggingface_hub import snapshot_download
851
+
852
+ cache_root = Path(
853
+ snapshot_download(
854
+ repo_id,
855
+ repo_type="dataset",
856
+ revision=revision,
857
+ allow_patterns=f"{instance_id}/**",
858
+ )
859
+ )
860
+ blob_dir = cache_root / instance_id
861
+ if not blob_dir.exists():
862
+ raise FileNotFoundError(
863
+ f"HF blob directory missing for {instance_id} at {blob_dir}"
864
+ )
865
+ return blob_dir
866
+
867
+
868
+ def evaluate(metadata: dict[str, Any]) -> dict[str, Any]:
869
+ bootstrap_toolchain_path()
870
+ branches = metadata.get("branches", {})
871
+ active_branch_items = [
872
+ (name, info) for name, info in branches.items() if not info.get("ignored")
873
+ ]
874
+ result: dict[str, Any] = {
875
+ "test_results": [],
876
+ "error_code": None,
877
+ "error_details": None,
878
+ "log": [],
879
+ "solution_branch": "submission",
880
+ "test_branches": [name for name, _ in active_branch_items],
881
+ "test_branch_errors": {},
882
+ "executable_hash": None,
883
+ "warnings": [],
884
+ }
885
+
886
+ instance_id = metadata["instance_id"]
887
+
888
+ compile_timeout = int(os.environ.get("PROGRAMGYM_COMPILE_TIMEOUT", "900"))
889
+ branch_timeout = int(os.environ.get("PROGRAMGYM_BRANCH_TIMEOUT", "3600"))
890
+
891
+ def fail_all(error_code: str, details: str) -> dict[str, Any]:
892
+ result["error_code"] = error_code
893
+ result["error_details"] = details
894
+ for branch, info in active_branch_items:
895
+ inject_not_run(result, branch, branch_tests(info), error_code)
896
+ return result
897
+
898
+ with tempfile.TemporaryDirectory(prefix="programgym-eval-") as tmp:
899
+ compiled_snapshot = Path(tmp) / "compiled"
900
+
901
+ started = time.monotonic()
902
+ removed = remove_hashed_files(
903
+ WORKSPACE, set(metadata.get("eval_clean_hashes", []))
904
+ )
905
+ result["log"].append(
906
+ {
907
+ "step": "remove_hashed_files",
908
+ "command": "remove files matching eval_clean_hashes",
909
+ "wall_time": time.monotonic() - started,
910
+ "output": "".join(f"removed '{path}'\n" for path in removed),
911
+ "returncode": 0,
912
+ "exception_info": "",
913
+ }
914
+ )
915
+
916
+ compile_sh = WORKSPACE / "compile.sh"
917
+ if not compile_sh.exists():
918
+ return fail_all(
919
+ "missing_compile_sh", "submission did not contain compile.sh"
920
+ )
921
+
922
+ seed = (
923
+ "if [ ! -d .git ]; then "
924
+ "GIT_AUTHOR_DATE='2000-01-01T00:00:00Z' "
925
+ "GIT_COMMITTER_DATE='2000-01-01T00:00:00Z' "
926
+ "git -c init.defaultBranch=gold init -q && "
927
+ "git -c user.email=gold@local -c user.name=gold -c commit.gpgsign=false add -A && "
928
+ "GIT_AUTHOR_DATE='2000-01-01T00:00:00Z' "
929
+ "GIT_COMMITTER_DATE='2000-01-01T00:00:00Z' "
930
+ "git -c user.email=gold@local -c user.name=gold -c commit.gpgsign=false commit -q --allow-empty -m gold; "
931
+ "fi"
932
+ )
933
+ try:
934
+ result["log"].append(
935
+ run_step(seed, WORKSPACE, timeout=300, step="seed_git")
936
+ )
937
+ compile_log = run_step(
938
+ "chmod +x ./compile.sh && ./compile.sh",
939
+ WORKSPACE,
940
+ timeout=compile_timeout,
941
+ step="compile",
942
+ accept_failure=True,
943
+ )
944
+ result["log"].append(compile_log)
945
+ if compile_log["returncode"]:
946
+ return fail_all("compile_failed", compile_log["output"])
947
+ executable = WORKSPACE / "executable"
948
+ if not executable.exists():
949
+ return fail_all(
950
+ "missing_executable",
951
+ "compile.sh completed but did not create ./executable",
952
+ )
953
+ STASHED_EXECUTABLE.parent.mkdir(parents=True, exist_ok=True)
954
+ # `move` (not copy) so /workspace doesn't keep a parallel copy of
955
+ # the agent's executable during the stash→restore window. Mirrors
956
+ # upstream `mv ./executable {STASHED}` (eval.py:472).
957
+ shutil.move(str(executable), STASHED_EXECUTABLE)
958
+ result["executable_hash"] = sha256(STASHED_EXECUTABLE)
959
+ result["log"].append(
960
+ run_step(
961
+ "pip3 install -q --disable-pip-version-check pytest-rerunfailures",
962
+ WORKSPACE,
963
+ timeout=120,
964
+ step="install_rerunfailures",
965
+ accept_failure=True,
966
+ )
967
+ )
968
+ has_rerunfailures = result["log"][-1]["returncode"] == 0
969
+ handoff_removed = remove_oracle_handoff_artifacts()
970
+ if handoff_removed:
971
+ result["log"].append(
972
+ {
973
+ "step": "remove_oracle_handoff",
974
+ "command": "remove oracle handoff artifacts from workspace",
975
+ "wall_time": 0.0,
976
+ "output": "".join(
977
+ f"removed '{name}'\n" for name in handoff_removed
978
+ ),
979
+ "returncode": 0,
980
+ "exception_info": "",
981
+ }
982
+ )
983
+ snapshot_workspace(compiled_snapshot)
984
+ except Exception as exc:
985
+ return fail_all(type(exc).__name__, str(exc))
986
+
987
+ try:
988
+ blob_dir = resolve_blob_dir(instance_id, metadata)
989
+ except Exception as exc:
990
+ details = f"{type(exc).__name__}: {exc}"
991
+ for branch, info in active_branch_items:
992
+ result["test_branch_errors"][branch] = [
993
+ {
994
+ "error_code": "blob_resolution_failed",
995
+ "error_details": details,
996
+ }
997
+ ]
998
+ inject_not_run(
999
+ result, branch, branch_tests(info), "blob_resolution_failed"
1000
+ )
1001
+ return result
1002
+
1003
+ for branch, info in active_branch_items:
1004
+ tests = branch_tests(info)
1005
+ blob = blob_dir / "tests" / f"{branch}.tar.gz"
1006
+ if not blob.exists():
1007
+ result["test_branch_errors"][branch] = [
1008
+ {"error_code": "missing_test_blob", "error_details": blob.name}
1009
+ ]
1010
+ inject_not_run(result, branch, tests, "missing_test_blob")
1011
+ continue
1012
+
1013
+ best_xml = ""
1014
+ # Prefer a complete, clean XML result, then the result covering the
1015
+ # most expected tests, and only then the one with the most passes.
1016
+ # Pass-count-only ranking can retain a partial xdist result over a
1017
+ # complete serial result.
1018
+ best_quality = (-1, -1, -1)
1019
+ serial = bool(metadata.get("force_serial_branches"))
1020
+ branch_log: list[dict[str, Any]] = []
1021
+ branch_ignored = {
1022
+ item["name"] for item in info.get("ignored_tests", []) if "name" in item
1023
+ }
1024
+ n_expected = len([name for name in tests if name not in branch_ignored])
1025
+
1026
+ def merge_best_xml(raw_xml: str) -> None:
1027
+ try:
1028
+ parsed, warnings = parse_junit(
1029
+ raw_xml, branch, list(info.get("tests", [])), branch_ignored
1030
+ )
1031
+ except Exception as exc:
1032
+ result["test_branch_errors"][branch] = [
1033
+ {"error_code": "xml_parse_error", "error_details": str(exc)}
1034
+ ]
1035
+ inject_not_run(result, branch, tests, "xml_parse_error")
1036
+ else:
1037
+ result["test_results"].extend(parsed)
1038
+ result["warnings"].extend(warnings)
1039
+
1040
+ while True:
1041
+ branch_log.append(cleanup_lingering_processes())
1042
+ restore_workspace(compiled_snapshot)
1043
+ extract_trusted_blob(blob, WORKSPACE)
1044
+ restore_reference_executable()
1045
+ actual_hash = sha256(WORKSPACE / "executable")
1046
+ if actual_hash != result["executable_hash"]:
1047
+ result["test_branch_errors"][branch] = [
1048
+ {
1049
+ "error_code": "executable_hash_mismatch",
1050
+ "error_details": (
1051
+ f"expected {result['executable_hash']}, got {actual_hash}"
1052
+ ),
1053
+ }
1054
+ ]
1055
+ inject_not_run(result, branch, tests, "executable_hash_mismatch")
1056
+ break
1057
+ run_sh = WORKSPACE / "eval" / "run.sh"
1058
+ if not run_sh.exists():
1059
+ result["test_branch_errors"][branch] = [
1060
+ {
1061
+ "error_code": "missing_run_sh",
1062
+ "error_details": "eval/run.sh missing",
1063
+ }
1064
+ ]
1065
+ inject_not_run(result, branch, tests, "missing_run_sh")
1066
+ break
1067
+ # Upstream rewrites thread→signal so xdist workers fail cleanly
1068
+ # instead of os._exit(1) on timeout. That works in fresh
1069
+ # containers per branch; here we reuse one container and
1070
+ # signal timeouts leave TUI/log-watcher subprocesses alive
1071
+ # (e.g. lazygit --logs + tail -f), wedging pytest for up to
1072
+ # branch_timeout. Keep the blob's thread method and rely on
1073
+ # cleanup_lingering_processes + serial fallback after crashes.
1074
+ env = branch_env(
1075
+ serial=serial,
1076
+ has_rerunfailures=has_rerunfailures,
1077
+ extras=metadata.get("branch_env"),
1078
+ )
1079
+ branch_log.append(
1080
+ run_step(
1081
+ "rm -f eval/results.xml results.xml",
1082
+ WORKSPACE,
1083
+ timeout=120,
1084
+ step="clean_stale_results",
1085
+ accept_failure=True,
1086
+ )
1087
+ )
1088
+ if serial:
1089
+ prepare_serial_run_sh(run_sh)
1090
+ run_entry = run_step(
1091
+ run_tests_command(serial=serial),
1092
+ WORKSPACE,
1093
+ timeout=branch_timeout,
1094
+ env=env,
1095
+ step="run_tests",
1096
+ accept_failure=True,
1097
+ )
1098
+ branch_log.append(run_entry)
1099
+ branch_log.append(cleanup_lingering_processes())
1100
+ xml_path = find_results_xml()
1101
+ if xml_path is None:
1102
+ if best_xml:
1103
+ merge_best_xml(best_xml)
1104
+ break
1105
+ if serial:
1106
+ result["test_branch_errors"][branch] = [
1107
+ {
1108
+ "error_code": "missing_results_xml",
1109
+ "error_details": "eval/results.xml was not produced",
1110
+ }
1111
+ ]
1112
+ inject_not_run(result, branch, tests, "missing_results_xml")
1113
+ break
1114
+ serial = True
1115
+ continue
1116
+ raw_xml = xml_path.read_text(errors="replace")
1117
+ crashes, n_tests, failures, missing = branch_attempt_metrics(
1118
+ raw_xml,
1119
+ run_output=run_entry.get("output", ""),
1120
+ expected_tests=n_expected,
1121
+ )
1122
+ useful = count_junit_passed(raw_xml)
1123
+ quality = (
1124
+ int(crashes == 0 and missing == 0),
1125
+ n_tests,
1126
+ useful,
1127
+ )
1128
+ if quality > best_quality:
1129
+ best_xml = raw_xml
1130
+ best_quality = quality
1131
+ retry = needs_serial_retry(
1132
+ serial=serial,
1133
+ crashes=crashes,
1134
+ missing=missing,
1135
+ failures=failures,
1136
+ n_tests=n_tests,
1137
+ expected_tests=n_expected,
1138
+ run_output=run_entry.get("output", ""),
1139
+ )
1140
+ if not retry:
1141
+ merge_best_xml(best_xml)
1142
+ break
1143
+ serial = True
1144
+ for entry in branch_log:
1145
+ entry["branch"] = branch
1146
+ result["log"].extend(branch_log)
1147
+
1148
+ return result
1149
+
1150
+
1151
+ def write_outputs(result: dict[str, Any], metadata: dict[str, Any]) -> None:
1152
+ LOG_DIR.mkdir(parents=True, exist_ok=True)
1153
+ write_json(LOG_DIR / "programgym_eval.json", result)
1154
+ write_json(LOG_DIR / "harbor_diagnostics.json", diagnostics(result, metadata))
1155
+ rewards = summarize(result, metadata)
1156
+ write_json(LOG_DIR / "reward.json", rewards)
1157
+ (LOG_DIR / "reward.txt").write_text(str(rewards["reward"]))
1158
+
1159
+
1160
+ def main() -> None:
1161
+ LOG_DIR.mkdir(parents=True, exist_ok=True)
1162
+ log_path = LOG_DIR / "programgym_eval.log"
1163
+ metadata = json.loads(METADATA_PATH.read_text())
1164
+ branches = metadata.get("branches", {})
1165
+ try:
1166
+ result = evaluate(metadata)
1167
+ except Exception as exc:
1168
+ error_code = type(exc).__name__
1169
+ result = {
1170
+ "test_results": [],
1171
+ "error_code": error_code,
1172
+ "error_details": str(exc),
1173
+ "log": [
1174
+ {
1175
+ "step": "evaluator_exception",
1176
+ "exception_info": traceback.format_exc(),
1177
+ "returncode": 1,
1178
+ }
1179
+ ],
1180
+ "solution_branch": "submission",
1181
+ "test_branches": [
1182
+ name for name, info in branches.items() if not info.get("ignored")
1183
+ ],
1184
+ "test_branch_errors": {
1185
+ "__evaluator__": [{"error_code": error_code, "error_details": str(exc)}]
1186
+ },
1187
+ "executable_hash": None,
1188
+ "warnings": [],
1189
+ }
1190
+ for branch, info in branches.items():
1191
+ if info.get("ignored"):
1192
+ continue
1193
+ inject_not_run(result, branch, branch_tests(info), error_code)
1194
+ log_path.write_text(traceback.format_exc())
1195
+ else:
1196
+ log_path.write_text("")
1197
+ write_outputs(result, metadata)
1198
+
1199
+
1200
+ if __name__ == "__main__":
1201
+ main()
zingerlittlebee--netop.90b92f0/tests/programgym_task.json ADDED
The diff for this file is too large to render. See raw diff
 
zingerlittlebee--netop.90b92f0/tests/test.sh ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # Verifier exec may not inherit image ENV (Modal/gVisor, login-shell resets).
5
+ export PATH="/usr/local/go/bin:/go/bin:/usr/local/cargo/bin:/root/.cargo/bin:${PATH}"
6
+
7
+ mkdir -p /logs/verifier /logs/artifacts
8
+
9
+ write_failure() {
10
+ local code="$1"
11
+ local details="$2"
12
+ python3 - "$code" "$details" <<'PY'
13
+ import json
14
+ import sys
15
+ from pathlib import Path
16
+
17
+ code, details = sys.argv[1:3]
18
+ try:
19
+ metadata = json.loads(Path("/tests/programgym_task.json").read_text())
20
+ n_tests = sum(
21
+ len([
22
+ name for name in info.get("tests", [])
23
+ if name not in {item.get("name") for item in info.get("ignored_tests", [])}
24
+ ])
25
+ for branch, info in metadata.get("branches", {}).items()
26
+ if not info.get("ignored")
27
+ )
28
+ except Exception:
29
+ n_tests = 0
30
+ result = {
31
+ "test_results": [],
32
+ "error_code": code,
33
+ "error_details": details,
34
+ "log": [],
35
+ "solution_branch": "submission",
36
+ "test_branches": [],
37
+ "test_branch_errors": {
38
+ "__infra__": [{"error_code": code, "error_details": details}]
39
+ },
40
+ "executable_hash": None,
41
+ "warnings": [],
42
+ }
43
+ diagnostics = {
44
+ "pass_rate": 0.0,
45
+ "resolved": 0,
46
+ "n_passed": 0,
47
+ "n_tests": n_tests,
48
+ "n_branch_errors": 1,
49
+ "infra_error": 1,
50
+ "executable_hash_present": 0,
51
+ }
52
+ Path("/logs/verifier/programgym_eval.json").write_text(
53
+ json.dumps(result, indent=2, sort_keys=True)
54
+ )
55
+ Path("/logs/verifier/harbor_diagnostics.json").write_text(
56
+ json.dumps(diagnostics, indent=2, sort_keys=True)
57
+ )
58
+ Path("/logs/verifier/reward.json").write_text(
59
+ json.dumps(
60
+ {"reward": 0.0, "resolved": 0.0, "almost_resolved": 0.0},
61
+ indent=2,
62
+ sort_keys=True,
63
+ )
64
+ )
65
+ Path("/logs/verifier/reward.txt").write_text("0.0")
66
+ Path("/logs/verifier/programgym_eval.log").write_text(details)
67
+ PY
68
+ }
69
+
70
+ if ! command -v python3 >/dev/null 2>&1; then
71
+ write_failure "missing_python3" "python3 is required in the cleanroom image"
72
+ exit 0
73
+ fi
74
+
75
+ if ! python3 /tests/programgym_evaluator.py; then
76
+ if [ ! -s /logs/verifier/reward.txt ]; then
77
+ write_failure "evaluator_crashed" \
78
+ "programgym_evaluator.py exited non-zero with no reward written"
79
+ fi
80
+ fi
81
+
82
+ exit 0
zingerlittlebee--netop.90b92f0/tests/workspace.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2217133c121b94deac9f3ce52d93d322e3eeab11d5af5de2b73947aa98f36a86
3
+ size 11338
zju-fast-lab--lbfgs-lite.a96c50e/environment/Dockerfile ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu:22.04
2
+ ARG PROGRAMGYM_APT_REPOSITORY_BASE_URL=""
3
+ ARG PROGRAMGYM_GOPROXY="https://proxy.golang.org,direct"
4
+ ARG PROGRAMGYM_NPM_REGISTRY="https://registry.npmjs.org/"
5
+ ARG PROGRAMGYM_NPM_STRICT_SSL="true"
6
+ ARG PROGRAMGYM_PYPI_INDEX_URL="https://pypi.org/simple"
7
+ ARG PROGRAMGYM_PYPI_TRUSTED_HOST=""
8
+ ARG PROGRAMGYM_UV_INSECURE_HOST=""
9
+ ENV GOPROXY=${PROGRAMGYM_GOPROXY}
10
+ ENV PIP_INDEX_URL=${PROGRAMGYM_PYPI_INDEX_URL}
11
+ ENV PIP_TRUSTED_HOST=${PROGRAMGYM_PYPI_TRUSTED_HOST}
12
+ ENV UV_INDEX_URL=${PROGRAMGYM_PYPI_INDEX_URL}
13
+ ENV UV_INSECURE_HOST=${PROGRAMGYM_UV_INSECURE_HOST}
14
+ ENV npm_config_registry=${PROGRAMGYM_NPM_REGISTRY}
15
+ ENV npm_config_strict_ssl=${PROGRAMGYM_NPM_STRICT_SSL}
16
+ COPY harbor_configure_apt_mirror.sh /tmp/harbor_configure_apt_mirror.sh
17
+ RUN chmod 0755 /tmp/harbor_configure_apt_mirror.sh \
18
+ && /bin/bash /tmp/harbor_configure_apt_mirror.sh "${PROGRAMGYM_APT_REPOSITORY_BASE_URL}" \
19
+ && rm -f /tmp/harbor_configure_apt_mirror.sh
20
+ ENV DEBIAN_FRONTEND=noninteractive
21
+ ENV RUSTUP_DIST_SERVER="https://static.rust-lang.org"
22
+ ENV RUSTUP_UPDATE_ROOT="https://static.rust-lang.org/rustup"
23
+ ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
24
+ ENV CARGO_REGISTRIES_CRATES_IO_INDEX="sparse+https://index.crates.io/"
25
+ ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
26
+ ENV GOSUMDB=sum.golang.google.cn
27
+ ENV GOTOOLCHAIN=auto
28
+ ENV UV_CACHE_DIR=/workspace/.cache/uv
29
+ ENV npm_config_cache=/workspace/.cache/npm
30
+ ENV HOME=/workspace
31
+ ENV XDG_CACHE_HOME=/workspace/.cache
32
+ ENV PIP_CACHE_DIR=/workspace/.cache/pip
33
+ ENV PYTHONUSERBASE=/workspace/.local
34
+ ENV PAGER=cat
35
+ ENV MANPAGER=cat
36
+ ENV LESS=-R
37
+ ENV TQDM_DISABLE=1
38
+ RUN apt-get update && apt-get install -y --no-install-recommends bash build-essential ca-certificates git make pkg-config python3 python3-pip autoconf automake gettext file binutils g++ libtool libncurses-dev meson ninja-build unzip wget curl xz-utils bzip2 zip zstd patch python3-pytest python3-pytest-xdist python3-coverage tar && rm -rf /var/lib/apt/lists/*
39
+ ARG CMAKE_VERSION=3.31.12
40
+ RUN set -eux; ARCH="$(dpkg --print-architecture)"; case "${ARCH}" in amd64) CMAKE_ARCH="x86_64" ;; arm64) CMAKE_ARCH="aarch64" ;; *) echo "unsupported architecture for CMake: ${ARCH}" >&2; exit 1 ;; esac; curl -fsSL -o /tmp/cmake.tar.gz "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-${CMAKE_ARCH}.tar.gz"; rm -rf /opt/cmake; mkdir -p /opt/cmake; tar -xzf /tmp/cmake.tar.gz --strip-components=1 -C /opt/cmake; ln -sf /opt/cmake/bin/cmake /usr/local/bin/cmake; ln -sf /opt/cmake/bin/ctest /usr/local/bin/ctest; ln -sf /opt/cmake/bin/cpack /usr/local/bin/cpack; rm -f /tmp/cmake.tar.gz; cmake --version
41
+ ARG GCC_VERSION=13.3.0
42
+ RUN set -eux; ARCH="$(dpkg --print-architecture)"; case "${ARCH}" in amd64) GCC_ARCH="x64" ;; arm64) GCC_ARCH="arm64" ;; *) echo "unsupported architecture for GCC 13: ${ARCH}" >&2; exit 1 ;; esac; wget -O /tmp/gcc.tar.gz "https://github.com/xpack-dev-tools/gcc-xpack/releases/download/v13.3.0-2/xpack-gcc-13.3.0-2-linux-${GCC_ARCH}.tar.gz"; rm -rf /opt/gcc-13; mkdir -p /opt/gcc-13; tar -xzf /tmp/gcc.tar.gz --strip-components=1 -C /opt/gcc-13; ln -sf /opt/gcc-13/bin/gcc /usr/local/bin/gcc; ln -sf /opt/gcc-13/bin/g++ /usr/local/bin/g++; ln -sf /opt/gcc-13/bin/gcc /usr/local/bin/cc; ln -sf /opt/gcc-13/bin/g++ /usr/local/bin/c++; ln -sf /opt/gcc-13/bin/gcc /usr/local/bin/gcc-13; ln -sf /opt/gcc-13/bin/g++ /usr/local/bin/g++-13; for PROGRAMGYM_GCOV_TOOL in gcov gcov-dump gcov-tool; do if [ -x "/opt/gcc-13/bin/${PROGRAMGYM_GCOV_TOOL}" ]; then ln -sf "/opt/gcc-13/bin/${PROGRAMGYM_GCOV_TOOL}" "/usr/local/bin/${PROGRAMGYM_GCOV_TOOL}"; ln -sf "/opt/gcc-13/bin/${PROGRAMGYM_GCOV_TOOL}" "/usr/local/bin/${PROGRAMGYM_GCOV_TOOL}-13"; ln -sf "/opt/gcc-13/bin/${PROGRAMGYM_GCOV_TOOL}" "/usr/bin/${PROGRAMGYM_GCOV_TOOL}"; fi; done; ln -sf /opt/gcc-13/bin/gcc /usr/bin/gcc; ln -sf /opt/gcc-13/bin/g++ /usr/bin/g++; ln -sf /opt/gcc-13/bin/gcc /usr/bin/cc; ln -sf /opt/gcc-13/bin/g++ /usr/bin/c++; rm -f /tmp/gcc.tar.gz; gcc --version; g++ --version; gcov --version; command -v gcov-dump >/dev/null && gcov-dump --version | head -n 1 || true
43
+ WORKDIR /workspace
44
+ ADD workspace.tar.gz /workspace/
45
+ COPY executable /workspace/executable
46
+ COPY download.sh /workspace/download.sh
47
+ RUN chmod 755 /workspace/download.sh
48
+ COPY harbor_prepare_download_env.sh /tmp/harbor_prepare_download_env.sh
49
+ RUN chmod 755 /tmp/harbor_prepare_download_env.sh \
50
+ && /bin/bash /tmp/harbor_prepare_download_env.sh \
51
+ && rm -f /workspace/download.sh \
52
+ && rm -f /tmp/harbor_prepare_download_env.sh
53
+ ENV BASH_ENV=/etc/profile.d/programgym_download_env.sh
54
+ RUN chmod 111 /workspace/executable
55
+ WORKDIR /workspace
56
+ # Harbor synthetic ProgramGym adapter: run the agent as an unprivileged user.
57
+ # Keep tool/runtime state under /home/agent and reserve /workspace for the
58
+ # submission handed to the separate verifier. Keep the reference executable
59
+ # execute-only; the oracle temporarily restores owner read permission.
60
+ RUN id -u agent >/dev/null 2>&1 || useradd -m -s /bin/bash agent
61
+ RUN mkdir -p /home/agent \
62
+ && chown -R agent:agent /home/agent /workspace \
63
+ && chown agent:agent /workspace/executable \
64
+ && chmod 111 /workspace/executable
65
+ ENV HOME=/home/agent
66
+ WORKDIR /workspace
zju-fast-lab--lbfgs-lite.a96c50e/environment/docker-compose.yaml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ main:
3
+ build:
4
+ args:
5
+ PROGRAMGYM_APT_REPOSITORY_BASE_URL: ${PROGRAMGYM_APT_REPOSITORY_BASE_URL:-}
6
+ PROGRAMGYM_GOPROXY: ${PROGRAMGYM_GOPROXY:-https://proxy.golang.org,direct}
7
+ PROGRAMGYM_NPM_REGISTRY: ${PROGRAMGYM_NPM_REGISTRY:-https://registry.npmjs.org/}
8
+ PROGRAMGYM_NPM_STRICT_SSL: ${PROGRAMGYM_NPM_STRICT_SSL:-true}
9
+ PROGRAMGYM_PYPI_INDEX_URL: ${PROGRAMGYM_PYPI_INDEX_URL:-https://pypi.org/simple}
10
+ PROGRAMGYM_PYPI_TRUSTED_HOST: ${PROGRAMGYM_PYPI_TRUSTED_HOST:-}
11
+ PROGRAMGYM_UV_INSECURE_HOST: ${PROGRAMGYM_UV_INSECURE_HOST:-}
zju-fast-lab--lbfgs-lite.a96c50e/environment/download.sh ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ #
3
+ # download.sh - ProgramGym dependency-prefetch stage for LBFGS-Lite.
4
+ #
5
+ # This script is executed via `source /source_ro/download.sh`, so it is written
6
+ # to be valid in shell source mode: it exports environment variables into the
7
+ # current shell, uses no positional arguments, and never uses `exit` in its
8
+ # normal control flow. It performs NO compilation, linking, or testing.
9
+ #
10
+ # It installs the Eigen3 headers required to build the lbfgs example executable
11
+ # and leaves a cache directory exported via the LBFGS_BUILD_ROOT variable.
12
+ #
13
+ # Standalone by design: it does not read any repository file.
14
+
15
+ set -u
16
+
17
+ if [ -n "${SUDO_AVAILABLE:-}" ]; then
18
+ :
19
+ fi
20
+
21
+ # Determine how to invoke privileged apt. When sourced as root (the usual
22
+ # validator case) plain apt works; otherwise fall back to sudo.
23
+ _can_sudo=""
24
+ if [ "$(id -u)" = "0" ]; then
25
+ _can_sudo="yes"
26
+ elif command -v sudo >/dev/null; then
27
+ _can_sudo="sudo"
28
+ fi
29
+
30
+ _apt_run() {
31
+ if [ -n "$_can_sudo" ]; then
32
+ if [ "$_can_sudo" = "yes" ]; then
33
+ "$@"
34
+ else
35
+ sudo "$@"
36
+ fi
37
+ else
38
+ "$@"
39
+ fi
40
+ }
41
+
42
+ # Put Eigen3 headers in place for the C++ example build.
43
+ if ! dpkg -s libeigen3-dev >/dev/null; then
44
+ _apt_run apt-get update
45
+ _apt_run apt-get install -y --no-install-recommends libeigen3-dev
46
+ fi
47
+
48
+ # Export the build root used by build.sh so the CMake build directory is
49
+ # deterministic and writable at build time. The actual clone/copy of the
50
+ # repository happens in the offline stage; here we only prepare the directory.
51
+ export LBFGS_BUILD_ROOT="${LBFGS_BUILD_ROOT:-/tmp/lbfgs-lite-build}"
52
+ mkdir -p "$LBFGS_BUILD_ROOT"
53
+
54
+ # Confirm Eigen is discoverable and export its include dir for build-time use.
55
+ export PKG_CONFIG_PATH="${PKG_CONFIG_PATH:-}"
56
+ _eigen_inc=""
57
+ if pkg-config --exists eigen3; then
58
+ _eigen_inc="$(pkg-config --variable=includedir eigen3)"
59
+ fi
60
+ if [ -z "$_eigen_inc" ]; then
61
+ _eigen_inc="/usr/include/eigen3"
62
+ fi
63
+ export EIGEN3_INCLUDE_DIR="$_eigen_inc"
zju-fast-lab--lbfgs-lite.a96c50e/environment/executable ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f8ceff7c78780dffbce7611894be3da6e31cc56ba32d016efd0d28944c901922
3
+ size 3203056
zju-fast-lab--lbfgs-lite.a96c50e/environment/harbor_configure_apt_mirror.sh ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ repository_base="${1%/}"
5
+ if [[ -z "$repository_base" ]]; then
6
+ exit 0
7
+ fi
8
+
9
+ . /etc/os-release
10
+ codename="${VERSION_CODENAME:-}"
11
+ if [[ -z "$codename" ]]; then
12
+ echo "VERSION_CODENAME is not set" >&2
13
+ exit 1
14
+ fi
15
+
16
+ if [[ "$ID" == "ubuntu" ]]; then
17
+ repository_name="apt-proxy"
18
+ components="main universe restricted multiverse"
19
+ else
20
+ repository_name="debian-proxy"
21
+ components="main contrib non-free non-free-firmware"
22
+ fi
23
+
24
+ install -d /etc/apt/sources.list.d
25
+ rm -f /etc/apt/sources.list /etc/apt/sources.list.d/*
26
+ printf 'deb [trusted=yes] %s/%s %s %s\n' \
27
+ "$repository_base" "$repository_name" "$codename" "$components" \
28
+ >/etc/apt/sources.list
29
+ printf 'deb [trusted=yes] %s/%s %s-updates %s\n' \
30
+ "$repository_base" "$repository_name" "$codename" "$components" \
31
+ >>/etc/apt/sources.list
32
+
33
+ if [[ "$ID" != "ubuntu" ]]; then
34
+ printf 'deb [trusted=yes] %s/%s %s-security %s\n' \
35
+ "$repository_base" "debian-proxy-security" "$codename" "$components" \
36
+ >>/etc/apt/sources.list
37
+ fi
zju-fast-lab--lbfgs-lite.a96c50e/environment/harbor_prepare_download_env.sh ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ cd /workspace
4
+ set -a
5
+ source /workspace/download.sh
6
+ set +a
7
+ python3 - <<'PY' > /etc/profile.d/programgym_download_env.sh
8
+ import os
9
+ import shlex
10
+
11
+ ignored = {
12
+ "ALL_PROXY",
13
+ "HTTP_PROXY",
14
+ "HTTPS_PROXY",
15
+ "NO_PROXY",
16
+ "OLDPWD",
17
+ "PIP_PROXY",
18
+ "PWD",
19
+ "SHLVL",
20
+ "_",
21
+ "all_proxy",
22
+ "http_proxy",
23
+ "https_proxy",
24
+ "no_proxy",
25
+ "pip_proxy",
26
+ }
27
+ for key in sorted(os.environ):
28
+ if key in ignored or key.startswith("BASH_FUNC_"):
29
+ continue
30
+ value = os.environ[key]
31
+ if "\n" in value:
32
+ continue
33
+ print(f"export {key}={shlex.quote(value)}")
34
+ PY
zju-fast-lab--lbfgs-lite.a96c50e/environment/workspace.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c561cba14bf4e9855837a9067068d63c7385f41cf43b28dcc4ede3f0834db5e1
3
+ size 13485
zju-fast-lab--lbfgs-lite.a96c50e/instruction.md ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ You are a helpful assistant that can interact with a computer.
2
+
3
+ This is a reverse-engineering benchmark. You are given a compiled binary and its documentation.
4
+ Your job is to write a new, original codebase from scratch that produces an executable with identical behavior.
5
+ You must figure out the behavior solely by running and interacting with the provided binary.
6
+ Writing original code based on observed behavior is the entire point of this benchmark.
7
+
8
+ Any approach that shortcuts this — finding existing source code, wrapping the binary,
9
+ or installing the original tool — does not count as a solution. It will be detected by an
10
+ automated judge, marked as a disqualification, and scored as a failure.
11
+ The trace will be posted to an online wall of shame.
12
+
13
+ <RULES>
14
+ ## What is not allowed
15
+
16
+ ### 1. Obtaining source code
17
+
18
+ The only source of truth about what the executable does is the executable itself and its
19
+ bundled documentation. You must not search the internet, package registries, or any external
20
+ source for information about this project's source code. Even if you recognize what the
21
+ executable is, you must reimplement it from behavioral observation alone.
22
+
23
+ This includes but is not limited to:
24
+ - Cloning or browsing the original GitHub repository, its forks, or mirrors
25
+ - Downloading the project from package registries: `cargo install <project>`, `go get github.com/<org>/<project>`, `pip install <project>`, `apt-get source <project>`, `npm install <project>`, etc.
26
+ - Fetching source tarballs from project websites (e.g., `curl https://lua.org/ftp/lua-5.5.0.tar.gz`)
27
+ - Using a package manager to download the project as a dependency and then reading its cached source (e.g., navigating into `~/.cargo/registry/src/` or `$(go env GOPATH)/pkg/mod/`)
28
+ - Searching the web for the project's source code or implementation details
29
+
30
+ ### 2. Wrapping or reusing the original binary
31
+
32
+ Your submission must be a genuine reimplementation. The provided `./executable` is for
33
+ observation only — your final solution must not depend on it or any other pre-built version
34
+ of the same tool at runtime.
35
+
36
+ This includes but is not limited to:
37
+ - Writing a wrapper script that delegates to the original binary (e.g., `exec zstd "$@"`)
38
+ - Installing the tool from a package manager and shimming to it (e.g., `apt-get install nnn && cp $(which nnn) ./executable`)
39
+ - Writing a `compile.sh` that simply makes the provided binary executable (`chmod +x ./executable`) or copies it (`cp ./executable ./executable`)
40
+ - Building a binary whose main function shells out to an external tool (e.g., `Command::new("miniserve").args(args).exec()`)
41
+ - Re-linking prebuilt `.o` object files found in the workspace without writing new source code
42
+
43
+ ### 3. Binary analysis of the provided executable
44
+
45
+ All information about the provided `./executable` must be obtained by interacting with it
46
+ through its normal user interface (CLI flags, stdin/stdout, etc.).
47
+ - You MUST NOT decompile `./executable` or use disassemblers (objdump, Ghidra, etc.) on it
48
+ - You MUST NOT use strace, ltrace, or similar tracing/instrumentation tools on `./executable`
49
+
50
+ Note: this restriction applies ONLY to the provided `./executable`. You are free to use any
51
+ analysis tools on binaries that you produce yourself during development.
52
+
53
+ ## What IS allowed
54
+
55
+ - Running the executable with any inputs, flags, and arguments to observe its behavior
56
+ - Reading any documentation files bundled in the workspace
57
+ </RULES>
58
+
59
+ ## Task context
60
+
61
+ We want to write the source code for a given executable.
62
+ The executable is located at `./executable` in the workspace root.
63
+
64
+ You also have access to the existing documentation.
65
+
66
+ ## Your task
67
+
68
+ Implement the source code to generate an executable of exactly identical behavior as the original.
69
+
70
+ No project-specific dependencies are pre-installed.
71
+ You do NOT have access to the internet.
72
+ **IMPORTANT**: Make sure that the executable(s) and everything else that is an artifact is not committed, i.e., is in your `.gitignore` file.
73
+ Finally, commit your changes.
74
+
75
+ Make sure that you have a `./compile.sh` file that produces an executable `./executable` in the workspace root.
76
+ `compile.sh` should be executable and should install any dependencies needed to compile the executable.
77
+ If your compile.sh fails to compile on a fresh checkout, your task has failed.
78
+
79
+ ## Important: This is a reverse-engineering benchmark
80
+
81
+ Your goal is to write original code from scratch that reproduces the executable's behavior.
82
+ The only way to learn what the executable does is to run it and read its bundled documentation.
83
+
84
+ Any attempt to obtain source code — whether successful or not — or to wrap/reuse the
85
+ provided binary will be detected by an automated judge, disqualified, and scored as zero.
86
+ See the full rules in the system prompt above. Key points:
87
+
88
+ - Do NOT search the internet, clone repos, or download the project from any package registry
89
+ - Do NOT wrap, shim, or delegate to the provided `./executable` or any installed version of the same tool
90
+ - Do NOT decompile the provided `./executable` or use strace/ltrace on it (analyzing your own binaries is fine)
91
+ - You SHOULD extensively test the executable to understand its behavior before writing code.
92
+ If you are dealing with a TUI, tmux/libtmux has been installed to help you test/inspect/it.
93
+
94
+ ## Recommended Workflow
95
+
96
+ 1. Explore all documentation files
97
+ 2. Play with the executable to understand its behavior (however, you MUST NOT decompile `./executable` or perform any other form of binary or strace/ltrace analysis on it)
98
+ 3. Write the source code to implement the behavior
zju-fast-lab--lbfgs-lite.a96c50e/solution/solve.sh ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # Oracle-only ceiling check. The reference is execute-only for normal agents;
3
+ # because the oracle runs as the owning `agent` user it can temporarily add read
4
+ # permission and encode the binary for Harbor's normal artifact handoff.
5
+ set -euo pipefail
6
+ test -f ./executable
7
+ chmod u+r ./executable
8
+ python3 - <<'PY'
9
+ import base64
10
+ from pathlib import Path
11
+
12
+ Path(".programgym_oracle_reference").write_bytes(
13
+ base64.b64encode(Path("executable").read_bytes())
14
+ )
15
+ PY
16
+ chmod u-r ./executable
17
+ cat > compile.sh <<'EOF'
18
+ #!/usr/bin/env bash
19
+ set -euo pipefail
20
+ if [ -f ./.programgym_oracle_reference ]; then
21
+ python3 - <<'PY'
22
+ import base64
23
+ from pathlib import Path
24
+
25
+ Path("executable").write_bytes(
26
+ base64.b64decode(Path(".programgym_oracle_reference").read_bytes())
27
+ )
28
+ PY
29
+ fi
30
+ test -f ./executable
31
+ chmod +x ./executable
32
+ EOF
33
+ chmod +x compile.sh
zju-fast-lab--lbfgs-lite.a96c50e/task.toml ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.3"
2
+ source = "ProgramGym"
3
+ artifacts = [
4
+ "/logs/verifier/programgym_eval.json",
5
+ "/logs/verifier/harbor_diagnostics.json",
6
+ "/logs/verifier/programgym_eval.log",
7
+ "/logs/verifier/reward.json",
8
+ "/logs/verifier/reward.txt",
9
+ # Keep agent/runtime state out of the submission handoff. In particular,
10
+ # Claude Code installs an absolute symlink under .local/bin; transferring it
11
+ # makes Python's safe tar extraction reject the entire workspace archive.
12
+ { source = "/workspace", exclude = [
13
+ "executable",
14
+ ".git",
15
+ ".bashrc",
16
+ ".cache",
17
+ ".cc-switch",
18
+ ".claude",
19
+ ".local",
20
+ ] },
21
+ ]
22
+
23
+ [task]
24
+ name = "programgym/zju-fast-lab--lbfgs-lite.a96c50e"
25
+ description = "Synthetic ProgramGym cleanroom reconstruction task for ZJU-FAST-Lab/LBFGS-Lite"
26
+ authors = [{ name = "Harbor ProgramGym Synthetic Adapter" }]
27
+ keywords = ["programgym", "synthetic", "reverse-engineering", "cleanroom", "cpp"]
28
+
29
+ [metadata]
30
+ source = "ProgramGym"
31
+ instance_id = "ZJU-FAST-Lab__LBFGS-Lite.a96c50e"
32
+ repository = "ZJU-FAST-Lab/LBFGS-Lite"
33
+ commit = "a96c50e3fdf8b5278577522a2c5e75766c8670bb"
34
+ language = "cpp"
35
+ difficulty = "easy"
36
+ difficulty_score = 1.2513948500401044
37
+ test_branches = 2
38
+ test_count = 201
39
+
40
+ [agent]
41
+ timeout_sec = 14400
42
+ user = "agent"
43
+ network_mode = "allowlist"
44
+ allowed_hosts = ["api.anthropic.com", "api.openai.com"]
45
+
46
+ [verifier]
47
+ timeout_sec = 7200
48
+ user = "root"
49
+ environment_mode = "separate"
50
+
51
+ [verifier.env]
52
+ PROGRAMGYM_XDIST_WORKERS = "8"
53
+
54
+ [verifier.environment]
55
+ build_timeout_sec = 1800
56
+ cpus = 8
57
+ memory_mb = 16384
58
+ storage_mb = 30720
59
+ gpus = 0
60
+ workdir = "/workspace"
61
+
62
+ [environment]
63
+ network_mode = "public"
64
+ build_timeout_sec = 1800
65
+ cpus = 8
66
+ memory_mb = 16384
67
+ storage_mb = 30720
68
+ gpus = 0
69
+ workdir = "/workspace"
zju-fast-lab--lbfgs-lite.a96c50e/tests/Dockerfile ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu:22.04
2
+ ARG PROGRAMGYM_APT_REPOSITORY_BASE_URL=""
3
+ ARG PROGRAMGYM_GOPROXY="https://proxy.golang.org,direct"
4
+ ARG PROGRAMGYM_NPM_REGISTRY="https://registry.npmjs.org/"
5
+ ARG PROGRAMGYM_NPM_STRICT_SSL="true"
6
+ ARG PROGRAMGYM_PYPI_INDEX_URL="https://pypi.org/simple"
7
+ ARG PROGRAMGYM_PYPI_TRUSTED_HOST=""
8
+ ARG PROGRAMGYM_UV_INSECURE_HOST=""
9
+ ENV GOPROXY=${PROGRAMGYM_GOPROXY}
10
+ ENV PIP_INDEX_URL=${PROGRAMGYM_PYPI_INDEX_URL}
11
+ ENV PIP_TRUSTED_HOST=${PROGRAMGYM_PYPI_TRUSTED_HOST}
12
+ ENV UV_INDEX_URL=${PROGRAMGYM_PYPI_INDEX_URL}
13
+ ENV UV_INSECURE_HOST=${PROGRAMGYM_UV_INSECURE_HOST}
14
+ ENV npm_config_registry=${PROGRAMGYM_NPM_REGISTRY}
15
+ ENV npm_config_strict_ssl=${PROGRAMGYM_NPM_STRICT_SSL}
16
+ COPY harbor_configure_apt_mirror.sh /tmp/harbor_configure_apt_mirror.sh
17
+ RUN chmod 0755 /tmp/harbor_configure_apt_mirror.sh \
18
+ && /bin/bash /tmp/harbor_configure_apt_mirror.sh "${PROGRAMGYM_APT_REPOSITORY_BASE_URL}" \
19
+ && rm -f /tmp/harbor_configure_apt_mirror.sh
20
+ ENV DEBIAN_FRONTEND=noninteractive
21
+ ENV RUSTUP_DIST_SERVER="https://static.rust-lang.org"
22
+ ENV RUSTUP_UPDATE_ROOT="https://static.rust-lang.org/rustup"
23
+ ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
24
+ ENV CARGO_REGISTRIES_CRATES_IO_INDEX="sparse+https://index.crates.io/"
25
+ ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
26
+ ENV GOSUMDB=sum.golang.google.cn
27
+ ENV GOTOOLCHAIN=auto
28
+ ENV UV_CACHE_DIR=/workspace/.cache/uv
29
+ ENV npm_config_cache=/workspace/.cache/npm
30
+ ENV HOME=/workspace
31
+ ENV XDG_CACHE_HOME=/workspace/.cache
32
+ ENV PIP_CACHE_DIR=/workspace/.cache/pip
33
+ ENV PYTHONUSERBASE=/workspace/.local
34
+ ENV PAGER=cat
35
+ ENV MANPAGER=cat
36
+ ENV LESS=-R
37
+ ENV TQDM_DISABLE=1
38
+ RUN apt-get update && apt-get install -y --no-install-recommends bash build-essential ca-certificates git make pkg-config python3 python3-pip autoconf automake gettext file binutils g++ libtool libncurses-dev meson ninja-build unzip wget curl xz-utils bzip2 zip zstd patch python3-pytest python3-pytest-xdist python3-coverage tar && rm -rf /var/lib/apt/lists/*
39
+ ARG CMAKE_VERSION=3.31.12
40
+ RUN set -eux; ARCH="$(dpkg --print-architecture)"; case "${ARCH}" in amd64) CMAKE_ARCH="x86_64" ;; arm64) CMAKE_ARCH="aarch64" ;; *) echo "unsupported architecture for CMake: ${ARCH}" >&2; exit 1 ;; esac; curl -fsSL -o /tmp/cmake.tar.gz "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-${CMAKE_ARCH}.tar.gz"; rm -rf /opt/cmake; mkdir -p /opt/cmake; tar -xzf /tmp/cmake.tar.gz --strip-components=1 -C /opt/cmake; ln -sf /opt/cmake/bin/cmake /usr/local/bin/cmake; ln -sf /opt/cmake/bin/ctest /usr/local/bin/ctest; ln -sf /opt/cmake/bin/cpack /usr/local/bin/cpack; rm -f /tmp/cmake.tar.gz; cmake --version
41
+ ARG GCC_VERSION=13.3.0
42
+ RUN set -eux; ARCH="$(dpkg --print-architecture)"; case "${ARCH}" in amd64) GCC_ARCH="x64" ;; arm64) GCC_ARCH="arm64" ;; *) echo "unsupported architecture for GCC 13: ${ARCH}" >&2; exit 1 ;; esac; wget -O /tmp/gcc.tar.gz "https://github.com/xpack-dev-tools/gcc-xpack/releases/download/v13.3.0-2/xpack-gcc-13.3.0-2-linux-${GCC_ARCH}.tar.gz"; rm -rf /opt/gcc-13; mkdir -p /opt/gcc-13; tar -xzf /tmp/gcc.tar.gz --strip-components=1 -C /opt/gcc-13; ln -sf /opt/gcc-13/bin/gcc /usr/local/bin/gcc; ln -sf /opt/gcc-13/bin/g++ /usr/local/bin/g++; ln -sf /opt/gcc-13/bin/gcc /usr/local/bin/cc; ln -sf /opt/gcc-13/bin/g++ /usr/local/bin/c++; ln -sf /opt/gcc-13/bin/gcc /usr/local/bin/gcc-13; ln -sf /opt/gcc-13/bin/g++ /usr/local/bin/g++-13; for PROGRAMGYM_GCOV_TOOL in gcov gcov-dump gcov-tool; do if [ -x "/opt/gcc-13/bin/${PROGRAMGYM_GCOV_TOOL}" ]; then ln -sf "/opt/gcc-13/bin/${PROGRAMGYM_GCOV_TOOL}" "/usr/local/bin/${PROGRAMGYM_GCOV_TOOL}"; ln -sf "/opt/gcc-13/bin/${PROGRAMGYM_GCOV_TOOL}" "/usr/local/bin/${PROGRAMGYM_GCOV_TOOL}-13"; ln -sf "/opt/gcc-13/bin/${PROGRAMGYM_GCOV_TOOL}" "/usr/bin/${PROGRAMGYM_GCOV_TOOL}"; fi; done; ln -sf /opt/gcc-13/bin/gcc /usr/bin/gcc; ln -sf /opt/gcc-13/bin/g++ /usr/bin/g++; ln -sf /opt/gcc-13/bin/gcc /usr/bin/cc; ln -sf /opt/gcc-13/bin/g++ /usr/bin/c++; rm -f /tmp/gcc.tar.gz; gcc --version; g++ --version; gcov --version; command -v gcov-dump >/dev/null && gcov-dump --version | head -n 1 || true
43
+ WORKDIR /workspace
44
+ ADD workspace.tar.gz /workspace/
45
+ COPY executable /workspace/executable
46
+ COPY download.sh /workspace/download.sh
47
+ RUN chmod 755 /workspace/download.sh
48
+ COPY harbor_prepare_download_env.sh /tmp/harbor_prepare_download_env.sh
49
+ RUN chmod 755 /tmp/harbor_prepare_download_env.sh \
50
+ && /bin/bash /tmp/harbor_prepare_download_env.sh \
51
+ && rm -f /workspace/download.sh \
52
+ && rm -f /tmp/harbor_prepare_download_env.sh
53
+ ENV BASH_ENV=/etc/profile.d/programgym_download_env.sh
54
+ RUN chmod 111 /workspace/executable
55
+ WORKDIR /workspace
56
+ # Harbor uses tests/ as the separate verifier build context. Start with the
57
+ # same toolchain as the agent, then remove every cleanroom workspace artifact.
58
+ RUN rm -rf /workspace/* /workspace/.[!.]* 2>/dev/null || true \
59
+ && mkdir -p /workspace /tests
60
+
61
+ # Synthetic cleanroom Dockerfiles commonly install Ubuntu's pytest-xdist 2.5.0.
62
+ # Installing a newer pytest alone leaves that apt package importable and creates
63
+ # an incompatible mixed apt/pip stack (xdist 2.5 imports the removed py.log).
64
+ # Install and constrain the verifier test runner as one coherent pip toolchain.
65
+ RUN printf 'pytest<9\n' > /etc/pip-constraint.txt
66
+ ENV PIP_CONSTRAINT=/etc/pip-constraint.txt
67
+ RUN python3 -m pip install --no-cache-dir --disable-pip-version-check \
68
+ 'pytest<9' 'pytest-xdist>=3,<4' pytest-rerunfailures pytest-timeout
69
+
70
+ COPY test.sh /tests/test.sh
71
+ COPY programgym_evaluator.py /tests/programgym_evaluator.py
72
+ COPY programgym_task.json /tests/programgym_task.json
73
+ COPY blobs/ /tests/blobs/
74
+ RUN chmod +x /tests/test.sh
zju-fast-lab--lbfgs-lite.a96c50e/tests/blobs/tests/generated_module_01.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a55f29f9f95e4aed67a045bb09820aa7f65b947256bea788a8fd326d201d9dbf
3
+ size 23015
zju-fast-lab--lbfgs-lite.a96c50e/tests/blobs/tests/generated_module_02.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:22d4b77ccd040c5d3ecfce105964ea0834837b5c17bfd56ca2d97a62074320a4
3
+ size 12068
zju-fast-lab--lbfgs-lite.a96c50e/tests/docker-compose.yaml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ main:
3
+ build:
4
+ args:
5
+ PROGRAMGYM_APT_REPOSITORY_BASE_URL: ${PROGRAMGYM_APT_REPOSITORY_BASE_URL:-}
6
+ PROGRAMGYM_GOPROXY: ${PROGRAMGYM_GOPROXY:-https://proxy.golang.org,direct}
7
+ PROGRAMGYM_NPM_REGISTRY: ${PROGRAMGYM_NPM_REGISTRY:-https://registry.npmjs.org/}
8
+ PROGRAMGYM_NPM_STRICT_SSL: ${PROGRAMGYM_NPM_STRICT_SSL:-true}
9
+ PROGRAMGYM_PYPI_INDEX_URL: ${PROGRAMGYM_PYPI_INDEX_URL:-https://pypi.org/simple}
10
+ PROGRAMGYM_PYPI_TRUSTED_HOST: ${PROGRAMGYM_PYPI_TRUSTED_HOST:-}
11
+ PROGRAMGYM_UV_INSECURE_HOST: ${PROGRAMGYM_UV_INSECURE_HOST:-}
zju-fast-lab--lbfgs-lite.a96c50e/tests/download.sh ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ #
3
+ # download.sh - ProgramGym dependency-prefetch stage for LBFGS-Lite.
4
+ #
5
+ # This script is executed via `source /source_ro/download.sh`, so it is written
6
+ # to be valid in shell source mode: it exports environment variables into the
7
+ # current shell, uses no positional arguments, and never uses `exit` in its
8
+ # normal control flow. It performs NO compilation, linking, or testing.
9
+ #
10
+ # It installs the Eigen3 headers required to build the lbfgs example executable
11
+ # and leaves a cache directory exported via the LBFGS_BUILD_ROOT variable.
12
+ #
13
+ # Standalone by design: it does not read any repository file.
14
+
15
+ set -u
16
+
17
+ if [ -n "${SUDO_AVAILABLE:-}" ]; then
18
+ :
19
+ fi
20
+
21
+ # Determine how to invoke privileged apt. When sourced as root (the usual
22
+ # validator case) plain apt works; otherwise fall back to sudo.
23
+ _can_sudo=""
24
+ if [ "$(id -u)" = "0" ]; then
25
+ _can_sudo="yes"
26
+ elif command -v sudo >/dev/null; then
27
+ _can_sudo="sudo"
28
+ fi
29
+
30
+ _apt_run() {
31
+ if [ -n "$_can_sudo" ]; then
32
+ if [ "$_can_sudo" = "yes" ]; then
33
+ "$@"
34
+ else
35
+ sudo "$@"
36
+ fi
37
+ else
38
+ "$@"
39
+ fi
40
+ }
41
+
42
+ # Put Eigen3 headers in place for the C++ example build.
43
+ if ! dpkg -s libeigen3-dev >/dev/null; then
44
+ _apt_run apt-get update
45
+ _apt_run apt-get install -y --no-install-recommends libeigen3-dev
46
+ fi
47
+
48
+ # Export the build root used by build.sh so the CMake build directory is
49
+ # deterministic and writable at build time. The actual clone/copy of the
50
+ # repository happens in the offline stage; here we only prepare the directory.
51
+ export LBFGS_BUILD_ROOT="${LBFGS_BUILD_ROOT:-/tmp/lbfgs-lite-build}"
52
+ mkdir -p "$LBFGS_BUILD_ROOT"
53
+
54
+ # Confirm Eigen is discoverable and export its include dir for build-time use.
55
+ export PKG_CONFIG_PATH="${PKG_CONFIG_PATH:-}"
56
+ _eigen_inc=""
57
+ if pkg-config --exists eigen3; then
58
+ _eigen_inc="$(pkg-config --variable=includedir eigen3)"
59
+ fi
60
+ if [ -z "$_eigen_inc" ]; then
61
+ _eigen_inc="/usr/include/eigen3"
62
+ fi
63
+ export EIGEN3_INCLUDE_DIR="$_eigen_inc"
zju-fast-lab--lbfgs-lite.a96c50e/tests/executable ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f8ceff7c78780dffbce7611894be3da6e31cc56ba32d016efd0d28944c901922
3
+ size 3203056
zju-fast-lab--lbfgs-lite.a96c50e/tests/harbor_configure_apt_mirror.sh ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ repository_base="${1%/}"
5
+ if [[ -z "$repository_base" ]]; then
6
+ exit 0
7
+ fi
8
+
9
+ . /etc/os-release
10
+ codename="${VERSION_CODENAME:-}"
11
+ if [[ -z "$codename" ]]; then
12
+ echo "VERSION_CODENAME is not set" >&2
13
+ exit 1
14
+ fi
15
+
16
+ if [[ "$ID" == "ubuntu" ]]; then
17
+ repository_name="apt-proxy"
18
+ components="main universe restricted multiverse"
19
+ else
20
+ repository_name="debian-proxy"
21
+ components="main contrib non-free non-free-firmware"
22
+ fi
23
+
24
+ install -d /etc/apt/sources.list.d
25
+ rm -f /etc/apt/sources.list /etc/apt/sources.list.d/*
26
+ printf 'deb [trusted=yes] %s/%s %s %s\n' \
27
+ "$repository_base" "$repository_name" "$codename" "$components" \
28
+ >/etc/apt/sources.list
29
+ printf 'deb [trusted=yes] %s/%s %s-updates %s\n' \
30
+ "$repository_base" "$repository_name" "$codename" "$components" \
31
+ >>/etc/apt/sources.list
32
+
33
+ if [[ "$ID" != "ubuntu" ]]; then
34
+ printf 'deb [trusted=yes] %s/%s %s-security %s\n' \
35
+ "$repository_base" "debian-proxy-security" "$codename" "$components" \
36
+ >>/etc/apt/sources.list
37
+ fi
zju-fast-lab--lbfgs-lite.a96c50e/tests/harbor_prepare_download_env.sh ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ cd /workspace
4
+ set -a
5
+ source /workspace/download.sh
6
+ set +a
7
+ python3 - <<'PY' > /etc/profile.d/programgym_download_env.sh
8
+ import os
9
+ import shlex
10
+
11
+ ignored = {
12
+ "ALL_PROXY",
13
+ "HTTP_PROXY",
14
+ "HTTPS_PROXY",
15
+ "NO_PROXY",
16
+ "OLDPWD",
17
+ "PIP_PROXY",
18
+ "PWD",
19
+ "SHLVL",
20
+ "_",
21
+ "all_proxy",
22
+ "http_proxy",
23
+ "https_proxy",
24
+ "no_proxy",
25
+ "pip_proxy",
26
+ }
27
+ for key in sorted(os.environ):
28
+ if key in ignored or key.startswith("BASH_FUNC_"):
29
+ continue
30
+ value = os.environ[key]
31
+ if "\n" in value:
32
+ continue
33
+ print(f"export {key}={shlex.quote(value)}")
34
+ PY
zju-fast-lab--lbfgs-lite.a96c50e/tests/programgym_evaluator.py ADDED
@@ -0,0 +1,1201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """In-place ProgramGym evaluator.
3
+
4
+ Mirrors ProgramGym's ``Evaluator`` pipeline as closely as a single-container,
5
+ no-Docker-in-Docker host allows. Run from ``tests/test.sh`` inside the agent's
6
+ cleanroom container after Harbor flips the verifier-phase network policy.
7
+
8
+ Differences from ``programgym.eval.eval.Evaluator`` that are structural to
9
+ running in one container:
10
+
11
+ * No fresh container per branch. ``snapshot_workspace`` / ``restore_workspace``
12
+ copy a post-compile workspace snapshot to a temp directory and restore it
13
+ before each branch; ``cleanup_lingering_processes`` kills leftover branch
14
+ processes between attempts to approximate the fresh-container boundary.
15
+ * No ``docker commit``. The post-compile workspace snapshot serves the same
16
+ role as the committed image upstream.
17
+ * Hidden test blobs are fetched on demand from HuggingFace via
18
+ ``huggingface_hub.snapshot_download`` (matching ``programgym.utils.blob_store``)
19
+ rather than being pre-staged into ``/tests/blobs/``. Override with
20
+ ``PROGRAMGYM_BLOB_DIR`` for offline reruns.
21
+
22
+ Everything else (eval_clean_hashes scrub, deterministic synthetic git seed,
23
+ ``compile.sh`` then stash + hash the executable, best-effort
24
+ ``pytest-rerunfailures``, per-branch test-tar overlay, executable hash
25
+ ``--max-worker-restart=4``, xdist worker-crash retry with serial fallback,
26
+ best-of-N attempt selection, active vs ignored test bookkeeping, scoring) is
27
+ preserved.
28
+ """
29
+
30
+ from __future__ import annotations
31
+
32
+ import hashlib
33
+ import json
34
+ import os
35
+ import re
36
+ import shlex
37
+ import shutil
38
+ import signal
39
+ import subprocess
40
+ import tempfile
41
+ import time
42
+ import traceback
43
+ import xml.etree.ElementTree as ET
44
+ from pathlib import Path
45
+ from typing import Any
46
+
47
+ WORKSPACE = Path(os.environ.get("PROGRAMGYM_WORKSPACE", "/workspace"))
48
+ STASHED_EXECUTABLE = Path("/opt/programgym-stashed-executable-do-not-modify")
49
+ METADATA_PATH = Path(
50
+ os.environ.get("PROGRAMGYM_METADATA", "/tests/programgym_task.json")
51
+ )
52
+ LOG_DIR = Path(os.environ.get("PROGRAMGYM_LOG_DIR", "/logs/verifier"))
53
+ WORKER_CRASH_PHRASE = "worker '"
54
+ XDIST_COLLAPSE_MARKERS = (
55
+ "maximum crashed workers reached",
56
+ "xdist: maximum crashed",
57
+ )
58
+
59
+ DEFAULT_HF_REPO_ID = "programgym/ProgramGym-Tests"
60
+ DEFAULT_HF_REVISION = "main"
61
+
62
+ # Oracle agent handoff files (see solution/solve.sh). Must not appear in the
63
+ # post-compile workspace snapshot or they pollute tree-scanning tests (dutree).
64
+ _ORACLE_HANDOFF_NAMES = (".programgym_oracle_reference",)
65
+
66
+ _TOOLCHAIN_BIN_DIR_CANDIDATES = (
67
+ "/usr/local/go/bin",
68
+ "/go/bin",
69
+ "/usr/local/cargo/bin",
70
+ "/root/.cargo/bin",
71
+ "/root/.ghcup/bin",
72
+ )
73
+
74
+
75
+ def toolchain_bin_dirs() -> list[str]:
76
+ """Return toolchain bin directories that exist on this image."""
77
+ candidates = list(_TOOLCHAIN_BIN_DIR_CANDIDATES)
78
+ candidates.extend(
79
+ str(path)
80
+ for path in sorted(Path("/usr/lib").glob("go-*/bin"))
81
+ if _is_accessible_dir(path)
82
+ )
83
+ seen: set[str] = set()
84
+ present: list[str] = []
85
+ for path in candidates:
86
+ if path in seen:
87
+ continue
88
+ seen.add(path)
89
+ if _is_accessible_dir(path):
90
+ present.append(path)
91
+ return present
92
+
93
+
94
+ def _is_accessible_dir(path: str | Path) -> bool:
95
+ """Return whether path is a directory without failing on protected homes."""
96
+ try:
97
+ return Path(path).is_dir()
98
+ except OSError:
99
+ return False
100
+
101
+
102
+ def bootstrap_toolchain_path() -> str:
103
+ """Prepend discovered toolchain dirs to PATH (idempotent)."""
104
+ prepend = toolchain_bin_dirs()
105
+ current_parts = [part for part in os.environ.get("PATH", "").split(":") if part]
106
+ merged: list[str] = []
107
+ for path in prepend + current_parts:
108
+ if path not in merged:
109
+ merged.append(path)
110
+ new_path = ":".join(merged)
111
+ os.environ["PATH"] = new_path
112
+ return new_path
113
+
114
+
115
+ def _bash_login_command(command: str) -> str:
116
+ """Run ``command`` under bash -lc with an explicit PATH export."""
117
+ path = bootstrap_toolchain_path()
118
+ return f"export PATH={shlex.quote(path)}; {command}"
119
+
120
+
121
+ def sha256(path: Path) -> str:
122
+ h = hashlib.sha256()
123
+ with path.open("rb") as f:
124
+ for chunk in iter(lambda: f.read(1024 * 1024), b""):
125
+ h.update(chunk)
126
+ return h.hexdigest()
127
+
128
+
129
+ def write_json(path: Path, data: dict[str, Any]) -> None:
130
+ tmp = path.with_suffix(path.suffix + ".tmp")
131
+ tmp.write_text(json.dumps(data, indent=2, sort_keys=True))
132
+ tmp.replace(path)
133
+
134
+
135
+ def _read_log_tail(path: Path | None, max_bytes: int = 65536) -> str:
136
+ if path is None or not path.exists():
137
+ return ""
138
+ data = path.read_bytes()
139
+ if len(data) <= max_bytes:
140
+ return data.decode(errors="replace")
141
+ return data[-max_bytes:].decode(errors="replace")
142
+
143
+
144
+ def _close_pipes(proc: subprocess.Popen[Any]) -> None:
145
+ for stream in (proc.stdout, proc.stderr):
146
+ if stream is not None:
147
+ try:
148
+ stream.close()
149
+ except OSError:
150
+ pass
151
+
152
+
153
+ def _terminate_process_tree(proc: subprocess.Popen[Any]) -> None:
154
+ try:
155
+ os.killpg(proc.pid, signal.SIGKILL)
156
+ except ProcessLookupError:
157
+ pass
158
+ try:
159
+ proc.kill()
160
+ except ProcessLookupError:
161
+ pass
162
+
163
+
164
+ _PKILL_PATTERNS = (
165
+ f"{WORKSPACE}/eval/",
166
+ f"{WORKSPACE}/tests/",
167
+ "tail -f",
168
+ "development.log",
169
+ " less ",
170
+ " less$",
171
+ "/less ",
172
+ )
173
+
174
+
175
+ def _pkill_aggressive() -> str:
176
+ """Best-effort kill of branch pytest/subprocess trees (Modal gVisor fallback)."""
177
+ notes: list[str] = []
178
+ workspace = str(WORKSPACE)
179
+ patterns = list(_PKILL_PATTERNS) + [
180
+ f"pytest.*{workspace}",
181
+ f"xdist.*{workspace}",
182
+ ]
183
+ for pattern in patterns:
184
+ result = subprocess.run(
185
+ ["pkill", "-9", "-f", pattern],
186
+ capture_output=True,
187
+ text=True,
188
+ )
189
+ notes.append(f"pkill -9 -f {pattern!r}: rc={result.returncode}")
190
+ return "\n".join(notes)
191
+
192
+
193
+ def run_step(
194
+ command: str,
195
+ cwd: Path,
196
+ *,
197
+ timeout: int,
198
+ env: dict[str, str] | None = None,
199
+ step: str,
200
+ accept_failure: bool = False,
201
+ log_output: bool | None = None,
202
+ max_output_bytes: int = 65536,
203
+ ) -> dict[str, Any]:
204
+ if log_output is None:
205
+ log_output = step == "run_tests" or timeout >= 60
206
+
207
+ started = time.monotonic()
208
+ stdout_path: Path | None = None
209
+ stderr_path: Path | None = None
210
+ stdout_f = None
211
+ stderr_f = None
212
+
213
+ if log_output:
214
+ LOG_DIR.mkdir(parents=True, exist_ok=True)
215
+ log_id = f"{step}-{int(started * 1000)}"
216
+ stdout_path = LOG_DIR / f"run-step-{log_id}.stdout.log"
217
+ stderr_path = LOG_DIR / f"run-step-{log_id}.stderr.log"
218
+ stdout_f = stdout_path.open("w", encoding="utf-8")
219
+ stderr_f = stderr_path.open("w", encoding="utf-8")
220
+ popen_stdout: Any = stdout_f
221
+ popen_stderr: Any = stderr_f
222
+ else:
223
+ popen_stdout = subprocess.PIPE
224
+ popen_stderr = subprocess.PIPE
225
+
226
+ proc = subprocess.Popen(
227
+ ["bash", "-lc", _bash_login_command(command)],
228
+ cwd=cwd,
229
+ env={**os.environ, **(env or {})},
230
+ stdout=popen_stdout,
231
+ stderr=popen_stderr,
232
+ start_new_session=True,
233
+ text=True,
234
+ )
235
+ timed_out = False
236
+ stdout = ""
237
+ stderr = ""
238
+ try:
239
+ if log_output:
240
+ proc.wait(timeout=timeout)
241
+ else:
242
+ stdout, stderr = proc.communicate(timeout=timeout)
243
+ except subprocess.TimeoutExpired:
244
+ timed_out = True
245
+ _terminate_process_tree(proc)
246
+ cleanup_lingering_processes(aggressive=True)
247
+ try:
248
+ proc.wait(timeout=5)
249
+ except subprocess.TimeoutExpired:
250
+ proc.kill()
251
+ if not log_output:
252
+ _close_pipes(proc)
253
+ finally:
254
+ if stdout_f is not None:
255
+ stdout_f.close()
256
+ if stderr_f is not None:
257
+ stderr_f.close()
258
+
259
+ if timed_out:
260
+ if log_output:
261
+ output = _read_log_tail(stdout_path, max_output_bytes) + _read_log_tail(
262
+ stderr_path, max_output_bytes
263
+ )
264
+ else:
265
+ output = ""
266
+ entry = {
267
+ "step": step,
268
+ "command": command,
269
+ "wall_time": time.monotonic() - started,
270
+ "output": output,
271
+ "returncode": 124,
272
+ "exception_info": f"timed out after {timeout}s",
273
+ }
274
+ else:
275
+ if log_output:
276
+ output = _read_log_tail(stdout_path, max_output_bytes) + _read_log_tail(
277
+ stderr_path, max_output_bytes
278
+ )
279
+ else:
280
+ output = stdout + stderr
281
+ entry = {
282
+ "step": step,
283
+ "command": command,
284
+ "wall_time": time.monotonic() - started,
285
+ "output": output,
286
+ "returncode": proc.returncode,
287
+ "exception_info": "",
288
+ }
289
+ if entry["returncode"] and not accept_failure:
290
+ raise RuntimeError(
291
+ f"{step} failed: {entry['exception_info'] or entry['output']}"
292
+ )
293
+ return entry
294
+
295
+
296
+ def cleanup_lingering_processes(*, aggressive: bool = False) -> dict[str, Any]:
297
+ started = time.monotonic()
298
+ patterns = [
299
+ str(WORKSPACE / "executable"),
300
+ f"{WORKSPACE}/eval/",
301
+ f"{WORKSPACE}/tests/",
302
+ # lazygit --logs/-l tests spawn `tail -f` outside /workspace/.
303
+ "tail -f",
304
+ "development.log",
305
+ ]
306
+ killed: list[int] = []
307
+ proc_root = Path("/proc")
308
+ proc_available = proc_root.exists()
309
+ if proc_available:
310
+ for proc_dir in proc_root.iterdir():
311
+ if not proc_dir.name.isdigit():
312
+ continue
313
+ pid = int(proc_dir.name)
314
+ if pid in {os.getpid(), os.getppid()}:
315
+ continue
316
+ try:
317
+ raw = (proc_dir / "cmdline").read_bytes()
318
+ except (FileNotFoundError, PermissionError, ProcessLookupError):
319
+ continue
320
+ cmdline = raw.replace(b"\0", b" ").decode(errors="replace")
321
+ if not any(pattern in cmdline for pattern in patterns):
322
+ continue
323
+ try:
324
+ os.kill(pid, signal.SIGKILL)
325
+ except (PermissionError, ProcessLookupError):
326
+ continue
327
+ killed.append(pid)
328
+ pkill_output = ""
329
+ if aggressive or not proc_available:
330
+ pkill_output = _pkill_aggressive()
331
+ output_parts = []
332
+ if killed:
333
+ output_parts.append("\n".join(str(pid) for pid in killed))
334
+ if pkill_output:
335
+ output_parts.append(pkill_output)
336
+ return {
337
+ "step": "cleanup_lingering_processes",
338
+ "command": "kill leftover branch processes referencing the workspace",
339
+ "wall_time": time.monotonic() - started,
340
+ "output": "\n".join(output_parts),
341
+ "returncode": 0,
342
+ "exception_info": "",
343
+ }
344
+
345
+
346
+ def extract_trusted_blob(tar_path: Path, dest: Path) -> None:
347
+ import tarfile
348
+
349
+ with tarfile.open(tar_path, "r:gz") as tf:
350
+ try:
351
+ tf.extractall(dest, filter="fully_trusted")
352
+ except TypeError:
353
+ tf.extractall(dest)
354
+
355
+
356
+ def find_results_xml() -> Path | None:
357
+ """Return the junit xml path if pytest wrote one."""
358
+ for candidate in (WORKSPACE / "eval" / "results.xml", WORKSPACE / "results.xml"):
359
+ if candidate.exists():
360
+ return candidate
361
+ return None
362
+
363
+
364
+ def remove_oracle_handoff_artifacts() -> list[str]:
365
+ """Drop oracle-agent handoff files from /workspace before snapshot/restore."""
366
+ removed: list[str] = []
367
+ for name in _ORACLE_HANDOFF_NAMES:
368
+ path = WORKSPACE / name
369
+ if path.exists():
370
+ if path.is_dir():
371
+ shutil.rmtree(path)
372
+ else:
373
+ path.unlink()
374
+ removed.append(name)
375
+ return removed
376
+
377
+
378
+ def _remove_tree(path: Path) -> None:
379
+ """Remove a file or directory tree, with a shell fallback for overlay races."""
380
+ if path.is_symlink() or path.is_file():
381
+ path.unlink(missing_ok=True)
382
+ return
383
+ if not path.is_dir():
384
+ path.unlink(missing_ok=True)
385
+ return
386
+ for attempt in range(3):
387
+ try:
388
+ shutil.rmtree(path)
389
+ if not path.exists():
390
+ return
391
+ except OSError:
392
+ if attempt == 2:
393
+ run_step(
394
+ f"rm -rf {shlex.quote(str(path))}",
395
+ path.parent,
396
+ timeout=120,
397
+ step="clear_workspace_fallback",
398
+ accept_failure=True,
399
+ )
400
+ if not path.exists():
401
+ return
402
+ raise
403
+
404
+
405
+ def ensure_workspace_dir() -> None:
406
+ """Guarantee WORKSPACE exists as a writable directory (not a symlink/file)."""
407
+ if WORKSPACE.exists() and not WORKSPACE.is_dir():
408
+ if WORKSPACE.is_symlink() or WORKSPACE.is_file():
409
+ WORKSPACE.unlink()
410
+ else:
411
+ shutil.rmtree(WORKSPACE)
412
+ WORKSPACE.mkdir(parents=True, exist_ok=True)
413
+
414
+
415
+ def clear_workspace() -> None:
416
+ ensure_workspace_dir()
417
+ for path in list(WORKSPACE.iterdir()):
418
+ _remove_tree(path)
419
+
420
+
421
+ def restore_reference_executable() -> None:
422
+ """Write the stashed reference binary into /workspace after a branch overlay.
423
+
424
+ Branch blobs may ship ``executable`` as a dangling symlink into
425
+ ``target/release/...``; ``shutil.copy2`` would follow it and raise
426
+ ``FileNotFoundError``. Drop whatever the blob left and copy the stashed
427
+ reference as a regular file.
428
+ """
429
+ ensure_workspace_dir()
430
+ if not STASHED_EXECUTABLE.is_file():
431
+ raise FileNotFoundError(
432
+ f"missing stashed reference executable at {STASHED_EXECUTABLE}"
433
+ )
434
+ dest = WORKSPACE / "executable"
435
+ if dest.exists() or dest.is_symlink():
436
+ if dest.is_dir():
437
+ shutil.rmtree(dest)
438
+ else:
439
+ dest.unlink(missing_ok=True)
440
+ shutil.copy2(STASHED_EXECUTABLE, dest)
441
+ dest.chmod(0o755)
442
+
443
+
444
+ def snapshot_workspace(dest: Path) -> None:
445
+ if dest.exists():
446
+ shutil.rmtree(dest)
447
+ shutil.copytree(WORKSPACE, dest, symlinks=True)
448
+
449
+
450
+ def restore_workspace(source: Path) -> None:
451
+ clear_workspace()
452
+ shutil.copytree(source, WORKSPACE, dirs_exist_ok=True, symlinks=True)
453
+ ensure_workspace_dir()
454
+
455
+
456
+ def remove_hashed_files(root: Path, hashes: set[str]) -> list[str]:
457
+ removed: list[str] = []
458
+ for path in root.rglob("*"):
459
+ if path.is_file() and not path.is_symlink():
460
+ try:
461
+ if sha256(path) in hashes:
462
+ path.unlink()
463
+ removed.append(str(path.relative_to(root)))
464
+ except OSError:
465
+ continue
466
+ return removed
467
+
468
+
469
+ def branch_tests(branch_info: dict[str, Any]) -> list[str]:
470
+ ignored = {
471
+ item["name"] for item in branch_info.get("ignored_tests", []) if "name" in item
472
+ }
473
+ return [name for name in branch_info.get("tests", []) if name not in ignored]
474
+
475
+
476
+ def ignored_tests(metadata: dict[str, Any]) -> set[str]:
477
+ result: set[str] = set()
478
+ for branch, info in metadata.get("branches", {}).items():
479
+ result.update(
480
+ f"{branch}/{item['name']}"
481
+ for item in info.get("ignored_tests", [])
482
+ if "name" in item
483
+ )
484
+ return result
485
+
486
+
487
+ def active_tests(metadata: dict[str, Any]) -> set[str]:
488
+ active: set[str] = set()
489
+ for branch, info in metadata.get("branches", {}).items():
490
+ if info.get("ignored"):
491
+ continue
492
+ ignored = {
493
+ item["name"] for item in info.get("ignored_tests", []) if "name" in item
494
+ }
495
+ active.update(
496
+ f"{branch}/{name}" for name in info.get("tests", []) if name not in ignored
497
+ )
498
+ return active
499
+
500
+
501
+ def inject_not_run(
502
+ result: dict[str, Any], branch: str, tests: list[str], error_code: str
503
+ ) -> None:
504
+ result["test_results"].extend(
505
+ {
506
+ "name": name,
507
+ "branch": branch,
508
+ "status": "not_run",
509
+ "extra": {"error_code": error_code},
510
+ }
511
+ for name in tests
512
+ )
513
+
514
+
515
+ def testcase_name(case: ET.Element) -> str:
516
+ classname = case.attrib.get("classname", "")
517
+ name = case.attrib.get("name", "")
518
+ return f"{classname}.{name}" if classname else name
519
+
520
+
521
+ # Only these tags under <testcase> represent a result. <system-out> /
522
+ # <system-err> are stdout/stderr captures and must not be treated as results
523
+ # (a leading <system-out> followed by <failure> would otherwise be classified
524
+ # as a stdout-only "passed").
525
+ JUNIT_RESULT_TAGS = {"skipped", "failure", "error"}
526
+
527
+
528
+ def parse_junit(
529
+ raw_xml: str, branch: str, expected: list[str], ignored: set[str]
530
+ ) -> tuple[list[dict[str, Any]], list[str]]:
531
+ root = ET.fromstring(raw_xml)
532
+ got: set[str] = set()
533
+ results: list[dict[str, Any]] = []
534
+ for case in root.iter("testcase"):
535
+ name = testcase_name(case)
536
+ got.add(name)
537
+ extra: dict[str, Any] = {}
538
+ if "time" in case.attrib:
539
+ try:
540
+ extra["time"] = float(case.attrib["time"])
541
+ except ValueError:
542
+ extra["time"] = case.attrib["time"]
543
+ result_children = [c for c in case if c.tag in JUNIT_RESULT_TAGS]
544
+ # Collapse duplicate same-tag result children. Pytest's
545
+ # "pytest.internal" pseudo-test sometimes emits two identical <error>
546
+ # entries; treating that as a system_error would over-flag a real
547
+ # single failure. Mirrors upstream eval.py:816-820.
548
+ if len(result_children) > 1 and len({c.tag for c in result_children}) == 1:
549
+ result_children = [result_children[0]]
550
+ if not result_children:
551
+ status = "passed"
552
+ elif len(result_children) != 1:
553
+ status = "system_error"
554
+ extra["error_details"] = (
555
+ f"Expected 1 result for {name}, got {len(result_children)}: "
556
+ f"{[c.tag for c in result_children]}"
557
+ )
558
+ else:
559
+ first = result_children[0]
560
+ status = first.tag # "skipped" | "failure" | "error"
561
+ extra["message"] = first.attrib.get("message") or ""
562
+ if first.text:
563
+ extra["text"] = first.text
564
+ results.append(
565
+ {"name": name, "branch": branch, "status": status, "extra": extra}
566
+ )
567
+
568
+ active_expected = [name for name in expected if name not in ignored]
569
+ missing = [name for name in active_expected if name not in got]
570
+ results.extend(
571
+ {
572
+ "name": name,
573
+ "branch": branch,
574
+ "status": "not_run",
575
+ "extra": {"error_code": "missing_from_junit_xml"},
576
+ }
577
+ for name in missing
578
+ )
579
+ unexpected = got - set(expected) - ignored
580
+ warnings = (
581
+ [f"Branch {branch}: {len(unexpected)} test(s) in JUnit XML not in tests.json"]
582
+ if unexpected
583
+ else []
584
+ )
585
+ return results, warnings
586
+
587
+
588
+ def count_worker_crashes(raw_xml: str) -> int:
589
+ if WORKER_CRASH_PHRASE not in raw_xml:
590
+ return 0
591
+ try:
592
+ root = ET.fromstring(raw_xml)
593
+ except ET.ParseError:
594
+ return 0
595
+ crashes = 0
596
+ for case in root.iter("testcase"):
597
+ for child in case:
598
+ text = (child.get("message") or "") + " " + (child.text or "")
599
+ if (
600
+ child.tag in {"error", "failure"}
601
+ and WORKER_CRASH_PHRASE in text
602
+ and "crashed" in text
603
+ ):
604
+ crashes += 1
605
+ break
606
+ return crashes
607
+
608
+
609
+ def run_output_indicates_xdist_collapse(output: str) -> bool:
610
+ lower = output.lower()
611
+ return any(marker in lower for marker in XDIST_COLLAPSE_MARKERS)
612
+
613
+
614
+ def count_junit_failures(raw_xml: str) -> int:
615
+ try:
616
+ root = ET.fromstring(raw_xml)
617
+ except ET.ParseError:
618
+ return 0
619
+ failures = 0
620
+ for case in root.iter("testcase"):
621
+ for child in case:
622
+ if child.tag in {"failure", "error"}:
623
+ failures += 1
624
+ break
625
+ return failures
626
+
627
+
628
+ def count_junit_passed(raw_xml: str) -> int:
629
+ try:
630
+ root = ET.fromstring(raw_xml)
631
+ except ET.ParseError:
632
+ return 0
633
+ passed = 0
634
+ for case in root.iter("testcase"):
635
+ if not any(child.tag in JUNIT_RESULT_TAGS for child in case):
636
+ passed += 1
637
+ return passed
638
+
639
+
640
+ def branch_attempt_metrics(
641
+ raw_xml: str, *, run_output: str, expected_tests: int
642
+ ) -> tuple[int, int, int, int]:
643
+ """Return (crashes, n_testcases, failures, missing_from_xml)."""
644
+ crashes = count_worker_crashes(raw_xml)
645
+ if run_output_indicates_xdist_collapse(run_output):
646
+ crashes = max(crashes, 1)
647
+ n_tests = count_testcases(raw_xml)
648
+ failures = count_junit_failures(raw_xml)
649
+ missing = max(0, expected_tests - n_tests)
650
+ return crashes, n_tests, failures, missing
651
+
652
+
653
+ def needs_serial_retry(
654
+ *,
655
+ serial: bool,
656
+ crashes: int,
657
+ missing: int,
658
+ failures: int,
659
+ n_tests: int,
660
+ expected_tests: int,
661
+ run_output: str,
662
+ ) -> bool:
663
+ if serial:
664
+ return False
665
+ high_failure_rate = (
666
+ expected_tests > 0 and n_tests >= expected_tests and failures / n_tests >= 0.8
667
+ )
668
+ return (
669
+ crashes > 0
670
+ or missing > 0
671
+ or high_failure_rate
672
+ or run_output_indicates_xdist_collapse(run_output)
673
+ )
674
+
675
+
676
+ def count_testcases(raw_xml: str) -> int:
677
+ try:
678
+ return sum(1 for _ in ET.fromstring(raw_xml).iter("testcase"))
679
+ except ET.ParseError:
680
+ return 0
681
+
682
+
683
+ def scored_results(
684
+ result: dict[str, Any], metadata: dict[str, Any]
685
+ ) -> list[dict[str, Any]]:
686
+ active = active_tests(metadata)
687
+ by_key = {
688
+ f"{test['branch']}/{test['name']}": test
689
+ for test in result["test_results"]
690
+ if f"{test['branch']}/{test['name']}" in active
691
+ }
692
+ return [
693
+ by_key.get(
694
+ key,
695
+ {
696
+ "branch": key.split("/", 1)[0],
697
+ "name": key.split("/", 1)[1],
698
+ "status": "not_run",
699
+ "extra": {"error_code": "missing_from_results"},
700
+ },
701
+ )
702
+ for key in sorted(active)
703
+ ]
704
+
705
+
706
+ def summarize(result: dict[str, Any], metadata: dict[str, Any]) -> dict[str, Any]:
707
+ scored = scored_results(result, metadata)
708
+ n_passed = sum(t["status"] == "passed" for t in scored)
709
+ n_tests = len(scored)
710
+ pass_rate = n_passed / n_tests if n_tests else 0.0
711
+ # Multi-key reward: Harbor's default Mean aggregates each key independently
712
+ # (see harbor.metrics.base.aggregate_reward_dicts), so mean("resolved") is
713
+ # the proportion of tasks scoring a perfect pass-rate and mean of
714
+ # "almost_resolved" is the proportion scoring >= 0.95. "reward" stays the
715
+ # per-task pass-rate whose mean is the overall mean reward.
716
+ return {
717
+ "reward": pass_rate,
718
+ "resolved": 1.0 if pass_rate >= 1.0 else 0.0,
719
+ "almost_resolved": 1.0 if pass_rate >= 0.95 else 0.0,
720
+ }
721
+
722
+
723
+ def diagnostics(result: dict[str, Any], metadata: dict[str, Any]) -> dict[str, Any]:
724
+ scored = scored_results(result, metadata)
725
+ n_passed = sum(t["status"] == "passed" for t in scored)
726
+ n_tests = len(scored)
727
+ pass_rate = n_passed / n_tests if n_tests else 0.0
728
+ return {
729
+ "pass_rate": pass_rate,
730
+ "resolved": int(
731
+ bool(
732
+ n_tests
733
+ and n_passed == n_tests
734
+ and not result["test_branch_errors"]
735
+ and not result["error_code"]
736
+ )
737
+ ),
738
+ "n_passed": n_passed,
739
+ "n_tests": n_tests,
740
+ "n_branch_errors": len(result["test_branch_errors"]),
741
+ "infra_error": int(bool(result["error_code"] or result["test_branch_errors"])),
742
+ "executable_hash_present": int(bool(result.get("executable_hash"))),
743
+ }
744
+
745
+
746
+ def use_script_pty() -> bool:
747
+ return os.environ.get("PROGRAMGYM_SCRIPT_PTY", "").strip() == "1"
748
+
749
+
750
+ def script_pty_available() -> bool:
751
+ return shutil.which("script") is not None
752
+
753
+
754
+ def branch_env(
755
+ *,
756
+ serial: bool,
757
+ has_rerunfailures: bool,
758
+ extras: dict[str, str] | None = None,
759
+ ) -> dict[str, str]:
760
+ addopts = ["--max-worker-restart=4"]
761
+ # A serial fallback is already a complete second execution. Re-running each
762
+ # failing test two more times makes large, failure-heavy suites prohibitively
763
+ # slow and adds little signal.
764
+ if has_rerunfailures and not serial:
765
+ addopts.extend(["--reruns=2", "--reruns-delay=1"])
766
+ env = {
767
+ "PYTEST_ADDOPTS": " ".join(addopts),
768
+ # Match upstream non-TTY regression environments (dirble log format, etc.).
769
+ "NO_COLOR": "1",
770
+ "TERM": "dumb",
771
+ "CLICOLOR": "0",
772
+ "CLICOLOR_FORCE": "0",
773
+ "COLORTERM": "",
774
+ }
775
+ if extras:
776
+ env.update(extras)
777
+ xdist_workers = os.environ.get("PROGRAMGYM_XDIST_WORKERS")
778
+ if serial:
779
+ xdist_workers = "1"
780
+ if xdist_workers:
781
+ env["PYTEST_XDIST_AUTO_NUM_WORKERS"] = xdist_workers
782
+ return env
783
+
784
+
785
+ _SERIAL_RUN_SH = ".programgym_run_serial.sh"
786
+ # ``eval/run.sh`` usually passes ``-n auto`` on the command line, which overrides
787
+ # ``PYTEST_ADDOPTS``. Rewrite to ``-n 0`` in a verifier-local copy for retries.
788
+ _RUN_SH_XDIST_RE = re.compile(r"-n\s*(?:auto|\d+)")
789
+
790
+
791
+ def prepare_serial_run_sh(run_sh: Path) -> Path:
792
+ """Write a serial-only copy of ``eval/run.sh`` with xdist disabled."""
793
+ serial_sh = run_sh.with_name(_SERIAL_RUN_SH)
794
+ patched = _RUN_SH_XDIST_RE.sub("-n 0", run_sh.read_text())
795
+ serial_sh.write_text(patched)
796
+ serial_sh.chmod(0o755)
797
+ return serial_sh
798
+
799
+
800
+ def run_tests_command(*, serial: bool) -> str:
801
+ if serial:
802
+ inner = f"chmod +x ./eval/{_SERIAL_RUN_SH} && ./eval/{_SERIAL_RUN_SH}"
803
+ else:
804
+ inner = "chmod +x ./eval/run.sh && ./eval/run.sh"
805
+ if use_script_pty() and script_pty_available():
806
+ return f"script -q -c {shlex.quote(inner)} /dev/null"
807
+ return inner
808
+
809
+
810
+ BAKED_BLOB_DIR = Path(os.environ.get("PROGRAMGYM_BAKED_BLOB_DIR", "/tests/blobs"))
811
+
812
+
813
+ def resolve_blob_dir(instance_id: str, metadata: dict[str, Any]) -> Path:
814
+ """Locate the per-instance blob directory.
815
+
816
+ Resolution order:
817
+
818
+ 1. ``/tests/blobs/`` if pre-fetched into the task at generation time
819
+ (``programgym-adapter --download-blobs``). Verifier-only mount, so
820
+ agent never sees these.
821
+ 2. ``PROGRAMGYM_BLOB_DIR`` env override pointing at an HF-cache-shaped
822
+ tree on disk (``<dir>/<instance_id>/tests/<branch>.tar.gz``). Useful
823
+ for offline reruns sharing a cache across many tasks.
824
+ 3. ``huggingface_hub.snapshot_download`` from
825
+ ``programgym/ProgramGym-Tests`` (default repo, ``main`` revision).
826
+
827
+ The returned directory contains ``tests/<branch>.tar.gz`` per active
828
+ branch — same shape as ``programgym/ProgramGym-Tests/<instance_id>/``
829
+ on HF.
830
+ """
831
+ if BAKED_BLOB_DIR.exists() and (BAKED_BLOB_DIR / "tests").exists():
832
+ return BAKED_BLOB_DIR
833
+
834
+ local = os.environ.get("PROGRAMGYM_BLOB_DIR", "").strip()
835
+ if local:
836
+ candidate = Path(local) / instance_id
837
+ if candidate.exists():
838
+ return candidate
839
+ raise FileNotFoundError(
840
+ f"PROGRAMGYM_BLOB_DIR set but {candidate} does not exist"
841
+ )
842
+
843
+ repo_id = os.environ.get("PROGRAMGYM_HF_REPO") or metadata.get(
844
+ "hf_repo_id", DEFAULT_HF_REPO_ID
845
+ )
846
+ revision = os.environ.get("PROGRAMGYM_HF_REVISION") or metadata.get(
847
+ "hf_revision", DEFAULT_HF_REVISION
848
+ )
849
+
850
+ from huggingface_hub import snapshot_download
851
+
852
+ cache_root = Path(
853
+ snapshot_download(
854
+ repo_id,
855
+ repo_type="dataset",
856
+ revision=revision,
857
+ allow_patterns=f"{instance_id}/**",
858
+ )
859
+ )
860
+ blob_dir = cache_root / instance_id
861
+ if not blob_dir.exists():
862
+ raise FileNotFoundError(
863
+ f"HF blob directory missing for {instance_id} at {blob_dir}"
864
+ )
865
+ return blob_dir
866
+
867
+
868
+ def evaluate(metadata: dict[str, Any]) -> dict[str, Any]:
869
+ bootstrap_toolchain_path()
870
+ branches = metadata.get("branches", {})
871
+ active_branch_items = [
872
+ (name, info) for name, info in branches.items() if not info.get("ignored")
873
+ ]
874
+ result: dict[str, Any] = {
875
+ "test_results": [],
876
+ "error_code": None,
877
+ "error_details": None,
878
+ "log": [],
879
+ "solution_branch": "submission",
880
+ "test_branches": [name for name, _ in active_branch_items],
881
+ "test_branch_errors": {},
882
+ "executable_hash": None,
883
+ "warnings": [],
884
+ }
885
+
886
+ instance_id = metadata["instance_id"]
887
+
888
+ compile_timeout = int(os.environ.get("PROGRAMGYM_COMPILE_TIMEOUT", "900"))
889
+ branch_timeout = int(os.environ.get("PROGRAMGYM_BRANCH_TIMEOUT", "3600"))
890
+
891
+ def fail_all(error_code: str, details: str) -> dict[str, Any]:
892
+ result["error_code"] = error_code
893
+ result["error_details"] = details
894
+ for branch, info in active_branch_items:
895
+ inject_not_run(result, branch, branch_tests(info), error_code)
896
+ return result
897
+
898
+ with tempfile.TemporaryDirectory(prefix="programgym-eval-") as tmp:
899
+ compiled_snapshot = Path(tmp) / "compiled"
900
+
901
+ started = time.monotonic()
902
+ removed = remove_hashed_files(
903
+ WORKSPACE, set(metadata.get("eval_clean_hashes", []))
904
+ )
905
+ result["log"].append(
906
+ {
907
+ "step": "remove_hashed_files",
908
+ "command": "remove files matching eval_clean_hashes",
909
+ "wall_time": time.monotonic() - started,
910
+ "output": "".join(f"removed '{path}'\n" for path in removed),
911
+ "returncode": 0,
912
+ "exception_info": "",
913
+ }
914
+ )
915
+
916
+ compile_sh = WORKSPACE / "compile.sh"
917
+ if not compile_sh.exists():
918
+ return fail_all(
919
+ "missing_compile_sh", "submission did not contain compile.sh"
920
+ )
921
+
922
+ seed = (
923
+ "if [ ! -d .git ]; then "
924
+ "GIT_AUTHOR_DATE='2000-01-01T00:00:00Z' "
925
+ "GIT_COMMITTER_DATE='2000-01-01T00:00:00Z' "
926
+ "git -c init.defaultBranch=gold init -q && "
927
+ "git -c user.email=gold@local -c user.name=gold -c commit.gpgsign=false add -A && "
928
+ "GIT_AUTHOR_DATE='2000-01-01T00:00:00Z' "
929
+ "GIT_COMMITTER_DATE='2000-01-01T00:00:00Z' "
930
+ "git -c user.email=gold@local -c user.name=gold -c commit.gpgsign=false commit -q --allow-empty -m gold; "
931
+ "fi"
932
+ )
933
+ try:
934
+ result["log"].append(
935
+ run_step(seed, WORKSPACE, timeout=300, step="seed_git")
936
+ )
937
+ compile_log = run_step(
938
+ "chmod +x ./compile.sh && ./compile.sh",
939
+ WORKSPACE,
940
+ timeout=compile_timeout,
941
+ step="compile",
942
+ accept_failure=True,
943
+ )
944
+ result["log"].append(compile_log)
945
+ if compile_log["returncode"]:
946
+ return fail_all("compile_failed", compile_log["output"])
947
+ executable = WORKSPACE / "executable"
948
+ if not executable.exists():
949
+ return fail_all(
950
+ "missing_executable",
951
+ "compile.sh completed but did not create ./executable",
952
+ )
953
+ STASHED_EXECUTABLE.parent.mkdir(parents=True, exist_ok=True)
954
+ # `move` (not copy) so /workspace doesn't keep a parallel copy of
955
+ # the agent's executable during the stash→restore window. Mirrors
956
+ # upstream `mv ./executable {STASHED}` (eval.py:472).
957
+ shutil.move(str(executable), STASHED_EXECUTABLE)
958
+ result["executable_hash"] = sha256(STASHED_EXECUTABLE)
959
+ result["log"].append(
960
+ run_step(
961
+ "pip3 install -q --disable-pip-version-check pytest-rerunfailures",
962
+ WORKSPACE,
963
+ timeout=120,
964
+ step="install_rerunfailures",
965
+ accept_failure=True,
966
+ )
967
+ )
968
+ has_rerunfailures = result["log"][-1]["returncode"] == 0
969
+ handoff_removed = remove_oracle_handoff_artifacts()
970
+ if handoff_removed:
971
+ result["log"].append(
972
+ {
973
+ "step": "remove_oracle_handoff",
974
+ "command": "remove oracle handoff artifacts from workspace",
975
+ "wall_time": 0.0,
976
+ "output": "".join(
977
+ f"removed '{name}'\n" for name in handoff_removed
978
+ ),
979
+ "returncode": 0,
980
+ "exception_info": "",
981
+ }
982
+ )
983
+ snapshot_workspace(compiled_snapshot)
984
+ except Exception as exc:
985
+ return fail_all(type(exc).__name__, str(exc))
986
+
987
+ try:
988
+ blob_dir = resolve_blob_dir(instance_id, metadata)
989
+ except Exception as exc:
990
+ details = f"{type(exc).__name__}: {exc}"
991
+ for branch, info in active_branch_items:
992
+ result["test_branch_errors"][branch] = [
993
+ {
994
+ "error_code": "blob_resolution_failed",
995
+ "error_details": details,
996
+ }
997
+ ]
998
+ inject_not_run(
999
+ result, branch, branch_tests(info), "blob_resolution_failed"
1000
+ )
1001
+ return result
1002
+
1003
+ for branch, info in active_branch_items:
1004
+ tests = branch_tests(info)
1005
+ blob = blob_dir / "tests" / f"{branch}.tar.gz"
1006
+ if not blob.exists():
1007
+ result["test_branch_errors"][branch] = [
1008
+ {"error_code": "missing_test_blob", "error_details": blob.name}
1009
+ ]
1010
+ inject_not_run(result, branch, tests, "missing_test_blob")
1011
+ continue
1012
+
1013
+ best_xml = ""
1014
+ # Prefer a complete, clean XML result, then the result covering the
1015
+ # most expected tests, and only then the one with the most passes.
1016
+ # Pass-count-only ranking can retain a partial xdist result over a
1017
+ # complete serial result.
1018
+ best_quality = (-1, -1, -1)
1019
+ serial = bool(metadata.get("force_serial_branches"))
1020
+ branch_log: list[dict[str, Any]] = []
1021
+ branch_ignored = {
1022
+ item["name"] for item in info.get("ignored_tests", []) if "name" in item
1023
+ }
1024
+ n_expected = len([name for name in tests if name not in branch_ignored])
1025
+
1026
+ def merge_best_xml(raw_xml: str) -> None:
1027
+ try:
1028
+ parsed, warnings = parse_junit(
1029
+ raw_xml, branch, list(info.get("tests", [])), branch_ignored
1030
+ )
1031
+ except Exception as exc:
1032
+ result["test_branch_errors"][branch] = [
1033
+ {"error_code": "xml_parse_error", "error_details": str(exc)}
1034
+ ]
1035
+ inject_not_run(result, branch, tests, "xml_parse_error")
1036
+ else:
1037
+ result["test_results"].extend(parsed)
1038
+ result["warnings"].extend(warnings)
1039
+
1040
+ while True:
1041
+ branch_log.append(cleanup_lingering_processes())
1042
+ restore_workspace(compiled_snapshot)
1043
+ extract_trusted_blob(blob, WORKSPACE)
1044
+ restore_reference_executable()
1045
+ actual_hash = sha256(WORKSPACE / "executable")
1046
+ if actual_hash != result["executable_hash"]:
1047
+ result["test_branch_errors"][branch] = [
1048
+ {
1049
+ "error_code": "executable_hash_mismatch",
1050
+ "error_details": (
1051
+ f"expected {result['executable_hash']}, got {actual_hash}"
1052
+ ),
1053
+ }
1054
+ ]
1055
+ inject_not_run(result, branch, tests, "executable_hash_mismatch")
1056
+ break
1057
+ run_sh = WORKSPACE / "eval" / "run.sh"
1058
+ if not run_sh.exists():
1059
+ result["test_branch_errors"][branch] = [
1060
+ {
1061
+ "error_code": "missing_run_sh",
1062
+ "error_details": "eval/run.sh missing",
1063
+ }
1064
+ ]
1065
+ inject_not_run(result, branch, tests, "missing_run_sh")
1066
+ break
1067
+ # Upstream rewrites thread→signal so xdist workers fail cleanly
1068
+ # instead of os._exit(1) on timeout. That works in fresh
1069
+ # containers per branch; here we reuse one container and
1070
+ # signal timeouts leave TUI/log-watcher subprocesses alive
1071
+ # (e.g. lazygit --logs + tail -f), wedging pytest for up to
1072
+ # branch_timeout. Keep the blob's thread method and rely on
1073
+ # cleanup_lingering_processes + serial fallback after crashes.
1074
+ env = branch_env(
1075
+ serial=serial,
1076
+ has_rerunfailures=has_rerunfailures,
1077
+ extras=metadata.get("branch_env"),
1078
+ )
1079
+ branch_log.append(
1080
+ run_step(
1081
+ "rm -f eval/results.xml results.xml",
1082
+ WORKSPACE,
1083
+ timeout=120,
1084
+ step="clean_stale_results",
1085
+ accept_failure=True,
1086
+ )
1087
+ )
1088
+ if serial:
1089
+ prepare_serial_run_sh(run_sh)
1090
+ run_entry = run_step(
1091
+ run_tests_command(serial=serial),
1092
+ WORKSPACE,
1093
+ timeout=branch_timeout,
1094
+ env=env,
1095
+ step="run_tests",
1096
+ accept_failure=True,
1097
+ )
1098
+ branch_log.append(run_entry)
1099
+ branch_log.append(cleanup_lingering_processes())
1100
+ xml_path = find_results_xml()
1101
+ if xml_path is None:
1102
+ if best_xml:
1103
+ merge_best_xml(best_xml)
1104
+ break
1105
+ if serial:
1106
+ result["test_branch_errors"][branch] = [
1107
+ {
1108
+ "error_code": "missing_results_xml",
1109
+ "error_details": "eval/results.xml was not produced",
1110
+ }
1111
+ ]
1112
+ inject_not_run(result, branch, tests, "missing_results_xml")
1113
+ break
1114
+ serial = True
1115
+ continue
1116
+ raw_xml = xml_path.read_text(errors="replace")
1117
+ crashes, n_tests, failures, missing = branch_attempt_metrics(
1118
+ raw_xml,
1119
+ run_output=run_entry.get("output", ""),
1120
+ expected_tests=n_expected,
1121
+ )
1122
+ useful = count_junit_passed(raw_xml)
1123
+ quality = (
1124
+ int(crashes == 0 and missing == 0),
1125
+ n_tests,
1126
+ useful,
1127
+ )
1128
+ if quality > best_quality:
1129
+ best_xml = raw_xml
1130
+ best_quality = quality
1131
+ retry = needs_serial_retry(
1132
+ serial=serial,
1133
+ crashes=crashes,
1134
+ missing=missing,
1135
+ failures=failures,
1136
+ n_tests=n_tests,
1137
+ expected_tests=n_expected,
1138
+ run_output=run_entry.get("output", ""),
1139
+ )
1140
+ if not retry:
1141
+ merge_best_xml(best_xml)
1142
+ break
1143
+ serial = True
1144
+ for entry in branch_log:
1145
+ entry["branch"] = branch
1146
+ result["log"].extend(branch_log)
1147
+
1148
+ return result
1149
+
1150
+
1151
+ def write_outputs(result: dict[str, Any], metadata: dict[str, Any]) -> None:
1152
+ LOG_DIR.mkdir(parents=True, exist_ok=True)
1153
+ write_json(LOG_DIR / "programgym_eval.json", result)
1154
+ write_json(LOG_DIR / "harbor_diagnostics.json", diagnostics(result, metadata))
1155
+ rewards = summarize(result, metadata)
1156
+ write_json(LOG_DIR / "reward.json", rewards)
1157
+ (LOG_DIR / "reward.txt").write_text(str(rewards["reward"]))
1158
+
1159
+
1160
+ def main() -> None:
1161
+ LOG_DIR.mkdir(parents=True, exist_ok=True)
1162
+ log_path = LOG_DIR / "programgym_eval.log"
1163
+ metadata = json.loads(METADATA_PATH.read_text())
1164
+ branches = metadata.get("branches", {})
1165
+ try:
1166
+ result = evaluate(metadata)
1167
+ except Exception as exc:
1168
+ error_code = type(exc).__name__
1169
+ result = {
1170
+ "test_results": [],
1171
+ "error_code": error_code,
1172
+ "error_details": str(exc),
1173
+ "log": [
1174
+ {
1175
+ "step": "evaluator_exception",
1176
+ "exception_info": traceback.format_exc(),
1177
+ "returncode": 1,
1178
+ }
1179
+ ],
1180
+ "solution_branch": "submission",
1181
+ "test_branches": [
1182
+ name for name, info in branches.items() if not info.get("ignored")
1183
+ ],
1184
+ "test_branch_errors": {
1185
+ "__evaluator__": [{"error_code": error_code, "error_details": str(exc)}]
1186
+ },
1187
+ "executable_hash": None,
1188
+ "warnings": [],
1189
+ }
1190
+ for branch, info in branches.items():
1191
+ if info.get("ignored"):
1192
+ continue
1193
+ inject_not_run(result, branch, branch_tests(info), error_code)
1194
+ log_path.write_text(traceback.format_exc())
1195
+ else:
1196
+ log_path.write_text("")
1197
+ write_outputs(result, metadata)
1198
+
1199
+
1200
+ if __name__ == "__main__":
1201
+ main()
zju-fast-lab--lbfgs-lite.a96c50e/tests/programgym_task.json ADDED
@@ -0,0 +1,302 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "branches": {
3
+ "generated_module_01": {
4
+ "ignore_reason": "",
5
+ "ignored": false,
6
+ "ignored_tests": [
7
+ {
8
+ "name": "eval.tests.test_golden_output.test_stdout_is_byte_identical_to_golden",
9
+ "reasons": [
10
+ {
11
+ "id": "missing_fixture_assets",
12
+ "message": "pytest test references fixture assets that are not packaged",
13
+ "path": "eval/tests/test_golden_output.py",
14
+ "repair_hint": "Package referenced fixture, resource, golden, or test data files with the eval branch.",
15
+ "severity": "error",
16
+ "stage": "static_lint"
17
+ }
18
+ ]
19
+ },
20
+ {
21
+ "name": "eval.tests.test_trajectory_order.test_summary_cost_is_rendered_in_scientific_notation",
22
+ "reasons": [
23
+ {
24
+ "id": "short_substring",
25
+ "message": "pytest test uses a too-short substring oracle",
26
+ "path": "eval/tests/test_trajectory_order.py",
27
+ "repair_hint": "Use a longer, specific substring or an exact normalized output comparison.",
28
+ "severity": "error",
29
+ "stage": "static_lint"
30
+ }
31
+ ]
32
+ }
33
+ ],
34
+ "tests": [
35
+ "eval.tests.test_convergence.test_every_2d_block_minimized_to_one",
36
+ "eval.tests.test_convergence.test_final_cost_matches_separated_max_variables",
37
+ "eval.tests.test_convergence.test_minimized_cost_is_nonnegative",
38
+ "eval.tests.test_convergence.test_minimized_cost_reaches_near_zero",
39
+ "eval.tests.test_convergence.test_minimizer_has_200_decision_variables",
40
+ "eval.tests.test_convergence.test_optimal_variables_reach_one",
41
+ "eval.tests.test_convergence.test_reports_lbfgs_convergence_return_value",
42
+ "eval.tests.test_convergence.test_returns_success_code",
43
+ "eval.tests.test_convergence_criterion.test_final_iteration_meets_exact_g_epsilon_criterion",
44
+ "eval.tests.test_convergence_criterion.test_final_variable_infinity_norm_is_unit_converged",
45
+ "eval.tests.test_convergence_criterion.test_prior_iteration_does_not_meet_criterion",
46
+ "eval.tests.test_convergence_criterion.test_reported_final_gradient_is_below_g_epsilon_directly",
47
+ "eval.tests.test_convergence_criterion.test_termination_is_gradient_criterion_not_max_iterations",
48
+ "eval.tests.test_determinism.test_command_line_arguments_are_ignored[argv0]",
49
+ "eval.tests.test_determinism.test_command_line_arguments_are_ignored[argv1]",
50
+ "eval.tests.test_determinism.test_command_line_arguments_are_ignored[argv2]",
51
+ "eval.tests.test_determinism.test_command_line_arguments_are_ignored[argv3]",
52
+ "eval.tests.test_determinism.test_command_line_arguments_are_ignored[argv4]",
53
+ "eval.tests.test_determinism.test_empty_args_still_succeed[--]",
54
+ "eval.tests.test_determinism.test_empty_args_still_succeed[--help]",
55
+ "eval.tests.test_determinism.test_empty_args_still_succeed[-x]",
56
+ "eval.tests.test_determinism.test_output_contains_no_nan_or_inf_value",
57
+ "eval.tests.test_determinism.test_output_is_byte_identical_across_runs",
58
+ "eval.tests.test_determinism.test_run_finishes_within_timeout",
59
+ "eval.tests.test_determinism.test_stderr_is_empty",
60
+ "eval.tests.test_golden_output.test_golden_structure_matches_semantic_parsers",
61
+ "eval.tests.test_golden_output.test_stdout_is_byte_identical_to_golden",
62
+ "eval.tests.test_initial_values.test_all_blocks_start_identically",
63
+ "eval.tests.test_initial_values.test_first_function_value_bounds",
64
+ "eval.tests.test_initial_values.test_first_gradient_norm_matches_magnitude",
65
+ "eval.tests.test_initial_values.test_first_iteration_index_is_one",
66
+ "eval.tests.test_initial_values.test_first_variables_near_initial_guess",
67
+ "eval.tests.test_input_robustness.test_batch_stdin_is_ignored[0\\n1\\n-2.5\\ninf\\nnan\\n]",
68
+ "eval.tests.test_input_robustness.test_batch_stdin_is_ignored[alpha\\nbeta\\ngamma\\n--flag value\\n]",
69
+ "eval.tests.test_input_robustness.test_batch_stdin_is_ignored[one line\\n]",
70
+ "eval.tests.test_input_robustness.test_batch_stdin_is_ignored[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\\n]",
71
+ "eval.tests.test_input_robustness.test_many_arguments_are_ignored",
72
+ "eval.tests.test_input_robustness.test_non_c_locale_environment_does_not_change_float_formatting[env_override0]",
73
+ "eval.tests.test_input_robustness.test_non_c_locale_environment_does_not_change_float_formatting[env_override1]",
74
+ "eval.tests.test_input_robustness.test_non_c_locale_environment_does_not_change_float_formatting[env_override2]",
75
+ "eval.tests.test_input_robustness.test_non_c_locale_environment_does_not_change_float_formatting[env_override3]",
76
+ "eval.tests.test_input_robustness.test_oversized_single_argument_is_ignored_without_overflow",
77
+ "eval.tests.test_input_robustness.test_runs_with_no_filesystem_side_effect",
78
+ "eval.tests.test_input_robustness.test_zero_length_stdin_is_tolerated",
79
+ "eval.tests.test_objective_consistency.test_each_block_contributes_invariantly_to_total_cost",
80
+ "eval.tests.test_objective_consistency.test_every_iteration_cost_and_gradient_are_finite_and_consistent",
81
+ "eval.tests.test_objective_consistency.test_final_summary_cost_matches_final_optimal_variables",
82
+ "eval.tests.test_objective_consistency.test_reported_cost_matches_recomputed_cost[0]",
83
+ "eval.tests.test_objective_consistency.test_reported_cost_matches_recomputed_cost[10]",
84
+ "eval.tests.test_objective_consistency.test_reported_cost_matches_recomputed_cost[1]",
85
+ "eval.tests.test_objective_consistency.test_reported_cost_matches_recomputed_cost[20]",
86
+ "eval.tests.test_objective_consistency.test_reported_cost_matches_recomputed_cost[2]",
87
+ "eval.tests.test_objective_consistency.test_reported_cost_matches_recomputed_cost[30]",
88
+ "eval.tests.test_objective_consistency.test_reported_cost_matches_recomputed_cost[39]",
89
+ "eval.tests.test_objective_consistency.test_reported_cost_matches_recomputed_cost[3]",
90
+ "eval.tests.test_objective_consistency.test_reported_cost_matches_recomputed_cost[4]",
91
+ "eval.tests.test_objective_consistency.test_reported_cost_matches_recomputed_cost[5]",
92
+ "eval.tests.test_objective_consistency.test_reported_gradient_matches_recomputed_gradient[0]",
93
+ "eval.tests.test_objective_consistency.test_reported_gradient_matches_recomputed_gradient[10]",
94
+ "eval.tests.test_objective_consistency.test_reported_gradient_matches_recomputed_gradient[1]",
95
+ "eval.tests.test_objective_consistency.test_reported_gradient_matches_recomputed_gradient[20]",
96
+ "eval.tests.test_objective_consistency.test_reported_gradient_matches_recomputed_gradient[2]",
97
+ "eval.tests.test_objective_consistency.test_reported_gradient_matches_recomputed_gradient[30]",
98
+ "eval.tests.test_objective_consistency.test_reported_gradient_matches_recomputed_gradient[39]",
99
+ "eval.tests.test_objective_consistency.test_reported_gradient_matches_recomputed_gradient[3]",
100
+ "eval.tests.test_objective_consistency.test_reported_gradient_matches_recomputed_gradient[4]",
101
+ "eval.tests.test_objective_consistency.test_reported_gradient_matches_recomputed_gradient[5]",
102
+ "eval.tests.test_output_format.test_each_iteration_block_six_lines",
103
+ "eval.tests.test_output_format.test_exit_code_matches_reported_return_value",
104
+ "eval.tests.test_output_format.test_iteration_header_numbers_ascending",
105
+ "eval.tests.test_output_format.test_minimized_cost_is_exponential_small_notation",
106
+ "eval.tests.test_output_format.test_required_labels_present[Function Value: ]",
107
+ "eval.tests.test_output_format.test_required_labels_present[Gradient Inf Norm: ]",
108
+ "eval.tests.test_output_format.test_required_labels_present[Iteration: ]",
109
+ "eval.tests.test_output_format.test_required_labels_present[L-BFGS Optimization Returned: ]",
110
+ "eval.tests.test_output_format.test_required_labels_present[Minimized Cost: ]",
111
+ "eval.tests.test_output_format.test_required_labels_present[Optimal Variables:]",
112
+ "eval.tests.test_output_format.test_required_labels_present[Variables:]",
113
+ "eval.tests.test_output_format.test_separator_rows_count_is_41",
114
+ "eval.tests.test_output_format.test_stdout_shape_has_separator_and_summary",
115
+ "eval.tests.test_output_format.test_summary_field_order",
116
+ "eval.tests.test_output_format.test_summary_separator_comes_after_last_iteration",
117
+ "eval.tests.test_output_format.test_summary_variable_row_is_all_ones",
118
+ "eval.tests.test_progress_trajectory.test_all_function_values_finite",
119
+ "eval.tests.test_progress_trajectory.test_all_gradient_norms_finite",
120
+ "eval.tests.test_progress_trajectory.test_cost_dropped_by_many_orders_of_magnitude",
121
+ "eval.tests.test_progress_trajectory.test_each_iteration_reports_200_variables",
122
+ "eval.tests.test_progress_trajectory.test_early_iterations_only_modestly_move_variables",
123
+ "eval.tests.test_progress_trajectory.test_exactly_40_iterations_reported",
124
+ "eval.tests.test_progress_trajectory.test_final_gradient_satisfies_g_epsilon",
125
+ "eval.tests.test_progress_trajectory.test_first_gnorm_is_large_and_final_gnorm_tiny",
126
+ "eval.tests.test_progress_trajectory.test_function_value_is_monotone_nonincreasing",
127
+ "eval.tests.test_progress_trajectory.test_function_value_strictly_decreases_early",
128
+ "eval.tests.test_progress_trajectory.test_iteration_indices_are_sequential",
129
+ "eval.tests.test_subproblem_symmetry.test_blocks_remain_identical_at_named_iteration[10]",
130
+ "eval.tests.test_subproblem_symmetry.test_blocks_remain_identical_at_named_iteration[1]",
131
+ "eval.tests.test_subproblem_symmetry.test_blocks_remain_identical_at_named_iteration[20]",
132
+ "eval.tests.test_subproblem_symmetry.test_blocks_remain_identical_at_named_iteration[2]",
133
+ "eval.tests.test_subproblem_symmetry.test_blocks_remain_identical_at_named_iteration[30]",
134
+ "eval.tests.test_subproblem_symmetry.test_blocks_remain_identical_at_named_iteration[39]",
135
+ "eval.tests.test_subproblem_symmetry.test_blocks_remain_identical_at_named_iteration[5]",
136
+ "eval.tests.test_subproblem_symmetry.test_final_iteration_blocks_converge_to_symmetric_one",
137
+ "eval.tests.test_subproblem_symmetry.test_final_summary_optimal_variables_are_even_odd_symmetric",
138
+ "eval.tests.test_subproblem_symmetry.test_per_block_cost_is_identical_across_all_subproblems",
139
+ "eval.tests.test_trajectory_order.test_all_intermediate_costs_strictly_above_final_cost",
140
+ "eval.tests.test_trajectory_order.test_cost_dynamic_range_spans_twelve_orders",
141
+ "eval.tests.test_trajectory_order.test_first_iteration_total_cost_below_analytical_initial_cost",
142
+ "eval.tests.test_trajectory_order.test_function_value_strictly_decreases_across_every_transition",
143
+ "eval.tests.test_trajectory_order.test_initial_guess_block_cost_is_analytically_exact[0]",
144
+ "eval.tests.test_trajectory_order.test_initial_guess_block_cost_is_analytically_exact[13]",
145
+ "eval.tests.test_trajectory_order.test_initial_guess_block_cost_is_analytically_exact[49]",
146
+ "eval.tests.test_trajectory_order.test_initial_guess_block_cost_is_analytically_exact[99]",
147
+ "eval.tests.test_trajectory_order.test_summary_cost_is_rendered_in_scientific_notation",
148
+ "eval.tests.test_trajectory_order.test_summary_return_line_is_exact_literal_zero",
149
+ "eval.tests.test_update_geometry.test_early_steps_are_strict_descent_directions",
150
+ "eval.tests.test_update_geometry.test_last_iteration_equals_summary_optimal_variables",
151
+ "eval.tests.test_update_geometry.test_material_forward_progress_with_converged_plateau",
152
+ "eval.tests.test_update_geometry.test_per_block_optimality_is_consistent_with_cost_sign",
153
+ "eval.tests.test_update_geometry.test_step_from_initial_guess_to_first_iteration_is_descent",
154
+ "eval.tests.test_update_geometry.test_summary_minimized_cost_equals_last_iteration_cost",
155
+ "eval.tests.test_update_geometry.test_weak_wolfe_curvature_condition_holds_for_each_step"
156
+ ]
157
+ },
158
+ "generated_module_02": {
159
+ "ignore_reason": "",
160
+ "ignored": false,
161
+ "ignored_tests": [],
162
+ "tests": [
163
+ "eval.tests.test_argv_indifference.test_argv_fully_ignored_byte_equal",
164
+ "eval.tests.test_argv_indifference.test_exit_code_identical_to_no_args[flags]",
165
+ "eval.tests.test_argv_indifference.test_exit_code_identical_to_no_args[many_positionals]",
166
+ "eval.tests.test_argv_indifference.test_exit_code_identical_to_no_args[mixed]",
167
+ "eval.tests.test_argv_indifference.test_exit_code_identical_to_no_args[none]",
168
+ "eval.tests.test_argv_indifference.test_exit_code_identical_to_no_args[numeric]",
169
+ "eval.tests.test_argv_indifference.test_exit_code_identical_to_no_args[single_positional]",
170
+ "eval.tests.test_argv_indifference.test_exit_code_identical_to_no_args[unnamed]",
171
+ "eval.tests.test_argv_indifference.test_stdout_identical_to_no_args[flags]",
172
+ "eval.tests.test_argv_indifference.test_stdout_identical_to_no_args[many_positionals]",
173
+ "eval.tests.test_argv_indifference.test_stdout_identical_to_no_args[mixed]",
174
+ "eval.tests.test_argv_indifference.test_stdout_identical_to_no_args[none]",
175
+ "eval.tests.test_argv_indifference.test_stdout_identical_to_no_args[numeric]",
176
+ "eval.tests.test_argv_indifference.test_stdout_identical_to_no_args[single_positional]",
177
+ "eval.tests.test_argv_indifference.test_stdout_identical_to_no_args[unnamed]",
178
+ "eval.tests.test_convergence.test_full_convergence_semantics",
179
+ "eval.tests.test_convergence.test_minimized_cost_is_nonnegative",
180
+ "eval.tests.test_convergence.test_minimized_cost_is_tiny",
181
+ "eval.tests.test_convergence.test_minimized_cost_scientific_negative_exponent",
182
+ "eval.tests.test_convergence.test_optimal_variable_count_is_exactly_200",
183
+ "eval.tests.test_convergence.test_optimal_variables_finite",
184
+ "eval.tests.test_convergence.test_optimal_variables_within_tolerance[0.001]",
185
+ "eval.tests.test_convergence.test_optimal_variables_within_tolerance[0.01]",
186
+ "eval.tests.test_convergence.test_optimal_variables_within_tolerance[0.1]",
187
+ "eval.tests.test_convergence.test_returned_code_is_convergence",
188
+ "eval.tests.test_determinism_stderr.test_no_crash_and_clean_exit",
189
+ "eval.tests.test_determinism_stderr.test_repeated_invocations_are_byte_identical",
190
+ "eval.tests.test_determinism_stderr.test_stderr_is_empty",
191
+ "eval.tests.test_determinism_stderr.test_stdout_nonempty_with_full_report",
192
+ "eval.tests.test_determinism_stderr.test_stdout_stable_over_repeats[2]",
193
+ "eval.tests.test_determinism_stderr.test_stdout_stable_over_repeats[3]",
194
+ "eval.tests.test_exit_code.test_exit_code_is_zero[dim_override]",
195
+ "eval.tests.test_exit_code.test_exit_code_is_zero[help_flag]",
196
+ "eval.tests.test_exit_code.test_exit_code_is_zero[no_args]",
197
+ "eval.tests.test_exit_code.test_exit_code_is_zero[numeric_args]",
198
+ "eval.tests.test_exit_code.test_exit_code_is_zero[positional]",
199
+ "eval.tests.test_exit_code.test_exit_code_is_zero[unknown_flag]",
200
+ "eval.tests.test_exit_code.test_exit_code_is_zero[verbose_flag]",
201
+ "eval.tests.test_exit_code.test_exit_code_is_zero[version_flag]",
202
+ "eval.tests.test_exit_code.test_exit_code_matches_convergence_constant",
203
+ "eval.tests.test_exit_code.test_exit_code_zero_plain",
204
+ "eval.tests.test_exit_code.test_run_returns_number_printed_in_report",
205
+ "eval.tests.test_formatting.test_every_optimal_variable_tokens_parse_and_near_one",
206
+ "eval.tests.test_formatting.test_minimized_cost_value_is_parseable_float",
207
+ "eval.tests.test_formatting.test_monitor_variables_rows_have_200_numeric_tokens[0]",
208
+ "eval.tests.test_formatting.test_monitor_variables_rows_have_200_numeric_tokens[1]",
209
+ "eval.tests.test_formatting.test_monitor_variables_rows_have_200_numeric_tokens[2]",
210
+ "eval.tests.test_formatting.test_optimal_variables_on_single_row",
211
+ "eval.tests.test_formatting.test_precision_uses_four_significant_digits",
212
+ "eval.tests.test_formatting.test_stdout_no_carriage_returns",
213
+ "eval.tests.test_monitoring.test_at_least_two_iterations_and_monotonic",
214
+ "eval.tests.test_monitoring.test_block_separators_match_iteration_count",
215
+ "eval.tests.test_monitoring.test_every_block_has_all_fields",
216
+ "eval.tests.test_monitoring.test_first_function_value_is_large_initial_cost",
217
+ "eval.tests.test_monitoring.test_function_value_monotonically_decreases",
218
+ "eval.tests.test_monitoring.test_function_value_starts_large_and_ends_tiny",
219
+ "eval.tests.test_monitoring.test_gradient_inf_norm_decreases_over_iterations",
220
+ "eval.tests.test_monitoring.test_iteration_indices_are_strictly_increasing",
221
+ "eval.tests.test_report_semantics.test_all_monitoring_blocks_precede_final_report",
222
+ "eval.tests.test_report_semantics.test_convergence_gradient_below_g_epsilon",
223
+ "eval.tests.test_report_semantics.test_every_function_value_line_is_parseable_nonnegative",
224
+ "eval.tests.test_report_semantics.test_final_monitored_cost_equals_reported_minimized_cost",
225
+ "eval.tests.test_report_semantics.test_final_monitored_variables_equal_reported_optimal",
226
+ "eval.tests.test_report_semantics.test_first_output_line_is_monitoring_separator",
227
+ "eval.tests.test_report_semantics.test_gradient_inf_norm_format_parseable_for_all_iterations",
228
+ "eval.tests.test_report_semantics.test_iteration_count_matches_expected_convergence_count",
229
+ "eval.tests.test_report_semantics.test_monitor_and_report_returned_line_agree",
230
+ "eval.tests.test_report_semantics.test_optimal_variables_printed_exactly_as_ones",
231
+ "eval.tests.test_report_semantics.test_report_section_order",
232
+ "eval.tests.test_stdout_structure.test_optimal_variables_is_final_section",
233
+ "eval.tests.test_stdout_structure.test_report_minimized_cost_header_present",
234
+ "eval.tests.test_stdout_structure.test_report_optimal_variables_header_present",
235
+ "eval.tests.test_stdout_structure.test_report_returned_line_present",
236
+ "eval.tests.test_stdout_structure.test_report_section_separator_present",
237
+ "eval.tests.test_stdout_structure.test_required_labels_present[cost_line]",
238
+ "eval.tests.test_stdout_structure.test_required_labels_present[function_value_header]",
239
+ "eval.tests.test_stdout_structure.test_required_labels_present[gradient_header]",
240
+ "eval.tests.test_stdout_structure.test_required_labels_present[iteration_header]",
241
+ "eval.tests.test_stdout_structure.test_required_labels_present[optimal_vars_header]",
242
+ "eval.tests.test_stdout_structure.test_required_labels_present[returned_line]",
243
+ "eval.tests.test_stdout_structure.test_required_labels_present[variables_header]",
244
+ "eval.tests.test_stdout_structure.test_returned_line_single_occurrence"
245
+ ]
246
+ }
247
+ },
248
+ "commit": "a96c50e3fdf8b5278577522a2c5e75766c8670bb",
249
+ "data_source": "synthetic_programgym",
250
+ "difficulty": "easy",
251
+ "difficulty_score": 1.2513948500401044,
252
+ "eval_clean_hashes": [
253
+ "f8ceff7c78780dffbce7611894be3da6e31cc56ba32d016efd0d28944c901922"
254
+ ],
255
+ "input_record": {
256
+ "commit": "a96c50e3fdf8b5278577522a2c5e75766c8670bb",
257
+ "difficulty": "easy",
258
+ "difficulty_code_lines": 892,
259
+ "difficulty_has_tests": false,
260
+ "difficulty_product_code_lines": 892,
261
+ "difficulty_runtime_deps": 1,
262
+ "difficulty_score": 1.2513948500401044,
263
+ "difficulty_test_code_lines": 0,
264
+ "full_name": "ZJU-FAST-Lab/LBFGS-Lite",
265
+ "input_joern_zip": "cpp_joern/ZJU-FAST-Lab__LBFGS-Lite.zip",
266
+ "joern_status": true,
267
+ "joern_time": 9.515045106876642,
268
+ "language": "cpp",
269
+ "pb_match": [
270
+ {
271
+ "pb_fullname": "facebookresearch/fastText",
272
+ "rank": 430,
273
+ "similarity": 0.47460564970970154
274
+ }
275
+ ],
276
+ "repo_path": "cpp/ZJU-FAST-Lab__LBFGS-Lite",
277
+ "source": "commit:a96c50e3fdf8b5278577522a2c5e75766c8670bb",
278
+ "status": "done",
279
+ "url": "https://github.com/ZJU-FAST-Lab/LBFGS-Lite"
280
+ },
281
+ "instance_id": "ZJU-FAST-Lab__LBFGS-Lite.a96c50e",
282
+ "language": "cpp",
283
+ "module_iterations": [
284
+ {
285
+ "actual_iterations": 5,
286
+ "branch_name": "generated_module_01",
287
+ "iteration_limit": 5,
288
+ "module_index": 1,
289
+ "module_kind": "source",
290
+ "termination_reason": "early_stopping"
291
+ },
292
+ {
293
+ "actual_iterations": 3,
294
+ "branch_name": "generated_module_02",
295
+ "iteration_limit": 5,
296
+ "module_index": 2,
297
+ "module_kind": "source",
298
+ "termination_reason": "module_coverage_threshold_reached"
299
+ }
300
+ ],
301
+ "repository": "ZJU-FAST-Lab/LBFGS-Lite"
302
+ }
zju-fast-lab--lbfgs-lite.a96c50e/tests/test.sh ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # Verifier exec may not inherit image ENV (Modal/gVisor, login-shell resets).
5
+ export PATH="/usr/local/go/bin:/go/bin:/usr/local/cargo/bin:/root/.cargo/bin:${PATH}"
6
+
7
+ mkdir -p /logs/verifier /logs/artifacts
8
+
9
+ write_failure() {
10
+ local code="$1"
11
+ local details="$2"
12
+ python3 - "$code" "$details" <<'PY'
13
+ import json
14
+ import sys
15
+ from pathlib import Path
16
+
17
+ code, details = sys.argv[1:3]
18
+ try:
19
+ metadata = json.loads(Path("/tests/programgym_task.json").read_text())
20
+ n_tests = sum(
21
+ len([
22
+ name for name in info.get("tests", [])
23
+ if name not in {item.get("name") for item in info.get("ignored_tests", [])}
24
+ ])
25
+ for branch, info in metadata.get("branches", {}).items()
26
+ if not info.get("ignored")
27
+ )
28
+ except Exception:
29
+ n_tests = 0
30
+ result = {
31
+ "test_results": [],
32
+ "error_code": code,
33
+ "error_details": details,
34
+ "log": [],
35
+ "solution_branch": "submission",
36
+ "test_branches": [],
37
+ "test_branch_errors": {
38
+ "__infra__": [{"error_code": code, "error_details": details}]
39
+ },
40
+ "executable_hash": None,
41
+ "warnings": [],
42
+ }
43
+ diagnostics = {
44
+ "pass_rate": 0.0,
45
+ "resolved": 0,
46
+ "n_passed": 0,
47
+ "n_tests": n_tests,
48
+ "n_branch_errors": 1,
49
+ "infra_error": 1,
50
+ "executable_hash_present": 0,
51
+ }
52
+ Path("/logs/verifier/programgym_eval.json").write_text(
53
+ json.dumps(result, indent=2, sort_keys=True)
54
+ )
55
+ Path("/logs/verifier/harbor_diagnostics.json").write_text(
56
+ json.dumps(diagnostics, indent=2, sort_keys=True)
57
+ )
58
+ Path("/logs/verifier/reward.json").write_text(
59
+ json.dumps(
60
+ {"reward": 0.0, "resolved": 0.0, "almost_resolved": 0.0},
61
+ indent=2,
62
+ sort_keys=True,
63
+ )
64
+ )
65
+ Path("/logs/verifier/reward.txt").write_text("0.0")
66
+ Path("/logs/verifier/programgym_eval.log").write_text(details)
67
+ PY
68
+ }
69
+
70
+ if ! command -v python3 >/dev/null 2>&1; then
71
+ write_failure "missing_python3" "python3 is required in the cleanroom image"
72
+ exit 0
73
+ fi
74
+
75
+ if ! python3 /tests/programgym_evaluator.py; then
76
+ if [ ! -s /logs/verifier/reward.txt ]; then
77
+ write_failure "evaluator_crashed" \
78
+ "programgym_evaluator.py exited non-zero with no reward written"
79
+ fi
80
+ fi
81
+
82
+ exit 0
zju-fast-lab--lbfgs-lite.a96c50e/tests/workspace.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c561cba14bf4e9855837a9067068d63c7385f41cf43b28dcc4ede3f0834db5e1
3
+ size 13485
zlthinker--stba.c0034d6/environment/Dockerfile ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu:22.04
2
+ ARG PROGRAMGYM_APT_REPOSITORY_BASE_URL=""
3
+ ARG PROGRAMGYM_GOPROXY="https://proxy.golang.org,direct"
4
+ ARG PROGRAMGYM_NPM_REGISTRY="https://registry.npmjs.org/"
5
+ ARG PROGRAMGYM_NPM_STRICT_SSL="true"
6
+ ARG PROGRAMGYM_PYPI_INDEX_URL="https://pypi.org/simple"
7
+ ARG PROGRAMGYM_PYPI_TRUSTED_HOST=""
8
+ ARG PROGRAMGYM_UV_INSECURE_HOST=""
9
+ ENV GOPROXY=${PROGRAMGYM_GOPROXY}
10
+ ENV PIP_INDEX_URL=${PROGRAMGYM_PYPI_INDEX_URL}
11
+ ENV PIP_TRUSTED_HOST=${PROGRAMGYM_PYPI_TRUSTED_HOST}
12
+ ENV UV_INDEX_URL=${PROGRAMGYM_PYPI_INDEX_URL}
13
+ ENV UV_INSECURE_HOST=${PROGRAMGYM_UV_INSECURE_HOST}
14
+ ENV npm_config_registry=${PROGRAMGYM_NPM_REGISTRY}
15
+ ENV npm_config_strict_ssl=${PROGRAMGYM_NPM_STRICT_SSL}
16
+ COPY harbor_configure_apt_mirror.sh /tmp/harbor_configure_apt_mirror.sh
17
+ RUN chmod 0755 /tmp/harbor_configure_apt_mirror.sh \
18
+ && /bin/bash /tmp/harbor_configure_apt_mirror.sh "${PROGRAMGYM_APT_REPOSITORY_BASE_URL}" \
19
+ && rm -f /tmp/harbor_configure_apt_mirror.sh
20
+ ENV DEBIAN_FRONTEND=noninteractive
21
+ ENV RUSTUP_DIST_SERVER="https://static.rust-lang.org"
22
+ ENV RUSTUP_UPDATE_ROOT="https://static.rust-lang.org/rustup"
23
+ ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
24
+ ENV CARGO_REGISTRIES_CRATES_IO_INDEX="sparse+https://index.crates.io/"
25
+ ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
26
+ ENV GOSUMDB=sum.golang.google.cn
27
+ ENV GOTOOLCHAIN=auto
28
+ ENV UV_CACHE_DIR=/workspace/.cache/uv
29
+ ENV npm_config_cache=/workspace/.cache/npm
30
+ ENV HOME=/workspace
31
+ ENV XDG_CACHE_HOME=/workspace/.cache
32
+ ENV PIP_CACHE_DIR=/workspace/.cache/pip
33
+ ENV PYTHONUSERBASE=/workspace/.local
34
+ ENV PAGER=cat
35
+ ENV MANPAGER=cat
36
+ ENV LESS=-R
37
+ ENV TQDM_DISABLE=1
38
+ RUN apt-get update && apt-get install -y --no-install-recommends bash build-essential ca-certificates git make pkg-config python3 python3-pip autoconf automake gettext file binutils g++ libtool libncurses-dev meson ninja-build python3-pytest python3-pytest-xdist python3-coverage curl tar && rm -rf /var/lib/apt/lists/*
39
+ ARG CMAKE_VERSION=3.31.12
40
+ RUN set -eux; ARCH="$(dpkg --print-architecture)"; case "${ARCH}" in amd64) CMAKE_ARCH="x86_64" ;; arm64) CMAKE_ARCH="aarch64" ;; *) echo "unsupported architecture for CMake: ${ARCH}" >&2; exit 1 ;; esac; curl -fsSL -o /tmp/cmake.tar.gz "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-${CMAKE_ARCH}.tar.gz"; rm -rf /opt/cmake; mkdir -p /opt/cmake; tar -xzf /tmp/cmake.tar.gz --strip-components=1 -C /opt/cmake; ln -sf /opt/cmake/bin/cmake /usr/local/bin/cmake; ln -sf /opt/cmake/bin/ctest /usr/local/bin/ctest; ln -sf /opt/cmake/bin/cpack /usr/local/bin/cpack; rm -f /tmp/cmake.tar.gz; cmake --version
41
+ WORKDIR /workspace
42
+ ADD workspace.tar.gz /workspace/
43
+ COPY executable /workspace/executable
44
+ COPY download.sh /workspace/download.sh
45
+ RUN chmod 755 /workspace/download.sh
46
+ COPY harbor_prepare_download_env.sh /tmp/harbor_prepare_download_env.sh
47
+ RUN chmod 755 /tmp/harbor_prepare_download_env.sh \
48
+ && /bin/bash /tmp/harbor_prepare_download_env.sh \
49
+ && rm -f /workspace/download.sh \
50
+ && rm -f /tmp/harbor_prepare_download_env.sh
51
+ ENV BASH_ENV=/etc/profile.d/programgym_download_env.sh
52
+ RUN chmod 111 /workspace/executable
53
+ WORKDIR /workspace
54
+ # Harbor synthetic ProgramGym adapter: run the agent as an unprivileged user.
55
+ # Keep tool/runtime state under /home/agent and reserve /workspace for the
56
+ # submission handed to the separate verifier. Keep the reference executable
57
+ # execute-only; the oracle temporarily restores owner read permission.
58
+ RUN id -u agent >/dev/null 2>&1 || useradd -m -s /bin/bash agent
59
+ RUN mkdir -p /home/agent \
60
+ && chown -R agent:agent /home/agent /workspace \
61
+ && chown agent:agent /workspace/executable \
62
+ && chmod 111 /workspace/executable
63
+ ENV HOME=/home/agent
64
+ WORKDIR /workspace
zlthinker--stba.c0034d6/environment/docker-compose.yaml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ main:
3
+ build:
4
+ args:
5
+ PROGRAMGYM_APT_REPOSITORY_BASE_URL: ${PROGRAMGYM_APT_REPOSITORY_BASE_URL:-}
6
+ PROGRAMGYM_GOPROXY: ${PROGRAMGYM_GOPROXY:-https://proxy.golang.org,direct}
7
+ PROGRAMGYM_NPM_REGISTRY: ${PROGRAMGYM_NPM_REGISTRY:-https://registry.npmjs.org/}
8
+ PROGRAMGYM_NPM_STRICT_SSL: ${PROGRAMGYM_NPM_STRICT_SSL:-true}
9
+ PROGRAMGYM_PYPI_INDEX_URL: ${PROGRAMGYM_PYPI_INDEX_URL:-https://pypi.org/simple}
10
+ PROGRAMGYM_PYPI_TRUSTED_HOST: ${PROGRAMGYM_PYPI_TRUSTED_HOST:-}
11
+ PROGRAMGYM_UV_INSECURE_HOST: ${PROGRAMGYM_UV_INSECURE_HOST:-}
zlthinker--stba.c0034d6/environment/download.sh ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # download.sh -- ProgramGym download stage for zlthinker/STBA.
3
+ #
4
+ # This stage installs the single system build dependency that is genuinely
5
+ # missing from the base image: the Eigen3 C++ header library, which the STBA
6
+ # build requires via find_package(Eigen3 REQUIRED). The rest of the build
7
+ # toolchain is already present in the base image and is intentionally not
8
+ # reinstalled here.
9
+ #
10
+ # This script performs NO compilation, linking, testing, packaging, or
11
+ # installation of any built artifact. It is meant to be sourced from a read-only
12
+ # repository mount while the container still has network access
13
+ # (source /source_ro/download.sh), so it keeps exported variables in the current
14
+ # shell, never relies on positional arguments, and never calls exit in normal
15
+ # control flow. It does not read any repository build or source file; all
16
+ # dependency information is explicit in this file.
17
+ #
18
+ # Installing a package that is already present is an idempotent no-op, so this
19
+ # script is safe to source repeatedly.
20
+
21
+ export DEBIAN_FRONTEND=noninteractive
22
+
23
+ fail() {
24
+ echo "download.sh: $1" >&2
25
+ if [ "${BASH_SOURCE[0]}" != "$0" ]; then
26
+ return 1
27
+ else
28
+ exit 1
29
+ fi
30
+ }
31
+
32
+ # Refresh the apt package index. A failure here is a real infrastructure problem
33
+ # (e.g. an expired mirror) and must be surfaced, not swallowed.
34
+ if ! apt-get update; then
35
+ fail "apt-get update failed; cannot prepare build dependencies"
36
+ fi
37
+
38
+ # Install the Eigen3 headers required to compile the STBA executable. No compile,
39
+ # link, test, or packaging step runs here -- this only makes the dependency
40
+ # available on the system for the later offline build stage.
41
+ if ! apt-get install -y --no-install-recommends libeigen3-dev; then
42
+ fail "apt-get install of libeigen3-dev failed"
43
+ fi
44
+
45
+ echo "download.sh: Eigen3 headers ready for the build stage"
zlthinker--stba.c0034d6/environment/executable ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bc0cec66e774e1228c66e630b60b8311065720e7691988d4f2214acd9a6dc22b
3
+ size 659344