Snapshot: new training tasks (balanced generation), docs

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Kral
2026-10-05 22:08:59 +02:00
parent eb13453097
commit 6984fc7917
572 changed files with 30024 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
{
"id": "G1924",
"pool": "train",
"object_type": "DDLS",
"category": "E",
"attempts": [
{
"stage": "bundle",
"errors": [
"Too close to task G0145 (similarity spec 0.60, rules 0.60, names 0.33). Choose a different business topic and different object names.",
"Too close to task G0147 (similarity spec 0.66, rules 0.63, names 0.00). Choose a different business topic and different object names."
],
"by_check": {
"extra": 2
}
},
{
"stage": "bundle",
"errors": [
"Too close to task G0147 (similarity spec 0.66, rules 0.64, names 0.00). Choose a different business topic and different object names."
],
"by_check": {
"extra": 1
}
},
{
"stage": "bundle",
"errors": [
"Too close to task G0147 (similarity spec 0.64, rules 0.61, names 0.00). Choose a different business topic and different object names.",
"Too close to task G1148 (similarity spec 0.31, rules 0.12, names 1.00). Choose a different business topic and different object names."
],
"by_check": {
"extra": 2
}
},
{
"stage": "validate",
"oracle": 95.0,
"null": 0
}
],
"accepted": false
}

View File

