Identifier Assignment change to Format breaks Autogenerate Identifiers

XMLWordPrintable

      The ACCESS PROD Registry 4.3.x was using an Identifier Assignment with this configuration:

                        id: 3
                     co_id: 2
                    status: A
                   context: CP
           identifier_type: accessid
                email_type: 
               description: ACCESS ID
                     login: 0
                 algorithm: S
                    format: (g:1)(f:25)[1:(#)]
                   minimum: NULL
                   maximum: NULL
                 permitted: AN
      collision_resolution: NULL
                exclusions: NULL
                      ordr: 3
               co_group_id: NULL
                    plugin: NULL

      After upgrading Registry to version 4.4.x the configuration was then changed to

                        id: 3
                     co_id: 2
                    status: A
                   context: CP
           identifier_type: accessid
                email_type: 
               description: ACCESS ID
                     login: 0
                 algorithm: S
                    format: (g:1)(f:25)[1:(#)][2:(#)][3:(#)]
                   minimum: NULL
                   maximum: NULL
                 permitted: AN
      collision_resolution: NULL
                exclusions: NULL
                      ordr: 3
               co_group_id: NULL
                    plugin: NULL
            minimum_length: 3
             transliterate: 1
      1 row in set (0.001 sec) 

      in order to enable transliteration and enforce a minimum length of 3 for the Identifier.

      This configuration works for some CO Person records but fails for others. When the failure occurs Registry shows this in the logs:

      1753295531.890226 2025-07-23T18:32:11.890020771Z stderr F 2025-07-23 18:32:11 Error: [ArgumentCountError] 3 arguments are required, 2 given
      1753295531.890231 2025-07-23T18:32:11.890047471Z stderr F Request URL: /registry/identifiers/assign/copersonid:280293
      1753295531.890234 2025-07-23T18:32:11.890057271Z stderr F Stack Trace:
      1753295531.890237 2025-07-23T18:32:11.890110782Z stderr F #0 /srv/comanage-registry/app/Model/CoIdentifierAssignment.php(526): sprintf()
      1753295531.890242 2025-07-23T18:32:11.890124212Z stderr F #1 /srv/comanage-registry/app/Model/CoIdentifierAssignment.php(433): CoIdentifierAssignment->assignCollisionNumber()
      1753295531.890246 2025-07-23T18:32:11.890133843Z stderr F #2 /srv/comanage-registry/app/Model/Identifier.php(291): CoIdentifierAssignment->assign()
      1753295531.890250 2025-07-23T18:32:11.890142333Z stderr F #3 /srv/comanage-registry/app/Controller/IdentifiersController.php(117): Identifier->assign()
      1753295531.890253 2025-07-23T18:32:11.890150313Z stderr F #4 [internal function]: IdentifiersController->assign()
      1753295531.890257 2025-07-23T18:32:11.890158673Z stderr F #5 /srv/comanage-registry/lib/Cake/Controller/Controller.php(499): ReflectionMethod->invokeArgs()
      1753295531.890261 2025-07-23T18:32:11.890184903Z stderr F #6 /srv/comanage-registry/lib/Cake/Routing/Dispatcher.php(193): Controller->invokeAction()
      1753295531.890401 2025-07-23T18:32:11.890194724Z stderr F #7 /srv/comanage-registry/lib/Cake/Routing/Dispatcher.php(167): Dispatcher->_invoke()
      1753295531.890406 2025-07-23T18:32:11.890203304Z stderr F #8 /srv/comanage-registry/app/webroot/index.php(96): Dispatcher->dispatch()
      1753295531.890409 2025-07-23T18:32:11.890212184Z stderr F #9 {main} 

      The ArgumentCountError is being thrown by the sprintf() call in this code block in CoIdentifierAssignment.php:

              case IdentifierAssignmentEnum::Sequential:
                return sprintf($sequenced, $this->CoSequentialIdentifierAssignment->next($coIdentifierAssignmentID, $sequenced, $min));
                break;
       

      An example for a CO Person record where the auto-generation of this Identifier is failing and throwing the stack trace is when the CO Person has a Name object like

      MySQL [access_registry]> select id,given,middle,family from cm_names where co_person_id = 280290;
      +--------+-------+--------+--------+
      | id     | given | middle | family |
      +--------+-------+--------+--------+
      | 499090 | Z     |        | Peng   |
      +--------+-------+--------+--------+
       
      
      

      The Registry for this CO Person record has the following relevant state:

      MySQL [access_registry]> select id,identifier,co_person_id from cm_identifiers where identifier like 'zpeng%' and type = 'accessid';
      +---------+------------+--------------+
      | id      | identifier | co_person_id |
      +---------+------------+--------------+
      |   14450 | zpeng      |         7226 |
      |  620106 | zpeng1     |       110401 |
      |  899676 | zpeng2     |       238295 |
      |  102950 | zpeng3     |        51476 |
      | 1044398 | zpeng4     |       280290 |
      | 1044887 | zpeng5     |       280293 |
      |  131730 | zpengiu    |        65866 |
      +---------+------------+--------------+
      7 rows in set (0.001 sec) 

      MySQL [access_registry]> select * from cm_co_sequential_identifier_assignments where affix like 'zpeng%'\G *************************** 1. row ***************************                          id: 358 co_identifier_assignment_id: 3                       affix: zpeng%s                        last: 5                     created: 2022-10-19 20:09:19                    modified: 2025-07-23 19:19:20 1 row in set (0.003 sec)
      

      Reverting the Identifier Assignment configuration to using a format of (g:1)(f:25)1:(#) and no minimum allows the auto-generation to work.

      I suspect that the minimum is not actually related and it is the change in format that is the issue along with the existing state in the cm_identifiers and cm_co_sequential_identifier_assignments tables.

      We have reverted the production configuration to using the format (g:1)(f:25)[1:(#)]  for now but that does not result in a guarantee of an Identifier with a minimum length of 3 always working for all enrollment flows. So we would like to be able to change the format to (g:1)(f:25)[1:(#)][2:(#)][3:(#)].

            Assignee:
            Benn Oshrin (internet2.edu)
            Reporter:
            Scott Koranda
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: