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,68 @@
# 1. Goal
Calculate the charge of a piano tuning visit. A booking program calls the
calculation before it confirms the appointment. The program needs the fee parts
and the total fee of the visit.
# 2. Open questions
None.
# 3. Context
- The class {{P}}TUNE_RATES is in package $TMP. It is active. It holds the
price list of the tuning service and the travel constants. Read this class.
Its interface is not written in this document.
- {{P}}TUNE_RATES is out of scope. Do not change it.
# 4. Contract
- Create the class {{P}}PIANO_PRICER in package $TMP.
- The class is public, final, and has a public constructor without parameters.
- Define these public types in the class:
- ty_piano_type: character, length 1.
- ty_amount: packed number, length 8, 2 decimals.
- ty_reason: character, length 8.
- ty_charge: structure with the components reason (TYPE ty_reason), base_fee,
travel_fee, extra_fee and total_fee (all TYPE ty_amount).
- Define the public constant structure c_reason with the components ok = 'OK',
unknown = 'UNKNOWN', distance = 'DISTANCE' and pitch = 'PITCH'. All
components have the type ty_reason.
- The class has one public method:
calculate
IMPORTING iv_piano_type TYPE ty_piano_type
iv_distance_km TYPE i
iv_pitch_cents TYPE i
RETURNING VALUE(rs_charge) TYPE ty_charge.
- Do not add other public methods.
# 5. Business rules
Apply the rules in this sequence.
1. Read the price list of {{P}}TUNE_RATES. If iv_piano_type is not a piano type
of the price list, return a charge with the reason UNKNOWN. All fee
components of this charge are 0.
2. If iv_distance_km is smaller than 0, return a charge with the reason
DISTANCE. All fee components of this charge are 0.
3. If iv_pitch_cents is smaller than 0, return a charge with the reason PITCH.
All fee components of this charge are 0.
4. The base fee is the base fee of the piano type in the price list.
5. A tuning takes 45 minutes. Each cent of pitch deviation adds one minute of
work.
6. The piano type has a number of included minutes and a fee for each minute.
The extra fee is the number of work minutes above the included minutes
multiplied by the minute fee. If the work minutes are not above the included
minutes, the extra fee is 0.
7. The travel is free up to the free distance of {{P}}TUNE_RATES. Each
kilometre above the free distance costs the kilometre fee of
{{P}}TUNE_RATES. The travel fee is this cost. If the distance is not above
the free distance, the travel fee is 0.
8. The total fee is the base fee plus the travel fee plus the extra fee.
9. Else return a charge with the reason OK and the fee components of rules 4,
6 and 7.
# 6. Constraints
- Release target: 8.16 (SAP_BASIS 816).
- Coding standards: Clean ABAP. Method length below 40 statements. No global
variables. No comment that restates the code.
- Out of scope: do not change {{P}}TUNE_RATES.
# 7. Acceptance
- The class is active and has no syntax error.
- The hidden tests pass.
- Write your own ABAP Unit tests for the class.