@@ -0,0 +1,117 @@
CLASS {{p}}mill_charge_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
TYPES ty_min TYPE p LENGTH 8 DECIMALS 2.
CLASS-DATA go_env TYPE REF TO if_cds_test_environment.
CLASS-METHODS class_setup.
CLASS-METHODS class_teardown.
METHODS setup.
METHODS charge_above_min FOR TESTING.
METHODS charge_below_min FOR TESTING.
METHODS mill_amount FOR TESTING.
METHODS counts FOR TESTING.
METHODS min_charge_other FOR TESTING.
METHODS min_charge_low FOR TESTING.
METHODS farmer_shown FOR TESTING.
METHODS job_without_lots FOR TESTING.
ENDCLASS.
CLASS {{p}}mill_charge_hidden IMPLEMENTATION.
METHOD class_setup.
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_MILL_CHARGE' ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
DATA lt_job TYPE STANDARD TABLE OF {{p}}milljob WITH EMPTY KEY.
DATA lt_lot TYPE STANDARD TABLE OF {{p}}milllot WITH EMPTY KEY.
go_env->clear_doubles( ).
lt_job = VALUE #(
( job_id = 'J1' farmer = 'ALPHA' delivery_date = '20251001' )
( job_id = 'J2' farmer = 'BETA' delivery_date = '20251002' )
( job_id = 'J3' farmer = 'GAMMA' delivery_date = '20251003' )
( job_id = 'J4' farmer = 'DELTA' delivery_date = '20251004' ) ).
lt_lot = VALUE #(
( job_id = 'J1' lot_no = 1 grain = 'WHEAT' sacks = 2 mill_rate = '100.00' )
( job_id = 'J1' lot_no = 2 grain = 'RYE' sacks = 1 mill_rate = '50.00' )
( job_id = 'J2' lot_no = 1 grain = 'WHEAT' sacks = 3 mill_rate = '80.00' )
( job_id = 'J4' lot_no = 1 grain = 'OATS' sacks = 1 mill_rate = '10.00' ) ).
go_env->insert_test_data( lt_job ).
go_env->insert_test_data( lt_lot ).
ENDMETHOD.
METHOD charge_above_min.
DATA lv_min TYPE ty_min.
lv_min = '25.00'.
SELECT SINGLE charge_amount FROM {{p}}i_mill_charge( p_min_charge = @lv_min )
WHERE job_id = 'J1' INTO @DATA(lv_charge).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '250.00' )
act = CONV decfloat34( lv_charge ) ).
ENDMETHOD.
METHOD charge_below_min.
DATA lv_min TYPE ty_min.
lv_min = '25.00'.
SELECT SINGLE charge_amount FROM {{p}}i_mill_charge( p_min_charge = @lv_min )
WHERE job_id = 'J4' INTO @DATA(lv_charge).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '25.00' )
act = CONV decfloat34( lv_charge ) ).
ENDMETHOD.
METHOD mill_amount.
DATA lv_min TYPE ty_min.
lv_min = '25.00'.
SELECT SINGLE mill_amount FROM {{p}}i_mill_charge( p_min_charge = @lv_min )
WHERE job_id = 'J1' INTO @DATA(lv_amount).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '250.00' )
act = CONV decfloat34( lv_amount ) ).
ENDMETHOD.
METHOD counts.
DATA lv_min TYPE ty_min.
lv_min = '25.00'.
SELECT SINGLE lot_count, sack_count FROM {{p}}i_mill_charge( p_min_charge = @lv_min )
WHERE job_id = 'J1' INTO @DATA(ls_counts).
cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_counts-lot_count ).
cl_abap_unit_assert=>assert_equals( exp = 3 act = ls_counts-sack_count ).
ENDMETHOD.
METHOD min_charge_other.
DATA lv_min TYPE ty_min.
lv_min = '400.00'.
SELECT SINGLE charge_amount FROM {{p}}i_mill_charge( p_min_charge = @lv_min )
WHERE job_id = 'J2' INTO @DATA(lv_charge).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '400.00' )
act = CONV decfloat34( lv_charge ) ).
ENDMETHOD.
METHOD min_charge_low.
DATA lv_min TYPE ty_min.
lv_min = '5.00'.
SELECT SINGLE charge_amount FROM {{p}}i_mill_charge( p_min_charge = @lv_min )
WHERE job_id = 'J4' INTO @DATA(lv_charge).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '10.00' )
act = CONV decfloat34( lv_charge ) ).
ENDMETHOD.
METHOD farmer_shown.
DATA lv_min TYPE ty_min.
lv_min = '25.00'.
SELECT SINGLE farmer FROM {{p}}i_mill_charge( p_min_charge = @lv_min )
WHERE job_id = 'J2' INTO @DATA(lv_farmer).
cl_abap_unit_assert=>assert_equals( exp = 'BETA' act = lv_farmer ).
ENDMETHOD.
METHOD job_without_lots.
DATA lv_min TYPE ty_min.
lv_min = '25.00'.
SELECT COUNT(*) FROM {{p}}i_mill_charge( p_min_charge = @lv_min ) INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 4 act = lv_rows ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,42 @@
{
"task": "T41",
"mutants": [
{
"object": "{{P}}I_MILL_CHARGE",
"mutant": "charge_amount then-branch: $parameters.p_min_charge -> literal 25.00",
"status": "killed",
"hidden": "7/8",
"failed_tests": [
"MIN_CHARGE_OTHER"
]
},
{
"object": "{{P}}I_MILL_CHARGE",
"mutant": "charge_amount comparison: < -> >",
"status": "killed",
"hidden": "4/8",
"failed_tests": [
"CHARGE_ABOVE_MIN",
"CHARGE_BELOW_MIN",
"MIN_CHARGE_LOW",
"MIN_CHARGE_OTHER"
]
},
{
"object": "{{P}}I_MILL_CHARGE",
"mutant": "mill_amount: sum( sacks * mill_rate ) -> sum( sacks )",
"status": "killed",
"hidden": "4/8",
"failed_tests": [
"MILL_AMOUNT",
"CHARGE_ABOVE_MIN",
"MIN_CHARGE_LOW",
"MIN_CHARGE_OTHER"
]
}
],
"valid": 3,
"killed": 3,
"kill_rate": 1.0,
"ok": true
}

View File

@@ -0,0 +1,21 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Milling charge'
define view entity {{P}}I_MILL_CHARGE
with parameters
p_min_charge : abap.dec( 15, 2 )
as select from {{p}}milllot as lot
inner join {{p}}milljob as job on job.job_id = lot.job_id
{
key job.job_id as job_id,
job.farmer as farmer,
count( * ) as lot_count,
sum( lot.sacks ) as sack_count,
sum( lot.sacks * lot.mill_rate ) as mill_amount,
case when sum( lot.sacks * lot.mill_rate ) < $parameters.p_min_charge
then $parameters.p_min_charge
else sum( lot.sacks * lot.mill_rate )
end as charge_amount
}
group by
job.job_id,
job.farmer

