Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 29, 2025

Fix invalid sourcemap tokens when oxc_codegen adds punctuation beyond source bounds

@graphite-app
Copy link
Contributor

graphite-app bot commented Oct 29, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

Copilot AI changed the title [WIP] Fix problem with last commit in pull request Fix invalid sourcemap tokens for positions beyond source bounds Oct 29, 2025
Copilot AI requested a review from sapphi-red October 29, 2025 17:54
Copilot finished work on behalf of sapphi-red October 29, 2025 17:54
Copilot AI requested a review from sapphi-red October 29, 2025 18:19
Copilot finished work on behalf of sapphi-red October 29, 2025 18:19
@github-actions github-actions bot added the A-codegen Area - Code Generation label Oct 29, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Oct 29, 2025

CodSpeed Performance Report

Merging #15069 will not alter performance

Comparing copilot/fix-commits-issue (ff3ecaf) with main (3a1cdd0)

Summary

✅ 37 untouched

@sapphi-red sapphi-red changed the title Fix invalid sourcemap tokens for positions beyond source bounds fix(codegen): avoid invalid sourcemap tokens for positions beyond source bounds Oct 29, 2025
@sapphi-red
Copy link
Member

@copilot fix lint error

Copy link
Contributor Author

Copilot AI commented Oct 29, 2025

@copilot fix lint error

Fixed in 2a121f0. Collapsed nested if statements, used inline format args, and replaced redundant closure with method reference.

Copilot finished work on behalf of sapphi-red October 29, 2025 18:46
Copilot AI requested a review from sapphi-red October 30, 2025 02:24
Copilot finished work on behalf of sapphi-red October 30, 2025 02:24
@sapphi-red sapphi-red assigned Boshen and unassigned sapphi-red Oct 30, 2025
@sapphi-red sapphi-red requested a review from Boshen October 30, 2025 02:41
@sapphi-red sapphi-red marked this pull request as ready for review October 30, 2025 02:41
Copilot AI review requested due to automatic review settings October 30, 2025 02:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an issue where oxc_codegen generates invalid sourcemap tokens for positions beyond the original source content. When the codegen adds semicolons or newlines that don't exist in the original source, it was creating sourcemap mappings with out-of-bounds positions.

  • Added bounds validation in add_source_mapping_end() to skip creating sourcemap tokens when span.end is beyond the source text length
  • Added comprehensive test case validating that all sourcemap tokens have valid source positions

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
crates/oxc_codegen/src/lib.rs Added bounds check in add_source_mapping_end to prevent invalid sourcemap tokens for positions beyond source content
crates/oxc_codegen/tests/integration/sourcemap.rs Added test no_invalid_tokens_beyond_source to verify sourcemap tokens are within source bounds

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Oct 30, 2025
Copy link
Member

Boshen commented Oct 30, 2025

Merge activity

…rce bounds (#15069)

Fix invalid sourcemap tokens when oxc_codegen adds punctuation beyond source bounds
@graphite-app graphite-app bot force-pushed the copilot/fix-commits-issue branch from ff3ecaf to 3fbb307 Compare October 30, 2025 02:50
@graphite-app graphite-app bot merged commit 3fbb307 into main Oct 30, 2025
20 checks passed
@graphite-app graphite-app bot deleted the copilot/fix-commits-issue branch October 30, 2025 02:56
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-codegen Area - Code Generation C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants