Skip to content

Conversation

@kdy1
Copy link
Member

@kdy1 kdy1 commented Dec 4, 2025

No description provided.

loewenheim and others added 7 commits June 30, 2025 08:57
…etsentry#134)

The debug ID field on all source maps is now **serialized as `debugId` rather than `debug_id`**.

To maintain backwards-compatibility with source maps that contain a `debug_id` field, we can still read the `debug_id` field. If a source map contains a `debugId` field and a `debug_id` field, **the `debugId` field takes precedence, which is a change from the old behavior**. 

Corresponding Sentry CLI PR: getsentry/sentry-cli#3005

Closes getsentry#96 
Closes [CLI-240](https://linear.app/getsentry/issue/CLI-240/turn-debug-id-field-to-debugid)
Integrate changes from upstream getsentry/rust-sourcemap v9.3.0 release:
- Update CHANGELOG.md with upstream changes
- Merge improvements to decoder, encoder, and type definitions
- Update test suite with upstream enhancements

Conflicts resolved by keeping swc-project fork modifications:
- Cargo.toml: Maintain package name as 'swc_sourcemap' and current version
- src/sourceview.rs: Keep BytesStr-based implementation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Copilot AI review requested due to automatic review settings December 4, 2025 10:52
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 5 committers have signed the CLA.

✅ kdy1
❌ loewenheim
❌ szokeasaurusrex
❌ coolreader18
❌ getsentry-bot
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot finished reviewing on behalf of kdy1 December 4, 2025 10:54
Copy link

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 merges upstream changes that standardize the serialization of debug IDs in source maps. The main change involves serializing the debugId field using camelCase instead of snake_case (debug_id) while maintaining backward compatibility for deserialization.

Key changes:

  • Introduced a new DebugIdField struct with custom deserialization logic that accepts both debugId and debug_id (with camelCase taking precedence), but always serializes as debugId
  • Simplified encoder and decoder implementations by consolidating debug ID handling into the new field type
  • Added comprehensive tests to verify camelCase serialization for both SourceMap and SourceMapIndex

Reviewed changes

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

Show a summary per file
File Description
src/jsontypes.rs Implements new DebugIdField struct with custom serde logic for backward-compatible deserialization and standardized camelCase serialization
src/encoder.rs Updates SourceMap and SourceMapIndex encoders to use the new DebugIdField type, simplifying the code
src/decoder.rs Simplifies debug ID extraction logic by using the new DebugIdField's Into conversion, and removes redundant test case
src/types.rs Adjusts test data to swap order of debug_id and debugId fields to verify camelCase precedence behavior
tests/test_index.rs Adds test ensuring SourceMapIndex serializes debug IDs using camelCase
tests/test_encoder.rs Adds test ensuring SourceMap serializes debug IDs using camelCase
cli/Cargo.toml Bumps version to 9.3.0
CHANGELOG.md Documents the new feature and other changes in version 9.3.0

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


/// This struct represents a `RawSourceMap`'s debug ID fields.
///
/// The reason this exists as a seperate struct is so that we can have custom deserialization
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

Spelling error: "seperate" should be "separate".

Suggested change
/// The reason this exists as a seperate struct is so that we can have custom deserialization
/// The reason this exists as a separate struct is so that we can have custom deserialization

Copilot uses AI. Check for mistakes.
/// This struct represents a `RawSourceMap`'s debug ID fields.
///
/// The reason this exists as a seperate struct is so that we can have custom deserialization
/// logic, which can read both the legacy snake_case debug_id and the new camelCase debugId
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

Extra whitespace: There are two spaces between "the" and "legacy" in the comment. Should be: "which can read both the legacy snake_case debug_id".

Suggested change
/// logic, which can read both the legacy snake_case debug_id and the new camelCase debugId
/// logic, which can read both the legacy snake_case debug_id and the new camelCase debugId

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

7 participants