Stage 2 summary at 50 accepted trajectories

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Kral
2026-10-05 18:02:52 +02:00
parent 332fb4601d
commit 5bcd1bf9cd
1230 changed files with 77563 additions and 33 deletions

View File

@@ -0,0 +1,16 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Honey yield per apiary'
define view entity {{P}}I_HONEY_YIELD
as select from {{p}}apiary as api
left outer join {{p}}honey as harv on harv.apiary_id = api.apiary_id
{
key api.apiary_id as apiary_id,
api.beekeeper as beekeeper,
api.region as region,
count( * ) as harvest_count,
sum( harv.kilograms ) as total_kg
}
group by
api.apiary_id,
api.beekeeper,
api.region

View File

@@ -0,0 +1,16 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Honey yield per apiary'
define view entity {{P}}I_HONEY_YIELD
as select from {{p}}apiary as api
inner join {{p}}honey as harv on harv.apiary_id <> api.apiary_id
{
key api.apiary_id as apiary_id,
api.beekeeper as beekeeper,
api.region as region,
count( * ) as harvest_count,
sum( harv.kilograms ) as total_kg
}
group by
api.apiary_id,
api.beekeeper,
api.region

View File

@@ -0,0 +1,16 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Honey yield per apiary'
define view entity {{P}}I_HONEY_YIELD
as select from {{p}}apiary as api
inner join {{p}}honey as harv on harv.apiary_id = api.apiary_id
{
key api.apiary_id as apiary_id,
api.beekeeper as beekeeper,
api.region as region,
count( * ) as harvest_count,
max( harv.kilograms ) as total_kg
}
group by
api.apiary_id,
api.beekeeper,
api.region

View File

@@ -0,0 +1,19 @@
{
"id": "G1131",
"pool": "train",
"object_type": "DDLS",
"category": "I",
"attempts": [
{
"stage": "validate",
"oracle": 100.0,
"null": 0,
"mutation": {
"valid": 3,
"killed": 3,
"ok": true
}
}
],
"accepted": true
}

View File

@@ -0,0 +1,90 @@
CLASS {{p}}t41_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
CLASS-DATA go_env TYPE REF TO if_cds_test_environment.
CLASS-METHODS class_setup.
CLASS-METHODS class_teardown.
METHODS setup.
METHODS yield_of_apiary FOR TESTING.
METHODS harvest_count_of_apiary FOR TESTING.
METHODS apiary_without_harvest FOR TESTING.
METHODS number_of_rows FOR TESTING.
METHODS beekeeper_shown FOR TESTING.
METHODS region_shown FOR TESTING.
METHODS single_harvest_total FOR TESTING.
METHODS quiet_region_apiary FOR TESTING.
ENDCLASS.
CLASS {{p}}t41_hidden IMPLEMENTATION.
METHOD class_setup.
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_HONEY_YIELD' ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
DATA lt_apiary TYPE STANDARD TABLE OF {{p}}apiary WITH EMPTY KEY.
DATA lt_honey TYPE STANDARD TABLE OF {{p}}honey WITH EMPTY KEY.
go_env->clear_doubles( ).
lt_apiary = VALUE #(
( apiary_id = 'A1' beekeeper = 'BK1' region = 'NORT' hive_count = 10 )
( apiary_id = 'A2' beekeeper = 'BK2' region = 'NORT' hive_count = 5 )
( apiary_id = 'A3' beekeeper = 'BK3' region = 'SOUT' hive_count = 8 )
( apiary_id = 'A4' beekeeper = 'BK4' region = 'SOUT' hive_count = 3 )
( apiary_id = 'A5' beekeeper = 'BK5' region = 'WEST' hive_count = 4 ) ).
lt_honey = VALUE #(
( apiary_id = 'A1' harvest_no = 1 region = 'NORT' harvest_date = '20240115' kilograms = '12.00' )
( apiary_id = 'A1' harvest_no = 2 region = 'NORT' harvest_date = '20240220' kilograms = '8.00' )
( apiary_id = 'A2' harvest_no = 1 region = 'NORT' harvest_date = '20240301' kilograms = '20.00' )
( apiary_id = 'A3' harvest_no = 1 region = 'SOUT' harvest_date = '20240410' kilograms = '5.00' ) ).
go_env->insert_test_data( lt_apiary ).
go_env->insert_test_data( lt_honey ).
ENDMETHOD.
METHOD yield_of_apiary.
SELECT SINGLE total_kg FROM {{p}}i_honey_yield WHERE apiary_id = 'A1' INTO @DATA(lv_total).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '20.00' )
act = CONV decfloat34( lv_total ) ).
ENDMETHOD.
METHOD harvest_count_of_apiary.
SELECT SINGLE harvest_count FROM {{p}}i_honey_yield WHERE apiary_id = 'A1' INTO @DATA(lv_count).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_count ).
ENDMETHOD.
METHOD apiary_without_harvest.
SELECT COUNT(*) FROM {{p}}i_honey_yield WHERE apiary_id = 'A4' INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rows ).
ENDMETHOD.
METHOD number_of_rows.
SELECT COUNT(*) FROM {{p}}i_honey_yield INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 3 act = lv_rows ).
ENDMETHOD.
METHOD beekeeper_shown.
SELECT SINGLE beekeeper FROM {{p}}i_honey_yield WHERE apiary_id = 'A2' INTO @DATA(lv_keeper).
cl_abap_unit_assert=>assert_equals( exp = 'BK2' act = lv_keeper ).
ENDMETHOD.
METHOD region_shown.
SELECT SINGLE region FROM {{p}}i_honey_yield WHERE apiary_id = 'A3' INTO @DATA(lv_region).
cl_abap_unit_assert=>assert_equals( exp = 'SOUT' act = lv_region ).
ENDMETHOD.
METHOD single_harvest_total.
SELECT SINGLE harvest_count, total_kg FROM {{p}}i_honey_yield WHERE apiary_id = 'A3'
INTO @DATA(ls_yield).
cl_abap_unit_assert=>assert_equals( exp = 1 act = ls_yield-harvest_count ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '5.00' )
act = CONV decfloat34( ls_yield-total_kg ) ).
ENDMETHOD.
METHOD quiet_region_apiary.
SELECT COUNT(*) FROM {{p}}i_honey_yield WHERE apiary_id = 'A5' INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rows ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,42 @@
{
"task": "G1131",
"mutants": [
{
"object": "{{P}}I_HONEY_YIELD",
"mutant": "line 5: inner join -> left outer join (join)",
"status": "killed",
"hidden": "5/8",
"failed_tests": [
"APIARY_WITHOUT_HARVEST",
"NUMBER_OF_ROWS",
"QUIET_REGION_APIARY"
]
},
{
"object": "{{P}}I_HONEY_YIELD",
"mutant": "line 5: = -> <> (eq)",
"status": "killed",
"hidden": "3/8",
"failed_tests": [
"APIARY_WITHOUT_HARVEST",
"NUMBER_OF_ROWS",
"QUIET_REGION_APIARY",
"SINGLE_HARVEST_TOTAL",
"YIELD_OF_APIARY"
]
},
{
"object": "{{P}}I_HONEY_YIELD",
"mutant": "line 11: sum( -> max( (agg)",
"status": "killed",
"hidden": "7/8",
"failed_tests": [
"YIELD_OF_APIARY"
]
}
],
"valid": 3,
"killed": 3,
"kill_rate": 1.0,
"ok": true
}

