Skip to content

Claude Opus dev/core/Animations/ Review#18234

Merged
sebavan merged 8 commits intoBabylonJS:masterfrom
regnaio:claude-core-src-animations
Apr 7, 2026
Merged

Claude Opus dev/core/Animations/ Review#18234
sebavan merged 8 commits intoBabylonJS:masterfrom
regnaio:claude-core-src-animations

Conversation

@regnaio
Copy link
Copy Markdown
Contributor

@regnaio regnaio commented Apr 3, 2026

I'm experimenting with using Claude Opus to analyze the Babylon.js source. To make the context manageable for Claude, I'm just doing 1 folder at a time (dev/core/Animations/ in this case).

Please let me know if these kinds of analyses are not valuable. I'm sure that not all of the changes are done in the way the Babylon.js Core Team deems best, so please feel free to edit/discard any of them.

My motivation for doing this is Claude did an amazing job analyzing my projects. And since Babylon.js is the most important framework I depend on, I thought that Claude's input here could hugely benefit my projects and others.

If you do find this valuable, please let me know if there are particular folders you'd like to go through. Otherwise, I'd like to go through commonly used folders like Bones/, Cameras/, Engines/, and more.

I verified that the following were able to run with the changes:

npm run build:babylonjs
npm run prepare-snapshot

gbz and others added 6 commits April 3, 2026 15:57
- Fix inverted toString separator logic in Animation (comma on first item instead of subsequent)
- Fix missing .length in AnimationGroup.toString (printed array object instead of count)
- Guard against division by zero in AnimatorAvatar proportionRatio calculation
- Fix vertical axis auto-detection comparing only 2 of 3 axes in AnimatorAvatar
- Throw Error instead of string literal in PathCursor.move
- Remove dead duplicated RegisterTargetForLateAnimationBinding from animatable.core.ts
- Change == to === in ElasticEase.easeInCore for strict equality consistency
- Rename shadowed loop variable in AnimatorAvatar._fixAnimationGroup
- Replace verbose manual iterator patterns with for-of loops in AnimatorAvatar
- Add audit summary document

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The project's tsconfig does not enable --downlevelIteration, so
for-of on Set<T> causes TS2802. Restored the original manual
iterator pattern (.keys() / .next() / .done).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Switching back to for-of to identify which build command
requires the manual iterator pattern.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The UMD build (packages/public/umd/babylonjs/tsconfig.build.json)
targets ES5, which doesn't support for-of on Set without
--downlevelIteration. The manual iterator pattern is required.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Documents that the verbose iterator pattern is required because the
UMD build targets ES5 and for-of on Set needs --downlevelIteration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Popov72
Copy link
Copy Markdown
Contributor

Popov72 commented Apr 4, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@bjsplat
Copy link
Copy Markdown
Collaborator

bjsplat commented Apr 4, 2026

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@bjsplat
Copy link
Copy Markdown
Collaborator

bjsplat commented Apr 4, 2026

Snapshot stored with reference name:
refs/pull/18234/merge

Test environment:
https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/18234/merge/index.html

To test a playground add it to the URL, for example:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/18234/merge/index.html#WGZLGJ#4600

Links to test your changes to core in the published versions of the Babylon tools (does not contain changes you made to the tools themselves):

https://playground.babylonjs.com/?snapshot=refs/pull/18234/merge
https://sandbox.babylonjs.com/?snapshot=refs/pull/18234/merge
https://gui.babylonjs.com/?snapshot=refs/pull/18234/merge
https://nme.babylonjs.com/?snapshot=refs/pull/18234/merge

To test the snapshot in the playground with a playground ID add it after the snapshot query string:

https://playground.babylonjs.com/?snapshot=refs/pull/18234/merge#BCU1XR#0

If you made changes to the sandbox or playground in this PR, additional comments will be generated soon containing links to the dev versions of those tools.

@bjsplat
Copy link
Copy Markdown
Collaborator

bjsplat commented Apr 4, 2026

@bjsplat
Copy link
Copy Markdown
Collaborator

bjsplat commented Apr 4, 2026

@bjsplat
Copy link
Copy Markdown
Collaborator

bjsplat commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

@Popov72 Popov72 left a comment

Choose a reason for hiding this comment

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

