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": "G0007",
"pool": "eval",
"object_type": "CLAS",
"category": "F",
"attempts": [
{
"stage": "validate",
"oracle": 100.0,
"null": 0
}
],
"accepted": true
}

View File

@@ -0,0 +1,103 @@
CLASS {{p}}t02_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
DATA mo_cut TYPE REF TO {{p}}if_loyalty_rules.
METHODS setup.
METHODS tier_boundaries FOR TESTING.
METHODS tier_negative FOR TESTING.
METHODS tier_zero FOR TESTING.
METHODS discount_all_tiers FOR TESTING.
METHODS discount_unknown_tier FOR TESTING.
METHODS next_tier_from_basic FOR TESTING.
METHODS next_tier_from_silver FOR TESTING.
METHODS next_tier_from_gold FOR TESTING.
METHODS next_tier_from_platinum FOR TESTING.
METHODS next_tier_negative_points FOR TESTING.
ENDCLASS.
CLASS {{p}}t02_hidden IMPLEMENTATION.
METHOD setup.
mo_cut = NEW {{p}}loyalty_evaluator( ).
ENDMETHOD.
METHOD tier_boundaries.
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_loyalty_rules=>c_tier-basic
act = mo_cut->get_tier( 999 ) msg = `999` ).
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_loyalty_rules=>c_tier-silver
act = mo_cut->get_tier( 1000 ) msg = `1000` ).
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_loyalty_rules=>c_tier-silver
act = mo_cut->get_tier( 4999 ) msg = `4999` ).
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_loyalty_rules=>c_tier-gold
act = mo_cut->get_tier( 5000 ) msg = `5000` ).
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_loyalty_rules=>c_tier-gold
act = mo_cut->get_tier( 19999 ) msg = `19999` ).
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_loyalty_rules=>c_tier-platinum
act = mo_cut->get_tier( 20000 ) msg = `20000` ).
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_loyalty_rules=>c_tier-platinum
act = mo_cut->get_tier( 500000 ) msg = `500000` ).
ENDMETHOD.
METHOD tier_negative.
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_loyalty_rules=>c_tier-basic
act = mo_cut->get_tier( -1 ) ).
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_loyalty_rules=>c_tier-basic
act = mo_cut->get_tier( -5000 ) ).
ENDMETHOD.
METHOD tier_zero.
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_loyalty_rules=>c_tier-basic
act = mo_cut->get_tier( 0 ) ).
ENDMETHOD.
METHOD discount_all_tiers.
cl_abap_unit_assert=>assert_equals( exp = 0
act = mo_cut->get_discount( {{p}}if_loyalty_rules=>c_tier-basic ) msg = `basic` ).
cl_abap_unit_assert=>assert_equals( exp = 3
act = mo_cut->get_discount( {{p}}if_loyalty_rules=>c_tier-silver ) msg = `silver` ).
cl_abap_unit_assert=>assert_equals( exp = 7
act = mo_cut->get_discount( {{p}}if_loyalty_rules=>c_tier-gold ) msg = `gold` ).
cl_abap_unit_assert=>assert_equals( exp = 12
act = mo_cut->get_discount( {{p}}if_loyalty_rules=>c_tier-platinum ) msg = `platinum` ).
ENDMETHOD.
METHOD discount_unknown_tier.
cl_abap_unit_assert=>assert_equals( exp = 0
act = mo_cut->get_discount( 'X' ) ).
cl_abap_unit_assert=>assert_equals( exp = 0
act = mo_cut->get_discount( ' ' ) ).
ENDMETHOD.
METHOD next_tier_from_basic.
cl_abap_unit_assert=>assert_equals( exp = 1000
act = mo_cut->points_to_next_tier( 0 ) msg = `0` ).
cl_abap_unit_assert=>assert_equals( exp = 1
act = mo_cut->points_to_next_tier( 999 ) msg = `999` ).
ENDMETHOD.
METHOD next_tier_from_silver.
cl_abap_unit_assert=>assert_equals( exp = 4000
act = mo_cut->points_to_next_tier( 1000 ) msg = `1000` ).
cl_abap_unit_assert=>assert_equals( exp = 1
act = mo_cut->points_to_next_tier( 4999 ) msg = `4999` ).
ENDMETHOD.
METHOD next_tier_from_gold.
cl_abap_unit_assert=>assert_equals( exp = 15000
act = mo_cut->points_to_next_tier( 5000 ) msg = `5000` ).
cl_abap_unit_assert=>assert_equals( exp = 1
act = mo_cut->points_to_next_tier( 19999 ) msg = `19999` ).
ENDMETHOD.
METHOD next_tier_from_platinum.
cl_abap_unit_assert=>assert_equals( exp = 0
act = mo_cut->points_to_next_tier( 20000 ) ).
cl_abap_unit_assert=>assert_equals( exp = 0
act = mo_cut->points_to_next_tier( 999999 ) ).
ENDMETHOD.
METHOD next_tier_negative_points.
cl_abap_unit_assert=>assert_equals( exp = 1000
act = mo_cut->points_to_next_tier( -7 ) ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,79 @@
CLASS {{p}}loyalty_evaluator DEFINITION PUBLIC FINAL CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES {{p}}if_loyalty_rules.
PRIVATE SECTION.
CONSTANTS:
c_silver_threshold TYPE i VALUE 1000,
c_gold_threshold TYPE i VALUE 5000,
c_platinum_threshold TYPE i VALUE 20000.
METHODS normalize_points
IMPORTING iv_points TYPE i
RETURNING VALUE(rv_points) TYPE i.
METHODS tier_of
IMPORTING iv_points TYPE i
RETURNING VALUE(rv_tier) TYPE {{p}}if_loyalty_rules=>ty_tier.
METHODS points_to_tier
IMPORTING iv_points TYPE i
iv_tier TYPE {{p}}if_loyalty_rules=>ty_tier
RETURNING VALUE(rv_points) TYPE i.
ENDCLASS.
CLASS {{p}}loyalty_evaluator IMPLEMENTATION.
METHOD {{p}}if_loyalty_rules~get_tier.
rv_tier = tier_of( normalize_points( iv_points ) ).
ENDMETHOD.
METHOD {{p}}if_loyalty_rules~get_discount.
CASE iv_tier.
WHEN {{p}}if_loyalty_rules=>c_tier-silver.
rv_percent = 3.
WHEN {{p}}if_loyalty_rules=>c_tier-gold.
rv_percent = 7.
WHEN {{p}}if_loyalty_rules=>c_tier-platinum.
rv_percent = 12.
WHEN OTHERS.
rv_percent = 0.
ENDCASE.
ENDMETHOD.
METHOD {{p}}if_loyalty_rules~points_to_next_tier.
DATA(lv_points) = normalize_points( iv_points ).
DATA(lv_tier) = tier_of( lv_points ).
rv_points = points_to_tier( iv_points = lv_points
iv_tier = lv_tier ).
ENDMETHOD.
METHOD normalize_points.
rv_points = COND #( WHEN iv_points < 0 THEN 0 ELSE iv_points ).
ENDMETHOD.
METHOD tier_of.
IF iv_points >= c_platinum_threshold.
rv_tier = {{p}}if_loyalty_rules=>c_tier-platinum.
ELSEIF iv_points >= c_gold_threshold.
rv_tier = {{p}}if_loyalty_rules=>c_tier-gold.
ELSEIF iv_points >= c_silver_threshold.
rv_tier = {{p}}if_loyalty_rules=>c_tier-silver.
ELSE.
rv_tier = {{p}}if_loyalty_rules=>c_tier-basic.
ENDIF.
ENDMETHOD.
METHOD points_to_tier.
CASE iv_tier.
WHEN {{p}}if_loyalty_rules=>c_tier-basic.
rv_points = c_silver_threshold - iv_points.
WHEN {{p}}if_loyalty_rules=>c_tier-silver.
rv_points = c_gold_threshold - iv_points.
WHEN {{p}}if_loyalty_rules=>c_tier-gold.
rv_points = c_platinum_threshold - iv_points.
WHEN OTHERS.
rv_points = 0.
ENDCASE.
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,77 @@
CLASS ltc_loyalty_evaluator DEFINITION FINAL FOR TESTING
DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
DATA mo_cut TYPE REF TO {{p}}if_loyalty_rules.
METHODS setup.
METHODS tier_of_boundary_points FOR TESTING.
METHODS negative_points_are_basic FOR TESTING.
METHODS discount_of_each_tier FOR TESTING.
METHODS discount_of_unknown_tier FOR TESTING.
METHODS points_to_silver FOR TESTING.
METHODS points_to_gold FOR TESTING.
METHODS points_to_platinum FOR TESTING.
METHODS platinum_needs_no_points FOR TESTING.
ENDCLASS.
CLASS ltc_loyalty_evaluator IMPLEMENTATION.
METHOD setup.
mo_cut = NEW {{p}}loyalty_evaluator( ).
ENDMETHOD.
METHOD tier_of_boundary_points.
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_loyalty_rules=>c_tier-basic
act = mo_cut->get_tier( 0 ) ).
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_loyalty_rules=>c_tier-silver
act = mo_cut->get_tier( 1000 ) ).
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_loyalty_rules=>c_tier-gold
act = mo_cut->get_tier( 5000 ) ).
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_loyalty_rules=>c_tier-platinum
act = mo_cut->get_tier( 20000 ) ).
ENDMETHOD.
METHOD negative_points_are_basic.
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_loyalty_rules=>c_tier-basic
act = mo_cut->get_tier( -100 ) ).
ENDMETHOD.
METHOD discount_of_each_tier.
cl_abap_unit_assert=>assert_equals( exp = 0
act = mo_cut->get_discount( {{p}}if_loyalty_rules=>c_tier-basic ) ).
cl_abap_unit_assert=>assert_equals( exp = 3
act = mo_cut->get_discount( {{p}}if_loyalty_rules=>c_tier-silver ) ).
cl_abap_unit_assert=>assert_equals( exp = 7
act = mo_cut->get_discount( {{p}}if_loyalty_rules=>c_tier-gold ) ).
cl_abap_unit_assert=>assert_equals( exp = 12
act = mo_cut->get_discount( {{p}}if_loyalty_rules=>c_tier-platinum ) ).
ENDMETHOD.
METHOD discount_of_unknown_tier.
cl_abap_unit_assert=>assert_equals( exp = 0
act = mo_cut->get_discount( 'X' ) ).
ENDMETHOD.
METHOD points_to_silver.
cl_abap_unit_assert=>assert_equals( exp = 1000
act = mo_cut->points_to_next_tier( 0 ) ).
cl_abap_unit_assert=>assert_equals( exp = 1
act = mo_cut->points_to_next_tier( 999 ) ).
ENDMETHOD.
METHOD points_to_gold.
cl_abap_unit_assert=>assert_equals( exp = 4000
act = mo_cut->points_to_next_tier( 1000 ) ).
ENDMETHOD.
METHOD points_to_platinum.
cl_abap_unit_assert=>assert_equals( exp = 15000
act = mo_cut->points_to_next_tier( 5000 ) ).
ENDMETHOD.
METHOD platinum_needs_no_points.
cl_abap_unit_assert=>assert_equals( exp = 0
act = mo_cut->points_to_next_tier( 20000 ) ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,24 @@
INTERFACE {{p}}if_loyalty_rules PUBLIC.
TYPES ty_points TYPE i.
TYPES ty_tier TYPE c LENGTH 1.
CONSTANTS:
BEGIN OF c_tier,
basic TYPE ty_tier VALUE 'B',
silver TYPE ty_tier VALUE 'S',
gold TYPE ty_tier VALUE 'G',
platinum TYPE ty_tier VALUE 'P',
END OF c_tier.
METHODS get_tier
IMPORTING iv_points TYPE ty_points
RETURNING VALUE(rv_tier) TYPE ty_tier.
METHODS get_discount
IMPORTING iv_tier TYPE ty_tier
RETURNING VALUE(rv_percent) TYPE i.
METHODS points_to_next_tier
IMPORTING iv_points TYPE ty_points
RETURNING VALUE(rv_points) TYPE i.
ENDINTERFACE.

View File

@@ -0,0 +1,57 @@
# 1. Goal
A retail company gives loyalty discounts to its customers. A checkout program needs
three values: the loyalty tier of a customer, the discount percent of a tier, and
the number of points that a customer still needs for the next tier. The program
calls one class for these three values.
# 2. Open questions
None.
# 3. Context
- The interface {{P}}IF_LOYALTY_RULES exists in package $TMP. It is active.
- The interface declares the type of a point value, the type of a tier, the
constants for all tiers, and three methods. This document does not repeat the
signature of the interface. Read the interface before you start.
- The three methods are:
* the method that returns the tier for a point value,
* the method that returns the discount percent of a tier,
* the method that returns the number of points that are missing for the next tier.
# 4. Contract
- Create the class {{P}}LOYALTY_EVALUATOR in package $TMP.
- The class is public and final. It has a public constructor without parameters.
- The class implements {{P}}IF_LOYALTY_RULES.
- Do not add other public methods.
# 5. Business rules
Tier of a point value:
1. A point value below zero counts as zero.
2. 0 to 999 points is the basic tier.
3. 1000 to 4999 points is the silver tier.
4. 5000 to 19999 points is the gold tier.
5. 20000 points and more is the platinum tier.
Discount percent of a tier:
6. basic is 0 percent.
7. silver is 3 percent.
8. gold is 7 percent.
9. platinum is 12 percent.
10. Any other tier value is 0 percent.
Points to the next tier:
11. A point value below zero counts as zero.
12. basic needs 1000 points minus the point value.
13. silver needs 5000 points minus the point value.
14. gold needs 20000 points minus the point value.
15. platinum needs 0 points.
# 6. Constraints
- Release target: 8.16.
- Coding standards: Clean ABAP. Methods below 40 statements. No global variables.
No comment that restates the code.
- Out of scope: do not change {{P}}IF_LOYALTY_RULES.
# 7. Acceptance
- The class is active and has no syntax error.
- The hidden tests pass.
- Write your own ABAP Unit tests for the class.

View File

@@ -0,0 +1,51 @@
{
"id": "G0007",
"category": "F",
"object_type": "CLAS",
"difficulty": 2,
"release_target": "v816",
"expected_outcome": "implement",
"budget": {
"max_tool_calls": 40,
"max_activations": 10
},
"seed": [
{
"type": "INTF",
"name": "{{P}}IF_LOYALTY_RULES",
"file": "seed/if_loyalty_rules.intf.abap",
"description": "Loyalty contract: tier type, point type, tier constants and three methods. The spec does not repeat the signature."
}
],
"contract": [
{
"type": "CLAS",
"name": "{{P}}LOYALTY_EVALUATOR",
"implements": "{{P}}IF_LOYALTY_RULES"
}
],
"out_of_scope": [
"{{P}}IF_LOYALTY_RULES"
],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}T02_HIDDEN",
"file": "hidden/t02_hidden.clas.abap",
"description": "T02 hidden tests"
}
],
"reference": [
{
"type": "CLAS",
"name": "{{P}}LOYALTY_EVALUATOR",
"file": "reference/loyalty_evaluator.clas.abap",
"description": "Loyalty evaluator",
"testclasses_file": "reference/loyalty_evaluator.testclasses.abap"
}
],
"craft_checks": [
"method_length",
"nesting_depth"
]
}