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 nested ternary chain (three levels deep) that maps a status code to a label string into an equivalent if/else block. Do not change the return values or the conditions evaluated.
{
"metrics": {
"visible": {
"checks": [
{
"contains": [
"if"
]
},
{
"contains": [
"else"
]
},
{
"contains": [
"ternary"
]
}
]
},
"hidden": {
"checks": [
{
"contains": [
"same output"
]
},
{
"contains": [
"all branches"
]
},
{
"contains": [
"no logic change"
]
}
]
},
"intent": {
"checks": [
{
"contains": [
"readability"
]
},
{
"contains": [
"reduce cognitive load"
]
},
{
"contains": [
"maintainability"
]
}
]
}
}
}temperature
0
max_tokens
460
timeout (s)
120
type
scored
file
refactor-nested-ternary-readable.json