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:
Kral
2026-10-03 05:04:23 +02:00
parent 15eb9f1bb2
commit 5de5e2851c
162 changed files with 9943 additions and 23 deletions

View File

@@ -0,0 +1,14 @@
{
"id": "G0012",
"pool": "eval",
"object_type": "FUNC",
"category": "F",
"attempts": [
{
"stage": "validate",
"oracle": 100.0,
"null": 0
}
],
"accepted": true
}

View File

@@ -0,0 +1,120 @@
CLASS {{p}}t14_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS call
IMPORTING iv_quantity TYPE decfloat34
iv_scrap TYPE decfloat34
iv_rework TYPE decfloat34 DEFAULT 0
EXPORTING ev_pct TYPE decfloat34
ev_severity TYPE string
ev_rework TYPE decfloat34
ev_subrc TYPE sysubrc.
METHODS percent_rounds_half_up FOR TESTING.
METHODS zero_scrap_is_ok FOR TESTING.
METHODS low_upper_boundary FOR TESTING.
METHODS high_lower_boundary FOR TESTING.
METHODS high_upper_boundary FOR TESTING.
METHODS critical_above_twenty FOR TESTING.
METHODS rework_unchanged_for_low FOR TESTING.
METHODS rework_set_for_high FOR TESTING.
METHODS quantity_zero_raises FOR TESTING.
METHODS scrap_negative_raises FOR TESTING.
METHODS scrap_above_quantity_raises FOR TESTING.
ENDCLASS.
CLASS {{p}}t14_hidden IMPLEMENTATION.
METHOD call.
ev_pct = 0.
ev_severity = ``.
ev_rework = iv_rework.
CALL FUNCTION '{{P}}PRD_SCRAP'
EXPORTING
iv_quantity = iv_quantity
iv_scrap = iv_scrap
IMPORTING
ev_scrap_pct = ev_pct
ev_severity = ev_severity
CHANGING
cv_rework_qty = ev_rework
EXCEPTIONS
invalid_quantity = 1
scrap_too_high = 2
OTHERS = 3.
ev_subrc = sy-subrc.
ENDMETHOD.
METHOD percent_rounds_half_up.
call( EXPORTING iv_quantity = 800 iv_scrap = 7
IMPORTING ev_pct = DATA(lv_pct) ev_severity = DATA(lv_sev) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '0.9' ) act = lv_pct ).
cl_abap_unit_assert=>assert_equals( exp = `LOW` act = lv_sev ).
ENDMETHOD.
METHOD zero_scrap_is_ok.
call( EXPORTING iv_quantity = 100 iv_scrap = 0
IMPORTING ev_pct = DATA(lv_pct) ev_severity = DATA(lv_sev) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_pct ).
cl_abap_unit_assert=>assert_equals( exp = `OK` act = lv_sev ).
ENDMETHOD.
METHOD low_upper_boundary.
call( EXPORTING iv_quantity = 100 iv_scrap = 5
IMPORTING ev_pct = DATA(lv_pct) ev_severity = DATA(lv_sev) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 5 ) act = lv_pct ).
cl_abap_unit_assert=>assert_equals( exp = `LOW` act = lv_sev ).
ENDMETHOD.
METHOD high_lower_boundary.
call( EXPORTING iv_quantity = 100 iv_scrap = '5.1'
IMPORTING ev_pct = DATA(lv_pct) ev_severity = DATA(lv_sev) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '5.1' ) act = lv_pct ).
cl_abap_unit_assert=>assert_equals( exp = `HIGH` act = lv_sev ).
ENDMETHOD.
METHOD high_upper_boundary.
call( EXPORTING iv_quantity = 100 iv_scrap = 20
IMPORTING ev_pct = DATA(lv_pct) ev_severity = DATA(lv_sev) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 20 ) act = lv_pct ).
cl_abap_unit_assert=>assert_equals( exp = `HIGH` act = lv_sev ).
ENDMETHOD.
METHOD critical_above_twenty.
call( EXPORTING iv_quantity = 100 iv_scrap = '20.1'
IMPORTING ev_pct = DATA(lv_pct) ev_severity = DATA(lv_sev) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '20.1' ) act = lv_pct ).
cl_abap_unit_assert=>assert_equals( exp = `CRITICAL` act = lv_sev ).
ENDMETHOD.
METHOD rework_unchanged_for_low.
call( EXPORTING iv_quantity = 200 iv_scrap = 4 iv_rework = 99
IMPORTING ev_rework = DATA(lv_rework) ev_severity = DATA(lv_sev) ).
cl_abap_unit_assert=>assert_equals( exp = `LOW` act = lv_sev ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 99 ) act = lv_rework ).
ENDMETHOD.
METHOD rework_set_for_high.
call( EXPORTING iv_quantity = 100 iv_scrap = 10 iv_rework = 99
IMPORTING ev_rework = DATA(lv_rework) ev_severity = DATA(lv_sev) ).
cl_abap_unit_assert=>assert_equals( exp = `HIGH` act = lv_sev ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 10 ) act = lv_rework ).
ENDMETHOD.
METHOD quantity_zero_raises.
call( EXPORTING iv_quantity = 0 iv_scrap = 0
IMPORTING ev_subrc = DATA(lv_rc) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ).
ENDMETHOD.
METHOD scrap_negative_raises.
call( EXPORTING iv_quantity = 100 iv_scrap = -1
IMPORTING ev_subrc = DATA(lv_rc) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ).
ENDMETHOD.
METHOD scrap_above_quantity_raises.
call( EXPORTING iv_quantity = 100 iv_scrap = 101
IMPORTING ev_subrc = DATA(lv_rc) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_rc ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,41 @@
FUNCTION {{p}}prd_scrap
IMPORTING
iv_quantity TYPE decfloat34
iv_scrap TYPE decfloat34
EXPORTING
ev_scrap_pct TYPE decfloat34
ev_severity TYPE string
CHANGING
cv_rework_qty TYPE decfloat34
EXCEPTIONS
invalid_quantity
scrap_too_high.
IF iv_quantity <= 0 OR iv_scrap < 0.
RAISE invalid_quantity.
ENDIF.
IF iv_scrap > iv_quantity.
RAISE scrap_too_high.
ENDIF.
ev_scrap_pct = round( val = iv_scrap / iv_quantity * 100
dec = 1
mode = cl_abap_math=>round_half_up ).
IF ev_scrap_pct = 0.
ev_severity = 'OK'.
ELSEIF ev_scrap_pct <= 5.
ev_severity = 'LOW'.
ELSEIF ev_scrap_pct <= 20.
ev_severity = 'HIGH'.
ELSE.
ev_severity = 'CRITICAL'.
ENDIF.
CASE ev_severity.
WHEN 'HIGH' OR 'CRITICAL'.
cv_rework_qty = iv_scrap.
ENDCASE.
ENDFUNCTION.

View File

@@ -0,0 +1,90 @@
CLASS {{p}}t14_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS result_for
IMPORTING iv_quantity TYPE decfloat34
iv_scrap TYPE decfloat34
iv_rework TYPE decfloat34 DEFAULT 0
EXPORTING ev_pct TYPE decfloat34
ev_severity TYPE string
ev_rework TYPE decfloat34.
METHODS percent_and_severity FOR TESTING.
METHODS severity_bands FOR TESTING.
METHODS rework_quantity FOR TESTING.
METHODS invalid_inputs FOR TESTING.
METHODS scrap_too_high FOR TESTING.
ENDCLASS.
CLASS {{p}}t14_test IMPLEMENTATION.
METHOD result_for.
ev_rework = iv_rework.
CALL FUNCTION '{{P}}PRD_SCRAP'
EXPORTING
iv_quantity = iv_quantity
iv_scrap = iv_scrap
IMPORTING
ev_scrap_pct = ev_pct
ev_severity = ev_severity
CHANGING
cv_rework_qty = ev_rework
EXCEPTIONS
invalid_quantity = 1
scrap_too_high = 2
OTHERS = 3.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
ENDMETHOD.
METHOD percent_and_severity.
result_for( EXPORTING iv_quantity = 800 iv_scrap = 7
IMPORTING ev_pct = DATA(lv_pct) ev_severity = DATA(lv_sev) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '0.9' ) act = lv_pct ).
cl_abap_unit_assert=>assert_equals( exp = `LOW` act = lv_sev ).
ENDMETHOD.
METHOD severity_bands.
result_for( EXPORTING iv_quantity = 100 iv_scrap = 0
IMPORTING ev_severity = DATA(lv_ok) ).
cl_abap_unit_assert=>assert_equals( exp = `OK` act = lv_ok ).
result_for( EXPORTING iv_quantity = 100 iv_scrap = 5
IMPORTING ev_severity = DATA(lv_low) ).
cl_abap_unit_assert=>assert_equals( exp = `LOW` act = lv_low ).
result_for( EXPORTING iv_quantity = 100 iv_scrap = 20
IMPORTING ev_severity = DATA(lv_high) ).
cl_abap_unit_assert=>assert_equals( exp = `HIGH` act = lv_high ).
result_for( EXPORTING iv_quantity = 100 iv_scrap = 21
IMPORTING ev_severity = DATA(lv_crit) ).
cl_abap_unit_assert=>assert_equals( exp = `CRITICAL` act = lv_crit ).
ENDMETHOD.
METHOD rework_quantity.
result_for( EXPORTING iv_quantity = 100 iv_scrap = 4 iv_rework = 99
IMPORTING ev_rework = DATA(lv_keep) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 99 ) act = lv_keep ).
result_for( EXPORTING iv_quantity = 100 iv_scrap = 10
IMPORTING ev_rework = DATA(lv_set) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 10 ) act = lv_set ).
ENDMETHOD.
METHOD invalid_inputs.
DATA lv_pct TYPE decfloat34.
DATA lv_rework TYPE decfloat34.
CALL FUNCTION '{{P}}PRD_SCRAP'
EXPORTING iv_quantity = 0 iv_scrap = 0
IMPORTING ev_scrap_pct = lv_pct
CHANGING cv_rework_qty = lv_rework
EXCEPTIONS invalid_quantity = 1 OTHERS = 2.
cl_abap_unit_assert=>assert_equals( exp = 1 act = sy-subrc ).
ENDMETHOD.
METHOD scrap_too_high.
DATA lv_pct TYPE decfloat34.
DATA lv_rework TYPE decfloat34.
CALL FUNCTION '{{P}}PRD_SCRAP'
EXPORTING iv_quantity = 100 iv_scrap = 101
IMPORTING ev_scrap_pct = lv_pct
CHANGING cv_rework_qty = lv_rework
EXCEPTIONS scrap_too_high = 2 OTHERS = 1.
cl_abap_unit_assert=>assert_equals( exp = 2 act = sy-subrc ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,18 @@
FUNCTION {{p}}prd_sample
IMPORTING
iv_quantity TYPE decfloat34
iv_scrap TYPE decfloat34
EXPORTING
ev_scrap_pct TYPE decfloat34
ev_severity TYPE string
CHANGING
cv_rework_qty TYPE decfloat34
EXCEPTIONS
invalid_quantity
scrap_too_high.
" Sample confirmation module. All confirmation modules use this interface.
ev_scrap_pct = 0.
ev_severity = 'OK'.
ENDFUNCTION.

View File

@@ -0,0 +1,46 @@
# 1. Goal
Evaluate a production confirmation. Calculate the scrap percentage and the
severity of the scrap. The confirmation program calls one module for each
confirmation. The new module must have the same interface as the sample module,
because the confirmation program calls all modules in the same way.
# 2. Open questions
None.
# 3. Context
- Function group {{P}}FG_PROD exists in package $TMP.
- Function module {{P}}PRD_SAMPLE exists in this group. It is the sample
confirmation module. Its interface is the interface that all confirmation
modules must use.
# 4. Contract
- Create the function module {{P}}PRD_SCRAP in function group {{P}}FG_PROD.
- Use exactly the interface of {{P}}PRD_SAMPLE: the same parameter names, kinds,
types, and exceptions.
# 5. Business rules
1. If the confirmed quantity is less than or equal to 0, raise the exception
INVALID_QUANTITY.
2. If the scrap quantity is less than 0, raise the exception INVALID_QUANTITY.
3. If the scrap quantity is greater than the confirmed quantity, raise the
exception SCRAP_TOO_HIGH.
4. The scrap percentage is the scrap quantity divided by the confirmed quantity,
multiplied by 100. Round the result half up to 1 decimal. Write the result to
the scrap percentage parameter.
5. Set the severity from the rounded scrap percentage of rule 4:
- equal to 0: `OK`
- greater than 0 and less than or equal to 5: `LOW`
- greater than 5 and less than or equal to 20: `HIGH`
- greater than 20: `CRITICAL`
6. If the severity is `HIGH` or `CRITICAL`, set the rework quantity to the scrap
quantity. In all other cases, do not change the rework quantity.
# 6. Constraints
- Release target: 7.58.
- Coding standards: Clean ABAP. Keep every method below 40 statements.
- Out of scope: do not change {{P}}PRD_SAMPLE.
# 7. Acceptance
- The function module is active and has no syntax error.
- The hidden tests pass.
- Write ABAP Unit tests for the function module in a global test class.

View File

@@ -0,0 +1,84 @@
{
"id": "G0012",
"category": "F",
"object_type": "FUNC",
"difficulty": 2,
"release_target": "v758",
"expected_outcome": "implement",
"budget": {
"max_tool_calls": 40,
"max_activations": 10
},
"seed": [
{
"type": "FUGR",
"name": "{{P}}FG_PROD",
"description": "Production confirmation modules"
},
{
"type": "FUNC",
"name": "{{P}}PRD_SAMPLE",
"functionGroup": "{{P}}FG_PROD",
"file": "seed/prd_sample.func.abap",
"description": "Sample confirmation module"
}
],
"contract": [
{
"type": "FUNC",
"name": "{{P}}PRD_SCRAP",
"functionGroup": "{{P}}FG_PROD",
"params": [
{
"name": "iv_quantity",
"type": "decfloat34"
},
{
"name": "iv_scrap",
"type": "decfloat34"
},
{
"name": "ev_scrap_pct",
"type": "decfloat34"
},
{
"name": "ev_severity",
"type": "string"
},
{
"name": "cv_rework_qty",
"type": "decfloat34"
}
]
}
],
"out_of_scope": [
"{{P}}PRD_SAMPLE"
],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}T14_HIDDEN",
"file": "hidden/t14_hidden.clas.abap",
"description": "T14 hidden tests"
}
],
"reference": [
{
"type": "FUNC",
"name": "{{P}}PRD_SCRAP",
"functionGroup": "{{P}}FG_PROD",
"file": "reference/prd_scrap.func.abap",
"description": "Scrap evaluation module"
},
{
"type": "CLAS",
"name": "{{P}}T14_TEST",
"file": "reference/t14_test.clas.abap",
"description": "T14 own tests"
}
],
"craft_checks": [
"method_length"
]
}