Skip to content

Quality: getFileId extracts incorrect file ID for multi-dot filenames#638

Open
kumburovicbranko682-boop wants to merge 1 commit into
tajo:mainfrom
kumburovicbranko682-boop:contribai/improve/quality/getfileid-extracts-incorrect-file-id-for
Open

Quality: getFileId extracts incorrect file ID for multi-dot filenames#638
kumburovicbranko682-boop wants to merge 1 commit into
tajo:mainfrom
kumburovicbranko682-boop:contribai/improve/quality/getfileid-extracts-incorrect-file-id-for

Conversation

@kumburovicbranko682-boop

Copy link
Copy Markdown

✨ Code Quality

Problem

split(".")[0] takes everything before the first dot, not before the last dot (the extension). For a filename like widget.v2.stories.tsx, this returns widget instead of widget.v2. Two files widget.v1.stories.tsx and widget.v2.stories.tsx would produce the same file ID, causing a spurious duplicate story ID error from detectDuplicateStoryNames even though the filenames are legitimately different. This is a silent correctness bug in the naming pipeline.

Severity: medium
File: packages/ladle/lib/cli/vite-plugin/naming-utils.js

Solution

Replace the file ID extraction with logic that strips only the extension (last dot segment):

Changes

  • packages/ladle/lib/cli/vite-plugin/naming-utils.js (modified)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced


🤖 About this PR

This pull request was generated by ContribAI, an AI agent
that helps improve open source projects. The change was:

  1. Discovered by automated code analysis
  2. Generated by AI with context-aware code generation
  3. Self-reviewed by AI quality checks

If you have questions or feedback about this PR, please comment below.
We appreciate your time reviewing this contribution!

Closes #637

…ilenames

`split(".")[0]` takes everything before the *first* dot, not before the last dot (the extension). For a filename like `widget.v2.stories.tsx`, this returns `widget` instead of `widget.v2`. Two files `widget.v1.stories.tsx` and `widget.v2.stories.tsx` would produce the same file ID, causing a spurious duplicate story ID error from `detectDuplicateStoryNames` even though the filenames are legitimately different. This is a silent correctness bug in the naming pipeline.


Affected files: naming-utils.js

Signed-off-by: kumburovicbranko682-boop <295886834+kumburovicbranko682-boop@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(ladle): getfileid extracts incorrect file id for multi-dot filenames

2 participants