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,16 @@
{
"id": "G1310",
"pool": "train",
"category": "K",
"base_task": "G1005",
"style": "free_text",
"tool_schema": null,
"attempts": [
{
"stage": "validate",
"oracle": 100.0,
"null": 0
}
],
"accepted": true
}

View File

@@ -0,0 +1,129 @@
CLASS {{p}}t02_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
DATA mo_cut TYPE REF TO {{p}}if_credit_check.
METHODS setup.
METHODS too_young FOR TESTING.
METHODS age_eighteen_is_ok FOR TESTING.
METHODS zero_income FOR TESTING.
METHODS two_open_plans FOR TESTING.
METHODS order_above_limit FOR TESTING.
METHODS order_at_limit_is_ok FOR TESTING.
METHODS young_limit_halved FOR TESTING.
METHODS adult_keeps_limit FOR TESTING.
METHODS young_limit_is_floor FOR TESTING.
METHODS plan_reduces_limit FOR TESTING.
METHODS valid_adult FOR TESTING.
ENDCLASS.
CLASS {{p}}t02_hidden IMPLEMENTATION.
METHOD setup.
mo_cut = NEW {{p}}credit_checker( ).
ENDMETHOD.
METHOD too_young.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_credit_check=>c_reason-age
act = mo_cut->check( iv_age = 17
iv_income = '3000.00'
iv_open_plans = 0
iv_order_amount = '100.00' ) ).
ENDMETHOD.
METHOD age_eighteen_is_ok.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_credit_check=>c_reason-ok
act = mo_cut->check( iv_age = 18
iv_income = '3000.00'
iv_open_plans = 0
iv_order_amount = '100.00' ) ).
ENDMETHOD.
METHOD zero_income.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_credit_check=>c_reason-income
act = mo_cut->check( iv_age = 30
iv_income = '0.00'
iv_open_plans = 0
iv_order_amount = '100.00' ) ).
ENDMETHOD.
METHOD two_open_plans.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_credit_check=>c_reason-open_plan
act = mo_cut->check( iv_age = 30
iv_income = '3000.00'
iv_open_plans = 2
iv_order_amount = '100.00' ) ).
ENDMETHOD.
METHOD order_above_limit.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_credit_check=>c_reason-limit
act = mo_cut->check( iv_age = 30
iv_income = '1000.00'
iv_open_plans = 0
iv_order_amount = '3000.01' ) ).
ENDMETHOD.
METHOD order_at_limit_is_ok.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_credit_check=>c_reason-ok
act = mo_cut->check( iv_age = 30
iv_income = '1000.00'
iv_open_plans = 0
iv_order_amount = '3000.00' ) ).
ENDMETHOD.
METHOD young_limit_halved.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_credit_check=>c_reason-limit
act = mo_cut->check( iv_age = 20
iv_income = '1000.00'
iv_open_plans = 0
iv_order_amount = '1500.01' ) ).
ENDMETHOD.
METHOD adult_keeps_limit.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_credit_check=>c_reason-ok
act = mo_cut->check( iv_age = 21
iv_income = '1000.00'
iv_open_plans = 0
iv_order_amount = '1500.01' ) ).
ENDMETHOD.
METHOD young_limit_is_floor.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_credit_check=>c_reason-limit
act = mo_cut->check( iv_age = 20
iv_income = '2500.50'
iv_open_plans = 0
iv_order_amount = '3750.50' ) ).
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_credit_check=>c_reason-ok
act = mo_cut->check( iv_age = 20
iv_income = '2500.50'
iv_open_plans = 0
iv_order_amount = '3750.00' ) ).
ENDMETHOD.
METHOD plan_reduces_limit.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_credit_check=>c_reason-limit
act = mo_cut->check( iv_age = 30
iv_income = '1000.00'
iv_open_plans = 1
iv_order_amount = '2500.01' ) ).
ENDMETHOD.
METHOD valid_adult.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_credit_check=>c_reason-ok
act = mo_cut->check( iv_age = 35
iv_income = '2000.00'
iv_open_plans = 1
iv_order_amount = '5500.00' ) ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,59 @@
CLASS {{p}}credit_checker DEFINITION PUBLIC FINAL CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES {{p}}if_credit_check.
PRIVATE SECTION.
CONSTANTS c_income_factor TYPE i VALUE 3.
CONSTANTS c_plan_reduction TYPE {{p}}if_credit_check=>ty_amount VALUE '500.00'.
CONSTANTS c_min_age TYPE i VALUE 18.
CONSTANTS c_full_limit_age TYPE i VALUE 21.
CONSTANTS c_max_open_plans TYPE i VALUE 2.
CONSTANTS c_hundred TYPE i VALUE 100.
METHODS credit_limit_cents
IMPORTING iv_age TYPE i
iv_income TYPE {{p}}if_credit_check=>ty_amount
iv_open_plans TYPE i
RETURNING VALUE(rv_cents) TYPE i.
METHODS to_cents
IMPORTING iv_amount TYPE {{p}}if_credit_check=>ty_amount
RETURNING VALUE(rv_cents) TYPE i.
ENDCLASS.
CLASS {{p}}credit_checker IMPLEMENTATION.
METHOD {{p}}if_credit_check~check.
IF iv_age < c_min_age.
rv_reason = {{p}}if_credit_check=>c_reason-age.
RETURN.
ENDIF.
IF iv_income <= 0.
rv_reason = {{p}}if_credit_check=>c_reason-income.
RETURN.
ENDIF.
IF iv_open_plans >= c_max_open_plans.
rv_reason = {{p}}if_credit_check=>c_reason-open_plan.
RETURN.
ENDIF.
IF to_cents( iv_order_amount ) > credit_limit_cents( iv_age = iv_age
iv_income = iv_income
iv_open_plans = iv_open_plans ).
rv_reason = {{p}}if_credit_check=>c_reason-limit.
RETURN.
ENDIF.
rv_reason = {{p}}if_credit_check=>c_reason-ok.
ENDMETHOD.
METHOD credit_limit_cents.
rv_cents = to_cents( iv_income ) * c_income_factor
- to_cents( c_plan_reduction ) * iv_open_plans.
IF iv_age < c_full_limit_age.
rv_cents = rv_cents DIV 2.
rv_cents = rv_cents DIV c_hundred * c_hundred.
ENDIF.
ENDMETHOD.
METHOD to_cents.
rv_cents = iv_amount * c_hundred.
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,98 @@
CLASS ltc_credit_checker DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
DATA mo_cut TYPE REF TO {{p}}if_credit_check.
METHODS setup.
METHODS too_young FOR TESTING.
METHODS zero_income FOR TESTING.
METHODS two_open_plans FOR TESTING.
METHODS order_above_limit FOR TESTING.
METHODS order_at_limit FOR TESTING.
METHODS young_limit_halved FOR TESTING.
METHODS young_limit_is_floor FOR TESTING.
METHODS valid_adult FOR TESTING.
ENDCLASS.
CLASS ltc_credit_checker IMPLEMENTATION.
METHOD setup.
mo_cut = NEW {{p}}credit_checker( ).
ENDMETHOD.
METHOD too_young.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_credit_check=>c_reason-age
act = mo_cut->check( iv_age = 17
iv_income = '3000.00'
iv_open_plans = 0
iv_order_amount = '100.00' ) ).
ENDMETHOD.
METHOD zero_income.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_credit_check=>c_reason-income
act = mo_cut->check( iv_age = 30
iv_income = '0.00'
iv_open_plans = 0
iv_order_amount = '100.00' ) ).
ENDMETHOD.
METHOD two_open_plans.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_credit_check=>c_reason-open_plan
act = mo_cut->check( iv_age = 30
iv_income = '3000.00'
iv_open_plans = 2
iv_order_amount = '100.00' ) ).
ENDMETHOD.
METHOD order_above_limit.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_credit_check=>c_reason-limit
act = mo_cut->check( iv_age = 30
iv_income = '1000.00'
iv_open_plans = 0
iv_order_amount = '3000.01' ) ).
ENDMETHOD.
METHOD order_at_limit.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_credit_check=>c_reason-ok
act = mo_cut->check( iv_age = 30
iv_income = '1000.00'
iv_open_plans = 0
iv_order_amount = '3000.00' ) ).
ENDMETHOD.
METHOD young_limit_halved.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_credit_check=>c_reason-limit
act = mo_cut->check( iv_age = 20
iv_income = '1000.00'
iv_open_plans = 0
iv_order_amount = '1500.01' ) ).
ENDMETHOD.
METHOD young_limit_is_floor.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_credit_check=>c_reason-limit
act = mo_cut->check( iv_age = 20
iv_income = '2500.50'
iv_open_plans = 0
iv_order_amount = '3750.50' ) ).
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_credit_check=>c_reason-ok
act = mo_cut->check( iv_age = 20
iv_income = '2500.50'
iv_open_plans = 0
iv_order_amount = '3750.00' ) ).
ENDMETHOD.
METHOD valid_adult.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_credit_check=>c_reason-ok
act = mo_cut->check( iv_age = 35
iv_income = '2000.00'
iv_open_plans = 1
iv_order_amount = '5500.00' ) ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,18 @@
INTERFACE {{p}}if_credit_check PUBLIC.
TYPES ty_reason TYPE c LENGTH 10.
TYPES ty_amount TYPE p LENGTH 11 DECIMALS 2.
CONSTANTS:
BEGIN OF c_reason,
ok TYPE ty_reason VALUE 'OK',
age TYPE ty_reason VALUE 'AGE',
income TYPE ty_reason VALUE 'INCOME',
open_plan TYPE ty_reason VALUE 'OPEN_PLAN',
limit TYPE ty_reason VALUE 'LIMIT',
END OF c_reason.
METHODS check
IMPORTING iv_age TYPE i
iv_income TYPE ty_amount
iv_open_plans TYPE i
iv_order_amount TYPE ty_amount
RETURNING VALUE(rv_reason) TYPE ty_reason.
ENDINTERFACE.

