Repository navigation
Enable cross-team views with shared team scopes - #607
Closed
thokra-nav wants to merge 1 commit into
Closed
thokra-nav wants to merge 1 commit into
thokra-nav wants to merge 1 commit into
Conversation
Apply team selection before pagination so totals, facets, and vulnerability drill-downs stay consistent.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The activityLog filter type change breaks existing GraphQL operations, while environment-mapping and team-facet errors can reject matching workloads or null the facets field.
3 open issues
9 files not reviewed
internal/activitylog/activitylogsql/activitylog.sql.go: Generated fileinternal/graph/gengql/activitylog.generated.go: Generated fileinternal/graph/gengql/complexity.go: Generated fileinternal/graph/gengql/issues.generated.go: Generated fileinternal/graph/gengql/schema.generated.go: Generated fileinternal/graph/gengql/search.generated.go: Generated fileinternal/graph/gengql/teams.generated.go: Generated fileinternal/graph/gengql/vulnerability.generated.go: Generated fileinternal/issue/issuesql/issue.sql.go: Generated file
What changed in this PR
Introduces shared team selection across Nais API to support cross-team views, extending the membership-filtering approach described in #594. Selection is applied before pagination so totals, facets, and vulnerability drill-downs use consistent scopes.
Changes:
- Adds
TeamScopeInputwith explicit-team and viewer-membership filters across teams, search, issues, activity logs, and vulnerabilities. - Adds tenant-wide issue queries, team facets, scoped vulnerability aggregates, and inherited CVE workload scopes.
- Updates generated bindings and adds unit and integration coverage for intersections, empty selections, and pagination.
| File | Description |
|---|---|
internal/vulnerability/queries.go |
Applies team and environment scopes to summaries and CVE workloads. |
internal/vulnerability/queries_test.go |
Tests scoped summaries and CVE lists. |
internal/vulnerability/models.go |
Adds scope fields and inherited CVE team selection. |
internal/vulnerability/fake/v13s.go |
Filters fake summaries by team and environment. |
internal/vulnerability/fake/v13s_test.go |
Tests fake summary scope consistency. |
internal/vulnerability/cve_workloads_test.go |
Tests inherited and intersected workload scopes. |
internal/team/teamscope/scope.go |
Implements shared team-selection resolution. |
internal/team/teamscope/scope_test.go |
Tests membership, identity, and empty-selection behavior. |
internal/team/queries.go |
Applies team selection before sorting and pagination. |
internal/team/model.go |
Adds shared scope to team filters. |
internal/search/models.go |
Adds shared scope to search filters. |
internal/search/bleve.go |
Applies scope intersections before search pagination. |
internal/search/bleve_test.go |
Tests scoped search results and totals. |
internal/issue/queries/issue.sql |
Supports tenant-wide issue selection and team facet grouping. |
internal/issue/queries.go |
Adds tenant queries and empty-page total recovery. |
internal/issue/model.go |
Adds tenant filters and team facet models. |
internal/issue/issuesql/issue.sql.go |
Updates generated issue SQL bindings. |
internal/issue/facets.go |
Builds scoped, ranked team facets. |
internal/issue/facets_test.go |
Tests team facet aggregation and limits. |
internal/graph/vulnerability.resolvers.go |
Passes scopes through vulnerability resolvers. |
internal/graph/vulnerability.resolvers_test.go |
Tests scope inheritance and count-only behavior. |
internal/graph/schema/vulnerability.graphqls |
Exposes scopes and deprecates legacy team filtering. |
internal/graph/schema/teams.graphqls |
Defines and documents shared team selection. |
internal/graph/schema/search.graphqls |
Exposes shared scope and deprecates legacy teams input. |
internal/graph/schema/issues.graphqls |
Adds tenant issue queries and team facets. |
internal/graph/schema/activitylog.graphqls |
Introduces the tenant activity-log filter type. |
internal/graph/issues.resolvers.go |
Resolves tenant issues and facet teams. |
internal/graph/gengql/vulnerability.generated.go |
Updates vulnerability filter decoding. |
internal/graph/gengql/teams.generated.go |
Adds shared scope decoding. |
internal/graph/gengql/search.generated.go |
Updates search filter decoding. |
internal/graph/gengql/schema.generated.go |
Updates query interfaces and execution bindings. |
internal/graph/gengql/root_.generated.go |
Updates embedded schemas and resolver registration. |
internal/graph/gengql/issues.generated.go |
Adds tenant issue and team facet bindings. |
internal/graph/gengql/complexity.go |
Accounts for tenant issue query complexity. |
internal/graph/gengql/activitylog.generated.go |
Adds tenant activity-log filter decoding. |
internal/graph/filter_scope_test.go |
Tests tenant and resource-scoped filter contracts. |
internal/graph/activitylog.resolvers.go |
Accepts the tenant activity-log filter. |
internal/activitylog/queries/activitylog.sql |
Adds team selection and deterministic ordering. |
internal/activitylog/queries.go |
Preserves scope and totals across tenant pages. |
internal/activitylog/model.go |
Adds tenant filters and multi-team scope storage. |
internal/activitylog/facets.go |
Applies team selection to tenant facets. |
internal/activitylog/activitylogsql/activitylog.sql.go |
Updates generated activity-log SQL bindings. |
integration_tests/cross_team_scope.lua |
Tests cross-team pagination, facets, and membership behavior. |
.configs/gqlgen.yaml |
Registers shared scope models for GraphQL generation. |
Review effort: Balanced
| Filter items. | ||
| """ | ||
| filter: ActivityLogFilter | ||
| filter: TenantActivityLogFilter |
| } | ||
|
|
||
| func (r *issueTeamFacetItemResolver) Team(ctx context.Context, obj *issue.IssueTeamFacetItem) (*team.Team, error) { | ||
| return team.Get(ctx, obj.TeamSlug) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Apply team selection before pagination so totals, facets, and vulnerability drill-downs stay consistent.
This supersede #594 in the case we choose to merge it