Pipeline controller: plan 2 (hard +, error +50 %), backlog throttle, 2 trajectory workers, stop rules, summaries every 50; budget reserve

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Kral
2026-10-05 13:35:54 +02:00
parent 1c4667a0fc
commit 13360292dd
781 changed files with 50211 additions and 22 deletions

View File

@@ -0,0 +1,18 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Container weight check'
define view entity {{P}}I_CONT_WEIGHT
as select from {{p}}cont as cont
inner join {{p}}weigh as weigh on weigh.cont_id <> cont.cont_id
{
key cont.cont_id as cont_id,
cont.customer as customer,
cont.decl_kg as decl_kg,
weigh.meas_kg as meas_kg,
cast( abs( weigh.meas_kg - cont.decl_kg ) as abap.dec(15,2) ) as deviation_kg,
division( abs( weigh.meas_kg - cont.decl_kg ) * 100, cont.decl_kg, 2 ) as deviation_pct,
case
when weigh.meas_kg > cont.max_kg then 'HOLD'
when division( abs( weigh.meas_kg - cont.decl_kg ) * 100, cont.decl_kg, 2 ) > 5 then 'WARN'
else 'LOAD'
end as status
}

View File

@@ -0,0 +1,18 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Container weight check'
define view entity {{P}}I_CONT_WEIGHT
as select from {{p}}cont as cont
inner join {{p}}weigh as weigh on weigh.cont_id = cont.cont_id
{
key cont.cont_id as cont_id,
cont.customer as customer,
cont.decl_kg as decl_kg,
weigh.meas_kg as meas_kg,
cast( abs( weigh.meas_kg - cont.decl_kg ) as abap.dec(15,2) ) as deviation_kg,
division( abs( weigh.meas_kg + cont.decl_kg ) * 100, cont.decl_kg, 2 ) as deviation_pct,
case
when weigh.meas_kg > cont.max_kg then 'HOLD'
when division( abs( weigh.meas_kg - cont.decl_kg ) * 100, cont.decl_kg, 2 ) > 5 then 'WARN'
else 'LOAD'
end as status
}

View File

@@ -0,0 +1,18 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Container weight check'
define view entity {{P}}I_CONT_WEIGHT
as select from {{p}}cont as cont
inner join {{p}}weigh as weigh on weigh.cont_id = cont.cont_id
{
key cont.cont_id as cont_id,
cont.customer as customer,
cont.decl_kg as decl_kg,
weigh.meas_kg as meas_kg,
cast( abs( weigh.meas_kg - cont.decl_kg ) as abap.dec(15,2) ) as deviation_kg,
division( abs( weigh.meas_kg - cont.decl_kg ) * 100, cont.decl_kg, 2 ) as deviation_pct,
case
when weigh.meas_kg <= cont.max_kg then 'HOLD'
when division( abs( weigh.meas_kg - cont.decl_kg ) * 100, cont.decl_kg, 2 ) > 5 then 'WARN'
else 'LOAD'
end as status
}

View File

@@ -0,0 +1,18 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Container weight check'
define view entity {{P}}I_CONT_WEIGHT
as select from {{p}}cont as cont
inner join {{p}}weigh as weigh on weigh.cont_id = cont.cont_id
{
key cont.cont_id as cont_id,
cont.customer as customer,
cont.decl_kg as decl_kg,
weigh.meas_kg as meas_kg,
cast( abs( weigh.meas_kg - cont.decl_kg ) as abap.dec(15,2) ) as deviation_kg,
division( abs( weigh.meas_kg - cont.decl_kg ) * 100, cont.decl_kg, 2 ) as deviation_pct,
case
when weigh.meas_kg > cont.max_kg then 'HOLD'
when division( abs( weigh.meas_kg - cont.decl_kg ) * 101, cont.decl_kg, 2 ) > 5 then 'WARN'
else 'LOAD'
end as status
}

View File

@@ -0,0 +1,18 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Container weight check'
define view entity {{P}}I_CONT_WEIGHT
as select from {{p}}cont as cont
inner join {{p}}weigh as weigh on weigh.cont_id = cont.cont_id
{
key cont.cont_id as cont_id,
cont.customer as customer,
cont.decl_kg as decl_kg,
weigh.meas_kg as meas_kg,
cast( abs( weigh.meas_kg - cont.decl_kg ) as abap.dec(15,2) ) as deviation_kg,
division( abs( weigh.meas_kg - cont.decl_kg ) * 100, cont.decl_kg, 2 ) as deviation_pct,
case
when weigh.meas_kg > cont.max_kg then 'HOLD'
when division( abs( weigh.meas_kg - cont.decl_kg ) * 100, cont.decl_kg, 2 ) > 5 then 'WARN'
else 'ZOAD'
end as status
}

