Repository navigation
test: align slot-approve internal-caller tests with the gate - #18944
Conversation
…ssion-approval gate The slot approve route refuses every internal-auth caller with 403 in deny_session_approval_caller, before the owner-bound target is read. Three tests in test_approval_decide_owner_bound.py were written against a base without that gate and expected 404/200; they now assert 403 and that the pending future stays unresolved.
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS The spec still says an internal caller on the slot route gets 404 Watch
Suggestions
[DESIGN-REVIEWED] dab0985 Description read[DESCRIPTION-READ] dcd27eb06b875df0c7dbdd7688e53002a941b98541d2623d35be095bd374af2c That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
buluoray
left a comment
There was a problem hiding this comment.
Approving at dab0985. Test-only change, no src/ behaviour touched.
Verified:
_internal_session_approval_refusalinsrc/kiro_crew/dashboard/chat_handlers.pyadmits only a verifiedcron:key onchat_mode; every otherinternal_authcaller onchat_slot_approvegets the owner-only 403. So 403owner_onlyis the right expectation for all three slot-route tests, and the owner-bound target is never read for an internal caller there.test/test_approval_decide_owner_bound.pyfails 3/8 on current main (403 vs 404/200) and passes 8/8 at this head, run locally with-n 0.- The approvals-route tests that still prove an internal caller must send the owner-bound target are unchanged.
Closes #18943
Refs #18810, #18867
Problem / Motivation
Goal: Turn
test/test_approval_decide_owner_bound.pygreen onmainwithout changing any auth behavior.Three tests fail on
mainfrom9086e9730(#18810) to the current tip:test_internal_caller_bare_id_slot_approve_is_refused--assert 403 == 404test_internal_caller_slot_approve_with_no_request_id_is_refused--assert 403 == 404test_internal_caller_owner_bound_slot_approve_resolves--assert 403 == 200They are red in "Backend Tests" on every PR whose merge ref includes #18810.
Why it matters
The red lands in "Backend Tests" on every PR whose merge ref includes #18810, so unrelated PRs cannot go green.
Not a goal
src/.Root cause: the test is stale, the code is right
This is a semantic merge conflict between two PRs that each passed CI alone.
849803612, merged 18:51Z) madedeny_session_approval_callerrefuse everyinternal_authcaller onchat_slot_approvewith 403owner_only. Only a verifiedcron:key onchat_modeis admitted. Its PR body and docstring say so explicitly: "any key onchat_slot_approve... even a verifieddashboard:orsubagent:key -- is refused".9086e9730, opened 09:40Z on an older base, merged 19:58Z) added tests that assume an internal caller reaches the slot route's body: 404approval_target_requiredfor a bare id, 200 for an owner-bound target. Its last green CI ran on a merge ref without fix(security): refuse bare internal-auth on session-approval routes #18867.api_chat_slot_approvecallsdeny_session_approval_calleron its first line, so on today'smainan internal caller never reaches the owner-bound check. The 403 is the later, stricter security contract working as written. Making the tests pass by restoring 200 would reopen the bypass #18867 closed. So the tests change, not the code.What changed (motivation → approach → change)
Test-only, one file:
owner_onlyfor the bare-id one). The future still stays unresolved.test_internal_caller_owner_bound_slot_approve_resolvesbecomes..._is_refused. It expects 403 and an unresolved future.No
src/change. The approvals-route tests (/api/approvals/{id}/{action}) and the dashboard-user tests are unchanged and still pass.Auth gates
Nothing is loosened. Every changed assertion is at least as strict as before: each one asserts a refusal and an unresolved future. The one assertion that asserted a resolve (200) now asserts a refusal.
Backwards compatibility
No behavior change; test-only.
Tests
python3 -m pytest test/test_approval_decide_owner_bound.py test/test_chat_mode_internal_auth_gate.py test/test_dashboard_approval.py: 129 passed (8/8 in the target file).main.Manual verification
N/A -- test-only change.
Screenshots / video
N/A -- no UI change.
Related Issues
Closes #18943. Refs #18810, #18867.
Pattern harvest
Rule candidate: review-prompt
Pattern: "Two auth PRs on the same route pass CI alone; a test written on the older base asserts a status the later gate now refuses."
Checklist
Contribution License Agreement
Contributed under the project's Apache-2.0 license.