View File

@@ -0,0 +1,56 @@
CLASS {{p}}mill_charge_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
TYPES ty_min TYPE p LENGTH 8 DECIMALS 2.
CLASS-DATA go_env TYPE REF TO if_cds_test_environment.
CLASS-METHODS class_setup.
CLASS-METHODS class_teardown.
METHODS setup.
METHODS charge_of_one_job FOR TESTING.
METHODS min_charge_drives_charge FOR TESTING.
ENDCLASS.
CLASS {{p}}mill_charge_test IMPLEMENTATION.
METHOD class_setup.
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_MILL_CHARGE' ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
DATA lt_job TYPE STANDARD TABLE OF {{p}}milljob WITH EMPTY KEY.
DATA lt_lot TYPE STANDARD TABLE OF {{p}}milllot WITH EMPTY KEY.
go_env->clear_doubles( ).
lt_job = VALUE #( ( job_id = 'A' farmer = 'C1' delivery_date = '20251101' ) ).
lt_lot = VALUE #(
( job_id = 'A' lot_no = 1 grain = 'WHEAT' sacks = 2 mill_rate = '30.00' )
( job_id = 'A' lot_no = 2 grain = 'RYE' sacks = 1 mill_rate = '20.00' ) ).
go_env->insert_test_data( lt_job ).
go_env->insert_test_data( lt_lot ).
ENDMETHOD.
METHOD charge_of_one_job.
DATA lv_min TYPE ty_min.
lv_min = '25.00'.
SELECT SINGLE mill_amount, charge_amount FROM {{p}}i_mill_charge( p_min_charge = @lv_min )
WHERE job_id = 'A' INTO @DATA(ls_charge).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '80.00' )
act = CONV decfloat34( ls_charge-mill_amount ) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '80.00' )
act = CONV decfloat34( ls_charge-charge_amount ) ).
ENDMETHOD.
METHOD min_charge_drives_charge.
DATA lv_min TYPE ty_min.
lv_min = '100.00'.
SELECT SINGLE charge_amount FROM {{p}}i_mill_charge( p_min_charge = @lv_min )
WHERE job_id = 'A' INTO @DATA(lv_charge).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '100.00' )
act = CONV decfloat34( lv_charge ) ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,21 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Milling charge'
define view entity {{P}}I_MILL_CHARGE
with parameters
p_min_charge : abap.dec( 15, 2 )
as select from {{p}}milllot as lot
inner join {{p}}milljob as job on job.job_id = lot.job_id
{
key job.job_id as job_id,
job.farmer as farmer,
count( * ) as lot_count,
sum( lot.sacks ) as sack_count,
sum( lot.sacks * lot.mill_rate ) as mill_amount,
case when sum( lot.sacks * lot.mill_rate ) < cast( '25.00' as abap.dec( 15, 2 ) )
then cast( '25.00' as abap.dec( 15, 2 ) )
else sum( lot.sacks * lot.mill_rate )
end as charge_amount
}
group by
job.job_id,
job.farmer

View File

@@ -0,0 +1,11 @@
@EndUserText.label : 'Milling job header'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}milljob {
key client : abap.clnt not null;
key job_id : abap.char(10) not null;
farmer : abap.char(10);
delivery_date : abap.dats;
}

View File

@@ -0,0 +1,13 @@
@EndUserText.label : 'Milling job grain lot'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}milllot {
key client : abap.clnt not null;
key job_id : abap.char(10) not null;
key lot_no : abap.int4 not null;
grain : abap.char(10);
sacks : abap.int4;
mill_rate : abap.dec(15,2);
}

View File

