Repository navigation
test(api): align scope matrix fixtures with the #416 approve API - #440
Conversation
|
Warning Review limit reached
This review includes 1 billable file and costs up to $0.25.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 33 minutes for your next included review. View limit detailsLimit details: You’ve used the included review currently available. Your 62 included PR review attempts over the past 7 days set your current allowance at 1 review per hour. Review configuration: ⚙️ Run configurationConfiguration used: Repository: LeanerCloud/cloud-commitments-platform/.coderabbit.yaml Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (1)
Comment |
|
Orchestrator-verified test-only fix for red main (emergent #416 x #381 conflict): the two matrix stubs return the post-#416 (string, error) shape, and the revoke fixture stores the hashed token. The author proved the matrix still has teeth (55 deny subtests fail with requireExecutionAccess forced to nil); go test -race -short api/server/mocks, golangci-lint v2.10.1, vet and gocyclo are clean; CI green. |
Summary
Fixes red main (Unit Tests and Integration Tests) after the #381 merge. Test-only change in
internal/api/execution_scope_test.go.Root cause
Emergent conflict between #416 and #381, each green alone. #416 changed
ApproveAndExecute/RunPlannedPurchaseNowto return(string, error)and stores approval tokens hashed. #381's matrix test stubbed both withReturn(errScopeTestReached)(one value), soMockPurchaseManagerpanicked onargs.String(0)("mutation reached"). Behind that panic,TestRevoke_AuthorizedNonRevocableStatusIs409stored the raw"email-token", so its token cases got 403 instead of 409.Fix
Return("", errScopeTestReached).config.HashApprovalToken("email-token").Regression proof
go test -race -short -run TestExecutionEndpoints_ScopeMatrix ./internal/api/panics as above; with the fix it passes.requireExecutionAccessreturn nil yields 55 failing subtests (all partial/out-of-scope deny cases). Reverted.Verification
go test -race -short ./internal/api ./internal/server ./internal/mocks: all ok (go1.26.6).run ./...: 0 issues.go vet ./...: clean.gocyclo -over 10 -ignore "_test\.go" .: no output.Closes #439