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,23 @@
{
"id": "G1139",
"pool": "train",
"object_type": "FUNC",
"category": "H",
"attempts": [
{
"stage": "bundle",
"errors": [
"Too close to task G0173 (similarity spec 0.64, rules 0.35, names 1.00). Choose a different business topic and different object names."
],
"by_check": {
"extra": 1
}
},
{
"stage": "validate",
"oracle": 100,
"null": 30
}
],
"accepted": true
}

View File

@@ -0,0 +1,36 @@
FUNCTION {{p}}loan_check
IMPORTING
iv_fragile TYPE abap_bool
iv_insured TYPE abap_bool
iv_days TYPE i
EXPORTING
ev_approved TYPE abap_bool
ev_reason TYPE string
EXCEPTIONS
invalid_days.
IF iv_days < 1.
RAISE invalid_days.
ENDIF.
IF iv_days > 90.
ev_approved = abap_false.
ev_reason = 'TOO_LONG'.
RETURN.
ENDIF.
" Open point: rules 3 and 4 give opposite priority to the insurance rule and
" the fragility rule for an insured fragile exhibit. This reference applies
" rule 3 (the insurance rule first).
IF iv_insured = abap_true.
ev_approved = abap_true.
ev_reason = 'INSURED'.
ELSEIF iv_fragile = abap_true.
ev_approved = abap_false.
ev_reason = 'FRAGILE'.
ELSE.
ev_approved = abap_true.
ev_reason = 'OK'.
ENDIF.
ENDFUNCTION.

View File

@@ -0,0 +1,91 @@
CLASS {{p}}loan_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS check
IMPORTING
iv_fragile TYPE abap_bool
iv_insured TYPE abap_bool
iv_days TYPE i
EXPORTING
ev_approved TYPE abap_bool
ev_reason TYPE string
ev_subrc TYPE sysubrc.
METHODS invalid_days FOR TESTING.
METHODS too_long FOR TESTING.
METHODS insured_approved FOR TESTING.
METHODS fragile_rejected FOR TESTING.
METHODS plain_approved FOR TESTING.
ENDCLASS.
CLASS {{p}}loan_test IMPLEMENTATION.
METHOD check.
CALL FUNCTION '{{P}}LOAN_CHECK'
EXPORTING
iv_fragile = iv_fragile
iv_insured = iv_insured
iv_days = iv_days
IMPORTING
ev_approved = ev_approved
ev_reason = ev_reason
EXCEPTIONS
invalid_days = 1
OTHERS = 2.
ev_subrc = sy-subrc.
ENDMETHOD.
METHOD invalid_days.
check(
EXPORTING
iv_days = 0
IMPORTING
ev_subrc = DATA(lv_rc) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ).
ENDMETHOD.
METHOD too_long.
check(
EXPORTING
iv_days = 100
IMPORTING
ev_approved = DATA(lv_approved)
ev_reason = DATA(lv_reason) ).
cl_abap_unit_assert=>assert_false( lv_approved ).
cl_abap_unit_assert=>assert_equals( exp = `TOO_LONG` act = lv_reason ).
ENDMETHOD.
METHOD insured_approved.
check(
EXPORTING
iv_insured = abap_true
iv_days = 30
IMPORTING
ev_approved = DATA(lv_approved)
ev_reason = DATA(lv_reason) ).
cl_abap_unit_assert=>assert_true( lv_approved ).
cl_abap_unit_assert=>assert_equals( exp = `INSURED` act = lv_reason ).
ENDMETHOD.
METHOD fragile_rejected.
check(
EXPORTING
iv_fragile = abap_true
iv_days = 30
IMPORTING
ev_approved = DATA(lv_approved)
ev_reason = DATA(lv_reason) ).
cl_abap_unit_assert=>assert_false( lv_approved ).
cl_abap_unit_assert=>assert_equals( exp = `FRAGILE` act = lv_reason ).
ENDMETHOD.
METHOD plain_approved.
check(
EXPORTING
iv_days = 30
IMPORTING
ev_approved = DATA(lv_approved)
ev_reason = DATA(lv_reason) ).
cl_abap_unit_assert=>assert_true( lv_approved ).
cl_abap_unit_assert=>assert_equals( exp = `OK` act = lv_reason ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,14 @@
FUNCTION {{p}}loan_sample
IMPORTING
iv_fragile TYPE abap_bool
iv_insured TYPE abap_bool
iv_days TYPE i
EXPORTING
ev_approved TYPE abap_bool
ev_reason TYPE string
EXCEPTIONS
invalid_days.
ev_approved = abap_false.
ENDFUNCTION.

View File

@@ -0,0 +1,40 @@
# 1. Goal
A museum lends exhibits to other museums. Before the museum approves a loan
request, the loan desk calls one check module for each request. The check module
must have the same interface as the sample check module, because the loan desk
calls all check modules in the same way.
# 2. Open questions
None.
# 3. Context
- Function group {{P}}FG_LOAN exists in package $TMP.
- Function module {{P}}LOAN_SAMPLE exists in this group. It is the sample check
module. Its interface is the interface that all check modules must use.
# 4. Contract
- Create the function module {{P}}LOAN_CHECK in function group {{P}}FG_LOAN.
- Use exactly the interface of {{P}}LOAN_SAMPLE: the same parameter names, kinds,
types, and exceptions.
# 5. Business rules
1. If the loan period in days is less than 1, raise the exception INVALID_DAYS.
2. If the loan period is more than 90 days, the request is rejected. The reason
is 'TOO_LONG'. No other rule applies.
3. If the exhibit is insured, the request is approved. The reason is 'INSURED'.
The insurance rule has priority over the fragility rule.
4. If the exhibit is fragile, the request is rejected. The reason is 'FRAGILE'.
The fragility rule has priority over the insurance rule.
5. If the exhibit is neither insured nor fragile, the request is approved. The
reason is 'OK'.
6. Rules 3, 4 and 5 apply to a loan period of 1 to 90 days.
# 6. Constraints
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
- Coding standards: Clean ABAP. Keep each method below 40 statements.
- Out of scope: do not change {{P}}LOAN_SAMPLE.
# 7. Acceptance
- The function module is active and has no syntax error.
- The tests of the check module pass.
- Write ABAP Unit tests for the function module in a global test class.

View File

@@ -0,0 +1,94 @@
{
"id": "G1139",
"category": "H",
"object_type": "FUNC",
"difficulty": 2,
"release_target": "v816",
"expected_outcome": "stop",
"budget": {
"max_tool_calls": 60,
"max_activations": 15
},
"seed": [
{
"type": "FUGR",
"name": "{{P}}FG_LOAN",
"description": "Exhibit loan check function group"
},
{
"type": "FUNC",
"name": "{{P}}LOAN_SAMPLE",
"functionGroup": "{{P}}FG_LOAN",
"file": "seed/loan_sample.func.abap",
"description": "Sample check module"
}
],
"contract": [
{
"type": "FUNC",
"name": "{{P}}LOAN_CHECK",
"functionGroup": "{{P}}FG_LOAN",
"params": [
{
"name": "iv_fragile",
"type": "abap_bool"
},
{
"name": "iv_insured",
"type": "abap_bool"
},
{
"name": "iv_days",
"type": "i"
},
{
"name": "ev_approved",
"type": "abap_bool"
},
{
"name": "ev_reason",
"type": "string"
}
]
}
],
"out_of_scope": [
"{{P}}LOAN_SAMPLE"
],
"hidden_tests": [],
"reference": [
{
"type": "FUNC",
"name": "{{P}}LOAN_CHECK",
"functionGroup": "{{P}}FG_LOAN",
"file": "reference/loan_check.func.abap",
"description": "Exhibit loan check module"
},
{
"type": "CLAS",
"name": "{{P}}LOAN_TEST",
"file": "reference/loan_test.clas.abap",
"description": "Own tests of the check module"
}
],
"craft_checks": [
"method_length"
],
"expected_gap": {
"description": "Business rules 3 and 4 give opposite priority to the insurance rule and the fragility rule, so a loan request for an insured fragile exhibit cannot be decided.",
"keywords": [
[
"insured",
"fragile"
],
[
"priority",
"opposite"
],
[
"contradict",
"rule"
]
]
}
}