Skip to content

Conversation

@mateuszJS
Copy link
Owner

@mateuszJS mateuszJS commented Oct 6, 2025

… with Number.MAX_SAFE_INTEGER

Summary by CodeRabbit

  • Refactor
    • Standardized image payload field to texture_id (previously textureId) across input/output serialization and asset updates/resets. This is a breaking change for consumers of serialized data.
  • Bug Fixes
    • Improved gradient fill serialization by replacing Infinity with a safe numeric sentinel to avoid compatibility issues.
  • Tests
    • Updated snapshots to reflect the texture_id field change.

Copilot AI review requested due to automatic review settings October 6, 2025 21:17
@coderabbitai
Copy link

coderabbitai bot commented Oct 6, 2025

Walkthrough

Renames serialized image field textureId to texture_id across public types and internal serialization, updates tests to match, and changes a gradient fill sentinel value from Infinity to Number.MAX_SAFE_INTEGER in SVG shape data processing.

Changes

Cohort / File(s) Summary of changes
Serialized image field rename
src/index.ts
Public types changed: SerializedInputImage.textureId?texture_id?; SerializedOutputImage.textureIdtexture_id. Updated serialization/reset logic to read/write texture_id.
Test snapshot alignment
integration-tests/tests/assets-snapshot.spec.ts
Snapshot updated to expect texture_id instead of textureId in STATE_AFTER_UPLOAD.
Gradient fill sentinel update
src/svgToShapes/collectShapesData.ts
Replaced gradient start distance sentinel from Infinity to Number.MAX_SAFE_INTEGER in serialized sdf_effects for fills.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

released on @next

Poem

A hop and a swap, says the bunny in cheer,
textureId grew an underscore, crystal clear.
Gradients stretch to MAX, not infinity’s sea,
Tests nod in agreement—so tidy, so free.
Thump-thump goes my review, swift as can be. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The title mentions renaming textureId and replacing “9999,” but the trailing ellipsis makes the sentinel replacement unclear and obscures the full intent of the change. Please clarify the title by fully specifying the sentinel replacement (e.g., “replace 9999 sentinel with Number.MAX_SAFE_INTEGER”) and ensure it remains concise while accurately reflecting the main changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch minor-serialization-fixes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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 pull request standardizes naming conventions and improves numeric constant usage by converting camelCase to snake_case for consistency with Zig conventions and replacing magic numbers with more semantically appropriate constants.

  • Changed textureId to texture_id across type definitions and implementations
  • Replaced hardcoded Infinity with Number.MAX_SAFE_INTEGER for better numeric precision

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/index.ts Updated type definitions and property references from textureId to texture_id
src/svgToShapes/collectShapesData.ts Replaced Infinity with Number.MAX_SAFE_INTEGER for distance calculations
integration-tests/tests/assets-snapshot.spec.ts Updated test data to use texture_id instead of textureId

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 95bb499 and b9975bc.

📒 Files selected for processing (3)
  • integration-tests/tests/assets-snapshot.spec.ts (1 hunks)
  • src/index.ts (4 hunks)
  • src/svgToShapes/collectShapesData.ts (1 hunks)
🔇 Additional comments (5)
src/index.ts (4)

15-20: LGTM! Breaking API change for snake_case convention.

The rename from textureId to texture_id aligns with Zig naming conventions. Note that this is a breaking change for any consumers of the SerializedInputImage type who may be passing or reading the textureId property.


41-46: LGTM! Consistent with input type rename.

The rename maintains consistency across both SerializedInputImage and SerializedOutputImage types.


184-192: LGTM! Serialization correctly uses renamed field.

The internal serialization properly maps to the renamed texture_id field, maintaining consistency with the updated types.


296-303: Ignore internal textureId occurrences
All remaining textureId matches are local variables or function parameters, not serialized fields. The API payload correctly uses texture_id. No further renaming required.

Likely an incorrect or invalid review comment.

integration-tests/tests/assets-snapshot.spec.ts (1)

7-39: LGTM! Test snapshot correctly reflects API changes.

The test snapshot has been properly updated to expect texture_id instead of textureId, ensuring tests align with the renamed public API.

@mateuszJS mateuszJS merged commit 391bf93 into next Oct 6, 2025
6 checks passed
@github-actions
Copy link

github-actions bot commented Oct 6, 2025

🎉 This PR is included in version 0.1.0-next.23 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants