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 plan, refactor, tests. A validation function has a long if/else chain for field names and error messages. Refactor it into a table-driven rules structure.
{
"metrics": {
"intent": {
"checks": [
{
"contains": [
"if/else chain"
]
},
{
"contains": [
"table-driven"
]
},
{
"contains": [
"validation"
]
}
]
},
"visible": {
"checks": [
{
"contains": [
"field names"
]
},
{
"contains": [
"error messages"
]
},
{
"contains": [
"rules"
]
}
]
},
"hidden": {
"checks": [
{
"contains": [
"same errors"
]
},
{
"contains": [
"invalid cases"
]
},
{
"contains": [
"tests"
]
}
]
}
}
}temperature
0
max_tokens
500
timeout (s)
120
type
scored
file
refactor-validation-rules-table.json