@@ -99,17 +99,17 @@ func TestQueryControlReports(t *testing.T) {
9999 orgUser := suite .seedOrgOwner (t )
100100
101101 orgOwnedCount := int64 (11 )
102- systemOwnedCount := int64 (3 )
103102 controlIDs := []string {}
104103
105104 for range orgOwnedCount {
106105 control := (& ControlBuilder {client : suite .client }).MustNew (localTestOrg .owner .UserCtx , t )
107106 controlIDs = append (controlIDs , control .ID )
108107 }
109108
110- // system-owned controls must not appear in controlReports results
111- for range systemOwnedCount {
112- (& ControlBuilder {client : suite .client , SystemOwned : lo .ToPtr (true )}).MustNew (localTestOrg .owner .UserCtx , t )
109+ // system-owned controls must not appear in controlReports results (resolver filters SystemOwned: false);
110+ // the hook sets system_owned = true automatically when it sees a system admin caller
111+ for range int64 (3 ) {
112+ (& ControlBuilder {client : suite .client }).MustNew (sharedSystemAdminUser .UserCtx , t )
113113 }
114114
115115 // enrich the first three org-owned controls with associated data so enrichment paths are exercised
@@ -234,9 +234,10 @@ func TestQueryControlReportsByCategory(t *testing.T) {
234234 control3 := (& ControlBuilder {client : suite .client , Category : cat2 }).MustNew (localTestOrg .owner .UserCtx , t )
235235 (& ControlBuilder {client : suite .client }).MustNew (localTestOrg .owner .UserCtx , t )
236236
237- // system-owned controls must not appear in results regardless of category
238- (& ControlBuilder {client : suite .client , Category : cat1 , SystemOwned : lo .ToPtr (true )}).MustNew (localTestOrg .owner .UserCtx , t )
239- (& ControlBuilder {client : suite .client , Category : cat2 , SystemOwned : lo .ToPtr (true )}).MustNew (localTestOrg .owner .UserCtx , t )
237+ // system-owned controls must not appear in results regardless of category;
238+ // the hook sets system_owned = true automatically when it sees a system admin caller
239+ (& ControlBuilder {client : suite .client , Category : cat1 }).MustNew (sharedSystemAdminUser .UserCtx , t )
240+ (& ControlBuilder {client : suite .client , Category : cat2 }).MustNew (sharedSystemAdminUser .UserCtx , t )
240241
241242 // enrich control1 with associated data so enrichment paths are exercised;
242243 // control3 is used as the tertiary to confirm a second unique related control
0 commit comments