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,14 @@
{
"id": "G1007",
"pool": "train",
"object_type": "CLAS",
"category": "H",
"attempts": [
{
"stage": "validate",
"oracle": 100,
"null": 30
}
],
"accepted": true
}

View File

@@ -0,0 +1,56 @@
CLASS {{p}}jump_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC.
PUBLIC SECTION.
TYPES ty_amount TYPE p LENGTH 8 DECIMALS 2.
METHODS constructor.
METHODS calculate
IMPORTING iv_persons TYPE i
iv_minutes TYPE i
iv_member TYPE abap_bool
RETURNING VALUE(rv_price) TYPE ty_amount.
PRIVATE SECTION.
CONSTANTS:
c_short_price TYPE ty_amount VALUE '8.00',
c_long_price TYPE ty_amount VALUE '12.00',
c_member_factor TYPE ty_amount VALUE '0.80',
c_group_factor TYPE ty_amount VALUE '0.90',
c_group_size TYPE i VALUE 10,
c_long_minutes TYPE i VALUE 60.
METHODS price_per_person
IMPORTING iv_minutes TYPE i
RETURNING VALUE(rv_price) TYPE ty_amount.
ENDCLASS.
CLASS {{p}}jump_pricer IMPLEMENTATION.
METHOD constructor.
ENDMETHOD.
METHOD calculate.
IF iv_persons < 1 OR iv_minutes < 1.
RETURN.
ENDIF.
DATA(lv_price) = CONV ty_amount( price_per_person( iv_minutes ) * iv_persons ).
IF iv_member = abap_true.
lv_price = lv_price * c_member_factor.
ENDIF.
IF iv_persons >= c_group_size.
lv_price = lv_price * c_group_factor.
ENDIF.
rv_price = round( val = lv_price dec = 2 ).
ENDMETHOD.
METHOD price_per_person.
IF iv_minutes < c_long_minutes.
rv_price = c_short_price.
ELSE.
rv_price = c_long_price.
ENDIF.
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,61 @@
CLASS ltc_jump_pricer DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
DATA mo_cut TYPE REF TO {{p}}jump_pricer.
METHODS setup.
METHODS zero_persons FOR TESTING.
METHODS zero_minutes FOR TESTING.
METHODS short_session FOR TESTING.
METHODS long_session FOR TESTING.
METHODS member_discount FOR TESTING.
METHODS group_discount FOR TESTING.
METHODS member_and_group FOR TESTING.
ENDCLASS.
CLASS ltc_jump_pricer IMPLEMENTATION.
METHOD setup.
mo_cut = NEW {{p}}jump_pricer( ).
ENDMETHOD.
METHOD zero_persons.
cl_abap_unit_assert=>assert_equals(
exp = CONV {{p}}jump_pricer=>ty_amount( '0.00' )
act = mo_cut->calculate( iv_persons = 0 iv_minutes = 30 iv_member = abap_false ) ).
ENDMETHOD.
METHOD zero_minutes.
cl_abap_unit_assert=>assert_equals(
exp = CONV {{p}}jump_pricer=>ty_amount( '0.00' )
act = mo_cut->calculate( iv_persons = 4 iv_minutes = 0 iv_member = abap_false ) ).
ENDMETHOD.
METHOD short_session.
cl_abap_unit_assert=>assert_equals(
exp = CONV {{p}}jump_pricer=>ty_amount( '16.00' )
act = mo_cut->calculate( iv_persons = 2 iv_minutes = 30 iv_member = abap_false ) ).
ENDMETHOD.
METHOD long_session.
cl_abap_unit_assert=>assert_equals(
exp = CONV {{p}}jump_pricer=>ty_amount( '36.00' )
act = mo_cut->calculate( iv_persons = 3 iv_minutes = 90 iv_member = abap_false ) ).
ENDMETHOD.
METHOD member_discount.
cl_abap_unit_assert=>assert_equals(
exp = CONV {{p}}jump_pricer=>ty_amount( '12.80' )
act = mo_cut->calculate( iv_persons = 2 iv_minutes = 30 iv_member = abap_true ) ).
ENDMETHOD.
METHOD group_discount.
cl_abap_unit_assert=>assert_equals(
exp = CONV {{p}}jump_pricer=>ty_amount( '72.00' )
act = mo_cut->calculate( iv_persons = 10 iv_minutes = 30 iv_member = abap_false ) ).
ENDMETHOD.
METHOD member_and_group.
cl_abap_unit_assert=>assert_equals(
exp = CONV {{p}}jump_pricer=>ty_amount( '86.40' )
act = mo_cut->calculate( iv_persons = 10 iv_minutes = 90 iv_member = abap_true ) ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,50 @@
# 1. Goal
Calculate the price of a jump session at a trampoline park. A booking program
calls the calculation before it confirms a booking. The booking program needs
one price in euro for each booking.
# 2. Open questions
None.
# 3. Context
- The trampoline park sells jump sessions of 30, 45, 60, 75 or 90 minutes.
- The booking program knows the number of persons in the booking, the length of
the session in minutes, and if the customer has a member card.
- All prices are in euro and have 2 decimals.
# 4. Contract
- Create the class {{P}}JUMP_PRICER in package $TMP.
- The class is public, final, and has a public constructor without parameters.
- The public section has the type TY_AMOUNT (packed number, length 8, 2 decimals)
and one method:
CALCULATE
IMPORTING iv_persons TYPE i
iv_minutes TYPE i
iv_member TYPE abap_bool
RETURNING VALUE(rv_price) TYPE ty_amount.
- iv_persons is the number of persons. iv_minutes is the session length in
minutes. iv_member is abap_true if the customer has a member card.
- Do not add other public methods.
# 5. Business rules
Apply the rules in this sequence.
1. If iv_persons is less than 1, or iv_minutes is less than 1, the price is 0.00.
2. The price per person depends on the session length:
- If the session is shorter than 60 minutes, the price per person is 8.00.
- If the session is longer than 60 minutes, the price per person is 12.00.
3. Multiply the price per person by the number of persons.
4. If iv_member is abap_true, subtract 20 percent from the result of rule 3.
5. If the number of persons is 10 or more, subtract 10 percent from the result
of rule 4.
6. Round the result to 2 decimals. Round half up.
# 6. Constraints
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
- Coding standards: Clean ABAP. Method length below 40 statements. No global
variables. No comment that restates the code.
- Out of scope: do not change other objects in package $TMP.
# 7. Acceptance
- The class is active and has no syntax error.
- Every business rule is checked by a test.
- Write your own ABAP Unit tests for the class.

View File

@@ -0,0 +1,54 @@
{
"id": "G1007",
"category": "H",
"object_type": "CLAS",
"difficulty": 2,
"release_target": "v816",
"expected_outcome": "stop",
"expected_gap": {
"description": "The business rules do not define the price per person for a jump session of exactly 60 minutes.",
"keywords": [
[
"exactly",
"60"
],
[
"60",
"minutes"
],
[
"60",
"minute"
],
[
"boundary",
"60"
]
]
},
"budget": {
"max_tool_calls": 60,
"max_activations": 15
},
"seed": [],
"contract": [
{
"type": "CLAS",
"name": "{{P}}JUMP_PRICER"
}
],
"out_of_scope": [],
"hidden_tests": [],
"reference": [
{
"type": "CLAS",
"name": "{{P}}JUMP_PRICER",
"file": "reference/jump_pricer.clas.abap",
"description": "Jump session pricer",
"testclasses_file": "reference/jump_pricer.testclasses.abap"
}
],
"craft_checks": [
"method_length"
]
}