@@ -0,0 +1,55 @@
# 1. Goal
A watermill grinds the grain that farmers deliver. Every job is billed from the
sacks of the job and from the milling rate of each lot. The front desk reads the
charge of a job from the CDS view entity {{P}}I_MILL_CHARGE in package $TMP.
The definition of that view is old. It activates and it returns correct data,
but a fixed money value sits in its source code and the import parameter
P_MIN_CHARGE is declared and never read. Rework the definition of the view so
that the parameter supplies that money value. The view keeps its name, its
elements and its behaviour.
# 2. Open questions
None.
# 3. Context
- Table {{P}}MILLJOB, package $TMP, one row for each milling job.
Key: JOB_ID (CHAR 10). Further fields: FARMER (CHAR 10), DELIVERY_DATE (DATS).
- Table {{P}}MILLLOT, package $TMP, one row for each grain lot of a job.
Key: JOB_ID (CHAR 10), LOT_NO (INT4). Further fields: GRAIN (CHAR 10),
SACKS (INT4), MILL_RATE (DEC 15,2, the price for milling one sack).
- The current definition of {{P}}I_MILL_CHARGE is the legacy code. Open it and
read it. It is the only description of the rules of the view.
# 4. Contract
- {{P}}I_MILL_CHARGE stays in package $TMP under its current name.
- The elements of the view keep their names and their order: JOB_ID (key),
FARMER, LOT_COUNT, SACK_COUNT, MILL_AMOUNT, CHARGE_AMOUNT.
- The import parameter P_MIN_CHARGE (DEC 15,2) stays. It holds an amount of
money.
- The authorization check stays #NOT_REQUIRED.
# 5. Business rules
The rules of the view are not repeated in this document. They are inside the
legacy source code of {{P}}I_MILL_CHARGE. Read that source code and keep every
rule exactly as it is.
The rework must fulfil three quality goals:
1. P_MIN_CHARGE supplies the money value that the legacy code writes as a
literal. That literal disappears from the source code of the view.
2. A caller that passes the money value of the legacy code receives exactly the
values that the view returned before the rework.
3. The view stays Clean ABAP: no unused element, no dead code, one expression
for each element.
# 6. Constraints
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
- Package $TMP. No transport.
- Out of scope: {{P}}MILLJOB and {{P}}MILLLOT stay untouched.
- The name of the view and the element names stay untouched.
- ATC must report no finding of priority 1 or priority 2.
# 7. Acceptance
- {{P}}I_MILL_CHARGE is active and free of syntax errors.
- The hidden tests pass.
- Write ABAP Unit tests with CL_CDS_TEST_ENVIRONMENT in a global test class.

View File

@@ -0,0 +1,73 @@
{
"id": "G1924",
"category": "E",
"object_type": "DDLS",
"difficulty": 2,
"release_target": "v816",
"expected_outcome": "implement",
"budget": {
"max_tool_calls": 60,
"max_activations": 15
},
"seed": [
{
"type": "TABL",
"name": "{{P}}MILLJOB",
"file": "seed/milljob.tabl.asabap",
"description": "Milling job header"
},
{
"type": "TABL",
"name": "{{P}}MILLLOT",
"file": "seed/milllot.tabl.asabap",
"description": "Milling job grain lot"
},
{
"type": "DDLS",
"name": "{{P}}I_MILL_CHARGE",
"file": "seed/i_mill_charge.ddls.asddls",
"description": "Legacy charge view of the watermill"
}
],
"contract": [
{
"type": "DDLS",
"name": "{{P}}I_MILL_CHARGE",
"fields": [
"JOB_ID",
"FARMER",
"LOT_COUNT",
"SACK_COUNT",
"MILL_AMOUNT",
"CHARGE_AMOUNT"
]
}
],
"out_of_scope": [
"{{P}}MILLJOB",
"{{P}}MILLLOT"
],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}MILL_CHARGE_HIDDEN",
"file": "hidden/mill_charge_hidden.clas.abap",
"description": "Hidden tests for the reworked charge view"
}
],
"reference": [
{
"type": "DDLS",
"name": "{{P}}I_MILL_CHARGE",
"file": "reference/i_mill_charge.ddls.asddls",
"description": "Reworked charge view"
},
{
"type": "CLAS",
"name": "{{P}}MILL_CHARGE_TEST",
"file": "reference/mill_charge_test.clas.abap",
"description": "Own tests of the model"
}
],
"craft_checks": []
}