Skip to content

fix(ownership): serialize owner IDs as strings to match Actor type contract#110592

Closed
dcramer wants to merge 4 commits intomasterfrom
cursor/ownership-rules-id-type-9ade
Closed

fix(ownership): serialize owner IDs as strings to match Actor type contract#110592
dcramer wants to merge 4 commits intomasterfrom
cursor/ownership-rules-id-type-9ade

Conversation

@dcramer
Copy link
Member

@dcramer dcramer commented Mar 12, 2026

Fixes ownership rules widget crash by ensuring owner IDs are consistently serialized as strings.

The "e?.trim is not a function" error occurred because the backend's ownership rules GET endpoint returned numeric owner IDs, while the frontend's Actor type expected string IDs. When a numeric ID was passed to avatar rendering logic, it caused a crash.

Fixes #110588

…ntract

- Convert numeric owner IDs to strings in add_owner_ids_to_schema()
- Add defensive string coercion in getInitials() to handle non-string names
- Normalize IDs in TeamStore.getById() to handle string/number mismatch
- Add tests for all three defensive fixes

Fixes the 'trim is not a function' error in ownership rules widget where
numeric team IDs were being passed as the name parameter to getInitials().
The frontend Actor type expects id: string, but the backend was returning
id as a number.

Co-authored-by: David Cramer <dcramer@users.noreply.github.com>
@github-actions github-actions bot added Scope: Frontend Automatically applied to PRs that change frontend components Scope: Backend Automatically applied to PRs that change backend components labels Mar 12, 2026
@github-actions
Copy link
Contributor

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

Add explicit type annotation and intermediate variables to resolve mypy's
Collection indexing error when accessing nested dict items.

Co-authored-by: David Cramer <dcramer@users.noreply.github.com>
@dcramer dcramer changed the title Ownership rules ID type fix(ownership): serialize owner IDs as strings to match Actor type contract Mar 12, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 12, 2026

Backend Test Failures

Failures on 9df0ce4 in this run:

