Skip to content

Fix accuracy of compare/diff view in merged and similar issues tabs #73393

@lobsterkatie

Description

@lobsterkatie

On both the Merged Issues and Similar Issues tab, you can compare stacktraces in a diff-like view. (On the merged issues tab, choose two entries and click 'Compare', and on the similar issues tab, click 'Diff.')

The problem is, our diffing algorithm isn't very smart, and therefore identifies differences it shouldn't. (Note that I haven't seen any examples of the opposite, and from my guess about what the problem is, I'd wager it doesn't happen.)

For example, if you look at the similar issues tab for this issue, you will see that it's listed as being similar to this issue. (The stacktraces are included at the bottom of this issue for reference.) Opening up the diff view gives you this:

Image

However, plugging the same stacktraces into an online diff tool gives the following:

Image

Now, different tools do give slightly different results - below are Fork and VSCode's diffs, respectively - but compared to all three of the others, we're highlighting way more that's "different" than we should be, giving a false impression of the overall similarity of the stacktraces.

Image

Image

For reference, here are the two stacktraces:

Lefthand Stacktrace
HTTPError: 400 Client Error: Bad Request for url: http://sentry-rpc-prod-control.us.sentry.internal:8999/api/0/internal/integration-proxy/
  File "sentry/shared_integrations/client/base.py", line 246, in _request
    resp.raise_for_status()

ApiError: null
  File "sentry/integrations/mixins/repositories.py", line 58, in check_file
    response = client.check_file(repo, filepath, branch)
  File "sentry/integrations/github/client.py", line 617, in check_file
    return self.head_cached(path=f"/repos/{repo.name}/contents/{path}", params={"ref": version})
  File "sentry/shared_integrations/client/base.py", line 358, in head_cached
    return self._get_cached(path, "HEAD", *args, **kwargs)
  File "sentry/shared_integrations/client/base.py", line 335, in _get_cached
    result = self.request(method, path, *args, **kwargs)
  File "sentry/shared_integrations/client/base.py", line 309, in request
    return self._request(*args, **kwargs)
  File "sentry/shared_integrations/client/base.py", line 274, in _request
    raise ApiError.from_response(error_resp, url=full_url) from e
Righthand Stacktrace
HTTPError: 403 Client Error: Forbidden for url: http://sentry-rpc-prod-control.us.sentry.internal:8999/api/0/internal/integration-proxy/
  File "sentry/shared_integrations/client/base.py", line 246, in _request
    resp.raise_for_status()

ApiError: null
  File "sentry/integrations/mixins/repositories.py", line 58, in check_file
    response = client.check_file(repo, filepath, branch)
  File "sentry/integrations/gitlab/client.py", line 322, in check_file
    return self.head_cached(request_path, params={"ref": ref})
  File "sentry/shared_integrations/client/base.py", line 358, in head_cached
    return self._get_cached(path, "HEAD", *args, **kwargs)
  File "sentry/shared_integrations/client/base.py", line 335, in _get_cached
    result = self.request(method, path, *args, **kwargs)
  File "sentry/integrations/gitlab/client.py", line 121, in request
    return super().request(*args, **kwargs)
  File "sentry/shared_integrations/client/base.py", line 309, in request
    return self._request(*args, **kwargs)
  File "sentry/shared_integrations/client/base.py", line 274, in _request
    raise ApiError.from_response(error_resp, url=full_url) from e

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions