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,35 @@
{
"id": "G1922",
"pool": "train",
"object_type": "DDLS",
"category": "E",
"attempts": [
{
"stage": "bundle",
"errors": [
"Too close to task G0145 (similarity spec 0.57, rules 0.61, names 0.00). Choose a different business topic and different object names.",
"Too close to task G0146 (similarity spec 0.71, rules 0.64, names 0.00). Choose a different business topic and different object names.",
"Too close to task G0147 (similarity spec 0.73, rules 0.70, names 0.00). Choose a different business topic and different object names."
],
"by_check": {
"extra": 3
}
},
{
"stage": "validate",
"oracle": null,
"null": null
},
{
"stage": "validate",
"oracle": null,
"null": null
},
{
"stage": "validate",
"oracle": null,
"null": null
}
],
"accepted": false
}

View File

@@ -0,0 +1,94 @@
CLASS {{p}}lift_usage_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 hours_summed FOR TESTING.
METHODS service_count FOR TESTING.
METHODS last_service_date FOR TESTING.
METHODS trip_total FOR TESTING.
METHODS test_mode_excluded FOR TESTING.
METHODS lift_without_ops FOR TESTING.
METHODS one_row_per_mode FOR TESTING.
METHODS building_shown FOR TESTING.
ENDCLASS.
CLASS {{p}}lift_usage_hidden IMPLEMENTATION.
METHOD class_setup.
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_LIFT_USAGE' ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
DATA lt_lift TYPE STANDARD TABLE OF {{p}}lift WITH EMPTY KEY.
DATA lt_op TYPE STANDARD TABLE OF {{p}}lift_op WITH EMPTY KEY.
go_env->clear_doubles( ).
lt_lift = VALUE #( ( lift_id = 'L1' building_id = 'B1' capacity_kg = '800.00' )
( lift_id = 'L2' building_id = 'B2' capacity_kg = '630.00' )
( lift_id = 'L3' building_id = 'B1' capacity_kg = '400.00' ) ).
lt_op = VALUE #( ( lift_id = 'L1' run_no = 1 run_date = '20240310' run_hours = '3.50' run_mode = 'AUTO' trips = 12 )
( lift_id = 'L1' run_no = 2 run_date = '20240315' run_hours = '1.50' run_mode = 'AUTO' trips = 5 )
( lift_id = 'L1' run_no = 3 run_date = '20240312' run_hours = '2.00' run_mode = 'MAN' trips = 8 )
( lift_id = 'L1' run_no = 4 run_date = '20240320' run_hours = '9.00' run_mode = 'TEST' trips = 99 )
( lift_id = 'L3' run_no = 1 run_date = '20240401' run_hours = '5.00' run_mode = 'AUTO' trips = 20 ) ).
go_env->insert_test_data( lt_lift ).
go_env->insert_test_data( lt_op ).
ENDMETHOD.
METHOD hours_summed.
SELECT SINGLE service_hours FROM {{p}}i_lift_usage
WHERE lift_id = 'L1' AND run_mode = 'AUTO' INTO @DATA(lv_hours).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '5.00' )
act = CONV decfloat34( lv_hours ) ).
ENDMETHOD.
METHOD service_count.
SELECT SINGLE service_count FROM {{p}}i_lift_usage
WHERE lift_id = 'L1' AND run_mode = 'AUTO' INTO @DATA(lv_count).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_count ).
ENDMETHOD.
METHOD last_service_date.
DATA lv_exp TYPE d VALUE '20240315'.
SELECT SINGLE last_service FROM {{p}}i_lift_usage
WHERE lift_id = 'L1' AND run_mode = 'AUTO' INTO @DATA(lv_date).
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_date ).
ENDMETHOD.
METHOD trip_total.
SELECT SINGLE trip_total FROM {{p}}i_lift_usage
WHERE lift_id = 'L1' AND run_mode = 'AUTO' INTO @DATA(lv_trips).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '17' )
act = CONV decfloat34( lv_trips ) ).
ENDMETHOD.
METHOD test_mode_excluded.
SELECT COUNT(*) FROM {{p}}i_lift_usage
WHERE run_mode = 'TEST' INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rows ).
ENDMETHOD.
METHOD lift_without_ops.
SELECT COUNT(*) FROM {{p}}i_lift_usage
WHERE lift_id = 'L2' INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rows ).
ENDMETHOD.
METHOD one_row_per_mode.
SELECT COUNT(*) FROM {{p}}i_lift_usage
WHERE lift_id = 'L1' INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_rows ).
ENDMETHOD.
METHOD building_shown.
SELECT SINGLE building_id FROM {{p}}i_lift_usage
WHERE lift_id = 'L1' AND run_mode = 'AUTO' INTO @DATA(lv_building).
cl_abap_unit_assert=>assert_equals( exp = 'B1' act = lv_building ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,46 @@
{
"task": "T41",
"mutants": [
{
"object": "{{P}}I_LIFT_USAGE",
"mutant": "element SERVICE_HOURS: sum( -> max( (agg)",
"status": "killed",
"hidden": "7/8",
"failed_tests": [
"HOURS_SUMMED"
]
},
{
"object": "{{P}}I_LIFT_USAGE",
"mutant": "join: inner join -> left outer join (join)",
"status": "killed",
"hidden": "7/8",
"failed_tests": [
"LIFT_WITHOUT_OPS"
]
},
{
"object": "{{P}}I_LIFT_USAGE",
"mutant": "join condition: remove o.run_mode <> 'TEST' (cond)",
"status": "killed",
"hidden": "6/8",
"failed_tests": [
"TEST_MODE_EXCLUDED",
"ONE_ROW_PER_MODE"
]
},
{
"object": "{{P}}I_LIFT_USAGE",
"mutant": "element LAST_SERVICE: max( -> min( (agg)",
"status": "killed",
"hidden": "7/8",
"failed_tests": [
"LAST_SERVICE_DATE"
]
}
],
"valid": 4,
"killed": 4,
"kill_rate": 1.0,
"ok": true
}

View File

@@ -0,0 +1,16 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Lift usage'
define view entity {{P}}I_LIFT_USAGE
as select from {{p}}lift as l
inner join {{p}}lift_op as o on o.lift_id = l.lift_id
and o.run_mode <> 'TEST'
{
key l.lift_id as lift_id,
key o.run_mode as run_mode,
l.building_id as building_id,
sum( o.run_hours ) as service_hours,
count( * ) as service_count,
max( o.run_date ) as last_service,
sum( o.trips ) as trip_total
}
group by l.lift_id, o.run_mode, l.building_id

View File

@@ -0,0 +1,50 @@
CLASS {{p}}lift_usage_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 totals_of_one_mode FOR TESTING.
METHODS test_runs_are_ignored FOR TESTING.
ENDCLASS.
CLASS {{p}}lift_usage_test IMPLEMENTATION.
METHOD class_setup.
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_LIFT_USAGE' ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
DATA lt_lift TYPE STANDARD TABLE OF {{p}}lift WITH EMPTY KEY.
DATA lt_op TYPE STANDARD TABLE OF {{p}}lift_op WITH EMPTY KEY.
go_env->clear_doubles( ).
lt_lift = VALUE #( ( lift_id = 'L1' building_id = 'B1' capacity_kg = '800.00' ) ).
lt_op = VALUE #( ( lift_id = 'L1' run_no = 1 run_date = '20240310' run_hours = '2.00' run_mode = 'AUTO' trips = 4 )
( lift_id = 'L1' run_no = 2 run_date = '20240311' run_hours = '1.00' run_mode = 'AUTO' trips = 6 )
( lift_id = 'L1' run_no = 3 run_date = '20240312' run_hours = '8.00' run_mode = 'TEST' trips = 50 ) ).
go_env->insert_test_data( lt_lift ).
go_env->insert_test_data( lt_op ).
ENDMETHOD.
METHOD totals_of_one_mode.
SELECT SINGLE service_hours, service_count, last_service, trip_total
FROM {{p}}i_lift_usage
WHERE lift_id = 'L1' AND run_mode = 'AUTO'
INTO @DATA(ls_row).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '3.00' )
act = CONV decfloat34( ls_row-service_hours ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_row-service_count ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '10' )
act = CONV decfloat34( ls_row-trip_total ) ).
ENDMETHOD.
METHOD test_runs_are_ignored.
SELECT COUNT(*) FROM {{p}}i_lift_usage INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rows ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,16 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Lift usage'
define view entity {{P}}I_LIFT_USAGE
as select from {{p}}lift as l
inner join {{p}}lift_op as o on o.lift_id = l.lift_id
and o.run_mode <> 'TEST'
{
key l.lift_id as lift_id,
key o.run_mode as run_mode,
l.building_id as building_id,
sum( o.run_hours ) as hours,
count( * ) as run_count,
max( o.run_date ) as last_run,
sum( o.trips ) as value
}
group by l.lift_id, o.run_mode, l.building_id