View File

@@ -0,0 +1,16 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Honey yield per apiary'
define view entity {{P}}I_HONEY_YIELD
as select from {{p}}apiary as api
inner join {{p}}honey as harv on harv.apiary_id = api.apiary_id
{
key api.apiary_id as apiary_id,
api.beekeeper as beekeeper,
api.region as region,
count( * ) as harvest_count,
sum( harv.kilograms ) as total_kg
}
group by
api.apiary_id,
api.beekeeper,
api.region

View File

@@ -0,0 +1,48 @@
CLASS {{p}}t41_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
CLASS-DATA go_env TYPE REF TO if_cds_test_environment.
CLASS-METHODS class_setup.
CLASS-METHODS class_teardown.
METHODS setup.
METHODS total_of_one_apiary FOR TESTING.
METHODS apiary_without_harvest FOR TESTING.
ENDCLASS.
CLASS {{p}}t41_test IMPLEMENTATION.
METHOD class_setup.
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_HONEY_YIELD' ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
DATA lt_apiary TYPE STANDARD TABLE OF {{p}}apiary WITH EMPTY KEY.
DATA lt_honey TYPE STANDARD TABLE OF {{p}}honey WITH EMPTY KEY.
go_env->clear_doubles( ).
lt_apiary = VALUE #(
( apiary_id = 'B1' beekeeper = 'BK9' region = 'EAST' hive_count = 6 )
( apiary_id = 'B2' beekeeper = 'BK8' region = 'EAST' hive_count = 2 ) ).
lt_honey = VALUE #(
( apiary_id = 'B1' harvest_no = 1 region = 'EAST' harvest_date = '20240501' kilograms = '7.50' )
( apiary_id = 'B1' harvest_no = 2 region = 'EAST' harvest_date = '20240601' kilograms = '2.50' ) ).
go_env->insert_test_data( lt_apiary ).
go_env->insert_test_data( lt_honey ).
ENDMETHOD.
METHOD total_of_one_apiary.
SELECT SINGLE harvest_count, total_kg FROM {{p}}i_honey_yield WHERE apiary_id = 'B1'
INTO @DATA(ls_yield).
cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_yield-harvest_count ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '10.00' )
act = CONV decfloat34( ls_yield-total_kg ) ).
ENDMETHOD.
METHOD apiary_without_harvest.
SELECT COUNT(*) FROM {{p}}i_honey_yield INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rows ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,12 @@
@EndUserText.label : 'Apiary'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}apiary {
key client : abap.clnt not null;
key apiary_id : abap.char(10) not null;
beekeeper : abap.char(10);
region : abap.char(4);
hive_count : abap.int4;
}

View File

@@ -0,0 +1,13 @@
@EndUserText.label : 'Honey harvest'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}honey {
key client : abap.clnt not null;
key apiary_id : abap.char(10) not null;
key harvest_no : abap.int4 not null;
region : abap.char(4);
harvest_date : abap.dats;
kilograms : abap.dec(15,2);
}

View File

@@ -0,0 +1,16 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Honey yield per apiary'
define view entity {{P}}I_HONEY_YIELD
as select from {{p}}apiary as api
inner join {{p}}honey as harv on harv.region = api.region
{
key api.apiary_id as apiary_id,
api.beekeeper as beekeeper,
api.region as region,
count( * ) as harvest_count,
sum( harv.kilograms ) as total_kg
}
group by
api.apiary_id,
api.beekeeper,
api.region

View File

@@ -0,0 +1,50 @@
# 1. Goal
The CDS view entity {{P}}I_HONEY_YIELD shows the honey yield of each apiary of a
beekeeping cooperative. The view is active, but its numbers are wrong. Fix the
view in place. A report and an OData service read the view.
# 2. Open questions
None.
# 3. Context
- Table {{P}}APIARY (apiary header), package $TMP. Key: APIARY_ID (CHAR 10).
Fields: BEEKEEPER (CHAR 10), REGION (CHAR 4), HIVE_COUNT (INT4).
- Table {{P}}HONEY (honey harvest), package $TMP. Key: APIARY_ID (CHAR 10),
HARVEST_NO (INT4). Fields: REGION (CHAR 4, region of the apiary at the time
of the harvest), HARVEST_DATE (DATS), KILOGRAMS (DEC 15,2).
- The view {{P}}I_HONEY_YIELD is in package $TMP and is active. The name, the
package and the element names stay the same.
# 4. Contract
- Fix the CDS view entity {{P}}I_HONEY_YIELD in package $TMP. Do not create a
new view.
- Elements, with these names: APIARY_ID (key), BEEKEEPER, REGION, HARVEST_COUNT,
TOTAL_KG.
- No authorization check (#NOT_REQUIRED).
# 5. Business rules
The users report these symptoms:
1. TOTAL_KG is too high for several apiaries. Expected: TOTAL_KG is the sum of
the KILOGRAMS of the harvests of that apiary only.
2. HARVEST_COUNT is too high for the same apiaries. Expected: HARVEST_COUNT is
the number of harvest records of that apiary only.
3. The list also shows apiaries that delivered no honey. Expected: the view
shows one row for each apiary that has at least one record in {{P}}HONEY. An
apiary without harvest records is not shown.
All other behavior stays the same. In particular:
4. BEEKEEPER is the beekeeper of the apiary, and REGION is the region of the
apiary.
5. An apiary with harvest records has exactly one row, also when no other apiary
of its region has harvest records.
# 6. Constraints
- Release target: ABAP Platform 2025 (SAP_BASIS 816).
- Coding standards: Clean ABAP. The view must be active and must not have a
syntax error. ATC must not report findings of priority 1 or priority 2.
- Out of scope: do not change {{P}}APIARY and {{P}}HONEY. Do not change the name
of the view or the names of its elements.
# 7. Acceptance
- The view {{P}}I_HONEY_YIELD is active and has no syntax error.
- The hidden tests pass.
- Write ABAP Unit tests with CL_CDS_TEST_ENVIRONMENT in a global test class.

View File

@@ -0,0 +1,72 @@
{
"id": "G1131",
"category": "I",
"object_type": "DDLS",
"difficulty": 2,
"release_target": "v816",
"expected_outcome": "implement",
"budget": {
"max_tool_calls": 60,
"max_activations": 15
},
"seed": [
{
"type": "TABL",
"name": "{{P}}APIARY",
"file": "seed/apiary.tabl.asabap",
"description": "Apiary header"
},
{
"type": "TABL",
"name": "{{P}}HONEY",
"file": "seed/honey.tabl.asabap",
"description": "Honey harvest records"
},
{
"type": "DDLS",
"name": "{{P}}I_HONEY_YIELD",
"file": "seed/i_honey_yield.ddls.asddls",
"description": "Active but faulty honey yield view"
}
],
"contract": [
{
"type": "DDLS",
"name": "{{P}}I_HONEY_YIELD",
"fields": [
"APIARY_ID",
"BEEKEEPER",
"REGION",
"HARVEST_COUNT",
"TOTAL_KG"
]
}
],
"out_of_scope": [
"{{P}}APIARY",
"{{P}}HONEY"
],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}T41_HIDDEN",
"file": "hidden/t41_hidden.clas.abap",
"description": "T41 hidden tests"
}
],
"reference": [
{
"type": "DDLS",
"name": "{{P}}I_HONEY_YIELD",
"file": "reference/i_honey_yield.ddls.asddls",
"description": "Fixed honey yield view"
},
{
"type": "CLAS",
"name": "{{P}}T41_TEST",
"file": "reference/t41_test.clas.abap",
"description": "T41 own tests"
}
],
"craft_checks": []
}