View File

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

View File

@@ -0,0 +1,108 @@
CLASS {{p}}t20_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 deviation_below FOR TESTING.
METHODS deviation_zero FOR TESTING.
METHODS deviation_above FOR TESTING.
METHODS percent_rounded FOR TESTING.
METHODS status_hold FOR TESTING.
METHODS status_warn FOR TESTING.
METHODS status_load FOR TESTING.
METHODS status_at_five_pct FOR TESTING.
METHODS unweighed_hidden FOR TESTING.
METHODS customer_shown FOR TESTING.
ENDCLASS.
CLASS {{p}}t20_hidden IMPLEMENTATION.
METHOD class_setup.
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_CONT_WEIGHT' ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
DATA lt_cont TYPE STANDARD TABLE OF {{p}}cont WITH EMPTY KEY.
DATA lt_weigh TYPE STANDARD TABLE OF {{p}}weigh WITH EMPTY KEY.
go_env->clear_doubles( ).
lt_cont = VALUE #(
( cont_id = 'C1' customer = 'ALPHA' decl_kg = '1000.00' max_kg = '1200.00' )
( cont_id = 'C2' customer = 'BETA' decl_kg = '1000.00' max_kg = '1200.00' )
( cont_id = 'C3' customer = 'GAMMA' decl_kg = '1000.00' max_kg = '1200.00' )
( cont_id = 'C4' customer = 'DELTA' decl_kg = '500.00' max_kg = '600.00' )
( cont_id = 'C5' customer = 'EPSILON' decl_kg = '1000.00' max_kg = '1200.00' )
( cont_id = 'C6' customer = 'ZETA' decl_kg = '1000.00' max_kg = '1200.00' )
( cont_id = 'C7' customer = 'ETA' decl_kg = '800.00' max_kg = '900.00' )
( cont_id = 'C8' customer = 'THETA' decl_kg = '300.00' max_kg = '400.00' ) ).
lt_weigh = VALUE #(
( cont_id = 'C1' meas_kg = '1020.00' )
( cont_id = 'C2' meas_kg = '1100.00' )
( cont_id = 'C3' meas_kg = '1300.00' )
( cont_id = 'C4' meas_kg = '450.00' )
( cont_id = 'C5' meas_kg = '950.00' )
( cont_id = 'C7' meas_kg = '800.00' )
( cont_id = 'C8' meas_kg = '310.00' ) ).
go_env->insert_test_data( lt_cont ).
go_env->insert_test_data( lt_weigh ).
ENDMETHOD.
METHOD deviation_below.
SELECT SINGLE deviation_kg FROM {{p}}i_cont_weight WHERE cont_id = 'C4' INTO @DATA(lv_dev).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '50.00' )
act = CONV decfloat34( lv_dev ) ).
ENDMETHOD.
METHOD deviation_zero.
SELECT SINGLE deviation_kg FROM {{p}}i_cont_weight WHERE cont_id = 'C7' INTO @DATA(lv_dev).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '0.00' )
act = CONV decfloat34( lv_dev ) ).
ENDMETHOD.
METHOD deviation_above.
SELECT SINGLE deviation_kg FROM {{p}}i_cont_weight WHERE cont_id = 'C1' INTO @DATA(lv_dev).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '20.00' )
act = CONV decfloat34( lv_dev ) ).
ENDMETHOD.
METHOD percent_rounded.
SELECT SINGLE deviation_pct FROM {{p}}i_cont_weight WHERE cont_id = 'C8' INTO @DATA(lv_pct).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '3.33' )
act = CONV decfloat34( lv_pct ) ).
ENDMETHOD.
METHOD status_hold.
SELECT SINGLE status FROM {{p}}i_cont_weight WHERE cont_id = 'C3' INTO @DATA(lv_status).
cl_abap_unit_assert=>assert_equals( exp = 'HOLD' act = lv_status ).
ENDMETHOD.
METHOD status_warn.
SELECT SINGLE status FROM {{p}}i_cont_weight WHERE cont_id = 'C2' INTO @DATA(lv_status).
cl_abap_unit_assert=>assert_equals( exp = 'WARN' act = lv_status ).
ENDMETHOD.
METHOD status_load.
SELECT SINGLE status FROM {{p}}i_cont_weight WHERE cont_id = 'C1' INTO @DATA(lv_status).
cl_abap_unit_assert=>assert_equals( exp = 'LOAD' act = lv_status ).
ENDMETHOD.
METHOD status_at_five_pct.
SELECT SINGLE status FROM {{p}}i_cont_weight WHERE cont_id = 'C5' INTO @DATA(lv_status).
cl_abap_unit_assert=>assert_equals( exp = 'LOAD' act = lv_status ).
ENDMETHOD.
METHOD unweighed_hidden.
SELECT COUNT(*) FROM {{p}}i_cont_weight INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 7 act = lv_rows ).
ENDMETHOD.
METHOD customer_shown.
SELECT SINGLE customer FROM {{p}}i_cont_weight WHERE cont_id = 'C4' INTO @DATA(lv_cust).
cl_abap_unit_assert=>assert_equals( exp = 'DELTA' act = lv_cust ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,65 @@
{
"task": "G1000",
"mutants": [
{
"object": "{{P}}I_CONT_WEIGHT",
"mutant": "line 5: = -> <> (eq)",
"status": "killed",
"hidden": "2/10",
"failed_tests": [
"DEVIATION_ABOVE",
"DEVIATION_BELOW",
"DEVIATION_ZERO",
"PERCENT_ROUNDED",
"STATUS_HOLD",
"STATUS_LOAD",
"STATUS_WARN",
"UNWEIGHED_HIDDEN"
]
},
{
"object": "{{P}}I_CONT_WEIGHT",
"mutant": "line 12: - -> + (arith)",
"status": "killed",
"hidden": "9/10",
"failed_tests": [
"PERCENT_ROUNDED"
]
},
{
"object": "{{P}}I_CONT_WEIGHT",
"mutant": "line 14: > -> <= (rel)",
"status": "killed",
"hidden": "6/10",
"failed_tests": [
"STATUS_AT_FIVE_PCT",
"STATUS_HOLD",
"STATUS_LOAD",
"STATUS_WARN"
]
},
{
"object": "{{P}}I_CONT_WEIGHT",
"mutant": "line 15: 100 -> 101 (const)",
"status": "killed",
"hidden": "9/10",
"failed_tests": [
"STATUS_AT_FIVE_PCT"
]
},
{
"object": "{{P}}I_CONT_WEIGHT",
"mutant": "line 16: 'LOAD' -> 'ZOAD' (lit)",
"status": "killed",
"hidden": "8/10",
"failed_tests": [
"STATUS_AT_FIVE_PCT",
"STATUS_LOAD"
]
}
],
"valid": 5,
"killed": 5,
"kill_rate": 1.0,
"ok": true
}

View File

@@ -0,0 +1,18 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Container weight check'
define view entity {{P}}I_CONT_WEIGHT
as select from {{p}}cont as cont
inner join {{p}}weigh as weigh on weigh.cont_id = cont.cont_id
{
key cont.cont_id as cont_id,
cont.customer as customer,
cont.decl_kg as decl_kg,
weigh.meas_kg as meas_kg,
cast( abs( weigh.meas_kg - cont.decl_kg ) as abap.dec(15,2) ) as deviation_kg,
division( abs( weigh.meas_kg - cont.decl_kg ) * 100, cont.decl_kg, 2 ) as deviation_pct,
case
when weigh.meas_kg > cont.max_kg then 'HOLD'
when division( abs( weigh.meas_kg - cont.decl_kg ) * 100, cont.decl_kg, 2 ) > 5 then 'WARN'
else 'LOAD'
end as status
}

View File

@@ -0,0 +1,53 @@
CLASS {{p}}t20_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 hold_for_heavy FOR TESTING.
METHODS load_for_light FOR TESTING.
ENDCLASS.
CLASS {{p}}t20_test IMPLEMENTATION.
METHOD class_setup.
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_CONT_WEIGHT' ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
DATA lt_cont TYPE STANDARD TABLE OF {{p}}cont WITH EMPTY KEY.
DATA lt_weigh TYPE STANDARD TABLE OF {{p}}weigh WITH EMPTY KEY.
go_env->clear_doubles( ).
lt_cont = VALUE #( ( cont_id = 'A' customer = 'CUST_A' decl_kg = '1000.00' max_kg = '1100.00' )
( cont_id = 'B' customer = 'CUST_B' decl_kg = '1000.00' max_kg = '1100.00' ) ).
lt_weigh = VALUE #( ( cont_id = 'A' meas_kg = '1150.00' )
( cont_id = 'B' meas_kg = '1010.00' ) ).
go_env->insert_test_data( lt_cont ).
go_env->insert_test_data( lt_weigh ).
ENDMETHOD.
METHOD hold_for_heavy.
SELECT SINGLE deviation_kg, deviation_pct, status FROM {{p}}i_cont_weight
WHERE cont_id = 'A' INTO @DATA(ls_row).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '150.00' )
act = CONV decfloat34( ls_row-deviation_kg ) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '15.00' )
act = CONV decfloat34( ls_row-deviation_pct ) ).
cl_abap_unit_assert=>assert_equals( exp = 'HOLD' act = ls_row-status ).
ENDMETHOD.
METHOD load_for_light.
SELECT SINGLE deviation_kg, deviation_pct, status FROM {{p}}i_cont_weight
WHERE cont_id = 'B' INTO @DATA(ls_row).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '10.00' )
act = CONV decfloat34( ls_row-deviation_kg ) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '1.00' )
act = CONV decfloat34( ls_row-deviation_pct ) ).
cl_abap_unit_assert=>assert_equals( exp = 'LOAD' act = ls_row-status ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,12 @@
@EndUserText.label : 'Container'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}cont {
key client : abap.clnt not null;
key cont_id : abap.char(10) not null;
customer : abap.char(10);
decl_kg : abap.dec(15,2);
max_kg : abap.dec(15,2);
}

View File

@@ -0,0 +1,10 @@
@EndUserText.label : 'Weighbridge record'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}weigh {
key client : abap.clnt not null;
key cont_id : abap.char(10) not null;
meas_kg : abap.dec(15,2);
}

View File

@@ -0,0 +1,41 @@
# 1. Goal
Show the weight check of each container at a container terminal. A report and an
OData service will read the check, so the calculation must be in the database,
in a CDS view.
# 2. Open questions
None.
# 3. Context
- Table {{P}}CONT (container master), package $TMP. Key: CONT_ID (CHAR 10).
Fields: CUSTOMER (CHAR 10), DECL_KG (DEC 15,2, declared weight in kilograms),
MAX_KG (DEC 15,2, maximum permitted weight in kilograms).
- Table {{P}}WEIGH (weighbridge record), package $TMP. Key: CONT_ID (CHAR 10).
Field: MEAS_KG (DEC 15,2, measured weight in kilograms).
# 4. Contract
- Create the CDS view entity {{P}}I_CONT_WEIGHT in package $TMP.
- Elements, with these names: CONT_ID (key), CUSTOMER, DECL_KG, MEAS_KG,
DEVIATION_KG, DEVIATION_PCT, STATUS.
- No authorization check (#NOT_REQUIRED).
# 5. Business rules
1. Show one row for each container that has a weighbridge record. Do not show a
container without a weighbridge record.
2. DEVIATION_KG is the difference between MEAS_KG and DECL_KG, without a sign.
It is always positive or zero and it has 2 decimals.
3. DEVIATION_PCT is DEVIATION_KG as a percentage of DECL_KG. It has 2 decimals.
4. STATUS is 'HOLD' if MEAS_KG is greater than MAX_KG.
5. STATUS is 'WARN' if rule 4 is not true and DEVIATION_PCT is greater than 5.
6. STATUS is 'LOAD' in all other cases.
7. DECL_KG is always greater than zero.
# 6. Constraints
- Release target: 8.16.
- Use Clean ABAP. Keep every method below 40 statements.
- Out of scope: do not change {{P}}CONT and {{P}}WEIGH.
# 7. Acceptance
- The view 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,68 @@
{
"id": "G1000",
"category": "B",
"object_type": "DDLS",
"difficulty": 2,
"release_target": "v816",
"expected_outcome": "implement",
"budget": {
"max_tool_calls": 60,
"max_activations": 15
},
"seed": [
{
"type": "TABL",
"name": "{{P}}CONT",
"file": "seed/cont.tabl.asabap",
"description": "Container master"
},
{
"type": "TABL",
"name": "{{P}}WEIGH",
"file": "seed/weigh.tabl.asabap",
"description": "Weighbridge record"
}
],
"contract": [
{
"type": "DDLS",
"name": "{{P}}I_CONT_WEIGHT",
"fields": [
"CONT_ID",
"CUSTOMER",
"DECL_KG",
"MEAS_KG",
"DEVIATION_KG",
"DEVIATION_PCT",
"STATUS"
]
}
],
"out_of_scope": [
"{{P}}CONT",
"{{P}}WEIGH"
],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}T20_HIDDEN",
"file": "hidden/t20_hidden.clas.abap",
"description": "T20 hidden tests"
}
],
"reference": [
{
"type": "DDLS",
"name": "{{P}}I_CONT_WEIGHT",
"file": "reference/i_cont_weight.ddls.asddls",
"description": "Container weight check"
},
{
"type": "CLAS",
"name": "{{P}}T20_TEST",
"file": "reference/t20_test.clas.abap",
"description": "T20 own tests"
}
],
"craft_checks": []
}