View File

@@ -0,0 +1,11 @@
@EndUserText.label : 'Lift'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}lift {
key client : abap.clnt not null;
key lift_id : abap.char(10) not null;
building_id : abap.char(10);
capacity_kg : abap.dec(15,2);
}

View File

@@ -0,0 +1,14 @@
@EndUserText.label : 'Lift operation'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}lift_op {
key client : abap.clnt not null;
key lift_id : abap.char(10) not null;
key run_no : abap.int4 not null;
run_date : abap.dats;
run_hours : abap.dec(5,2);
run_mode : abap.char(4);
trips : abap.int4;
}

View File

@@ -0,0 +1,44 @@
# 1. Goal
A lift service company keeps the operating data of its lifts in the tables
{{P}}LIFT and {{P}}LIFT_OP. The CDS view entity {{P}}I_LIFT_USAGE in package $TMP
was written years ago. Its element names are SQL words, so the reporting layer
and the OData service cannot consume the view. Refactor the view in place: the
view name stays, the result stays, the element names become clean.
# 2. Open questions
None.
# 3. Context
- {{P}}I_LIFT_USAGE is an active CDS view entity in package $TMP.
- It reads {{P}}LIFT (the lift master data) and {{P}}LIFT_OP (one row for each
operating run of a lift).
- Nobody documented the view. The source of the view is the only specification
of the numbers that it calculates.
- The two tables are not part of this task.
# 4. Contract
- Refactor the CDS view entity {{P}}I_LIFT_USAGE in package $TMP. The name of the
view does not change.
- The view has these elements with exactly these names: LIFT_ID (key), RUN_MODE
(key), BUILDING_ID, SERVICE_HOURS, SERVICE_COUNT, LAST_SERVICE, TRIP_TOTAL.
- The authorization check stays #NOT_REQUIRED.
# 5. Business rules
1. The result of the view does not change. For every content of {{P}}LIFT and
{{P}}LIFT_OP the refactored view returns the same rows and the same values as
the legacy view.
2. The legacy source contains the rules. Read the legacy source before you
change it. Do not drop a rule and do not add a rule.
3. No element name is a reserved word and no element name is an SQL word.
# 6. Constraints
- Release target: 8.16.
- Coding standards: Clean ABAP. Never use a reserved word or an SQL word as an
element name.
- Out of scope: {{P}}LIFT and {{P}}LIFT_OP stay as they are.
# 7. Acceptance
- The view is active and free of syntax errors.
- The element names are the names of the contract.
- The hidden tests pass.
- Write ABAP Unit tests with CL_CDS_TEST_ENVIRONMENT in a global test class.

View File

@@ -0,0 +1,74 @@
{
"id": "G1922",
"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}}LIFT",
"file": "seed/lift.tabl.asabap",
"description": "Lift master data"
},
{
"type": "TABL",
"name": "{{P}}LIFT_OP",
"file": "seed/lift_op.tabl.asabap",
"description": "Operating run of a lift"
},
{
"type": "DDLS",
"name": "{{P}}I_LIFT_USAGE",
"file": "seed/i_lift_usage.ddls.asddls",
"description": "Legacy view with SQL words as element names (refactor in place)"
}
],
"contract": [
{
"type": "DDLS",
"name": "{{P}}I_LIFT_USAGE",
"fields": [
"LIFT_ID",
"RUN_MODE",
"BUILDING_ID",
"SERVICE_HOURS",
"SERVICE_COUNT",
"LAST_SERVICE",
"TRIP_TOTAL"
]
}
],
"out_of_scope": [
"{{P}}LIFT",
"{{P}}LIFT_OP"
],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}LIFT_USAGE_HIDDEN",
"file": "hidden/lift_usage_hidden.clas.abap",
"description": "Hidden tests for the refactored view"
}
],
"reference": [
{
"type": "DDLS",
"name": "{{P}}I_LIFT_USAGE",
"file": "reference/i_lift_usage.ddls.asddls",
"description": "Refactored view with clean element names"
},
{
"type": "CLAS",
"name": "{{P}}LIFT_USAGE_TEST",
"file": "reference/lift_usage_test.clas.abap",
"description": "Own tests for the view"
}
],
"craft_checks": []
}