@app-vitals/agent-admin 1.87.0 → 1.88.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/prisma/client/internal/class.ts +4 -4
- package/prisma/client/internal/prismaNamespace.ts +1 -0
- package/prisma/client/internal/prismaNamespaceBrowser.ts +1 -0
- package/prisma/client/models/GitHubRepoSnapshot.ts +33 -1
- package/prisma/migrations/20261125000000_add_github_snapshot_repository_selection/migration.sql +2 -0
- package/prisma/schema/schema.prisma +2 -0
- package/src/github-agent-installation-crawler.ts +27 -8
- package/src/github-agent-installation-crawler.unit.test.ts +76 -1
- package/src/github-installation-selection.integration.test.ts +91 -0
- package/src/github-repo-cache.ts +8 -0
- package/src/installation-ports.ts +2 -0
- package/src/installation-repos-service.ts +2 -0
|
@@ -3580,6 +3580,7 @@ export const GitHubRepoSnapshotScalarFieldEnum = {
|
|
|
3580
3580
|
crawlStartedAt: 'crawlStartedAt',
|
|
3581
3581
|
completedAt: 'completedAt',
|
|
3582
3582
|
totalCount: 'totalCount',
|
|
3583
|
+
repositorySelection: 'repositorySelection',
|
|
3583
3584
|
lastError: 'lastError',
|
|
3584
3585
|
attempts: 'attempts',
|
|
3585
3586
|
nextAttemptAt: 'nextAttemptAt',
|
|
@@ -604,6 +604,7 @@ export const GitHubRepoSnapshotScalarFieldEnum = {
|
|
|
604
604
|
crawlStartedAt: 'crawlStartedAt',
|
|
605
605
|
completedAt: 'completedAt',
|
|
606
606
|
totalCount: 'totalCount',
|
|
607
|
+
repositorySelection: 'repositorySelection',
|
|
607
608
|
lastError: 'lastError',
|
|
608
609
|
attempts: 'attempts',
|
|
609
610
|
nextAttemptAt: 'nextAttemptAt',
|
|
@@ -48,6 +48,7 @@ export type GitHubRepoSnapshotMinAggregateOutputType = {
|
|
|
48
48
|
crawlStartedAt: Date | null
|
|
49
49
|
completedAt: Date | null
|
|
50
50
|
totalCount: number | null
|
|
51
|
+
repositorySelection: string | null
|
|
51
52
|
lastError: string | null
|
|
52
53
|
attempts: number | null
|
|
53
54
|
nextAttemptAt: Date | null
|
|
@@ -69,6 +70,7 @@ export type GitHubRepoSnapshotMaxAggregateOutputType = {
|
|
|
69
70
|
crawlStartedAt: Date | null
|
|
70
71
|
completedAt: Date | null
|
|
71
72
|
totalCount: number | null
|
|
73
|
+
repositorySelection: string | null
|
|
72
74
|
lastError: string | null
|
|
73
75
|
attempts: number | null
|
|
74
76
|
nextAttemptAt: Date | null
|
|
@@ -90,6 +92,7 @@ export type GitHubRepoSnapshotCountAggregateOutputType = {
|
|
|
90
92
|
crawlStartedAt: number
|
|
91
93
|
completedAt: number
|
|
92
94
|
totalCount: number
|
|
95
|
+
repositorySelection: number
|
|
93
96
|
lastError: number
|
|
94
97
|
attempts: number
|
|
95
98
|
nextAttemptAt: number
|
|
@@ -125,6 +128,7 @@ export type GitHubRepoSnapshotMinAggregateInputType = {
|
|
|
125
128
|
crawlStartedAt?: true
|
|
126
129
|
completedAt?: true
|
|
127
130
|
totalCount?: true
|
|
131
|
+
repositorySelection?: true
|
|
128
132
|
lastError?: true
|
|
129
133
|
attempts?: true
|
|
130
134
|
nextAttemptAt?: true
|
|
@@ -146,6 +150,7 @@ export type GitHubRepoSnapshotMaxAggregateInputType = {
|
|
|
146
150
|
crawlStartedAt?: true
|
|
147
151
|
completedAt?: true
|
|
148
152
|
totalCount?: true
|
|
153
|
+
repositorySelection?: true
|
|
149
154
|
lastError?: true
|
|
150
155
|
attempts?: true
|
|
151
156
|
nextAttemptAt?: true
|
|
@@ -167,6 +172,7 @@ export type GitHubRepoSnapshotCountAggregateInputType = {
|
|
|
167
172
|
crawlStartedAt?: true
|
|
168
173
|
completedAt?: true
|
|
169
174
|
totalCount?: true
|
|
175
|
+
repositorySelection?: true
|
|
170
176
|
lastError?: true
|
|
171
177
|
attempts?: true
|
|
172
178
|
nextAttemptAt?: true
|
|
@@ -275,6 +281,7 @@ export type GitHubRepoSnapshotGroupByOutputType = {
|
|
|
275
281
|
crawlStartedAt: Date | null
|
|
276
282
|
completedAt: Date | null
|
|
277
283
|
totalCount: number | null
|
|
284
|
+
repositorySelection: string | null
|
|
278
285
|
lastError: string | null
|
|
279
286
|
attempts: number
|
|
280
287
|
nextAttemptAt: Date | null
|
|
@@ -319,6 +326,7 @@ export type GitHubRepoSnapshotWhereInput = {
|
|
|
319
326
|
crawlStartedAt?: Prisma.DateTimeNullableFilter<"GitHubRepoSnapshot"> | Date | string | null
|
|
320
327
|
completedAt?: Prisma.DateTimeNullableFilter<"GitHubRepoSnapshot"> | Date | string | null
|
|
321
328
|
totalCount?: Prisma.IntNullableFilter<"GitHubRepoSnapshot"> | number | null
|
|
329
|
+
repositorySelection?: Prisma.StringNullableFilter<"GitHubRepoSnapshot"> | string | null
|
|
322
330
|
lastError?: Prisma.StringNullableFilter<"GitHubRepoSnapshot"> | string | null
|
|
323
331
|
attempts?: Prisma.IntFilter<"GitHubRepoSnapshot"> | number
|
|
324
332
|
nextAttemptAt?: Prisma.DateTimeNullableFilter<"GitHubRepoSnapshot"> | Date | string | null
|
|
@@ -341,6 +349,7 @@ export type GitHubRepoSnapshotOrderByWithRelationInput = {
|
|
|
341
349
|
crawlStartedAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
342
350
|
completedAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
343
351
|
totalCount?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
352
|
+
repositorySelection?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
344
353
|
lastError?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
345
354
|
attempts?: Prisma.SortOrder
|
|
346
355
|
nextAttemptAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
@@ -367,6 +376,7 @@ export type GitHubRepoSnapshotWhereUniqueInput = Prisma.AtLeast<{
|
|
|
367
376
|
crawlStartedAt?: Prisma.DateTimeNullableFilter<"GitHubRepoSnapshot"> | Date | string | null
|
|
368
377
|
completedAt?: Prisma.DateTimeNullableFilter<"GitHubRepoSnapshot"> | Date | string | null
|
|
369
378
|
totalCount?: Prisma.IntNullableFilter<"GitHubRepoSnapshot"> | number | null
|
|
379
|
+
repositorySelection?: Prisma.StringNullableFilter<"GitHubRepoSnapshot"> | string | null
|
|
370
380
|
lastError?: Prisma.StringNullableFilter<"GitHubRepoSnapshot"> | string | null
|
|
371
381
|
attempts?: Prisma.IntFilter<"GitHubRepoSnapshot"> | number
|
|
372
382
|
nextAttemptAt?: Prisma.DateTimeNullableFilter<"GitHubRepoSnapshot"> | Date | string | null
|
|
@@ -389,6 +399,7 @@ export type GitHubRepoSnapshotOrderByWithAggregationInput = {
|
|
|
389
399
|
crawlStartedAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
390
400
|
completedAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
391
401
|
totalCount?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
402
|
+
repositorySelection?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
392
403
|
lastError?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
393
404
|
attempts?: Prisma.SortOrder
|
|
394
405
|
nextAttemptAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
@@ -418,6 +429,7 @@ export type GitHubRepoSnapshotScalarWhereWithAggregatesInput = {
|
|
|
418
429
|
crawlStartedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"GitHubRepoSnapshot"> | Date | string | null
|
|
419
430
|
completedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"GitHubRepoSnapshot"> | Date | string | null
|
|
420
431
|
totalCount?: Prisma.IntNullableWithAggregatesFilter<"GitHubRepoSnapshot"> | number | null
|
|
432
|
+
repositorySelection?: Prisma.StringNullableWithAggregatesFilter<"GitHubRepoSnapshot"> | string | null
|
|
421
433
|
lastError?: Prisma.StringNullableWithAggregatesFilter<"GitHubRepoSnapshot"> | string | null
|
|
422
434
|
attempts?: Prisma.IntWithAggregatesFilter<"GitHubRepoSnapshot"> | number
|
|
423
435
|
nextAttemptAt?: Prisma.DateTimeNullableWithAggregatesFilter<"GitHubRepoSnapshot"> | Date | string | null
|
|
@@ -439,6 +451,7 @@ export type GitHubRepoSnapshotCreateInput = {
|
|
|
439
451
|
crawlStartedAt?: Date | string | null
|
|
440
452
|
completedAt?: Date | string | null
|
|
441
453
|
totalCount?: number | null
|
|
454
|
+
repositorySelection?: string | null
|
|
442
455
|
lastError?: string | null
|
|
443
456
|
attempts?: number
|
|
444
457
|
nextAttemptAt?: Date | string | null
|
|
@@ -461,6 +474,7 @@ export type GitHubRepoSnapshotUncheckedCreateInput = {
|
|
|
461
474
|
crawlStartedAt?: Date | string | null
|
|
462
475
|
completedAt?: Date | string | null
|
|
463
476
|
totalCount?: number | null
|
|
477
|
+
repositorySelection?: string | null
|
|
464
478
|
lastError?: string | null
|
|
465
479
|
attempts?: number
|
|
466
480
|
nextAttemptAt?: Date | string | null
|
|
@@ -483,6 +497,7 @@ export type GitHubRepoSnapshotUpdateInput = {
|
|
|
483
497
|
crawlStartedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
484
498
|
completedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
485
499
|
totalCount?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
|
|
500
|
+
repositorySelection?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
486
501
|
lastError?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
487
502
|
attempts?: Prisma.IntFieldUpdateOperationsInput | number
|
|
488
503
|
nextAttemptAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
@@ -505,6 +520,7 @@ export type GitHubRepoSnapshotUncheckedUpdateInput = {
|
|
|
505
520
|
crawlStartedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
506
521
|
completedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
507
522
|
totalCount?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
|
|
523
|
+
repositorySelection?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
508
524
|
lastError?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
509
525
|
attempts?: Prisma.IntFieldUpdateOperationsInput | number
|
|
510
526
|
nextAttemptAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
@@ -527,6 +543,7 @@ export type GitHubRepoSnapshotCreateManyInput = {
|
|
|
527
543
|
crawlStartedAt?: Date | string | null
|
|
528
544
|
completedAt?: Date | string | null
|
|
529
545
|
totalCount?: number | null
|
|
546
|
+
repositorySelection?: string | null
|
|
530
547
|
lastError?: string | null
|
|
531
548
|
attempts?: number
|
|
532
549
|
nextAttemptAt?: Date | string | null
|
|
@@ -548,6 +565,7 @@ export type GitHubRepoSnapshotUpdateManyMutationInput = {
|
|
|
548
565
|
crawlStartedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
549
566
|
completedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
550
567
|
totalCount?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
|
|
568
|
+
repositorySelection?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
551
569
|
lastError?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
552
570
|
attempts?: Prisma.IntFieldUpdateOperationsInput | number
|
|
553
571
|
nextAttemptAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
@@ -569,6 +587,7 @@ export type GitHubRepoSnapshotUncheckedUpdateManyInput = {
|
|
|
569
587
|
crawlStartedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
570
588
|
completedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
571
589
|
totalCount?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
|
|
590
|
+
repositorySelection?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
572
591
|
lastError?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
573
592
|
attempts?: Prisma.IntFieldUpdateOperationsInput | number
|
|
574
593
|
nextAttemptAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
@@ -597,6 +616,7 @@ export type GitHubRepoSnapshotCountOrderByAggregateInput = {
|
|
|
597
616
|
crawlStartedAt?: Prisma.SortOrder
|
|
598
617
|
completedAt?: Prisma.SortOrder
|
|
599
618
|
totalCount?: Prisma.SortOrder
|
|
619
|
+
repositorySelection?: Prisma.SortOrder
|
|
600
620
|
lastError?: Prisma.SortOrder
|
|
601
621
|
attempts?: Prisma.SortOrder
|
|
602
622
|
nextAttemptAt?: Prisma.SortOrder
|
|
@@ -624,6 +644,7 @@ export type GitHubRepoSnapshotMaxOrderByAggregateInput = {
|
|
|
624
644
|
crawlStartedAt?: Prisma.SortOrder
|
|
625
645
|
completedAt?: Prisma.SortOrder
|
|
626
646
|
totalCount?: Prisma.SortOrder
|
|
647
|
+
repositorySelection?: Prisma.SortOrder
|
|
627
648
|
lastError?: Prisma.SortOrder
|
|
628
649
|
attempts?: Prisma.SortOrder
|
|
629
650
|
nextAttemptAt?: Prisma.SortOrder
|
|
@@ -645,6 +666,7 @@ export type GitHubRepoSnapshotMinOrderByAggregateInput = {
|
|
|
645
666
|
crawlStartedAt?: Prisma.SortOrder
|
|
646
667
|
completedAt?: Prisma.SortOrder
|
|
647
668
|
totalCount?: Prisma.SortOrder
|
|
669
|
+
repositorySelection?: Prisma.SortOrder
|
|
648
670
|
lastError?: Prisma.SortOrder
|
|
649
671
|
attempts?: Prisma.SortOrder
|
|
650
672
|
nextAttemptAt?: Prisma.SortOrder
|
|
@@ -691,6 +713,7 @@ export type GitHubRepoSnapshotCreateWithoutReposInput = {
|
|
|
691
713
|
crawlStartedAt?: Date | string | null
|
|
692
714
|
completedAt?: Date | string | null
|
|
693
715
|
totalCount?: number | null
|
|
716
|
+
repositorySelection?: string | null
|
|
694
717
|
lastError?: string | null
|
|
695
718
|
attempts?: number
|
|
696
719
|
nextAttemptAt?: Date | string | null
|
|
@@ -712,6 +735,7 @@ export type GitHubRepoSnapshotUncheckedCreateWithoutReposInput = {
|
|
|
712
735
|
crawlStartedAt?: Date | string | null
|
|
713
736
|
completedAt?: Date | string | null
|
|
714
737
|
totalCount?: number | null
|
|
738
|
+
repositorySelection?: string | null
|
|
715
739
|
lastError?: string | null
|
|
716
740
|
attempts?: number
|
|
717
741
|
nextAttemptAt?: Date | string | null
|
|
@@ -749,6 +773,7 @@ export type GitHubRepoSnapshotUpdateWithoutReposInput = {
|
|
|
749
773
|
crawlStartedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
750
774
|
completedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
751
775
|
totalCount?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
|
|
776
|
+
repositorySelection?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
752
777
|
lastError?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
753
778
|
attempts?: Prisma.IntFieldUpdateOperationsInput | number
|
|
754
779
|
nextAttemptAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
@@ -770,6 +795,7 @@ export type GitHubRepoSnapshotUncheckedUpdateWithoutReposInput = {
|
|
|
770
795
|
crawlStartedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
771
796
|
completedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
772
797
|
totalCount?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
|
|
798
|
+
repositorySelection?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
773
799
|
lastError?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
774
800
|
attempts?: Prisma.IntFieldUpdateOperationsInput | number
|
|
775
801
|
nextAttemptAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
@@ -822,6 +848,7 @@ export type GitHubRepoSnapshotSelect<ExtArgs extends runtime.Types.Extensions.In
|
|
|
822
848
|
crawlStartedAt?: boolean
|
|
823
849
|
completedAt?: boolean
|
|
824
850
|
totalCount?: boolean
|
|
851
|
+
repositorySelection?: boolean
|
|
825
852
|
lastError?: boolean
|
|
826
853
|
attempts?: boolean
|
|
827
854
|
nextAttemptAt?: boolean
|
|
@@ -845,6 +872,7 @@ export type GitHubRepoSnapshotSelectCreateManyAndReturn<ExtArgs extends runtime.
|
|
|
845
872
|
crawlStartedAt?: boolean
|
|
846
873
|
completedAt?: boolean
|
|
847
874
|
totalCount?: boolean
|
|
875
|
+
repositorySelection?: boolean
|
|
848
876
|
lastError?: boolean
|
|
849
877
|
attempts?: boolean
|
|
850
878
|
nextAttemptAt?: boolean
|
|
@@ -866,6 +894,7 @@ export type GitHubRepoSnapshotSelectUpdateManyAndReturn<ExtArgs extends runtime.
|
|
|
866
894
|
crawlStartedAt?: boolean
|
|
867
895
|
completedAt?: boolean
|
|
868
896
|
totalCount?: boolean
|
|
897
|
+
repositorySelection?: boolean
|
|
869
898
|
lastError?: boolean
|
|
870
899
|
attempts?: boolean
|
|
871
900
|
nextAttemptAt?: boolean
|
|
@@ -887,6 +916,7 @@ export type GitHubRepoSnapshotSelectScalar = {
|
|
|
887
916
|
crawlStartedAt?: boolean
|
|
888
917
|
completedAt?: boolean
|
|
889
918
|
totalCount?: boolean
|
|
919
|
+
repositorySelection?: boolean
|
|
890
920
|
lastError?: boolean
|
|
891
921
|
attempts?: boolean
|
|
892
922
|
nextAttemptAt?: boolean
|
|
@@ -898,7 +928,7 @@ export type GitHubRepoSnapshotSelectScalar = {
|
|
|
898
928
|
updatedAt?: boolean
|
|
899
929
|
}
|
|
900
930
|
|
|
901
|
-
export type GitHubRepoSnapshotOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "accountId" | "appKind" | "appRef" | "org" | "crawlPage" | "crawlStartedAt" | "completedAt" | "totalCount" | "lastError" | "attempts" | "nextAttemptAt" | "rateLimitResetAt" | "leaseHolder" | "leasedUntil" | "lastTickAt" | "createdAt" | "updatedAt", ExtArgs["result"]["gitHubRepoSnapshot"]>
|
|
931
|
+
export type GitHubRepoSnapshotOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "accountId" | "appKind" | "appRef" | "org" | "crawlPage" | "crawlStartedAt" | "completedAt" | "totalCount" | "repositorySelection" | "lastError" | "attempts" | "nextAttemptAt" | "rateLimitResetAt" | "leaseHolder" | "leasedUntil" | "lastTickAt" | "createdAt" | "updatedAt", ExtArgs["result"]["gitHubRepoSnapshot"]>
|
|
902
932
|
export type GitHubRepoSnapshotInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
|
903
933
|
repos?: boolean | Prisma.GitHubRepoSnapshot$reposArgs<ExtArgs>
|
|
904
934
|
_count?: boolean | Prisma.GitHubRepoSnapshotCountOutputTypeDefaultArgs<ExtArgs>
|
|
@@ -921,6 +951,7 @@ export type $GitHubRepoSnapshotPayload<ExtArgs extends runtime.Types.Extensions.
|
|
|
921
951
|
crawlStartedAt: Date | null
|
|
922
952
|
completedAt: Date | null
|
|
923
953
|
totalCount: number | null
|
|
954
|
+
repositorySelection: string | null
|
|
924
955
|
lastError: string | null
|
|
925
956
|
attempts: number
|
|
926
957
|
nextAttemptAt: Date | null
|
|
@@ -1363,6 +1394,7 @@ export interface GitHubRepoSnapshotFieldRefs {
|
|
|
1363
1394
|
readonly crawlStartedAt: Prisma.FieldRef<"GitHubRepoSnapshot", 'DateTime'>
|
|
1364
1395
|
readonly completedAt: Prisma.FieldRef<"GitHubRepoSnapshot", 'DateTime'>
|
|
1365
1396
|
readonly totalCount: Prisma.FieldRef<"GitHubRepoSnapshot", 'Int'>
|
|
1397
|
+
readonly repositorySelection: Prisma.FieldRef<"GitHubRepoSnapshot", 'String'>
|
|
1366
1398
|
readonly lastError: Prisma.FieldRef<"GitHubRepoSnapshot", 'String'>
|
|
1367
1399
|
readonly attempts: Prisma.FieldRef<"GitHubRepoSnapshot", 'Int'>
|
|
1368
1400
|
readonly nextAttemptAt: Prisma.FieldRef<"GitHubRepoSnapshot", 'DateTime'>
|
|
@@ -761,6 +761,8 @@ model GitHubRepoSnapshot {
|
|
|
761
761
|
crawlStartedAt DateTime?
|
|
762
762
|
completedAt DateTime?
|
|
763
763
|
totalCount Int?
|
|
764
|
+
// Agent App installation on the org: 'all' | 'selected'; null = unknown (never treated as 'all')
|
|
765
|
+
repositorySelection String?
|
|
764
766
|
lastError String?
|
|
765
767
|
attempts Int @default(0)
|
|
766
768
|
nextAttemptAt DateTime?
|
|
@@ -55,6 +55,8 @@ export type AgentInstallationClient = Pick<
|
|
|
55
55
|
export interface AgentInstallationPageSource extends PageSource {
|
|
56
56
|
/** The agent App's installation id on the org; throws AppNotInstalledError. Cached. */
|
|
57
57
|
resolveInstallationId(): Promise<number>;
|
|
58
|
+
/** The installation's repository selection ('all' | 'selected'); null if unknown. Resolves like resolveInstallationId. */
|
|
59
|
+
resolveRepositorySelection?(): Promise<"all" | "selected" | null>;
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
export interface AgentInstallationSourceOptions {
|
|
@@ -78,23 +80,34 @@ export function agentInstallationPageSource(
|
|
|
78
80
|
opts: AgentInstallationSourceOptions,
|
|
79
81
|
): AgentInstallationPageSource {
|
|
80
82
|
const { client, org, appId, identity } = opts;
|
|
81
|
-
let
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
let installation:
|
|
84
|
+
| Promise<{ id: number; selection: "all" | "selected" | null }>
|
|
85
|
+
| undefined;
|
|
86
|
+
const resolveInstallation = () => {
|
|
87
|
+
installation ??= client
|
|
84
88
|
.listOrgInstallations(org, identity?.accountId)
|
|
85
89
|
.then((installs) => {
|
|
86
90
|
const found = matchInstallation(installs, appId, identity);
|
|
87
91
|
if (!found) throw new AppNotInstalledError(appId, org);
|
|
88
|
-
|
|
92
|
+
const sel = found.repositorySelection;
|
|
93
|
+
return {
|
|
94
|
+
id: found.id,
|
|
95
|
+
// "none" or an absent value is unknown, never "all".
|
|
96
|
+
selection: sel === "all" || sel === "selected" ? sel : null,
|
|
97
|
+
};
|
|
89
98
|
});
|
|
90
99
|
// Do not cache a failure: a later page or run may succeed.
|
|
91
|
-
|
|
92
|
-
|
|
100
|
+
installation.catch(() => {
|
|
101
|
+
installation = undefined;
|
|
93
102
|
});
|
|
94
|
-
return
|
|
103
|
+
return installation;
|
|
95
104
|
};
|
|
105
|
+
const resolveInstallationId = async (): Promise<number> =>
|
|
106
|
+
(await resolveInstallation()).id;
|
|
96
107
|
return {
|
|
97
108
|
resolveInstallationId,
|
|
109
|
+
resolveRepositorySelection: async () =>
|
|
110
|
+
(await resolveInstallation()).selection,
|
|
98
111
|
async fetchPage(page: number): Promise<RepoPage> {
|
|
99
112
|
const id = await resolveInstallationId();
|
|
100
113
|
const res = await client.listInstallationRepositoriesPage(
|
|
@@ -158,8 +171,10 @@ export async function crawlAgentInstallation(
|
|
|
158
171
|
appId: agent.appId,
|
|
159
172
|
identity: identityOf(agent),
|
|
160
173
|
});
|
|
174
|
+
let selection: "all" | "selected" | null;
|
|
161
175
|
try {
|
|
162
|
-
await source.
|
|
176
|
+
selection = (await source.resolveRepositorySelection?.()) ?? null;
|
|
177
|
+
if (!source.resolveRepositorySelection) await source.resolveInstallationId();
|
|
163
178
|
} catch (err) {
|
|
164
179
|
if (!(err instanceof AppNotInstalledError)) {
|
|
165
180
|
// Let the engine record GitHub failures and rate limits on the snapshot.
|
|
@@ -177,10 +192,14 @@ export async function crawlAgentInstallation(
|
|
|
177
192
|
nextAttemptAt: null,
|
|
178
193
|
rateLimitResetAt: null,
|
|
179
194
|
lastTickAt: now,
|
|
195
|
+
repositorySelection: null,
|
|
180
196
|
});
|
|
181
197
|
const swept = await store.sweepGeneration(snap.id);
|
|
182
198
|
return { outcome: "not_installed", pagesFetched: 0, swept };
|
|
183
199
|
}
|
|
200
|
+
// Record the selection on every crawl; null clears a stale value. A GitHub
|
|
201
|
+
// failure above returns early and leaves the previous value untouched.
|
|
202
|
+
await store.upsertSnapshot(key, { repositorySelection: selection });
|
|
184
203
|
return crawlRepos({ ...engineOpts(), key, source });
|
|
185
204
|
|
|
186
205
|
function engineOpts() {
|
|
@@ -77,7 +77,13 @@ class MemoryStore implements CrawlStore {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
interface FakeClientOpts {
|
|
80
|
-
installs?: {
|
|
80
|
+
installs?: {
|
|
81
|
+
id: number;
|
|
82
|
+
appId?: number;
|
|
83
|
+
appSlug?: string;
|
|
84
|
+
clientId?: string;
|
|
85
|
+
repositorySelection?: "all" | "selected" | "none";
|
|
86
|
+
}[];
|
|
81
87
|
total?: number;
|
|
82
88
|
perPage?: number;
|
|
83
89
|
failPage?: (page: number) => Error | undefined;
|
|
@@ -376,3 +382,72 @@ describe("lookupAccountKeys", () => {
|
|
|
376
382
|
expect(lookupAccountKeys("acct")).not.toContain("");
|
|
377
383
|
});
|
|
378
384
|
});
|
|
385
|
+
|
|
386
|
+
describe("crawlAgentInstallation repository selection (GIS-1.1)", () => {
|
|
387
|
+
const run = (store: MemoryStore, client: AgentInstallationClient) =>
|
|
388
|
+
crawlAgentInstallation({
|
|
389
|
+
agent: agent(),
|
|
390
|
+
org: "acme",
|
|
391
|
+
client,
|
|
392
|
+
store,
|
|
393
|
+
clock,
|
|
394
|
+
});
|
|
395
|
+
const selection = (store: MemoryStore) =>
|
|
396
|
+
(store.snap as unknown as Record<string, unknown> | null)
|
|
397
|
+
?.repositorySelection;
|
|
398
|
+
|
|
399
|
+
it.each(["all", "selected"] as const)("records %s", async (value) => {
|
|
400
|
+
const store = new MemoryStore();
|
|
401
|
+
const { client } = fakeClient({
|
|
402
|
+
installs: [{ id: 501, appId: 777, repositorySelection: value }],
|
|
403
|
+
});
|
|
404
|
+
await run(store, client);
|
|
405
|
+
expect(selection(store)).toBe(value);
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
it("records null when the listing omits it or says none", async () => {
|
|
409
|
+
for (const repositorySelection of [undefined, "none" as const]) {
|
|
410
|
+
const store = new MemoryStore();
|
|
411
|
+
const { client } = fakeClient({
|
|
412
|
+
installs: [{ id: 501, appId: 777, repositorySelection }],
|
|
413
|
+
});
|
|
414
|
+
await run(store, client);
|
|
415
|
+
expect(selection(store)).toBeNull();
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
it("clears a previous value when the App is not installed", async () => {
|
|
420
|
+
const store = new MemoryStore();
|
|
421
|
+
await run(
|
|
422
|
+
store,
|
|
423
|
+
fakeClient({
|
|
424
|
+
installs: [{ id: 501, appId: 777, repositorySelection: "all" }],
|
|
425
|
+
}).client,
|
|
426
|
+
);
|
|
427
|
+
expect(selection(store)).toBe("all");
|
|
428
|
+
const res = await run(store, fakeClient({ installs: [] }).client);
|
|
429
|
+
expect(res.outcome).toBe("not_installed");
|
|
430
|
+
expect(selection(store)).toBeNull();
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
it("keeps the previous value when listing installations fails", async () => {
|
|
434
|
+
const store = new MemoryStore();
|
|
435
|
+
await run(
|
|
436
|
+
store,
|
|
437
|
+
fakeClient({
|
|
438
|
+
installs: [{ id: 501, appId: 777, repositorySelection: "selected" }],
|
|
439
|
+
}).client,
|
|
440
|
+
);
|
|
441
|
+
const failing: AgentInstallationClient = {
|
|
442
|
+
async listOrgInstallations() {
|
|
443
|
+
throw new GithubEnterpriseError("server", "boom");
|
|
444
|
+
},
|
|
445
|
+
async listInstallationRepositoriesPage() {
|
|
446
|
+
throw new GithubEnterpriseError("server", "boom");
|
|
447
|
+
},
|
|
448
|
+
};
|
|
449
|
+
const res = await run(store, failing);
|
|
450
|
+
expect(res.outcome).toBe("failed");
|
|
451
|
+
expect(selection(store)).toBe("selected");
|
|
452
|
+
});
|
|
453
|
+
});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* admin/src/github-installation-selection.integration.test.ts
|
|
3
|
+
* Real-database test (GIS-1.1): the agent installation crawl records whether
|
|
4
|
+
* the agent App's installation is on "all" or "selected" repositories on the
|
|
5
|
+
* cached snapshot, and listAgentSnapshots exposes it. A missing value stays
|
|
6
|
+
* null (unknown), never "all".
|
|
7
|
+
*
|
|
8
|
+
* Requires DATABASE_URL_ADMIN_TEST to be set; skips otherwise.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { afterEach, beforeEach, describe, expect, it } from "bun:test";
|
|
12
|
+
import type { PrismaClient } from "../prisma/client/client.ts";
|
|
13
|
+
import {
|
|
14
|
+
type AgentInstallationClient,
|
|
15
|
+
crawlAgentInstallation,
|
|
16
|
+
DEPLOYMENT_WIDE_ACCOUNT_KEY,
|
|
17
|
+
} from "./github-agent-installation-crawler.ts";
|
|
18
|
+
import { GitHubRepoCacheService } from "./github-repo-cache.ts";
|
|
19
|
+
import { createAdminPrismaClient } from "./prisma-client.ts";
|
|
20
|
+
|
|
21
|
+
const TEST_DB = process.env.DATABASE_URL_ADMIN_TEST;
|
|
22
|
+
const describeOrSkip = TEST_DB ? describe : describe.skip;
|
|
23
|
+
|
|
24
|
+
const T0 = new Date("2026-11-25T12:00:00Z");
|
|
25
|
+
const clock = { now: () => new Date(T0) };
|
|
26
|
+
const APP_ID = 4242;
|
|
27
|
+
|
|
28
|
+
type Selection = "all" | "selected" | "none" | undefined;
|
|
29
|
+
|
|
30
|
+
function client(selection: Selection): AgentInstallationClient {
|
|
31
|
+
return {
|
|
32
|
+
async listOrgInstallations() {
|
|
33
|
+
return [{ id: 900, appId: APP_ID, repositorySelection: selection }];
|
|
34
|
+
},
|
|
35
|
+
async listInstallationRepositoriesPage() {
|
|
36
|
+
return {
|
|
37
|
+
repos: [{ id: 1, fullName: "acme/a" }],
|
|
38
|
+
hasNext: false,
|
|
39
|
+
perPage: 10,
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
describeOrSkip("agent installation repository selection (integration)", () => {
|
|
46
|
+
let prisma: PrismaClient;
|
|
47
|
+
let cache: GitHubRepoCacheService;
|
|
48
|
+
|
|
49
|
+
const clean = async () => {
|
|
50
|
+
await prisma.gitHubCachedRepo.deleteMany();
|
|
51
|
+
await prisma.gitHubRepoSnapshot.deleteMany();
|
|
52
|
+
};
|
|
53
|
+
const crawl = (selection: Selection) =>
|
|
54
|
+
crawlAgentInstallation({
|
|
55
|
+
agent: { accountId: null, appId: APP_ID },
|
|
56
|
+
org: "acme",
|
|
57
|
+
client: client(selection),
|
|
58
|
+
store: cache,
|
|
59
|
+
clock,
|
|
60
|
+
});
|
|
61
|
+
const stored = async () =>
|
|
62
|
+
(
|
|
63
|
+
await cache.listAgentSnapshots(DEPLOYMENT_WIDE_ACCOUNT_KEY, String(APP_ID))
|
|
64
|
+
)[0]?.repositorySelection;
|
|
65
|
+
|
|
66
|
+
beforeEach(async () => {
|
|
67
|
+
prisma = createAdminPrismaClient(TEST_DB as string);
|
|
68
|
+
cache = new GitHubRepoCacheService(prisma, clock);
|
|
69
|
+
await clean();
|
|
70
|
+
});
|
|
71
|
+
afterEach(async () => {
|
|
72
|
+
await clean();
|
|
73
|
+
await prisma.$disconnect();
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it("stores 'all', then 'selected' on a later crawl", async () => {
|
|
77
|
+
expect((await crawl("all")).outcome).toBe("complete");
|
|
78
|
+
expect(await stored()).toBe("all");
|
|
79
|
+
await crawl("selected");
|
|
80
|
+
expect(await stored()).toBe("selected");
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it("leaves a missing value null, and resets a previous value to null", async () => {
|
|
84
|
+
await crawl(undefined);
|
|
85
|
+
expect(await stored()).toBeNull();
|
|
86
|
+
await crawl("all");
|
|
87
|
+
expect(await stored()).toBe("all");
|
|
88
|
+
await crawl(undefined);
|
|
89
|
+
expect(await stored()).toBeNull();
|
|
90
|
+
});
|
|
91
|
+
});
|
package/src/github-repo-cache.ts
CHANGED
|
@@ -33,6 +33,8 @@ export type SnapshotProgress = Partial<{
|
|
|
33
33
|
crawlStartedAt: Date | null;
|
|
34
34
|
completedAt: Date | null;
|
|
35
35
|
totalCount: number | null;
|
|
36
|
+
/** Agent snapshots: the App installation's repository selection; null = unknown. */
|
|
37
|
+
repositorySelection: "all" | "selected" | null;
|
|
36
38
|
lastError: string | null;
|
|
37
39
|
attempts: number;
|
|
38
40
|
nextAttemptAt: Date | null;
|
|
@@ -71,6 +73,11 @@ export interface AccessQuery {
|
|
|
71
73
|
|
|
72
74
|
const REPO_BATCH_SIZE = 500;
|
|
73
75
|
|
|
76
|
+
/** A stored selection narrowed to the known values; anything else is unknown (null). */
|
|
77
|
+
function asSelection(raw: string | null): "all" | "selected" | null {
|
|
78
|
+
return raw === "all" || raw === "selected" ? raw : null;
|
|
79
|
+
}
|
|
80
|
+
|
|
74
81
|
function requireNonEmpty(name: string, value: unknown): void {
|
|
75
82
|
if (typeof value !== "string" || value.trim() === "") {
|
|
76
83
|
throw new BadRequestError(`${name} is required`);
|
|
@@ -178,6 +185,7 @@ export class GitHubRepoCacheService {
|
|
|
178
185
|
totalCount: r.totalCount,
|
|
179
186
|
lastError: r.lastError,
|
|
180
187
|
rateLimitResetAt: r.rateLimitResetAt,
|
|
188
|
+
repositorySelection: asSelection(r.repositorySelection),
|
|
181
189
|
attempts: r.attempts,
|
|
182
190
|
nextAttemptAt: r.nextAttemptAt,
|
|
183
191
|
leaseHolder: r.leaseHolder,
|
|
@@ -179,6 +179,8 @@ export interface InstallationRepoClient {
|
|
|
179
179
|
appId?: number;
|
|
180
180
|
appSlug?: string;
|
|
181
181
|
clientId?: string;
|
|
182
|
+
/** "all" | "selected" | "none"; absent when the listing does not say. */
|
|
183
|
+
repositorySelection?: "all" | "selected" | "none";
|
|
182
184
|
}[]
|
|
183
185
|
>;
|
|
184
186
|
listInstallationRepositories(
|
|
@@ -92,6 +92,8 @@ export interface InstallationSnapshotRow {
|
|
|
92
92
|
totalCount: number | null;
|
|
93
93
|
lastError: string | null;
|
|
94
94
|
rateLimitResetAt: Date | null;
|
|
95
|
+
/** The agent App's installation on the org; absent or null = unknown (never 'all'). */
|
|
96
|
+
repositorySelection?: "all" | "selected" | null;
|
|
95
97
|
attempts?: number;
|
|
96
98
|
nextAttemptAt?: Date | null;
|
|
97
99
|
leaseHolder?: string | null;
|