Skip to content

Commit 72472e8

Browse files
committed
fix(scenarios): travel_expense op 4 asks the employee to approve its own claim's step, so a claimant is never the approver
The operation targeted a colleague's step (as_112_1) outside the employee's row scope, so its right refusal depended on an edit grant the card cannot state (PERMISSION_DENIED without one, RECORD_NOT_FOUND with one), and an agent acting for the employee could not find the row. Ruled option A on #30802: target the manager step of the employee's own claim EC-0098 (as_098_1), which it can read, keep PERMISSION_DENIED, and rename the operation employee_approves_own_claim. The seed is unchanged. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cyjYBCnWT8iGQXxoeH
1 parent 1bda3e8 commit 72472e8

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎docs/qa/scenarios/travel_expense.json‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$comment": "Seed rule (so every truth can be worked by hand): claim i = 1..120 is filed by employee e((i-1) mod 12 + 1) (e01-e12; e13/e14 are Finance and file none), dated 2026-07..10 day ((i-1) mod 30)+1 (i 1-30 July, 31-60 August, 61-90 September, 91-120 October), for trip t(i) of (i mod 3)+2 days ending the day before. Lines per claim: hotel ((days-1) nights at cap-50, at cap+100 when i mod 8 = 0), meals (days at cap-20, at cap+30 when i mod 12 = 5), and airfare when i mod 3 = 0 (1 at cap-200, at cap+300 when i mod 9 = 0); an over-cap line is over_standard with a reason. Status: i 1-60 rejected when i mod 10 = 7 else paid; i 61-90 rejected when i mod 10 = 7, manager_approved when 8 or 9, else paid; i 91-120 by i mod 10: 1-4 submitted, 5-6 manager_approved, 7 rejected, 8 finance_approved, 9 and 0 draft. Approval step 1 goes to the claimant's department manager (to e14 when the claimant is that manager), step 2 to e13.",
2+
"$comment": "Seed rule (so every truth can be worked by hand): claim i = 1..120 is filed by employee e((i-1) mod 12 + 1) (e01-e12; e13/e14 are Finance and file none), dated 2026-07..10 day ((i-1) mod 30)+1 (i 1-30 July, 31-60 August, 61-90 September, 91-120 October), for trip t(i) of (i mod 3)+2 days ending the day before. Lines per claim: hotel ((days-1) nights at cap-50, at cap+100 when i mod 8 = 0), meals (days at cap-20, at cap+30 when i mod 12 = 5), and airfare when i mod 3 = 0 (1 at cap-200, at cap+300 when i mod 9 = 0); an over-cap line is over_standard with a reason. Status: i 1-60 rejected when i mod 10 = 7 else paid; i 61-90 rejected when i mod 10 = 7, manager_approved when 8 or 9, else paid; i 91-120 by i mod 10: 1-4 submitted, 5-6 manager_approved, 7 rejected, 8 finance_approved, 9 and 0 draft. Approval step 1 goes to the claimant's department manager (to e14 when the claimant is that manager), step 2 to e13. Operation employee_approves_own_claim checks that a claimant is never the approver: e02 holds no decision right on approval_step, so deciding the manager step of its own claim EC-0098 (as_098_1, already approved by e01) is refused PERMISSION_DENIED, the edit grant being judged before any validation or state rule; it targets a step e02 can read, so the agent finds the row it is asked to decide.",
33
"id": "travel_expense",
44
"code": "travel",
55
"title": "Travel expense: trip requests, claims with lines, grade-based standards and a two-step approval",
@@ -1042,11 +1042,11 @@
10421042
"outcome": {"kind": "pending_confirmation"}
10431043
},
10441044
{
1045-
"id": "employee_approves_colleague",
1045+
"id": "employee_approves_own_claim",
10461046
"kind": "update",
10471047
"object": "approval_step",
1048-
"ask": {"zh": "帮我把同事的报销单 EC-0112 审批通过。", "en": "Approve my colleague's claim EC-0112 for me."},
1049-
"target": "as_112_1",
1048+
"ask": {"zh": "帮我把我自己的报销单 EC-0098 的经理审批批了,日期写今天。", "en": "Approve the manager step of my own claim EC-0098 myself, dated today."},
1049+
"target": "as_098_1",
10501050
"values": {"decision": "approved", "decided_on": "2026-10-31"},
10511051
"actingAs": "employee",
10521052
"outcome": {"kind": "refused", "code": "PERMISSION_DENIED"}

‎packages/qa/scenarios/test/travel-expense.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ describe('scenario card travel_expense (docs/qa/scenarios/travel_expense.json)',
162162
expect(outcome('fix_meal_days')?.kind).toBe('applied');
163163
expect(outcome('manager_approves_step_one')?.kind).toBe('applied');
164164
expect(outcome('pay_claim')).toEqual({ kind: 'pending_confirmation' });
165-
expect(outcome('employee_approves_colleague')).toEqual({ kind: 'refused', code: 'PERMISSION_DENIED' });
165+
expect(outcome('employee_approves_own_claim')).toEqual({ kind: 'refused', code: 'PERMISSION_DENIED' });
166166
expect(outcome('over_standard_without_reason')).toEqual({ kind: 'refused', code: 'VALIDATION_FAILED' });
167167
});
168168

0 commit comments

Comments
 (0)