View File

@@ -0,0 +1,5 @@
Hello, please create the class {{P}}CREDIT_CHECKER in package $TMP. The class is public and final. It has a public constructor without parameters. It implements the interface {{P}}IF_CREDIT_CHECK. Do not add other public methods. The interface {{P}}IF_CREDIT_CHECK exists in package $TMP. It is active. It declares the type of the reason, the type of a money amount, the constants of the reason codes, and one method. The method name, the parameter names, and the parameter types are not in this document. Read the interface in the system. The reason constants have the names OK, AGE, INCOME, OPEN_PLAN, and LIMIT. There are no open questions.
The check receives the age of the customer in years, the net monthly income of the customer, the number of open instalment plans of the customer, and the amount of the new order. Apply the rules in this sequence. Return the reason of the first rule that fails. If the age is less than 18, return AGE. If the net monthly income is zero or less, return INCOME. If the number of open instalment plans is 2 or more, return OPEN_PLAN. Calculate the credit limit. Start with three times the net monthly income. Subtract 500 for each open instalment plan. If the age is less than 21, halve the limit and round the result down to whole euros. For example, 3750.75 becomes 3750.00. If the amount of the new order is more than the credit limit, return LIMIT. Else return OK.
The release target is SAP_BASIS 8.16 (ABAP Platform 2025). Use Clean ABAP coding standards. Keep the method length below 40 statements. Do not use global variables. Do not write comments that restate the code. Do not change the interface {{P}}IF_CREDIT_CHECK. The class must be active and have no syntax error. The hidden tests must pass. Write your own ABAP Unit tests for the class.

View File

@@ -0,0 +1,53 @@
{
"id": "G1310",
"category": "K",
"object_type": "CLAS",
"difficulty": 2,
"release_target": "v816",
"expected_outcome": "implement",
"budget": {
"max_tool_calls": 70,
"max_activations": 18
},
"seed": [
{
"type": "INTF",
"name": "{{P}}IF_CREDIT_CHECK",
"file": "seed/if_credit_check.intf.abap",
"description": "Instalment plan check contract"
}
],
"contract": [
{
"type": "CLAS",
"name": "{{P}}CREDIT_CHECKER",
"implements": "{{P}}IF_CREDIT_CHECK"
}
],
"out_of_scope": [
"{{P}}IF_CREDIT_CHECK"
],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}T02_HIDDEN",
"file": "hidden/t02_hidden.clas.abap",
"description": "T02 hidden tests"
}
],
"reference": [
{
"type": "CLAS",
"name": "{{P}}CREDIT_CHECKER",
"file": "reference/credit_checker.clas.abap",
"description": "Instalment plan credit checker",
"testclasses_file": "reference/credit_checker.testclasses.abap"
}
],
"craft_checks": [
"method_length",
"no_global_variables"
],
"base_task": "G1005",
"input_style": "free_text"
}