@@ -112,6 +112,8 @@ const sysUserPermissionSet = {
112112 id : { name : 'id' , type : 'text' as const , primaryKey : true } ,
113113 user_id : { name : 'user_id' , type : 'text' as const } ,
114114 permission_set_id : { name : 'permission_set_id' , type : 'text' as const } ,
115+ // [ADR-0131 D4] The grant's set BY NAME — the column the guard reads.
116+ permission_set : { name : 'permission_set' , type : 'text' as const } ,
115117 organization_id : { name : 'organization_id' , type : 'text' as const } ,
116118 valid_from : { name : 'valid_from' , type : 'datetime' as const } ,
117119 valid_until : { name : 'valid_until' , type : 'datetime' as const } ,
@@ -236,7 +238,7 @@ describe('[#11663 L2] the enumeration counts CONFIG-derived administrators', ()
236238 await engine . insert ( 'sys_permission_set' , { id : 'ps_a' , name : ADMIN_FULL_ACCESS , active : true } , SYSTEM ) ;
237239 await engine . insert (
238240 'sys_user_permission_set' ,
239- { id : 'ups_1' , user_id : 'usr_grant' , permission_set_id : 'ps_a' } ,
241+ { id : 'ups_1' , user_id : 'usr_grant' , permission_set_id : 'ps_a' , permission_set : ADMIN_FULL_ACCESS } ,
240242 SYSTEM ,
241243 ) ;
242244
@@ -311,7 +313,7 @@ describe('[#11663 L2] the FIFTH write shape is judged', () => {
311313 await engine . insert ( 'sys_permission_set' , { id : 'ps_a' , name : ADMIN_FULL_ACCESS , active : true } , SYSTEM ) ;
312314 await engine . insert (
313315 'sys_user_permission_set' ,
314- { id : 'ups_1' , user_id : 'usr_owner' , permission_set_id : 'ps_a' } ,
316+ { id : 'ups_1' , user_id : 'usr_owner' , permission_set_id : 'ps_a' , permission_set : ADMIN_FULL_ACCESS } ,
315317 SYSTEM ,
316318 ) ;
317319
@@ -403,7 +405,7 @@ describe('[#11663 L5] under a WALLED posture the legacy grant is not an administ
403405 await engine . insert ( 'sys_permission_set' , { id : 'ps_a' , name : ADMIN_FULL_ACCESS , active : true } , SYSTEM ) ;
404406 await engine . insert (
405407 'sys_user_permission_set' ,
406- { id : 'ups_1' , user_id : 'usr_legacy' , permission_set_id : 'ps_a' } ,
408+ { id : 'ups_1' , user_id : 'usr_legacy' , permission_set_id : 'ps_a' , permission_set : ADMIN_FULL_ACCESS } ,
407409 SYSTEM ,
408410 ) ;
409411 return engine ;
@@ -455,7 +457,7 @@ describe('[#11663 L5] under a WALLED posture the legacy grant is not an administ
455457 await engine . insert ( 'sys_permission_set' , { id : 'ps_a' , name : ADMIN_FULL_ACCESS , active : true } , SYSTEM ) ;
456458 await engine . insert (
457459 'sys_user_permission_set' ,
458- { id : 'ups_1' , user_id : 'usr_legacy' , permission_set_id : 'ps_a' } ,
460+ { id : 'ups_1' , user_id : 'usr_legacy' , permission_set_id : 'ps_a' , permission_set : ADMIN_FULL_ACCESS } ,
459461 SYSTEM ,
460462 ) ;
461463
@@ -476,7 +478,7 @@ describe('[#11663 L5] under a WALLED posture the legacy grant is not an administ
476478 await engine . insert ( 'sys_permission_set' , { id : 'ps_a' , name : ADMIN_FULL_ACCESS , active : true } , SYSTEM ) ;
477479 await engine . insert (
478480 'sys_user_permission_set' ,
479- { id : 'ups_1' , user_id : 'usr_legacy' , permission_set_id : 'ps_a' } ,
481+ { id : 'ups_1' , user_id : 'usr_legacy' , permission_set_id : 'ps_a' , permission_set : ADMIN_FULL_ACCESS } ,
480482 SYSTEM ,
481483 ) ;
482484
@@ -518,7 +520,7 @@ describe('[#11663 L5] under a WALLED posture the legacy grant is not an administ
518520 await engine . insert ( 'sys_permission_set' , { id : 'ps_a' , name : ADMIN_FULL_ACCESS , active : false } , SYSTEM ) ;
519521 await engine . insert (
520522 'sys_user_permission_set' ,
521- { id : 'ups_1' , user_id : 'usr_legacy' , permission_set_id : 'ps_a' } ,
523+ { id : 'ups_1' , user_id : 'usr_legacy' , permission_set_id : 'ps_a' , permission_set : ADMIN_FULL_ACCESS } ,
522524 SYSTEM ,
523525 ) ;
524526
@@ -537,7 +539,7 @@ describe('[#11663 L5] under a WALLED posture the legacy grant is not an administ
537539 await engine . insert ( 'sys_permission_set' , { id : 'ps_a' , name : ADMIN_FULL_ACCESS , active : false } , SYSTEM ) ;
538540 await engine . insert (
539541 'sys_user_permission_set' ,
540- { id : 'ups_1' , user_id : 'usr_legacy' , permission_set_id : 'ps_a' } ,
542+ { id : 'ups_1' , user_id : 'usr_legacy' , permission_set_id : 'ps_a' , permission_set : ADMIN_FULL_ACCESS } ,
541543 SYSTEM ,
542544 ) ;
543545
0 commit comments