Test fixture
Code transformation while preserving behavior and intent.
The model receives the prompt (and optional system message). The run uses scorer rubric_json_metrics with the JSON configuration below. Pass/fail and partial credit are determined entirely by that scorer against the model output; no human grading.
Return JSON only with keys refactor, rationale, tests. Refactor a for-loop that calls array.push() on each iteration to collect transformed items into a result array. Replace it with a single Array.prototype.map call that returns the new array. The output array must contain identical elements in the same order.
{
"metrics": {
"visible": {
"checks": [
{
"contains": [
"map"
]
},
{
"contains": [
"return"
]
},
{
"contains": [
"push"
]
}
]
},
"hidden": {
"checks": [
{
"contains": [
"same order"
]
},
{
"contains": [
"no mutation"
]
},
{
"contains": [
"identical elements"
]
}
]
},
"intent": {
"checks": [
{
"contains": [
"declarative"
]
},
{
"contains": [
"immutability"
]
},
{
"contains": [
"pipeline readability"
]
}
]
}
}
}temperature
0
max_tokens
460
timeout (s)
120
type
scored
file
refactor-array-push-loop-spread.json