tests/sentry/issues/endpoints/test_project_codeowners_index.py::ProjectCodeOwnersEndpointTestCase::test_getlog
tests/sentry/issues/endpoints/test_project_codeowners_index.py:567: in test_get
    assert response_data["schema"] == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': '105', 'name': 'admin@sentry.io', 'type': 'user'}, {'id': '4557781867692032', 'name': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': 105, 'name': 'admin@sentry.io', 'type': 'user'}, {'id': 4557781867692032, 'name': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': 'docs/*',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 105,
E     +                     'id': '105',
E     ?                           +   +
E                           'name': 'admin@sentry.io',
E                           'type': 'user',
E                       },
E                       {
E     -                     'id': 4557781867692032,
E     +                     'id': '4557781867692032',
E     ?                           +                +
E                           'name': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_codeowners_index.py::ProjectCodeOwnersEndpointTestCase::test_get_all_external_users_deletion_schema_updates_triggeredlog
tests/sentry/issues/endpoints/test_project_codeowners_index.py:706: in test_get_all_external_users_deletion_schema_updates_triggered
    assert response.data[0]["schema"] == {
E   AssertionError: assert {'$version': ...': 'user'}]}]} == {'$version': ...': 'user'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': '117', 'name': 'member_delete@localhost', 'type': 'user'}]}]} != {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': 117, 'name': 'member_delete@localhost', 'type': 'user'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': 'docs/*',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 117,
E     +                     'id': '117',
E     ?                           +   +
E                           'name': 'member_delete@localhost',
E                           'type': 'user',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_codeowners_index.py::ProjectCodeOwnersEndpointTestCase::test_get_codeowners_with_integration_post_creationlog
tests/sentry/issues/endpoints/test_project_codeowners_index.py:70: in test_get_codeowners_with_integration_post_creation
    assert resp_data["schema"] == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': '124', 'name': 'admin@sentry.io', 'type': 'user'}, {'id': '4557781868216320', 'name': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': 124, 'name': 'admin@sentry.io', 'type': 'user'}, {'id': 4557781868216320, 'name': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': 'docs/*',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 124,
E     +                     'id': '124',
E     ?                           +   +
E                           'name': 'admin@sentry.io',
E                           'type': 'user',
E                       },
E                       {
E     -                     'id': 4557781868216320,
E     +                     'id': '4557781868216320',
E     ?                           +                +
E                           'name': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_codeowners_index.py::ProjectCodeOwnersEndpointTestCase::test_get_expanded_codeowners_with_integrationlog
tests/sentry/issues/endpoints/test_project_codeowners_index.py:154: in test_get_expanded_codeowners_with_integration
    assert resp_data["schema"] == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': '*.js', 'type': 'codeowners'}, 'owners': [{'id': '4557781868412928', 'name': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': '*.js', 'type': 'codeowners'}, 'owners': [{'id': 4557781868412928, 'name': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': '*.js',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 4557781868412928,
E     +                     'id': '4557781868412928',
E     ?                           +                +
E                           'name': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_codeowners_index.py::ProjectCodeOwnersEndpointTestCase::test_get_multiple_rules_deleted_owners_schema_updates_triggeredlog
tests/sentry/issues/endpoints/test_project_codeowners_index.py:795: in test_get_multiple_rules_deleted_owners_schema_updates_triggered
    assert response.data[0]["schema"] == {
E   AssertionError: assert {'$version': ...': 'user'}]}]} == {'$version': ...': 'user'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': '147', 'name': 'member_delete_1@...er': {'pattern': '*.rb', 'type': 'codeowners'}, 'owners': [{'id': '146', 'name': 'admin@sentry.io', 'type': 'user'}]}]} != {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': 147, 'name': 'member_delete_1@lo...cher': {'pattern': '*.rb', 'type': 'codeowners'}, 'owners': [{'id': 146, 'name': 'admin@sentry.io', 'type': 'user'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': 'docs/*',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 147,
E     +                     'id': '147',
E     ?                           +   +
E                           'name': 'member_delete_1@localhost',
E                           'type': 'user',
E                       },
E                   ],
E               },
E               {
E                   'matcher': {
E                       'pattern': '*.py',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 4557781868740608,
E     +                     'id': '4557781868740608',
E     ?                           +                +
E                           'name': 'tiger-team',
E                           'type': 'team',
E                       },
E                       {
E     -                     'id': 147,
E     +                     'id': '147',
E     ?                           +   +
E                           'name': 'member_delete_1@localhost',
E                           'type': 'user',
E                       },
E                   ],
E               },
E               {
... (31 more lines)
tests/sentry/issues/endpoints/test_project_codeowners_index.py::ProjectCodeOwnersEndpointTestCase::test_post_with_schemalog
tests/sentry/issues/endpoints/test_project_codeowners_index.py:542: in test_post_with_schema
    assert response.data["schema"] == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': '158', 'identifier': 'admin@sentry.io', 'type': 'user'}, {'id': '4557781869133824', 'identifier': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': 158, 'identifier': 'admin@sentry.io', 'type': 'user'}, {'id': 4557781869133824, 'identifier': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': 'docs/*',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 158,
E     +                     'id': '158',
E     ?                           +   +
E                           'identifier': 'admin@sentry.io',
E                           'type': 'user',
E                       },
E                       {
E     -                     'id': 4557781869133824,
E     +                     'id': '4557781869133824',
E     ?                           +                +
E                           'identifier': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_codeowners_index.py::ProjectCodeOwnersEndpointTestCase::test_schema_preserves_commentslog
tests/sentry/issues/endpoints/test_project_codeowners_index.py:428: in test_schema_preserves_comments
    assert project_codeowners.schema == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': '164', 'identifier': 'admin@sentry.io', 'type': 'user'}, {'id': '4557781869395968', 'identifier': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': 164, 'identifier': 'admin@sentry.io', 'type': 'user'}, {'id': 4557781869395968, 'identifier': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': 'docs/*',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 164,
E     +                     'id': '164',
E     ?                           +   +
E                           'identifier': 'admin@sentry.io',
E                           'type': 'user',
E                       },
E                       {
E     -                     'id': 4557781869395968,
E     +                     'id': '4557781869395968',
E     ?                           +                +
E                           'identifier': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_ownership.py::ProjectOwnershipEndpointTestCase::test_getlog
tests/sentry/issues/endpoints/test_project_ownership.py:183: in test_get
    assert resp.data["schema"] == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': '*.js', 'type': 'path'}, 'owners': [{'id': '185', 'name': 'admin@localhost', 'type': 'user'}, {'id': '4557781869854720', 'name': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': '*.js', 'type': 'path'}, 'owners': [{'id': 185, 'name': 'admin@localhost', 'type': 'user'}, {'id': 4557781869854720, 'name': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': '*.js',
E                       'type': 'path',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 185,
E     +                     'id': '185',
E     ?                           +   +
E                           'name': 'admin@localhost',
E                           'type': 'user',
E                       },
E                       {
E     -                     'id': 4557781869854720,
E     +                     'id': '4557781869854720',
E     ?                           +                +
E                           'name': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_ownership.py::ProjectOwnershipEndpointTestCase::test_get_rule_deleted_ownerlog
tests/sentry/issues/endpoints/test_project_ownership.py:256: in test_get_rule_deleted_owner
    assert resp.data["schema"] == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': '*.js', 'type': 'path'}, 'owners': [{'id': '4557781870182400', 'name': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': '*.js', 'type': 'path'}, 'owners': [{'id': 4557781870182400, 'name': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': '*.js',
E                       'type': 'path',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 4557781870182400,
E     +                     'id': '4557781870182400',
E     ?                           +                +
E                           'name': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_codeowners_index.py::ProjectCodeOwnersEndpointTestCase::test_get_codeowners_with_integrationlog
tests/sentry/issues/endpoints/test_project_codeowners_index.py:122: in test_get_codeowners_with_integration
    assert resp_data["schema"] == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': '*.js', 'type': 'codeowners'}, 'owners': [{'id': '4557781868675072', 'name': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': '*.js', 'type': 'codeowners'}, 'owners': [{'id': 4557781868675072, 'name': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': '*.js',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 4557781868675072,
E     +                     'id': '4557781868675072',
E     ?                           +                +
E                           'name': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_codeowners_index.py::ProjectCodeOwnersEndpointTestCase::test_get_multiple_rules_deleted_owners_schema_updates_correctlog
tests/sentry/issues/endpoints/test_project_codeowners_index.py:887: in test_get_multiple_rules_deleted_owners_schema_updates_correct
    assert response.data[0]["schema"] == {
E   AssertionError: assert {'$version': ...': 'user'}]}]} == {'$version': ...': 'user'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': '*.py', 'type': 'codeowners'}, 'owners': [{'id': '4557781869068288', 'name': 'tiger...er': {'pattern': '*.rb', 'type': 'codeowners'}, 'owners': [{'id': '130', 'name': 'admin@sentry.io', 'type': 'user'}]}]} != {'rules': [{'matcher': {'pattern': '*.py', 'type': 'codeowners'}, 'owners': [{'id': 4557781869068288, 'name': 'tiger-t...cher': {'pattern': '*.rb', 'type': 'codeowners'}, 'owners': [{'id': 130, 'name': 'admin@sentry.io', 'type': 'user'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': '*.py',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 4557781869068288,
E     +                     'id': '4557781869068288',
E     ?                           +                +
E                           'name': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E               {
E                   'matcher': {
E                       'pattern': '*.rb',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 130,
E     +                     'id': '130',
E     ?                           +   +
E                           'name': 'admin@sentry.io',
E                           'type': 'user',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_codeowners_index.py::ProjectCodeOwnersEndpointTestCase::test_get_one_external_user_deletion_schema_updates_correctlog
tests/sentry/issues/endpoints/test_project_codeowners_index.py:667: in test_get_one_external_user_deletion_schema_updates_correct
    assert response.data[0]["schema"] == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': '4557781869330432', 'name': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': 4557781869330432, 'name': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': 'docs/*',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 4557781869330432,
E     +                     'id': '4557781869330432',
E     ?                           +                +
E                           'name': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_codeowners_index.py::ProjectCodeOwnersEndpointTestCase::test_get_one_external_user_deletion_schema_updates_triggeredlog
tests/sentry/issues/endpoints/test_project_codeowners_index.py:626: in test_get_one_external_user_deletion_schema_updates_triggered
    assert response.data[0]["schema"] == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': '156', 'name': 'member_delete@localhost', 'type': 'user'}, {'id': '4557781869658112', 'name': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': 156, 'name': 'member_delete@localhost', 'type': 'user'}, {'id': 4557781869658112, 'name': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': 'docs/*',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 156,
E     +                     'id': '156',
E     ?                           +   +
E                           'name': 'member_delete@localhost',
E                           'type': 'user',
E                       },
E                       {
E     -                     'id': 4557781869658112,
E     +                     'id': '4557781869658112',
E     ?                           +                +
E                           'name': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_codeowners_index.py::ProjectCodeOwnersEndpointTestCase::test_raw_email_correct_schemalog
tests/sentry/issues/endpoints/test_project_codeowners_index.py:452: in test_raw_email_correct_schema
    assert project_codeowners.schema == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': '165', 'identifier': 'admin@sentry.io', 'type': 'user'}, {'id': '4557781869920256', 'identifier': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': 165, 'identifier': 'admin@sentry.io', 'type': 'user'}, {'id': 4557781869920256, 'identifier': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': 'docs/*',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 165,
E     +                     'id': '165',
E     ?                           +   +
E                           'identifier': 'admin@sentry.io',
E                           'type': 'user',
E                       },
E                       {
E     -                     'id': 4557781869920256,
E     +                     'id': '4557781869920256',
E     ?                           +                +
E                           'identifier': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_codeowners_index.py::ProjectCodeOwnersEndpointTestCase::test_schema_is_correctlog
tests/sentry/issues/endpoints/test_project_codeowners_index.py:339: in test_schema_is_correct
    assert project_codeowners.schema == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': '171', 'identifier': 'admin@sentry.io', 'type': 'user'}, {'id': '4557781870182400', 'identifier': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': 171, 'identifier': 'admin@sentry.io', 'type': 'user'}, {'id': 4557781870182400, 'identifier': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': 'docs/*',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 171,
E     +                     'id': '171',
E     ?                           +   +
E                           'identifier': 'admin@sentry.io',
E                           'type': 'user',
E                       },
E                       {
E     -                     'id': 4557781870182400,
E     +                     'id': '4557781870182400',
E     ?                           +                +
E                           'identifier': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_ownership.py::ProjectOwnershipEndpointTestCase::test_get_multiple_rules_deleted_ownerslog
tests/sentry/issues/endpoints/test_project_ownership.py:309: in test_get_multiple_rules_deleted_owners
    assert resp.data["schema"] == {
E   AssertionError: assert {'$version': ...': 'user'}]}]} == {'$version': ...': 'user'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': '*.py', 'type': 'path'}, 'owners': [{'id': '4557781870641152', 'name': 'tiger-team'...matcher': {'pattern': '*.rb', 'type': 'path'}, 'owners': [{'id': '198', 'name': 'member@localhost', 'type': 'user'}]}]} != {'rules': [{'matcher': {'pattern': '*.py', 'type': 'path'}, 'owners': [{'id': 4557781870641152, 'name': 'tiger-team', ...{'matcher': {'pattern': '*.rb', 'type': 'path'}, 'owners': [{'id': 198, 'name': 'member@localhost', 'type': 'user'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': '*.py',
E                       'type': 'path',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 4557781870641152,
E     +                     'id': '4557781870641152',
E     ?                           +                +
E                           'name': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E               {
E                   'matcher': {
E                       'pattern': '*.rb',
E                       'type': 'path',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 198,
E     +                     'id': '198',
E     ?                           +   +
E                           'name': 'member@localhost',
E                           'type': 'user',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_ownership.py::ProjectOwnershipEndpointTestCase::test_update_schemalog
tests/sentry/issues/endpoints/test_project_ownership.py:166: in test_update_schema
    assert resp.data["schema"] == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': '*.js', 'type': 'path'}, 'owners': [{'id': '225', 'identifier': 'admin@localhost', 'type': 'user'}, {'id': '4557781871230976', 'identifier': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': '*.js', 'type': 'path'}, 'owners': [{'id': 225, 'identifier': 'admin@localhost', 'type': 'user'}, {'id': 4557781871230976, 'identifier': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': '*.js',
E                       'type': 'path',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 225,
E     +                     'id': '225',
E     ?                           +   +
E                           'identifier': 'admin@localhost',
E                           'type': 'user',
E                       },
E                       {
E     -                     'id': 4557781871230976,
E     +                     'id': '4557781871230976',
E     ?                           +                +
E                           'identifier': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/tasks/test_code_owners.py::CodeOwnersTest::test_codeowners_auto_sync_successfullog
tests/sentry/tasks/test_code_owners.py:117: in test_codeowners_auto_sync_successful
    assert code_owners.schema == {
E   AssertionError: assert {'$version': ...': 'user'}]}]} == {'$version': ...': 'user'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': '428', 'identifier': 'admin@loca...: {'pattern': '*', 'type': 'codeowners'}, 'owners': [{'id': '428', 'identifier': 'admin@localhost', 'type': 'user'}]}]} != {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': 428, 'identifier': 'admin@localh...r': {'pattern': '*', 'type': 'codeowners'}, 'owners': [{'id': 428, 'identifier': 'admin@localhost', 'type': 'user'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': 'docs/*',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 428,
E     +                     'id': '428',
E     ?                           +   +
E                           'identifier': 'admin@localhost',
E                           'type': 'user',
E                       },
E                       {
E     -                     'id': 4557781875949568,
E     +                     'id': '4557781875949568',
E     ?                           +                +
E                           'identifier': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E               {
E                   'matcher': {
E                       'pattern': '*',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 428,
E     +                     'id': '428',
E     ?                           +   +
E                           'identifier': 'admin@localhost',
E                           'type': 'user',
E                       },
E                   ],
E               },
E           ],
... (1 more lines)
tests/sentry/tasks/test_code_owners.py::CodeOwnersTest::test_simplelog
tests/sentry/tasks/test_code_owners.py:66: in test_simple
    assert code_owners.schema == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': '4557781876211712', 'identifier': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': 4557781876211712, 'identifier': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': 'docs/*',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 4557781876211712,
E     +                     'id': '4557781876211712',
E     ?                           +                +
E                           'identifier': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }

Update test assertions to expect string IDs instead of numeric IDs in
schema responses. This aligns with the fix that serializes owner IDs as
strings to match the frontend Actor type contract.

Co-authored-by: David Cramer <dcramer@users.noreply.github.com>
@github-actions
Copy link
Contributor

github-actions bot commented Mar 12, 2026

Backend Test Failures

Failures on 4ac88e8 in this run:

tests/sentry/issues/endpoints/test_project_codeowners_index.py::ProjectCodeOwnersEndpointTestCase::test_getlog
tests/sentry/issues/endpoints/test_project_codeowners_index.py:587: in test_get
    assert ownership.schema["rules"] == [
E   AssertionError: assert [{'matcher': ...e': 'team'}]}] == [{'matcher': ...e': 'team'}]}]
E     
E     At index 0 diff: {'matcher': {'type': 'codeowners', 'pattern': 'docs/*'}, 'owners': [{'type': 'user', 'identifier': 'admin@sentry.io', 'id': '105'}, {'type': 'team', 'identifier': 'tiger-team', 'id': '4557781928706048'}]} != {'matcher': {'type': 'codeowners', 'pattern': 'docs/*'}, 'owners': [{'type': 'user', 'identifier': 'admin@sentry.io', 'id': 105}, {'type': 'team', 'identifier': 'tiger-team', 'id': 4557781928706048}]}
E     
E     Full diff:
E       [
E           {
E               'matcher': {
E                   'pattern': 'docs/*',
E                   'type': 'codeowners',
E               },
E               'owners': [
E                   {
E     -                 'id': 105,
E     +                 'id': '105',
E     ?                       +   +
E                       'identifier': 'admin@sentry.io',
E                       'type': 'user',
E                   },
E                   {
E     -                 'id': 4557781928706048,
E     +                 'id': '4557781928706048',
E     ?                       +                +
E                       'identifier': 'tiger-team',
E                       'type': 'team',
E                   },
E               ],
E           },
E       ]
tests/sentry/issues/endpoints/test_project_codeowners_index.py::ProjectCodeOwnersEndpointTestCase::test_post_with_schemalog
tests/sentry/issues/endpoints/test_project_codeowners_index.py:542: in test_post_with_schema
    assert response.data["schema"] == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': '123', 'identifier': 'admin@sentry.io', 'type': 'user'}, {'id': '4557781929230336', 'identifier': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': 123, 'identifier': 'admin@sentry.io', 'type': 'user'}, {'id': 4557781929230336, 'identifier': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': 'docs/*',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 123,
E     +                     'id': '123',
E     ?                           +   +
E                           'identifier': 'admin@sentry.io',
E                           'type': 'user',
E                       },
E                       {
E     -                     'id': 4557781929230336,
E     +                     'id': '4557781929230336',
E     ?                           +                +
E                           'identifier': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_codeowners_index.py::ProjectCodeOwnersEndpointTestCase::test_schema_preserves_commentslog
tests/sentry/issues/endpoints/test_project_codeowners_index.py:428: in test_schema_preserves_comments
    assert project_codeowners.schema == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': '129', 'identifier': 'admin@sentry.io', 'type': 'user'}, {'id': '4557781929492480', 'identifier': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': 129, 'identifier': 'admin@sentry.io', 'type': 'user'}, {'id': 4557781929492480, 'identifier': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': 'docs/*',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 129,
E     +                     'id': '129',
E     ?                           +   +
E                           'identifier': 'admin@sentry.io',
E                           'type': 'user',
E                       },
E                       {
E     -                     'id': 4557781929492480,
E     +                     'id': '4557781929492480',
E     ?                           +                +
E                           'identifier': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_ownership.py::ProjectOwnershipEndpointTestCase::test_getlog
tests/sentry/issues/endpoints/test_project_ownership.py:183: in test_get
    assert resp.data["schema"] == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': '*.js', 'type': 'path'}, 'owners': [{'id': '150', 'name': 'admin@localhost', 'type': 'user'}, {'id': '4557781929885696', 'name': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': '*.js', 'type': 'path'}, 'owners': [{'id': 150, 'name': 'admin@localhost', 'type': 'user'}, {'id': 4557781929885696, 'name': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': '*.js',
E                       'type': 'path',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 150,
E     +                     'id': '150',
E     ?                           +   +
E                           'name': 'admin@localhost',
E                           'type': 'user',
E                       },
E                       {
E     -                     'id': 4557781929885696,
E     +                     'id': '4557781929885696',
E     ?                           +                +
E                           'name': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_ownership.py::ProjectOwnershipEndpointTestCase::test_get_rule_deleted_ownerlog
tests/sentry/issues/endpoints/test_project_ownership.py:256: in test_get_rule_deleted_owner
    assert resp.data["schema"] == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': '*.js', 'type': 'path'}, 'owners': [{'id': '4557781930213376', 'name': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': '*.js', 'type': 'path'}, 'owners': [{'id': 4557781930213376, 'name': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': '*.js',
E                       'type': 'path',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 4557781930213376,
E     +                     'id': '4557781930213376',
E     ?                           +                +
E                           'name': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_codeowners_index.py::ProjectCodeOwnersEndpointTestCase::test_raw_email_correct_schemalog
tests/sentry/issues/endpoints/test_project_codeowners_index.py:452: in test_raw_email_correct_schema
    assert project_codeowners.schema == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': '125', 'identifier': 'admin@sentry.io', 'type': 'user'}, {'id': '4557781931589632', 'identifier': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': 125, 'identifier': 'admin@sentry.io', 'type': 'user'}, {'id': 4557781931589632, 'identifier': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': 'docs/*',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 125,
E     +                     'id': '125',
E     ?                           +   +
E                           'identifier': 'admin@sentry.io',
E                           'type': 'user',
E                       },
E                       {
E     -                     'id': 4557781931589632,
E     +                     'id': '4557781931589632',
E     ?                           +                +
E                           'identifier': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_codeowners_index.py::ProjectCodeOwnersEndpointTestCase::test_schema_is_correctlog
tests/sentry/issues/endpoints/test_project_codeowners_index.py:339: in test_schema_is_correct
    assert project_codeowners.schema == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': '131', 'identifier': 'admin@sentry.io', 'type': 'user'}, {'id': '4557781931786240', 'identifier': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': 131, 'identifier': 'admin@sentry.io', 'type': 'user'}, {'id': 4557781931786240, 'identifier': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': 'docs/*',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 131,
E     +                     'id': '131',
E     ?                           +   +
E                           'identifier': 'admin@sentry.io',
E                           'type': 'user',
E                       },
E                       {
E     -                     'id': 4557781931786240,
E     +                     'id': '4557781931786240',
E     ?                           +                +
E                           'identifier': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_ownership.py::ProjectOwnershipEndpointTestCase::test_get_multiple_rules_deleted_ownerslog
tests/sentry/issues/endpoints/test_project_ownership.py:309: in test_get_multiple_rules_deleted_owners
    assert resp.data["schema"] == {
E   AssertionError: assert {'$version': ...': 'user'}]}]} == {'$version': ...': 'user'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': '*.py', 'type': 'path'}, 'owners': [{'id': '4557781932376064', 'name': 'tiger-team'...matcher': {'pattern': '*.rb', 'type': 'path'}, 'owners': [{'id': '158', 'name': 'member@localhost', 'type': 'user'}]}]} != {'rules': [{'matcher': {'pattern': '*.py', 'type': 'path'}, 'owners': [{'id': 4557781932376064, 'name': 'tiger-team', ...{'matcher': {'pattern': '*.rb', 'type': 'path'}, 'owners': [{'id': 158, 'name': 'member@localhost', 'type': 'user'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': '*.py',
E                       'type': 'path',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 4557781932376064,
E     +                     'id': '4557781932376064',
E     ?                           +                +
E                           'name': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E               {
E                   'matcher': {
E                       'pattern': '*.rb',
E                       'type': 'path',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 158,
E     +                     'id': '158',
E     ?                           +   +
E                           'name': 'member@localhost',
E                           'type': 'user',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_ownership.py::ProjectOwnershipEndpointTestCase::test_update_schemalog
tests/sentry/issues/endpoints/test_project_ownership.py:166: in test_update_schema
    assert resp.data["schema"] == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': '*.js', 'type': 'path'}, 'owners': [{'id': '185', 'identifier': 'admin@localhost', 'type': 'user'}, {'id': '4557781932900352', 'identifier': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': '*.js', 'type': 'path'}, 'owners': [{'id': 185, 'identifier': 'admin@localhost', 'type': 'user'}, {'id': 4557781932900352, 'identifier': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': '*.js',
E                       'type': 'path',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 185,
E     +                     'id': '185',
E     ?                           +   +
E                           'identifier': 'admin@localhost',
E                           'type': 'user',
E                       },
E                       {
E     -                     'id': 4557781932900352,
E     +                     'id': '4557781932900352',
E     ?                           +                +
E                           'identifier': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/tasks/test_code_owners.py::CodeOwnersTest::test_codeowners_auto_sync_successfullog
tests/sentry/tasks/test_code_owners.py:117: in test_codeowners_auto_sync_successful
    assert code_owners.schema == {
E   AssertionError: assert {'$version': ...': 'user'}]}]} == {'$version': ...': 'user'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': '388', 'identifier': 'admin@loca...: {'pattern': '*', 'type': 'codeowners'}, 'owners': [{'id': '388', 'identifier': 'admin@localhost', 'type': 'user'}]}]} != {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': 388, 'identifier': 'admin@localh...r': {'pattern': '*', 'type': 'codeowners'}, 'owners': [{'id': 388, 'identifier': 'admin@localhost', 'type': 'user'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': 'docs/*',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 388,
E     +                     'id': '388',
E     ?                           +   +
E                           'identifier': 'admin@localhost',
E                           'type': 'user',
E                       },
E                       {
E     -                     'id': 4557781938208768,
E     +                     'id': '4557781938208768',
E     ?                           +                +
E                           'identifier': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E               {
E                   'matcher': {
E                       'pattern': '*',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 388,
E     +                     'id': '388',
E     ?                           +   +
E                           'identifier': 'admin@localhost',
E                           'type': 'user',
E                       },
E                   ],
E               },
E           ],
... (1 more lines)
tests/sentry/tasks/test_code_owners.py::CodeOwnersTest::test_simplelog
tests/sentry/tasks/test_code_owners.py:66: in test_simple
    assert code_owners.schema == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': '4557781938405376', 'identifier': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': 4557781938405376, 'identifier': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': 'docs/*',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 4557781938405376,
E     +                     'id': '4557781938405376',
E     ?                           +                +
E                           'identifier': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }

Fix remaining test assertions that check the stored database schema
(with 'identifier' field) to expect string IDs instead of numeric IDs.
This includes test_schema_is_correct, test_schema_preserves_comments,
test_raw_email_correct_schema, test_post_with_schema, and test_get.

Co-authored-by: David Cramer <dcramer@users.noreply.github.com>
@github-actions
Copy link
Contributor

github-actions bot commented Mar 12, 2026

Backend Test Failures

Failures on 1e2e9e9 in this run:

tests/sentry/issues/endpoints/test_project_ownership.py::ProjectOwnershipEndpointTestCase::test_get_multiple_rules_deleted_ownerslog
tests/sentry/issues/endpoints/test_project_ownership.py:309: in test_get_multiple_rules_deleted_owners
    assert resp.data["schema"] == {
E   AssertionError: assert {'$version': ...': 'user'}]}]} == {'$version': ...': 'user'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': '*.py', 'type': 'path'}, 'owners': [{'id': '4557781987229696', 'name': 'tiger-team'...matcher': {'pattern': '*.rb', 'type': 'path'}, 'owners': [{'id': '148', 'name': 'member@localhost', 'type': 'user'}]}]} != {'rules': [{'matcher': {'pattern': '*.py', 'type': 'path'}, 'owners': [{'id': 4557781987229696, 'name': 'tiger-team', ...{'matcher': {'pattern': '*.rb', 'type': 'path'}, 'owners': [{'id': 148, 'name': 'member@localhost', 'type': 'user'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': '*.py',
E                       'type': 'path',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 4557781987229696,
E     +                     'id': '4557781987229696',
E     ?                           +                +
E                           'name': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E               {
E                   'matcher': {
E                       'pattern': '*.rb',
E                       'type': 'path',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 148,
E     +                     'id': '148',
E     ?                           +   +
E                           'name': 'member@localhost',
E                           'type': 'user',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_ownership.py::ProjectOwnershipEndpointTestCase::test_update_schemalog
tests/sentry/issues/endpoints/test_project_ownership.py:166: in test_update_schema
    assert resp.data["schema"] == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': '*.js', 'type': 'path'}, 'owners': [{'id': '175', 'identifier': 'admin@localhost', 'type': 'user'}, {'id': '4557781987688448', 'identifier': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': '*.js', 'type': 'path'}, 'owners': [{'id': 175, 'identifier': 'admin@localhost', 'type': 'user'}, {'id': 4557781987688448, 'identifier': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': '*.js',
E                       'type': 'path',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 175,
E     +                     'id': '175',
E     ?                           +   +
E                           'identifier': 'admin@localhost',
E                           'type': 'user',
E                       },
E                       {
E     -                     'id': 4557781987688448,
E     +                     'id': '4557781987688448',
E     ?                           +                +
E                           'identifier': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/tasks/test_code_owners.py::CodeOwnersTest::test_codeowners_auto_sync_successfullog
tests/sentry/tasks/test_code_owners.py:117: in test_codeowners_auto_sync_successful
    assert code_owners.schema == {
E   AssertionError: assert {'$version': ...': 'user'}]}]} == {'$version': ...': 'user'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': '378', 'identifier': 'admin@loca...: {'pattern': '*', 'type': 'codeowners'}, 'owners': [{'id': '378', 'identifier': 'admin@localhost', 'type': 'user'}]}]} != {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': 378, 'identifier': 'admin@localh...r': {'pattern': '*', 'type': 'codeowners'}, 'owners': [{'id': 378, 'identifier': 'admin@localhost', 'type': 'user'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': 'docs/*',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 378,
E     +                     'id': '378',
E     ?                           +   +
E                           'identifier': 'admin@localhost',
E                           'type': 'user',
E                       },
E                       {
E     -                     'id': 4557781992538112,
E     +                     'id': '4557781992538112',
E     ?                           +                +
E                           'identifier': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E               {
E                   'matcher': {
E                       'pattern': '*',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 378,
E     +                     'id': '378',
E     ?                           +   +
E                           'identifier': 'admin@localhost',
E                           'type': 'user',
E                       },
E                   ],
E               },
E           ],
... (1 more lines)
tests/sentry/tasks/test_code_owners.py::CodeOwnersTest::test_simplelog
tests/sentry/tasks/test_code_owners.py:66: in test_simple
    assert code_owners.schema == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': '4557781992734720', 'identifier': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': 'docs/*', 'type': 'codeowners'}, 'owners': [{'id': 4557781992734720, 'identifier': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': 'docs/*',
E                       'type': 'codeowners',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 4557781992734720,
E     +                     'id': '4557781992734720',
E     ?                           +                +
E                           'identifier': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_ownership.py::ProjectOwnershipEndpointTestCase::test_getlog
tests/sentry/issues/endpoints/test_project_ownership.py:183: in test_get
    assert resp.data["schema"] == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': '*.js', 'type': 'path'}, 'owners': [{'id': '135', 'name': 'admin@localhost', 'type': 'user'}, {'id': '4557781988933632', 'name': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': '*.js', 'type': 'path'}, 'owners': [{'id': 135, 'name': 'admin@localhost', 'type': 'user'}, {'id': 4557781988933632, 'name': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': '*.js',
E                       'type': 'path',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 135,
E     +                     'id': '135',
E     ?                           +   +
E                           'name': 'admin@localhost',
E                           'type': 'user',
E                       },
E                       {
E     -                     'id': 4557781988933632,
E     +                     'id': '4557781988933632',
E     ?                           +                +
E                           'name': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }
tests/sentry/issues/endpoints/test_project_ownership.py::ProjectOwnershipEndpointTestCase::test_get_rule_deleted_ownerlog
tests/sentry/issues/endpoints/test_project_ownership.py:256: in test_get_rule_deleted_owner
    assert resp.data["schema"] == {
E   AssertionError: assert {'$version': ...': 'team'}]}]} == {'$version': ...': 'team'}]}]}
E     
E     Omitting 1 identical items, use -vv to show
E     Differing items:
E     {'rules': [{'matcher': {'pattern': '*.js', 'type': 'path'}, 'owners': [{'id': '4557781989261312', 'name': 'tiger-team', 'type': 'team'}]}]} != {'rules': [{'matcher': {'pattern': '*.js', 'type': 'path'}, 'owners': [{'id': 4557781989261312, 'name': 'tiger-team', 'type': 'team'}]}]}
E     
E     Full diff:
E       {
E           '$version': 1,
E           'rules': [
E               {
E                   'matcher': {
E                       'pattern': '*.js',
E                       'type': 'path',
E                   },
E                   'owners': [
E                       {
E     -                     'id': 4557781989261312,
E     +                     'id': '4557781989261312',
E     ?                           +                +
E                           'name': 'tiger-team',
E                           'type': 'team',
E                       },
E                   ],
E               },
E           ],
E       }

@dcramer
Copy link
Member Author

dcramer commented Mar 12, 2026

gonna close this it was mostly trying to see if cursor would do ok

@dcramer dcramer closed this Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ownership rules widget crashes when name is numeric (team_id)

2 participants