Skip to content

Commit 541a669

Browse files
authored
fix(gitlab): include archived projects in person-filtered group listings (#10571)
Group issue and merge request listings leave out archived projects unless non_archived=false, while unfiltered group search includes them, so a person filter could miss items an unfiltered search finds.
1 parent 2019eb6 commit 541a669

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

‎apps/sim/lib/sim-search/live/gitlab.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,21 @@ describe('GitLab person filters', () => {
481481
expect([...roles].sort()).toEqual(['assignee_id', 'author_id', 'reviewer_id'])
482482
})
483483

484+
it('finds the person’s issues in a group’s archived projects, as group search does', async () => {
485+
const { client } = gitlab({
486+
'/api/v4/groups/5/issues': (query) =>
487+
query?.author_id === '7' && query?.non_archived === 'false'
488+
? [{ iid: 1, project_id: 42, title: 'Archived', updated_at: '2026-11-01T00:00:00Z' }]
489+
: [],
490+
})
491+
const page = await searchGitLab(
492+
client,
493+
{ ...search('issues'), native: { provider: 'gitlab', query: 'cache', kind: 'issues' } },
494+
{ person, groupId: 5 }
495+
)
496+
expect(page.documents.map((document) => document.title)).toEqual(['Archived'])
497+
})
498+
484499
it('searches only collections with an author, and refuses code under a person filter', async () => {
485500
const paths: string[] = []
486501
const { client } = gitlab({

‎apps/sim/lib/sim-search/live/gitlab.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ async function listGitLabPersonItems(
226226
path: string,
227227
kind: 'issues' | 'merge_requests',
228228
person: GitLabPerson,
229-
cursor: string | undefined
229+
cursor: string | undefined,
230+
group: boolean
230231
): Promise<NativePage> {
231232
const roles =
232233
kind === 'merge_requests'
@@ -245,6 +246,8 @@ async function listGitLabPersonItems(
245246
...(dates.end ? { updated_before: dates.end } : {}),
246247
order_by: 'updated_at',
247248
sort: direction,
249+
/** Group listings leave out archived projects by default; group search includes them. */
250+
...(group ? { non_archived: 'false' } : {}),
248251
},
249252
input.limit,
250253
cursor,
@@ -630,7 +633,8 @@ export async function searchGitLab(
630633
: `${gitLabProjectPath(project ?? '')}/${kind}`,
631634
kind,
632635
person,
633-
merged
636+
merged,
637+
groupId !== undefined
634638
)
635639
const groupPageLimit = Math.floor(10_000 / input.limit)
636640
if (groupId !== undefined && Number(page) > groupPageLimit)

0 commit comments

Comments
 (0)