Thank you for taking the time to put this PR together — we appreciate the effort and the interest in improving the Babylon.js codebase!

That said, we'd like to be transparent: while the individual bug findings here are mostly legitimate, we don't think external AI-driven code audits are the best path forward for the project. This is something we can (and already do) ourselves for parts of the codebase, using AI tooling that is specifically configured for our codebase conventions, internal context, and workflow. Microsoft also has direct partnerships with AI providers (OpenAI, Anthropic, etc.) that give us access to tailored models and tooling better suited to this kind of work. We plan to continue doing more of these AI-assisted reviews across the codebase in the coming weeks and months.

We'd rather focus review bandwidth on PRs that address specific issues, implement features, or fix bugs that contributors have encountered directly.

Regarding the specific changes in this PR, here are our findings:

Issues to address

1. RegisterTargetForLateAnimationBinding must not be removed
This function is exported via the barrel chain (animatable.core.tsanimatable.tsindex.ts → package root), making it a public API. Removing it is a breaking change. It should be kept as-is.

2. @internal JSDoc accidentally removed from ElasticEase.easeInCore
The diff replaces the /** @internal */ JSDoc with a plain block comment, removing the @internal annotation. Compare with BackEase.easeInCore where it was correctly preserved.

3. claude/ directory should not be committed
Audit summaries should live in the PR description, not as committed files in the repository.

4. Inline "Claude explanation" comments should be removed
Every change includes a multi-line /* Feel free to delete this comment... */ block. These are not appropriate for production code — explanations belong in the commit message or PR description.

Correct fixes ✅

The following are legitimate bugs that are correctly fixed:

  • animation.ts — toString separator logic was inverted.
  • animationGroup.ts — Missing .length on array concatenation.
  • animatorAvatar.ts — Vertical axis auto-detection comparison was flawed; division by zero was unguarded; inner loop variable shadowed outer i.
  • easing.ts===== for strict equality.
  • pathCursor.tsthrow "string"throw new Error(...) for proper stack traces.

local and others added 2 commits April 6, 2026 22:16
…tion artifacts

- Restore RegisterTargetForLateAnimationBinding as exported public API
- Fix @internal JSDoc on ElasticEase.easeInCore (was accidentally removed)
- Remove claude/ directory from tracked files
- Remove all inline "Claude explanation" comments from production code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Keep only the i→j rename for the inner loop variable that shadowed the
outer loop's i. Revert the vertical axis auto-detection and division-by-zero
guard changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@regnaio
Copy link
Copy Markdown
Contributor Author

regnaio commented Apr 7, 2026

Thank you so much, @Popov72, for your review, and I love what you and the team are doing for Babylon.js 😄

The PR now only includes the 5 correct fixes you shared in your reply.

@Popov72
Copy link
Copy Markdown
Contributor

Popov72 commented Apr 7, 2026

I'm not sure why you removed the fix for the vertical axis auto-detection code? This is a real bug :)

@sebavan
Copy link
Copy Markdown
Member

sebavan commented Apr 7, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@sebavan sebavan enabled auto-merge (squash) April 7, 2026 16:57
@bjsplat
Copy link
Copy Markdown
Collaborator

bjsplat commented Apr 7, 2026

@bjsplat
Copy link
Copy Markdown
Collaborator

bjsplat commented Apr 7, 2026

@bjsplat
Copy link
Copy Markdown
Collaborator

bjsplat commented Apr 7, 2026

@sebavan sebavan merged commit 6ad3ffe into BabylonJS:master Apr 7, 2026
21 of 22 checks passed
@regnaio
Copy link
Copy Markdown
Contributor Author

regnaio commented Apr 7, 2026

I'm not sure why you removed the fix for the vertical axis auto-detection code? This is a real bug :)

Ooh my mistake on removing that fix! I misread that only the shadowed i fix was valid, let me add that back

sebavan pushed a commit that referenced this pull request Apr 7, 2026
Please see @Popov72 's comment here:
#18234 (comment)

I accidentally removed some of the fixes from Claude, and this PR looks
to restore them. Thank you for your help!

---------

Co-authored-by: gbz <gbz@gbzs-MacBook-Pro.local>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: local <local@local.local>
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.

4 participants