Skip to content

Migration - Investigation Needed - Staff IDs showing on Filings in Prod #29914

Closed

Description

@dylan644

@argush3 - FYI

This was noted during a demo of what the citizen sees in Prod for a corp migrated from COLIN

image.png

"YWOLF" is Yasmin's ID, a staff member.

This was noted in Dev for BC0000160 which is correct:

image.png

Further investigation and analysis needed please

Activity

  1. added
    Entities - Data Migration
    on Aug 1, 2025
  2. argush3 commented on Aug 6, 2025

    @argush3
    Contributor
  3. eason-pan-bc commented on Aug 19, 2025

    @eason-pan-bc

    Filing Submitter Display Issue Investigation

    Summary

    Front-end (filings-UI) and back-end (business-api / legal-api) work as expected. Behaviours when filed in modernized system were as expected. Root cause is highly likely missing submitter_roles in migration pipelines.

    Detailed Report

    1 - Flow

    1.1 - Front-end behaviour

    FE calls GET filings endpoint https://xxx/business/api/v2/businesses/BCXXXX/filings, then use the filing.submitter in each filing item.
    code: https://github.com/bcgov/business-dashboard-ui/blob/896d4cb77aa1e6e5a70fa2ef72916bbc2427e467/src/components/bcros/filing/common/FiledLabel.vue#L18

    1.2 - Back-end logic

    Depending on the logged-in user's role, it returns redacted staff submitter or username as the submitter displayname.
    code: https://github.com/bcgov/lear/blob/main/legal-api/src/legal_api/core/filing.py#L411-L415

    1.3 - Database

    It appears the data entry with issues doesn't have a proper submitter_role populated in the db
    Pasted image 20250818150524.png


    2 - Migration Pipeline Analysis

    Primarily investigated in the migration of submitter_id and submitter_roles filings, since they are the main factors determine the submitter_displayname.

    2.1 - submitter_id Migration ✅:

    1. Primary submitter_id handling: flows/custom_filer/filing_processors/filing_components/init.py:197
      - Sets filing_submission.submitter_id = user.id
    2. Corps tombstone flow: flows/corps_tombstone_flow.py:242-244
      - Reads username = f['submitter_id'] and updates f['submitter_id'] = user_id
    3. Multiple filing processors use submitter_id as staff_id:
      - flows/custom_filer/filing_processors/dissolution.py:69
      - flows/custom_filer/filing_processors/change_of_registration.py:88
      - flows/custom_filer/filing_processors/conversion.py:120
      - flows/custom_filer/filing_processors/correction.py:40,48
      - flows/custom_filer/filing_processors/registration.py:138
    4. Tombstone utilities: flows/tombstone/tombstone_utils.py:501
      - Sets initial submitter_id that gets updated during data loading

    2.2 - submitter_roles Migration ❌:

    Only found in: flows/tombstone/tombstone_base_data.py:206

    • Sets 'submitter_roles': None in the base filing template

    3 - Recommendations

    • Audit Migration Scripts: Review all migration pipelines for submitter_roles handling
    • Implement migration script to populate missing roles
  4. AimeeGao commented on Aug 19, 2025

    @AimeeGao

    Findings

    1. In our workflow pipeline, the Role field successfully queried

    As the code shown above:
    u_role_typ_cd is selected from COLIN in the pipeline query.

    2. And submitter_roles field is initialized as None in our tombstone_base_data

    3. Missing Role field-related processing in our pipeline

    1. we include the u_role_typ_cd data when calling format_filings_data

    2. get_username handling on name info

    3. In the format_filings_data, we don't handle the role type info and use the default value: 'submitter_roles': None

    Data flow breakdown:

    • SQL query: u.role_typ_cd as u_role_typ_cd ✅
    • Data processing: format_filings_data receives data with u_role_typ_cd ✅
    • Filing body: The filing body misses the role handling logic and uses the default 'submitter_roles': None

    Issue:

    Since submitter_roles is None, the UI defaults to showing the user’s real name instead of staff info.

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

Metadata

Metadata

Labels

Entities - Data Migration

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions