docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
{
"context": "This criteria evaluates how effectively the engineer uses instrumentation patterns for dynamic method patching, focusing on proper wrapping techniques, duplicate prevention mechanisms, property preservation strategies, and cleanup handling as demonstrated in @opentelemetry/instrumentation-express.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Method Wrapping Implementation",
"description": "Uses proper method wrapping pattern to intercept method calls. Should store the original method reference, replace the target method with a wrapper function that calls the original, and return or assign the wrapped function correctly.",
"max_score": 25
},
{
"name": "Duplicate Patching Prevention",
"description": "Implements a flag or symbol (e.g., a property like `__patched` or using Symbol) to mark patched methods and checks for this flag before applying patches. The isPatched function should correctly identify already-patched methods.",
"max_score": 20
},
{
"name": "Original Reference Storage",
"description": "Stores a reference to the original unpatched method (e.g., as a property on the wrapper or using a WeakMap) to enable proper restoration during unpatch operations.",
"max_score": 15
},
{
"name": "Property Preservation",
"description": "Preserves original method properties on the wrapped function. Should copy properties like name, length, and custom properties using techniques such as Object.defineProperty, Object.getOwnPropertyDescriptors, or similar property copying mechanisms.",
"max_score": 20
},
{
"name": "Unpatch Implementation",
"description": "Implements proper cleanup in unpatchMethod by restoring the original method reference from storage, removing patching flags, and returning the target object to its pre-instrumentation state.",
"max_score": 20
}
]
}