Skip to content

feat(debug files): Use legacy IDs for lookups - #127577

Merged
loewenheim merged 9 commits into
sebastian/correctly-read-wasm-idsfrom
sebastian/query-legacy-ids
Oct 21, 2026
Merged

loewenheim merged 9 commits into
sebastian/correctly-read-wasm-idsfrom
sebastian/query-legacy-ids

Conversation

@loewenheim

Copy link
Copy Markdown
Contributor

This uses the wasm_legacy_code_id and wasm_legacy_debug_id fields, which we started writing in #127557, for debug file lookups.

This works by making three comparisons instead of one, both for code and debug IDs. Taking debug IDs as the example:

  1. compare the request debug ID to the stored debug ID (this is how it works right now)
  2. compare the request debug ID to the stored wasm_legacy_debug_id
  3. compare the legacy debug ID computed from the request to the stored debug ID

(1) covers the cases where the request and the stored file agree on the debug ID. (2) takes care of the case where the file was uploaded with a correct debug ID, but the request still has the legacy one. (3) handles the converse case, where the file was uploaded with a legacy ID but the request has the correct one. For this case, it's essential that the legacy debug ID can be computed from the correct one.

Implements INGEST-1293.

@loewenheim
loewenheim added this pull request to stack #127578 October 15, 2026 18:01
@loewenheim
loewenheim requested a review from a team as a code owner October 15, 2026 18:01
@linear-code

linear-code Bot commented Oct 15, 2026

Copy link
Copy Markdown

INGEST-1293

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 15, 2026

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread src/sentry/api/endpoints/debug_files.py Resolved
Comment thread src/sentry/api/endpoints/debug_files.py Resolved
Comment thread src/sentry/api/endpoints/debug_files.py Outdated
`wasm_legacy_code_id`, and the "legacy" code ID is extremely unlikely to be a match for
any file that never suffered from the WASM build ID bug.
"""
query = Q(code_id__exact=code_id) | Q(wasm_legacy_code_id__exact=code_id)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per discussion on Slack and testing in Redash, queries like this won't make good use of the index.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now replaced with returning the queries individually from this function and constructing separate querysets later.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread src/sentry/api/endpoints/debug_files.py Resolved
Comment thread src/sentry/api/endpoints/debug_files.py Resolved
This uses the `wasm_legacy_code_id` and `wasm_legacy_debug_id` fields,
which we started writing in #127557, for debug file lookups.

This works by making three comparisons instead of one, both for code and
debug IDs. Taking debug IDs as the example:

1. compare the request debug ID to the stored debug ID (this is how it
   works right now)
2. compare the request debug ID to the stored `wasm_legacy_debug_id`
3. compare the legacy debug ID computed from the request to the stored
   debug ID

(1) covers the cases where the request and the stored file agree on the
debug ID. (2) takes care of the case where the file was uploaded with
a correct debug ID, but the request still has the legacy one. (3) handles
the converse case, where the file was uploaded with a legacy ID but the
request has the correct one. For this case, it's essential that the
legacy debug ID can be computed from the correct one.

Implements INGEST-1293.
@loewenheim
loewenheim force-pushed the sebastian/query-legacy-ids branch from a833ae1 to ae091a8 Compare October 20, 2026 06:58
@loewenheim
loewenheim requested a review from a team October 20, 2026 07:47
# speed up such queries.
if query and len(query) <= 45 and not debug_id:
try:
debug_id = normalize_debug_id(query.strip())

@vjeranc vjeranc Oct 20, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are query paths that could be influenced by wasm: code_id, debug_id and query, right?
This line attempts to figure out if query is a debug_id, would it also make sense to include new wasm behavior here as well?

Below is prior behavior (not including changes in this PR), with 2nd case being confusing.

  ?code_id=10da03eb5d63d750faab0fb8e7cc12a1c3  → found
  ?query=10da03eb5d63d750faab0fb8e7cc12a1c3    → empty
  ?query=10da03eb5d63                          → found

I think, given new queries try to match multiple id variants, it would make sense to make 2nd case work for debug_id fully matched, or new code_id as well?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify with an example:

query = "10da03eb5d63d750faab0fb8e7cc12a1c3"
# transformed into
debug_id = "10da03eb-5d63-d750-faab-0fb8e7cc12a1-c3"
code_id = "10da03eb5d63d750faab0fb8e7cc12a1c3"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new behavior is implicitly already covered here. If you send a query consisting of just a debug ID, it gets extracted to the debug_id variable and then we continue exactly as if the query had contained debug_id=…. I can adjust the tests I wrote to cover this case as well.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1771da4. Configure here.

@loewenheim
loewenheim merged commit ab5b328 into master Oct 21, 2026
72 of 73 checks passed
@loewenheim
loewenheim deleted the sebastian/query-legacy-ids branch October 21, 2026 07:05
loewenheim added a commit that referenced this pull request Oct 21, 2026
This updates `symbolic` to `14.0.0a4` for
getsentry/symbolic#1093.

The values that are written as the code and debug ID for WASM files are
now correct, but we also reproduce the previous incorrect logic and
write the results into the "legacy" fields introduced in
#127508. We do this so that
symbolication requests coming in with "legacy" IDs can still find their
files.

As such, this PR should only be merged and deployed together with
#127577.

Implements INGEST-1292.
@loewenheim loewenheim added the Trigger: Revert Add to a merged PR to revert it (skips CI) label Oct 21, 2026
@loewenheim
loewenheim deployed to fast-revert October 21, 2026 09:08 — with GitHub Actions Active
@sentry-fast-revert-bot

Copy link
Copy Markdown
Contributor

PR reverted: dad0221

sentry-fast-revert-bot Bot added a commit that referenced this pull request Oct 21, 2026
loewenheim added a commit that referenced this pull request Oct 27, 2026
Second try of #127577, which was
reverted in
dad0221.

This uses the wasm_legacy_code_id and wasm_legacy_debug_id fields, which
we started writing in #127557,
for debug file lookups.

This works by making three comparisons instead of one, both for code and
debug IDs. Taking debug IDs as the example:

compare the request debug ID to the stored debug ID (this is how it
works right now)
    compare the request debug ID to the stored wasm_legacy_debug_id
compare the legacy debug ID computed from the request to the stored
debug ID

(1) covers the cases where the request and the stored file agree on the
debug ID. (2) takes care of the case where the file was uploaded with a
correct debug ID, but the request still has the legacy one. (3) handles
the converse case, where the file was uploaded with a legacy ID but the
request has the correct one. For this case, it's essential that the
legacy debug ID can be computed from the correct one.

Implements INGEST-1293.

This branch was successfully deployed

1 active deployment
fast-revert — ae6aa30f Deployed Oct 21, 2026 by loewenheim via revert #10500
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 Trigger: Revert Add to a merged PR to revert it (skips CI)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants