Generator: pilot analysis and fixes; G0002-G0021 tasks; handover notes merged
- Static bundle checks (name length, seed type, reserved words, contract test classes, testclasses_file), local abaplint parser check before SAP, max_tokens, robust JSON parse - Runner: G2 for CDS views with parameters, contract_check detail in report - G0020 and G0013 fixed by review and revalidated (oracle 100, null 0) - Pilot results in docs/faz1-tasarim.md 11e; handover notes merged into CLAUDE.md and docs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
26
tasks_gen/eval/G0013/generation.json
Normal file
26
tasks_gen/eval/G0013/generation.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"id": "G0013",
|
||||
"pool": "eval",
|
||||
"object_type": "FUNC",
|
||||
"category": "I",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 70.5,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "manual_fix",
|
||||
"by": "Claude review 2026-10-03",
|
||||
"change": "Removed own test class REPL_TEST from the contract and from the spec acceptance (own tests are the model's choice). REPL_TEST stays in the reference as own tests.",
|
||||
"oracle": 100.0,
|
||||
"null": 0
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
108
tasks_gen/eval/G0013/hidden/t21_hidden.clas.abap
Normal file
108
tasks_gen/eval/G0013/hidden/t21_hidden.clas.abap
Normal file
@@ -0,0 +1,108 @@
|
||||
CLASS {{p}}t21_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
TYPES: BEGIN OF ty_result,
|
||||
qty TYPE decfloat34,
|
||||
action TYPE string,
|
||||
subrc TYPE sysubrc,
|
||||
END OF ty_result.
|
||||
METHODS call
|
||||
IMPORTING iv_stock TYPE decfloat34
|
||||
iv_safety TYPE decfloat34
|
||||
iv_lot_size TYPE decfloat34
|
||||
iv_min_order TYPE decfloat34
|
||||
RETURNING VALUE(rs_result) TYPE ty_result.
|
||||
METHODS exact_multiple_lot FOR TESTING.
|
||||
METHODS exact_multiple_single_lot FOR TESTING.
|
||||
METHODS exact_multiple_with_minimum FOR TESTING.
|
||||
METHODS partial_lot_rounds_up FOR TESTING.
|
||||
METHODS stock_above_safety FOR TESTING.
|
||||
METHODS stock_equals_safety FOR TESTING.
|
||||
METHODS no_lot_size_no_rounding FOR TESTING.
|
||||
METHODS minimum_order_applies FOR TESTING.
|
||||
METHODS minimum_order_keeps_quantity FOR TESTING.
|
||||
METHODS negative_lot_size FOR TESTING.
|
||||
METHODS negative_min_order FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t21_hidden IMPLEMENTATION.
|
||||
METHOD call.
|
||||
CALL FUNCTION '{{P}}REPL_QTY'
|
||||
EXPORTING
|
||||
iv_stock = iv_stock
|
||||
iv_safety = iv_safety
|
||||
iv_lot_size = iv_lot_size
|
||||
iv_min_order = iv_min_order
|
||||
IMPORTING
|
||||
ev_order_qty = rs_result-qty
|
||||
ev_action = rs_result-action
|
||||
EXCEPTIONS
|
||||
invalid_input = 1
|
||||
OTHERS = 2.
|
||||
rs_result-subrc = sy-subrc.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD exact_multiple_lot.
|
||||
DATA(ls_result) = call( iv_stock = 0 iv_safety = 100 iv_lot_size = 50 iv_min_order = 0 ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = ls_result-subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 100 ) act = ls_result-qty ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `ORDER` act = ls_result-action ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD exact_multiple_single_lot.
|
||||
DATA(ls_result) = call( iv_stock = 0 iv_safety = 50 iv_lot_size = 50 iv_min_order = 0 ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = ls_result-subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 50 ) act = ls_result-qty ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD exact_multiple_with_minimum.
|
||||
DATA(ls_result) = call( iv_stock = 0 iv_safety = 100 iv_lot_size = 50 iv_min_order = 120 ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 120 ) act = ls_result-qty ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `ORDER` act = ls_result-action ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD partial_lot_rounds_up.
|
||||
DATA(ls_result) = call( iv_stock = 0 iv_safety = 110 iv_lot_size = 50 iv_min_order = 0 ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 150 ) act = ls_result-qty ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `ORDER` act = ls_result-action ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD stock_above_safety.
|
||||
DATA(ls_result) = call( iv_stock = 200 iv_safety = 100 iv_lot_size = 50 iv_min_order = 50 ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = ls_result-qty ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `NONE` act = ls_result-action ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD stock_equals_safety.
|
||||
DATA(ls_result) = call( iv_stock = 100 iv_safety = 100 iv_lot_size = 50 iv_min_order = 0 ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = ls_result-qty ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `NONE` act = ls_result-action ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD no_lot_size_no_rounding.
|
||||
DATA(ls_result) = call( iv_stock = 0 iv_safety = '37.5' iv_lot_size = 0 iv_min_order = 0 ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '37.5' ) act = ls_result-qty ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `ORDER` act = ls_result-action ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD minimum_order_applies.
|
||||
DATA(ls_result) = call( iv_stock = 0 iv_safety = 10 iv_lot_size = 0 iv_min_order = 25 ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 25 ) act = ls_result-qty ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD minimum_order_keeps_quantity.
|
||||
DATA(ls_result) = call( iv_stock = 0 iv_safety = 100 iv_lot_size = 0 iv_min_order = 25 ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 100 ) act = ls_result-qty ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD negative_lot_size.
|
||||
DATA(ls_result) = call( iv_stock = 0 iv_safety = 100 iv_lot_size = -1 iv_min_order = 0 ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = ls_result-subrc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD negative_min_order.
|
||||
DATA(ls_result) = call( iv_stock = 0 iv_safety = 100 iv_lot_size = 0 iv_min_order = -1 ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = ls_result-subrc ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
38
tasks_gen/eval/G0013/reference/repl_qty.func.abap
Normal file
38
tasks_gen/eval/G0013/reference/repl_qty.func.abap
Normal file
@@ -0,0 +1,38 @@
|
||||
FUNCTION {{p}}repl_qty
|
||||
IMPORTING
|
||||
iv_stock TYPE decfloat34
|
||||
iv_safety TYPE decfloat34
|
||||
iv_lot_size TYPE decfloat34
|
||||
iv_min_order TYPE decfloat34
|
||||
EXPORTING
|
||||
ev_order_qty TYPE decfloat34
|
||||
ev_action TYPE string
|
||||
EXCEPTIONS
|
||||
invalid_input.
|
||||
|
||||
IF iv_lot_size < 0 OR iv_min_order < 0.
|
||||
RAISE invalid_input.
|
||||
ENDIF.
|
||||
|
||||
DATA lv_required TYPE decfloat34.
|
||||
lv_required = iv_safety - iv_stock.
|
||||
|
||||
IF lv_required <= 0.
|
||||
ev_order_qty = 0.
|
||||
ev_action = 'NONE'.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF iv_lot_size > 0.
|
||||
ev_order_qty = ceil( lv_required / iv_lot_size ) * iv_lot_size.
|
||||
ELSE.
|
||||
ev_order_qty = lv_required.
|
||||
ENDIF.
|
||||
|
||||
IF ev_order_qty < iv_min_order.
|
||||
ev_order_qty = iv_min_order.
|
||||
ENDIF.
|
||||
|
||||
ev_action = 'ORDER'.
|
||||
|
||||
ENDFUNCTION.
|
||||
65
tasks_gen/eval/G0013/reference/t21_test.clas.abap
Normal file
65
tasks_gen/eval/G0013/reference/t21_test.clas.abap
Normal file
@@ -0,0 +1,65 @@
|
||||
CLASS {{p}}repl_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
TYPES: BEGIN OF ty_result,
|
||||
qty TYPE decfloat34,
|
||||
action TYPE string,
|
||||
subrc TYPE sysubrc,
|
||||
END OF ty_result.
|
||||
METHODS call
|
||||
IMPORTING iv_stock TYPE decfloat34
|
||||
iv_safety TYPE decfloat34
|
||||
iv_lot_size TYPE decfloat34
|
||||
iv_min_order TYPE decfloat34
|
||||
RETURNING VALUE(rs_result) TYPE ty_result.
|
||||
METHODS exact_multiple FOR TESTING.
|
||||
METHODS partial_lot FOR TESTING.
|
||||
METHODS no_order FOR TESTING.
|
||||
METHODS minimum_order FOR TESTING.
|
||||
METHODS invalid_input FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}repl_test IMPLEMENTATION.
|
||||
METHOD call.
|
||||
CALL FUNCTION '{{P}}REPL_QTY'
|
||||
EXPORTING
|
||||
iv_stock = iv_stock
|
||||
iv_safety = iv_safety
|
||||
iv_lot_size = iv_lot_size
|
||||
iv_min_order = iv_min_order
|
||||
IMPORTING
|
||||
ev_order_qty = rs_result-qty
|
||||
ev_action = rs_result-action
|
||||
EXCEPTIONS
|
||||
invalid_input = 1
|
||||
OTHERS = 2.
|
||||
rs_result-subrc = sy-subrc.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD exact_multiple.
|
||||
DATA(ls_result) = call( iv_stock = 0 iv_safety = 100 iv_lot_size = 50 iv_min_order = 0 ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 100 ) act = ls_result-qty ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD partial_lot.
|
||||
DATA(ls_result) = call( iv_stock = 0 iv_safety = 101 iv_lot_size = 50 iv_min_order = 0 ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 150 ) act = ls_result-qty ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD no_order.
|
||||
DATA(ls_result) = call( iv_stock = 300 iv_safety = 100 iv_lot_size = 50 iv_min_order = 0 ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = ls_result-qty ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `NONE` act = ls_result-action ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD minimum_order.
|
||||
DATA(ls_result) = call( iv_stock = 0 iv_safety = 5 iv_lot_size = 0 iv_min_order = 20 ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 20 ) act = ls_result-qty ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_input.
|
||||
DATA(ls_result) = call( iv_stock = 0 iv_safety = 100 iv_lot_size = -5 iv_min_order = 0 ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = ls_result-subrc ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
38
tasks_gen/eval/G0013/seed/repl_qty.func.abap
Normal file
38
tasks_gen/eval/G0013/seed/repl_qty.func.abap
Normal file
@@ -0,0 +1,38 @@
|
||||
FUNCTION {{p}}repl_qty
|
||||
IMPORTING
|
||||
iv_stock TYPE decfloat34
|
||||
iv_safety TYPE decfloat34
|
||||
iv_lot_size TYPE decfloat34
|
||||
iv_min_order TYPE decfloat34
|
||||
EXPORTING
|
||||
ev_order_qty TYPE decfloat34
|
||||
ev_action TYPE string
|
||||
EXCEPTIONS
|
||||
invalid_input.
|
||||
|
||||
IF iv_lot_size < 0.
|
||||
RAISE invalid_input.
|
||||
ENDIF.
|
||||
|
||||
DATA lv_required TYPE decfloat34.
|
||||
lv_required = iv_safety - iv_stock.
|
||||
|
||||
IF lv_required <= 0.
|
||||
ev_order_qty = 0.
|
||||
ev_action = 'NONE'.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF iv_lot_size > 0.
|
||||
ev_order_qty = ( floor( lv_required / iv_lot_size ) + 1 ) * iv_lot_size.
|
||||
ELSE.
|
||||
ev_order_qty = lv_required.
|
||||
ENDIF.
|
||||
|
||||
IF ev_order_qty < iv_min_order.
|
||||
ev_order_qty = iv_min_order.
|
||||
ENDIF.
|
||||
|
||||
ev_action = 'ORDER'.
|
||||
|
||||
ENDFUNCTION.
|
||||
38
tasks_gen/eval/G0013/seed/repl_qty_old.func.abap
Normal file
38
tasks_gen/eval/G0013/seed/repl_qty_old.func.abap
Normal file
@@ -0,0 +1,38 @@
|
||||
FUNCTION {{p}}repl_qty_old
|
||||
IMPORTING
|
||||
iv_stock TYPE decfloat34
|
||||
iv_safety TYPE decfloat34
|
||||
iv_lot_size TYPE decfloat34
|
||||
iv_min_order TYPE decfloat34
|
||||
EXPORTING
|
||||
ev_order_qty TYPE decfloat34
|
||||
ev_action TYPE string
|
||||
EXCEPTIONS
|
||||
invalid_input.
|
||||
|
||||
IF iv_lot_size < 0.
|
||||
RAISE invalid_input.
|
||||
ENDIF.
|
||||
|
||||
DATA lv_required TYPE decfloat34.
|
||||
lv_required = iv_safety - iv_stock.
|
||||
|
||||
IF lv_required <= 0.
|
||||
ev_order_qty = 0.
|
||||
ev_action = 'NONE'.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF iv_lot_size > 0.
|
||||
ev_order_qty = ( floor( lv_required / iv_lot_size ) + 1 ) * iv_lot_size.
|
||||
ELSE.
|
||||
ev_order_qty = lv_required.
|
||||
ENDIF.
|
||||
|
||||
IF ev_order_qty < iv_min_order.
|
||||
ev_order_qty = iv_min_order.
|
||||
ENDIF.
|
||||
|
||||
ev_action = 'ORDER'.
|
||||
|
||||
ENDFUNCTION.
|
||||
48
tasks_gen/eval/G0013/spec.md
Normal file
48
tasks_gen/eval/G0013/spec.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# 1. Goal
|
||||
The function module {{P}}REPL_QTY_OLD calculates the replenishment order quantity for a material. Users report two defects:
|
||||
- When the required quantity is exactly a multiple of the lot size, the module orders one lot too many.
|
||||
- The module accepts a negative minimum order quantity. It must report an error instead.
|
||||
The module {{P}}REPL_QTY_OLD is used by a released interface and must not change. Deliver the corrected calculation in the new function module {{P}}REPL_QTY.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- Function group {{P}}FG_REPL exists in package $TMP.
|
||||
- Function module {{P}}REPL_QTY_OLD exists in this group. It is the module in production. It has the two defects above.
|
||||
- The replenishment program will call {{P}}REPL_QTY.
|
||||
|
||||
# 4. Contract
|
||||
Create the function module {{P}}REPL_QTY in function group {{P}}FG_REPL with this interface:
|
||||
|
||||
IMPORTING
|
||||
iv_stock TYPE decfloat34
|
||||
iv_safety TYPE decfloat34
|
||||
iv_lot_size TYPE decfloat34
|
||||
iv_min_order TYPE decfloat34
|
||||
EXPORTING
|
||||
ev_order_qty TYPE decfloat34
|
||||
ev_action TYPE string
|
||||
EXCEPTIONS
|
||||
invalid_input
|
||||
|
||||
ev_action contains the value 'ORDER' or the value 'NONE'.
|
||||
|
||||
# 5. Business rules
|
||||
1. If iv_lot_size is less than 0, or if iv_min_order is less than 0, raise the exception INVALID_INPUT.
|
||||
2. The required quantity is iv_safety minus iv_stock.
|
||||
3. If the required quantity is less than or equal to 0, ev_order_qty is 0 and ev_action is 'NONE'. Rules 4 to 6 do not apply then.
|
||||
4. If iv_lot_size is greater than 0, round the required quantity up to the next multiple of iv_lot_size. A required quantity that is already a multiple of iv_lot_size does not change.
|
||||
5. If iv_lot_size is 0, do not round.
|
||||
6. If ev_order_qty is less than iv_min_order, set ev_order_qty to iv_min_order.
|
||||
7. If ev_order_qty is greater than 0, ev_action is 'ORDER'. Otherwise ev_action is 'NONE'.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 8.16.
|
||||
- Coding standards: Clean ABAP. Keep methods below 40 statements.
|
||||
- Out of scope: do not change the function group {{P}}FG_REPL. Do not change {{P}}REPL_QTY_OLD.
|
||||
|
||||
# 7. Acceptance
|
||||
- The function module {{P}}REPL_QTY is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write ABAP Unit tests for the function module in a global test class.
|
||||
89
tasks_gen/eval/G0013/task.json
Normal file
89
tasks_gen/eval/G0013/task.json
Normal file
@@ -0,0 +1,89 @@
|
||||
{
|
||||
"id": "G0013",
|
||||
"category": "I",
|
||||
"object_type": "FUNC",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 40,
|
||||
"max_activations": 10
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "FUGR",
|
||||
"name": "{{P}}FG_REPL",
|
||||
"description": "Replenishment function group"
|
||||
},
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}REPL_QTY_OLD",
|
||||
"functionGroup": "{{P}}FG_REPL",
|
||||
"file": "seed/repl_qty_old.func.abap",
|
||||
"description": "Faulty replenishment order quantity module"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}REPL_QTY",
|
||||
"functionGroup": "{{P}}FG_REPL",
|
||||
"params": [
|
||||
{
|
||||
"name": "iv_stock",
|
||||
"type": "decfloat34"
|
||||
},
|
||||
{
|
||||
"name": "iv_safety",
|
||||
"type": "decfloat34"
|
||||
},
|
||||
{
|
||||
"name": "iv_lot_size",
|
||||
"type": "decfloat34"
|
||||
},
|
||||
{
|
||||
"name": "iv_min_order",
|
||||
"type": "decfloat34"
|
||||
},
|
||||
{
|
||||
"name": "ev_order_qty",
|
||||
"type": "decfloat34"
|
||||
},
|
||||
{
|
||||
"name": "ev_action",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}FG_REPL",
|
||||
"{{P}}REPL_QTY_OLD"
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T21_HIDDEN",
|
||||
"file": "hidden/t21_hidden.clas.abap",
|
||||
"description": "T21 hidden tests"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}REPL_QTY",
|
||||
"functionGroup": "{{P}}FG_REPL",
|
||||
"file": "reference/repl_qty.func.abap",
|
||||
"description": "Corrected replenishment order quantity module"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}REPL_TEST",
|
||||
"file": "reference/t21_test.clas.abap",
|
||||
"description": "Own tests of the reference (not contract)"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user