@app-vitals/agent-admin 1.35.0 → 1.35.1
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/openapi.platform.json +2 -392
- package/package.json +2 -2
- package/src/admin-boot.ts +1 -12
- package/src/admin-extension.ts +3 -3
- package/src/admin-ui-github-identity.smoke.test.ts +0 -114
- package/src/admin-ui-installation-repos-pages.ts +2 -2
- package/src/admin-ui-installation-repos.smoke.test.ts +0 -1
- package/src/admin-ui.ts +0 -82
- package/src/agents-api.smoke.test.ts +2 -352
- package/src/agents-api.ts +5 -269
- package/src/github-enterprise-isolation.unit.test.ts +4 -4
- package/src/{github-reconcile-wiring.ts → github-installation-wiring.ts} +18 -38
- package/src/github-installation-wiring.unit.test.ts +111 -0
- package/src/github-installation.fixtures.ts +76 -0
- package/src/installation-ports.integration.test.ts +89 -0
- package/src/installation-ports.ts +207 -0
- package/src/installation-ports.unit.test.ts +51 -0
- package/src/installation-repos-service.ts +12 -12
- package/src/installation-repos-service.unit.test.ts +3 -3
- package/src/lost-access-removal.ts +9 -9
- package/src/lost-access-removal.unit.test.ts +7 -7
- package/src/reconcile-open-work.ts +5 -7
- package/src/repo-access-rules.ts +58 -0
- package/src/repo-access-rules.unit.test.ts +98 -0
- package/src/admin-ui-github-reconcile-pages.ts +0 -208
- package/src/admin-ui-github-reconcile-pages.unit.test.ts +0 -226
- package/src/github-reconcile-routes.integration.test.ts +0 -206
- package/src/github-reconcile-wiring.unit.test.ts +0 -170
- package/src/reconcile-apply-service.integration.test.ts +0 -271
- package/src/reconcile-apply-service.ts +0 -439
- package/src/reconcile-apply-service.unit.test.ts +0 -279
- package/src/reconcile-planner.ts +0 -264
- package/src/reconcile-planner.unit.test.ts +0 -274
package/openapi.platform.json
CHANGED
|
@@ -3260,238 +3260,6 @@
|
|
|
3260
3260
|
"status"
|
|
3261
3261
|
]
|
|
3262
3262
|
},
|
|
3263
|
-
"GithubReconcilePlanResult": {
|
|
3264
|
-
"type": "object",
|
|
3265
|
-
"properties": {
|
|
3266
|
-
"status": {
|
|
3267
|
-
"type": "string",
|
|
3268
|
-
"enum": [
|
|
3269
|
-
"planned",
|
|
3270
|
-
"skipped"
|
|
3271
|
-
],
|
|
3272
|
-
"description": "`skipped` (not an error) when no GitHub username is bound or the Apps are not configured; `reason` says why."
|
|
3273
|
-
},
|
|
3274
|
-
"reason": {
|
|
3275
|
-
"type": "string"
|
|
3276
|
-
},
|
|
3277
|
-
"planHash": {
|
|
3278
|
-
"type": "string"
|
|
3279
|
-
},
|
|
3280
|
-
"empty": {
|
|
3281
|
-
"type": "boolean"
|
|
3282
|
-
},
|
|
3283
|
-
"diff": {
|
|
3284
|
-
"type": "object",
|
|
3285
|
-
"properties": {
|
|
3286
|
-
"installationAdds": {
|
|
3287
|
-
"type": "array",
|
|
3288
|
-
"items": {
|
|
3289
|
-
"type": "string"
|
|
3290
|
-
}
|
|
3291
|
-
},
|
|
3292
|
-
"installationRemoves": {
|
|
3293
|
-
"type": "array",
|
|
3294
|
-
"items": {
|
|
3295
|
-
"type": "string"
|
|
3296
|
-
}
|
|
3297
|
-
},
|
|
3298
|
-
"configAdds": {
|
|
3299
|
-
"type": "array",
|
|
3300
|
-
"items": {
|
|
3301
|
-
"type": "string"
|
|
3302
|
-
}
|
|
3303
|
-
},
|
|
3304
|
-
"configRemoves": {
|
|
3305
|
-
"type": "array",
|
|
3306
|
-
"items": {
|
|
3307
|
-
"type": "string"
|
|
3308
|
-
}
|
|
3309
|
-
}
|
|
3310
|
-
},
|
|
3311
|
-
"required": [
|
|
3312
|
-
"installationAdds",
|
|
3313
|
-
"installationRemoves",
|
|
3314
|
-
"configAdds",
|
|
3315
|
-
"configRemoves"
|
|
3316
|
-
]
|
|
3317
|
-
},
|
|
3318
|
-
"skippedOrgs": {
|
|
3319
|
-
"type": "array",
|
|
3320
|
-
"items": {
|
|
3321
|
-
"type": "object",
|
|
3322
|
-
"properties": {
|
|
3323
|
-
"org": {
|
|
3324
|
-
"type": "string"
|
|
3325
|
-
},
|
|
3326
|
-
"reason": {
|
|
3327
|
-
"type": "string"
|
|
3328
|
-
}
|
|
3329
|
-
},
|
|
3330
|
-
"required": [
|
|
3331
|
-
"org",
|
|
3332
|
-
"reason"
|
|
3333
|
-
]
|
|
3334
|
-
}
|
|
3335
|
-
},
|
|
3336
|
-
"rejectedAdds": {
|
|
3337
|
-
"type": "array",
|
|
3338
|
-
"items": {
|
|
3339
|
-
"type": "object",
|
|
3340
|
-
"properties": {
|
|
3341
|
-
"repo": {
|
|
3342
|
-
"type": "string"
|
|
3343
|
-
},
|
|
3344
|
-
"reason": {
|
|
3345
|
-
"type": "string"
|
|
3346
|
-
}
|
|
3347
|
-
},
|
|
3348
|
-
"required": [
|
|
3349
|
-
"repo",
|
|
3350
|
-
"reason"
|
|
3351
|
-
]
|
|
3352
|
-
}
|
|
3353
|
-
},
|
|
3354
|
-
"warnings": {
|
|
3355
|
-
"type": "array",
|
|
3356
|
-
"items": {
|
|
3357
|
-
"type": "string"
|
|
3358
|
-
}
|
|
3359
|
-
},
|
|
3360
|
-
"affectedOpenWork": {
|
|
3361
|
-
"type": "array",
|
|
3362
|
-
"items": {
|
|
3363
|
-
"type": "object",
|
|
3364
|
-
"properties": {
|
|
3365
|
-
"id": {
|
|
3366
|
-
"type": "string"
|
|
3367
|
-
},
|
|
3368
|
-
"repo": {
|
|
3369
|
-
"type": "string"
|
|
3370
|
-
},
|
|
3371
|
-
"title": {
|
|
3372
|
-
"type": "string"
|
|
3373
|
-
}
|
|
3374
|
-
},
|
|
3375
|
-
"required": [
|
|
3376
|
-
"id",
|
|
3377
|
-
"repo"
|
|
3378
|
-
]
|
|
3379
|
-
},
|
|
3380
|
-
"description": "Open work the removals would block; empty when no open-work port is wired."
|
|
3381
|
-
}
|
|
3382
|
-
},
|
|
3383
|
-
"required": [
|
|
3384
|
-
"status"
|
|
3385
|
-
]
|
|
3386
|
-
},
|
|
3387
|
-
"GithubReconcilePlanBody": {
|
|
3388
|
-
"type": "object",
|
|
3389
|
-
"properties": {
|
|
3390
|
-
"addRepos": {
|
|
3391
|
-
"type": "array",
|
|
3392
|
-
"items": {
|
|
3393
|
-
"type": "string",
|
|
3394
|
-
"pattern": "^[^/\\s]+\\/[^/\\s]+$"
|
|
3395
|
-
},
|
|
3396
|
-
"description": "Repos (owner/repo) to explicitly add to the agent's config and installation."
|
|
3397
|
-
}
|
|
3398
|
-
}
|
|
3399
|
-
},
|
|
3400
|
-
"GithubReconcileApplyResult": {
|
|
3401
|
-
"type": "object",
|
|
3402
|
-
"properties": {
|
|
3403
|
-
"status": {
|
|
3404
|
-
"type": "string",
|
|
3405
|
-
"enum": [
|
|
3406
|
-
"applied",
|
|
3407
|
-
"failed",
|
|
3408
|
-
"noop",
|
|
3409
|
-
"skipped"
|
|
3410
|
-
]
|
|
3411
|
-
},
|
|
3412
|
-
"reason": {
|
|
3413
|
-
"type": "string"
|
|
3414
|
-
},
|
|
3415
|
-
"auditId": {
|
|
3416
|
-
"type": "string"
|
|
3417
|
-
},
|
|
3418
|
-
"planHash": {
|
|
3419
|
-
"type": "string"
|
|
3420
|
-
},
|
|
3421
|
-
"diff": {
|
|
3422
|
-
"type": "object",
|
|
3423
|
-
"properties": {
|
|
3424
|
-
"installationAdds": {
|
|
3425
|
-
"type": "array",
|
|
3426
|
-
"items": {
|
|
3427
|
-
"type": "string"
|
|
3428
|
-
}
|
|
3429
|
-
},
|
|
3430
|
-
"installationRemoves": {
|
|
3431
|
-
"type": "array",
|
|
3432
|
-
"items": {
|
|
3433
|
-
"type": "string"
|
|
3434
|
-
}
|
|
3435
|
-
},
|
|
3436
|
-
"configAdds": {
|
|
3437
|
-
"type": "array",
|
|
3438
|
-
"items": {
|
|
3439
|
-
"type": "string"
|
|
3440
|
-
}
|
|
3441
|
-
},
|
|
3442
|
-
"configRemoves": {
|
|
3443
|
-
"type": "array",
|
|
3444
|
-
"items": {
|
|
3445
|
-
"type": "string"
|
|
3446
|
-
}
|
|
3447
|
-
}
|
|
3448
|
-
},
|
|
3449
|
-
"required": [
|
|
3450
|
-
"installationAdds",
|
|
3451
|
-
"installationRemoves",
|
|
3452
|
-
"configAdds",
|
|
3453
|
-
"configRemoves"
|
|
3454
|
-
]
|
|
3455
|
-
},
|
|
3456
|
-
"warnings": {
|
|
3457
|
-
"type": "array",
|
|
3458
|
-
"items": {
|
|
3459
|
-
"type": "string"
|
|
3460
|
-
}
|
|
3461
|
-
},
|
|
3462
|
-
"error": {
|
|
3463
|
-
"type": "string"
|
|
3464
|
-
}
|
|
3465
|
-
},
|
|
3466
|
-
"required": [
|
|
3467
|
-
"status"
|
|
3468
|
-
]
|
|
3469
|
-
},
|
|
3470
|
-
"GithubReconcileApplyBody": {
|
|
3471
|
-
"type": "object",
|
|
3472
|
-
"properties": {
|
|
3473
|
-
"planHash": {
|
|
3474
|
-
"type": "string",
|
|
3475
|
-
"minLength": 1,
|
|
3476
|
-
"description": "planHash of the plan the admin reviewed."
|
|
3477
|
-
},
|
|
3478
|
-
"addRepos": {
|
|
3479
|
-
"type": "array",
|
|
3480
|
-
"items": {
|
|
3481
|
-
"type": "string",
|
|
3482
|
-
"pattern": "^[^/\\s]+\\/[^/\\s]+$"
|
|
3483
|
-
},
|
|
3484
|
-
"description": "Must match the addRepos used when the plan was made."
|
|
3485
|
-
},
|
|
3486
|
-
"confirmRemovals": {
|
|
3487
|
-
"type": "boolean",
|
|
3488
|
-
"description": "Required when the plan removes more than 10 repos."
|
|
3489
|
-
}
|
|
3490
|
-
},
|
|
3491
|
-
"required": [
|
|
3492
|
-
"planHash"
|
|
3493
|
-
]
|
|
3494
|
-
},
|
|
3495
3263
|
"GithubInstallationReposList": {
|
|
3496
3264
|
"type": "object",
|
|
3497
3265
|
"properties": {
|
|
@@ -7507,164 +7275,6 @@
|
|
|
7507
7275
|
}
|
|
7508
7276
|
}
|
|
7509
7277
|
},
|
|
7510
|
-
"/agents/{id}/github-reconcile/plan": {
|
|
7511
|
-
"post": {
|
|
7512
|
-
"summary": "Plan a GitHub repo reconcile for the agent",
|
|
7513
|
-
"description": "Platform-admin only (session members, ops keys and agent keys get 403). Read-only: nothing is persisted or changed. Returns the diff, warnings, `planHash` and the open work the removals would affect. 200 with `status: skipped` and a `reason` when no githubUsername is bound or the enterprise Apps are not configured. 404 for an unknown agent.",
|
|
7514
|
-
"parameters": [
|
|
7515
|
-
{
|
|
7516
|
-
"schema": {
|
|
7517
|
-
"type": "string",
|
|
7518
|
-
"example": "clx1234567890"
|
|
7519
|
-
},
|
|
7520
|
-
"required": true,
|
|
7521
|
-
"name": "id",
|
|
7522
|
-
"in": "path"
|
|
7523
|
-
}
|
|
7524
|
-
],
|
|
7525
|
-
"requestBody": {
|
|
7526
|
-
"required": false,
|
|
7527
|
-
"content": {
|
|
7528
|
-
"application/json": {
|
|
7529
|
-
"schema": {
|
|
7530
|
-
"$ref": "#/components/schemas/GithubReconcilePlanBody"
|
|
7531
|
-
}
|
|
7532
|
-
}
|
|
7533
|
-
}
|
|
7534
|
-
},
|
|
7535
|
-
"responses": {
|
|
7536
|
-
"200": {
|
|
7537
|
-
"description": "Reconcile plan",
|
|
7538
|
-
"content": {
|
|
7539
|
-
"application/json": {
|
|
7540
|
-
"schema": {
|
|
7541
|
-
"$ref": "#/components/schemas/GithubReconcilePlanResult"
|
|
7542
|
-
}
|
|
7543
|
-
}
|
|
7544
|
-
}
|
|
7545
|
-
},
|
|
7546
|
-
"401": {
|
|
7547
|
-
"description": "Unauthorized",
|
|
7548
|
-
"content": {
|
|
7549
|
-
"application/json": {
|
|
7550
|
-
"schema": {
|
|
7551
|
-
"$ref": "#/components/schemas/Error"
|
|
7552
|
-
}
|
|
7553
|
-
}
|
|
7554
|
-
}
|
|
7555
|
-
},
|
|
7556
|
-
"403": {
|
|
7557
|
-
"description": "Platform admin required",
|
|
7558
|
-
"content": {
|
|
7559
|
-
"application/json": {
|
|
7560
|
-
"schema": {
|
|
7561
|
-
"$ref": "#/components/schemas/Error"
|
|
7562
|
-
}
|
|
7563
|
-
}
|
|
7564
|
-
}
|
|
7565
|
-
},
|
|
7566
|
-
"404": {
|
|
7567
|
-
"description": "Agent not found",
|
|
7568
|
-
"content": {
|
|
7569
|
-
"application/json": {
|
|
7570
|
-
"schema": {
|
|
7571
|
-
"$ref": "#/components/schemas/Error"
|
|
7572
|
-
}
|
|
7573
|
-
}
|
|
7574
|
-
}
|
|
7575
|
-
}
|
|
7576
|
-
}
|
|
7577
|
-
}
|
|
7578
|
-
},
|
|
7579
|
-
"/agents/{id}/github-reconcile/apply": {
|
|
7580
|
-
"post": {
|
|
7581
|
-
"summary": "Apply a reviewed GitHub repo reconcile plan",
|
|
7582
|
-
"description": "Platform-admin only (session members, ops keys and agent keys get 403). Re-plans server-side and applies only when the fresh plan still matches `planHash` (409 otherwise). More than 10 removals need `confirmRemovals: true` (422 otherwise). Returns the audit id and result. 200 with `status: skipped` (unbound user or unconfigured Apps) or `status: noop` (nothing to change) is not an error. Open work on removed repos is blocked through the optional open-work port; a failure there is a warning.",
|
|
7583
|
-
"parameters": [
|
|
7584
|
-
{
|
|
7585
|
-
"schema": {
|
|
7586
|
-
"type": "string",
|
|
7587
|
-
"example": "clx1234567890"
|
|
7588
|
-
},
|
|
7589
|
-
"required": true,
|
|
7590
|
-
"name": "id",
|
|
7591
|
-
"in": "path"
|
|
7592
|
-
}
|
|
7593
|
-
],
|
|
7594
|
-
"requestBody": {
|
|
7595
|
-
"required": true,
|
|
7596
|
-
"content": {
|
|
7597
|
-
"application/json": {
|
|
7598
|
-
"schema": {
|
|
7599
|
-
"$ref": "#/components/schemas/GithubReconcileApplyBody"
|
|
7600
|
-
}
|
|
7601
|
-
}
|
|
7602
|
-
}
|
|
7603
|
-
},
|
|
7604
|
-
"responses": {
|
|
7605
|
-
"200": {
|
|
7606
|
-
"description": "Apply result",
|
|
7607
|
-
"content": {
|
|
7608
|
-
"application/json": {
|
|
7609
|
-
"schema": {
|
|
7610
|
-
"$ref": "#/components/schemas/GithubReconcileApplyResult"
|
|
7611
|
-
}
|
|
7612
|
-
}
|
|
7613
|
-
}
|
|
7614
|
-
},
|
|
7615
|
-
"401": {
|
|
7616
|
-
"description": "Unauthorized",
|
|
7617
|
-
"content": {
|
|
7618
|
-
"application/json": {
|
|
7619
|
-
"schema": {
|
|
7620
|
-
"$ref": "#/components/schemas/Error"
|
|
7621
|
-
}
|
|
7622
|
-
}
|
|
7623
|
-
}
|
|
7624
|
-
},
|
|
7625
|
-
"403": {
|
|
7626
|
-
"description": "Platform admin required",
|
|
7627
|
-
"content": {
|
|
7628
|
-
"application/json": {
|
|
7629
|
-
"schema": {
|
|
7630
|
-
"$ref": "#/components/schemas/Error"
|
|
7631
|
-
}
|
|
7632
|
-
}
|
|
7633
|
-
}
|
|
7634
|
-
},
|
|
7635
|
-
"404": {
|
|
7636
|
-
"description": "Agent not found",
|
|
7637
|
-
"content": {
|
|
7638
|
-
"application/json": {
|
|
7639
|
-
"schema": {
|
|
7640
|
-
"$ref": "#/components/schemas/Error"
|
|
7641
|
-
}
|
|
7642
|
-
}
|
|
7643
|
-
}
|
|
7644
|
-
},
|
|
7645
|
-
"409": {
|
|
7646
|
-
"description": "Plan hash is stale; re-plan",
|
|
7647
|
-
"content": {
|
|
7648
|
-
"application/json": {
|
|
7649
|
-
"schema": {
|
|
7650
|
-
"$ref": "#/components/schemas/Error"
|
|
7651
|
-
}
|
|
7652
|
-
}
|
|
7653
|
-
}
|
|
7654
|
-
},
|
|
7655
|
-
"422": {
|
|
7656
|
-
"description": "Removal cap needs confirmRemovals",
|
|
7657
|
-
"content": {
|
|
7658
|
-
"application/json": {
|
|
7659
|
-
"schema": {
|
|
7660
|
-
"$ref": "#/components/schemas/Error"
|
|
7661
|
-
}
|
|
7662
|
-
}
|
|
7663
|
-
}
|
|
7664
|
-
}
|
|
7665
|
-
}
|
|
7666
|
-
}
|
|
7667
|
-
},
|
|
7668
7278
|
"/agents/{id}/github-installation/repos": {
|
|
7669
7279
|
"get": {
|
|
7670
7280
|
"summary": "List the repos on the agent App's installation",
|
|
@@ -7755,7 +7365,7 @@
|
|
|
7755
7365
|
},
|
|
7756
7366
|
"post": {
|
|
7757
7367
|
"summary": "Add repos to the agent App's installation",
|
|
7758
|
-
"description": "Platform-admin only. Grants the agent's own GitHub App installation access to the named repos
|
|
7368
|
+
"description": "Platform-admin only. Grants the agent's own GitHub App installation access to the named repos; the agent's configured repos are not changed. Writes one audit entry (GitHubReconcileAudit, planHash `direct:add`) recording the caller and repos. 404 unknown agent; 422 no GH_APP_ID; 409 when the App is not installed on a repo's org (nothing is changed or audited); 502 when GitHub refuses (a failed audit entry is written).",
|
|
7759
7369
|
"parameters": [
|
|
7760
7370
|
{
|
|
7761
7371
|
"schema": {
|
|
@@ -7864,7 +7474,7 @@
|
|
|
7864
7474
|
"/agents/{id}/github-installation/repos/remove": {
|
|
7865
7475
|
"post": {
|
|
7866
7476
|
"summary": "Remove repos from the agent App's installation",
|
|
7867
|
-
"description": "Platform-admin only. Revokes the agent's own GitHub App installation access to the named repos
|
|
7477
|
+
"description": "Platform-admin only. Revokes the agent's own GitHub App installation access to the named repos; the agent's configured repos are not changed. Writes one audit entry (GitHubReconcileAudit, planHash `direct:remove`) recording the caller and repos. Same errors as the add route.",
|
|
7868
7478
|
"parameters": [
|
|
7869
7479
|
{
|
|
7870
7480
|
"schema": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@app-vitals/agent-admin",
|
|
3
|
-
"version": "1.35.
|
|
3
|
+
"version": "1.35.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/app-vitals/agent.git",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@anthropic-ai/sdk": "0.135.0",
|
|
45
|
-
"@app-vitals/agent-lib": "1.35.
|
|
45
|
+
"@app-vitals/agent-lib": "1.35.1",
|
|
46
46
|
"@hono/zod-openapi": "^1.0.0",
|
|
47
47
|
"@prisma/adapter-pg": "^7.10.0",
|
|
48
48
|
"@prisma/client": "^7.10.0",
|
package/src/admin-boot.ts
CHANGED
|
@@ -108,8 +108,7 @@ import { GitHubEnterpriseAppService } from "./github-enterprise-apps.ts";
|
|
|
108
108
|
import {
|
|
109
109
|
createGithubInstallationRepos,
|
|
110
110
|
createGithubLostAccessRemoval,
|
|
111
|
-
|
|
112
|
-
} from "./github-reconcile-wiring.ts";
|
|
111
|
+
} from "./github-installation-wiring.ts";
|
|
113
112
|
import { HttpGoogleAuthClient } from "./google-auth-client.ts";
|
|
114
113
|
import { HttpChatClient } from "./http-chat-client.ts";
|
|
115
114
|
import { HttpOktaAuthClient } from "./okta-auth-client.ts";
|
|
@@ -474,15 +473,6 @@ export async function startAdmin(
|
|
|
474
473
|
const githubAccessPreview = createGithubAccessPreview({
|
|
475
474
|
appService: githubEnterpriseAppService,
|
|
476
475
|
});
|
|
477
|
-
// GHE-3.9: the reconcile routes' service, with the extension's optional
|
|
478
|
-
// open-work port. Each agent's App id is read from its own stored GH_APP_ID.
|
|
479
|
-
const githubReconcile = createGithubReconcile({
|
|
480
|
-
prisma,
|
|
481
|
-
appService: githubEnterpriseAppService,
|
|
482
|
-
access: githubAccessPreview,
|
|
483
|
-
agentEnv: agentEnvService,
|
|
484
|
-
openWork: resolvedExtensions.openWork,
|
|
485
|
-
});
|
|
486
476
|
const githubInstallationRepos = createGithubInstallationRepos({
|
|
487
477
|
prisma,
|
|
488
478
|
appService: githubEnterpriseAppService,
|
|
@@ -498,7 +488,6 @@ export async function startAdmin(
|
|
|
498
488
|
});
|
|
499
489
|
const adminApiApp = createAdminApp({
|
|
500
490
|
githubAccessPreview,
|
|
501
|
-
githubReconcile,
|
|
502
491
|
...(resolvedExtensions.openWork
|
|
503
492
|
? { openWork: resolvedExtensions.openWork }
|
|
504
493
|
: {}),
|
package/src/admin-extension.ts
CHANGED
|
@@ -130,9 +130,9 @@ export interface AdminExtensionServices {
|
|
|
130
130
|
*/
|
|
131
131
|
agentPhaseMethodologyService?: AgentPhaseMethodologyServiceLike;
|
|
132
132
|
/**
|
|
133
|
-
* Supplies the
|
|
134
|
-
*
|
|
135
|
-
* extension → nothing is listed or blocked.
|
|
133
|
+
* Supplies the open-work port: removing a repo from an agent (or the
|
|
134
|
+
* lost-access removal) previews and blocks the open work on it. Absent from
|
|
135
|
+
* every extension → nothing is listed or blocked.
|
|
136
136
|
*/
|
|
137
137
|
openWork?: OpenWorkPort;
|
|
138
138
|
}
|
|
@@ -202,118 +202,4 @@ describe("admin UI — GitHub identity (GHE-2.5)", () => {
|
|
|
202
202
|
expect(res.status).toBe(403);
|
|
203
203
|
expect(calls.length).toBe(0);
|
|
204
204
|
});
|
|
205
|
-
|
|
206
|
-
it("IRM-1.4: the Reconcile card is replaced on the page by the installation repos card", async () => {
|
|
207
|
-
const { app } = setup({});
|
|
208
|
-
const html = await (await get(app, admin)).text();
|
|
209
|
-
expect(html).not.toContain('id="github-reconcile-card"');
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
it("GHE-3.5: hides the Reconcile card when the apps are unconfigured", async () => {
|
|
213
|
-
const { app } = setup({ configured: false });
|
|
214
|
-
const html = await (await get(app, admin)).text();
|
|
215
|
-
expect(html).not.toContain("github-reconcile-card");
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
it("GHE-3.5: hides the Reconcile card from a non-admin", async () => {
|
|
219
|
-
const { app } = setup({});
|
|
220
|
-
const html = await (await get(app, member)).text();
|
|
221
|
-
expect(html).not.toContain("github-reconcile-card");
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
it("GHE-3.5: plan route proxies the API and renders the diff", async () => {
|
|
225
|
-
const { app, calls } = setup({
|
|
226
|
-
agentsApi: () =>
|
|
227
|
-
json({
|
|
228
|
-
status: "planned",
|
|
229
|
-
planHash: "h1",
|
|
230
|
-
empty: false,
|
|
231
|
-
diff: {
|
|
232
|
-
installationAdds: [],
|
|
233
|
-
installationRemoves: [],
|
|
234
|
-
configAdds: ["acme/new"],
|
|
235
|
-
configRemoves: [],
|
|
236
|
-
},
|
|
237
|
-
}),
|
|
238
|
-
});
|
|
239
|
-
const res = await app.request(
|
|
240
|
-
`/admin/agents/${AGENT_ID}/github-reconcile/plan`,
|
|
241
|
-
{
|
|
242
|
-
method: "POST",
|
|
243
|
-
headers: {
|
|
244
|
-
Cookie: `admin_session=${admin}`,
|
|
245
|
-
"Content-Type": "application/json",
|
|
246
|
-
},
|
|
247
|
-
body: JSON.stringify({ addRepos: ["acme/new"] }),
|
|
248
|
-
},
|
|
249
|
-
);
|
|
250
|
-
expect(res.status).toBe(200);
|
|
251
|
-
const html = await res.text();
|
|
252
|
-
expect(calls.at(-1)?.path).toBe(
|
|
253
|
-
`/agents/${AGENT_ID}/github-reconcile/plan`,
|
|
254
|
-
);
|
|
255
|
-
expect(JSON.parse(String(calls.at(-1)?.init?.body))).toEqual({
|
|
256
|
-
addRepos: ["acme/new"],
|
|
257
|
-
});
|
|
258
|
-
expect(html).toContain('data-plan-hash="h1"');
|
|
259
|
-
expect(html).toContain('data-add-repos="acme/new"');
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
it("GHE-3.5: apply route forwards the confirmation and renders the result", async () => {
|
|
263
|
-
const { app, calls } = setup({
|
|
264
|
-
agentsApi: () => json({ status: "applied", auditId: "aud-9" }),
|
|
265
|
-
});
|
|
266
|
-
const payload = { planHash: "h1", addRepos: [], confirmRemovals: true };
|
|
267
|
-
const res = await app.request(
|
|
268
|
-
`/admin/agents/${AGENT_ID}/github-reconcile/apply`,
|
|
269
|
-
{
|
|
270
|
-
method: "POST",
|
|
271
|
-
headers: {
|
|
272
|
-
Cookie: `admin_session=${admin}`,
|
|
273
|
-
"Content-Type": "application/json",
|
|
274
|
-
},
|
|
275
|
-
body: JSON.stringify(payload),
|
|
276
|
-
},
|
|
277
|
-
);
|
|
278
|
-
expect(await res.text()).toContain("aud-9");
|
|
279
|
-
expect(JSON.parse(String(calls.at(-1)?.init?.body))).toEqual(payload);
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
it("GHE-3.5: apply surfaces a 409 stale plan error", async () => {
|
|
283
|
-
const { app } = setup({
|
|
284
|
-
agentsApi: () => json({ error: "the plan changed" }, 409),
|
|
285
|
-
});
|
|
286
|
-
const res = await app.request(
|
|
287
|
-
`/admin/agents/${AGENT_ID}/github-reconcile/apply`,
|
|
288
|
-
{
|
|
289
|
-
method: "POST",
|
|
290
|
-
headers: {
|
|
291
|
-
Cookie: `admin_session=${admin}`,
|
|
292
|
-
"Content-Type": "application/json",
|
|
293
|
-
},
|
|
294
|
-
body: JSON.stringify({ planHash: "old" }),
|
|
295
|
-
},
|
|
296
|
-
);
|
|
297
|
-
expect(res.status).toBe(409);
|
|
298
|
-
expect(await res.text()).toContain("the plan changed");
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
it("GHE-3.5: plan and apply routes are forbidden for a non-admin", async () => {
|
|
302
|
-
const { app, calls } = setup({});
|
|
303
|
-
for (const step of ["plan", "apply"]) {
|
|
304
|
-
const res = await app.request(
|
|
305
|
-
`/admin/agents/${AGENT_ID}/github-reconcile/${step}`,
|
|
306
|
-
{
|
|
307
|
-
method: "POST",
|
|
308
|
-
headers: {
|
|
309
|
-
Cookie: `admin_session=${member}`,
|
|
310
|
-
"Content-Type": "application/json",
|
|
311
|
-
},
|
|
312
|
-
body: "{}",
|
|
313
|
-
},
|
|
314
|
-
);
|
|
315
|
-
expect(res.status).toBe(403);
|
|
316
|
-
}
|
|
317
|
-
expect(calls.length).toBe(0);
|
|
318
|
-
});
|
|
319
205
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* admin/src/admin-ui-installation-repos-pages.ts
|
|
3
3
|
* Pure renderers for the agent detail page's "Installation repos" card
|
|
4
|
-
* (IRM-1.4),
|
|
4
|
+
* (IRM-1.4), the repos on the
|
|
5
5
|
* agent App's installation per org with add/remove, the user-can-push hint,
|
|
6
6
|
* and a button that removes repos the bound user can no longer push to (IRM-1.3)
|
|
7
7
|
* after an explicit confirmation. It also renders the open-work lists shown
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { escapeHtml } from "./admin-ui-styles.ts";
|
|
14
|
-
import { MAX_UNCONFIRMED_REMOVALS } from "./
|
|
14
|
+
import { MAX_UNCONFIRMED_REMOVALS } from "./installation-ports.ts";
|
|
15
15
|
|
|
16
16
|
export interface OpenWorkView {
|
|
17
17
|
id: string;
|
|
@@ -111,7 +111,6 @@ describe("admin UI — installation repos card (IRM-1.4)", () => {
|
|
|
111
111
|
const { app } = setup({ agentsApi: () => json(INSTALLED) });
|
|
112
112
|
const html = await (await get(app, "")).text();
|
|
113
113
|
expect(html).toContain('id="github-installation-card"');
|
|
114
|
-
expect(html).not.toContain('id="github-reconcile-card"');
|
|
115
114
|
});
|
|
116
115
|
|
|
117
116
|
it("is absent for an agent with no GH_APP_ID", async () => {
|