Skip to content

SPIKE: Investigate Continuation In Numbering Format #33143

Closed

Description

@mstanton1

BC Business numbering users the company prefix (e.g. BC, C, FM) followed by seven digits.

E.g. FM1142783
CP1012674
BC1539994

In PROD a BC Benefit Company was recently continued in. The number assigned was C9900710. Since we had only been issuing numbers starting with 1 this raised concern that we are skipping numbers and may reach a point where we need to extend the total number of digits in the company number sooner. Review is required to understand logic for issuance of the Continuation In number (why did it start with 9 and skip a significant set of numbers in our current sequence).

Note: Elizabeth has requested that we provide her with a summary after review is complete.

Activity

  1. added
    Entities Team
    on Apr 13, 2026
  2. self-assigned this
    on Apr 30, 2026
  3. kialj876 commented on Apr 30, 2026

    @kialj876
    Collaborator

    Below outlines my findings:

    Code path from the business-filer:

    1. continuation_in.py line 115 calls business_info.get_next_corp_num(legalType)
    2. get_next_corp_num normalises the type to "C" and POSTs to the COLIN API
    3. colin-api/src/colin_api/resources/business.py lines 99–119 validates legal_type in ['BC', 'C'] and calls Business.get_next_corp_num
    4. colin-api/src/colin_api/models/business.py lines 688–718 atomically reads and increments the Oracle system_id table:
      SELECT id_num FROM system_id WHERE id_typ_cd = :corp_type FOR UPDATE
      UPDATE system_id SET id_num = :new_num WHERE id_typ_cd = :corp_type
    5. Returns '%07d' % corp_num → back in business_info.py lines 152–155:
      new_corpnum = int(resp.json()["corpNum"])
      if new_corpnum and new_corpnum <= 9999999:
          return f"{legal_type}{new_corpnum:07d}"
      Producing "C9900710".

    This means the sequence in cprd for the 'C' corp_type is at 9900710 - I need someone to verify this as I don't have access to the database. If the sequence is not at 9900710 then I will debug further done

    Update
    The sequence for 'C' corp types is at this value so the code is working as expected. It is actually supposed to be using the 'BC' sequence instead (that's what colin currently does) - discussion needed for next steps and verification

  4. TVWerdal commented on May 1, 2026

    @TVWerdal
    Collaborator

    Chatted with @thorwolpert - and they relayed the following:

    • We did set the sequence higher for a couple of other types. Linda had said they had done that in the past so the help desk would know which system was being used. I don't think we decided on any policy or anything like that
    • For BEN Corps we used the same sequence as in Colin, so there was no break in numbering. I would've assumed cben would've been handled the same way
    • Looks like that flag has to be on, or it uses the Colin sequence generator
  5. kialj876 commented on May 4, 2026

    @kialj876
    Collaborator

    Chatted with @thorwolpert - and they relayed the following:

    • We did set the sequence higher for a couple of other types. Linda had said they had done that in the past so the help desk would know which system was being used. I don't think we decided on any policy or anything like that
    • For BEN Corps we used the same sequence as in Colin, so there was no break in numbering. I would've assumed cben would've been handled the same way
    • Looks like that flag has to be on, or it uses the Colin sequence generator

    'Looks like that flag has to be on, or it uses the Colin sequence generator'

    • For corps it is supposed to use the colin sequence in dev, test, and prod - that flag 'enable-sandbox' effects several things throughout the business flow (i.e. payment, authentication, emails, etc.) and should only ever be turned on in the sandbox environment. The reason that condition is there is because there isn't a colin db for the sandbox so this allows processing of incorporations, etc. in the sandbox environment by removing the colin dependency - I don't think this is something we'll want to do for the other environments until the migration of corps is completed otherwise we'll end up with sequencing conflicts

    'For BEN Corps we used the same sequence as in Colin, so there was no break in numbering. I would've assumed cben would've been handled the same way'

    • Yeah BEN companies use the colin 'BC' sequence (same as BC, CC, ULC). CBEN is configured to use the 'C' sequence in colin, but what I was saying above is that we saw the other 'C' companies being generated through colin were NOT actually using this sequence. I assume we want the numbering to be consistent with the current colin numbering for 'C' companies? Right now CBN's are going off a different sequence than the ones that aren't modernized yet (C, CCC and CUL)
    • The number its at is also potentially problematic because it'll run out of numbers before 1 million more are created which may be fine for now, but that's a much smaller window compared to the other sequences?
  6. mstanton1 commented on May 4, 2026

    @mstanton1
    CollaboratorAuthor

    If I'm understanding correctly the only rationale was for help desk identification of the entity type. Given information on entity type can be easily obtained through the modernized system, and we run the risk of running out of numbers sooner, it seems there isn't enough value to warrant a unique/higher sequence.

    I'd recommend we use the BC sequence for CBEN/C as well. We have regular meetings for SAF with these helpdesk groups and could share out there.

    @thorwolpert @TVWerdal @kialj876 any concerns with this approach?

  7. thorwolpert commented on May 4, 2026

    @thorwolpert
    Collaborator

    I think it's safer to use the Colin based sequence until all of the BCA types are moved over.
    Afaict the "sandbox" flag was turned on in Prod.
    As there is no sandbox environment in the Colin environment, it makes sense to use the local sequence in the sandbox ( the flag seems aptly named ) it was probably turned on in Prod by accident.
    An issue that will exist is some businesses with a higher sequence number. Those can be renumbered (the Registrar has the right to change an existing reg) or we add some code to check if the sequence already exists and get a new one, so we don't try and save the same reg num twice

  8. kialj876 commented on May 6, 2026

    @kialj876
    Collaborator

    Okay so after meeting with Thor and Melissa we have a plan:

    • use same colin sequence for C companies as BC companies for now
      • change is in the filer (refer to diagram below)
    • split the sequences after the migration is done and we're using sequences in the modernized db
    Image
  9. mstanton1 commented on May 8, 2026

    @mstanton1
    CollaboratorAuthor

    Closing as spike is complete. Implementation of change will be tackled in https://app.zenhub.com/workspaces/entities-team-65af15f59e89f5043c2911f7/issues/gh/bcgov/entity/33365.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Entities Teamtimeboxed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions