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 module where the same inline conditional expression (checking whether a user role is admin or moderator) appears in three separate places by extracting it into a single named helper function. All call sites must use the helper.
{
"metrics": {
"visible": {
"checks": [
{
"contains": [
"helper function"
]
},
{
"contains": [
"isPrivileged"
]
},
{
"contains": [
"call sites"
]
}
]
},
"hidden": {
"checks": [
{
"contains": [
"all three usages"
]
},
{
"contains": [
"same condition"
]
},
{
"contains": [
"no inline duplication"
]
}
]
},
"intent": {
"checks": [
{
"contains": [
"DRY"
]
},
{
"contains": [
"single definition"
]
},
{
"contains": [
"testability"
]
}
]
}
}
}temperature
0
max_tokens
460
timeout (s)
120
type
scored
file
refactor-inline-conditional-function.json