Skip to content

fix: Adjust uniqueness constraint on file names#9014

Merged
erichare merged 48 commits into
mainfrom
fix-file-name-uniqueness
Aug 19, 2025
Merged

fix: Adjust uniqueness constraint on file names#9014
erichare merged 48 commits into
mainfrom
fix-file-name-uniqueness

Conversation

@erichare
Copy link
Copy Markdown
Collaborator

@erichare erichare commented Jul 11, 2025

This pull request fixes a possible race condition with the MCP Servers JSON internal file that can be caused by an incorrect specification of the uniqueness constraint.

Summary by CodeRabbit

  • New Features

    • Updated file naming rules to allow different users to have files with the same name, while still preventing duplicate file names for the same user.
  • Bug Fixes

    • Resolved issues related to file name uniqueness, ensuring that file name conflicts only occur within the same user account.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 11, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes update the uniqueness constraint for the "file" table and its ORM model. The uniqueness of the "name" field is changed from single-column to a composite constraint on ("name", "user_id"). Alembic migration scripts and the SQLModel ORM definition are both updated to reflect this new composite uniqueness.

Changes

File(s) Change Summary
.../alembic/versions/1cb603706752_modify_uniqueness_constraint_on_file_.py Added Alembic migration to change unique constraint on "file" table from "name" to ("name", "user_id"), with upgrade and downgrade logic for SQLite and PostgreSQL.
.../services/database/models/file/model.py Updated File model: removed unique=True from name field, added composite UniqueConstraint("name", "user_id") to __table_args__.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App
    participant Database

    User->>App: Request to create/update file (name, user_id)
    App->>Database: INSERT/UPDATE file (name, user_id)
    Database-->>App: Enforces unique constraint on (name, user_id)
    App-->>User: Success or uniqueness error
Loading
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-file-name-uniqueness

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 11, 2025
@dosubot dosubot Bot added the bug Something isn't working label Jul 11, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jul 11, 2025
coderabbitai[bot]

This comment was marked as resolved.

@erichare erichare requested a review from lucaseduoli July 11, 2025 17:05
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jul 11, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jul 14, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jul 14, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jul 14, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jul 15, 2025
@github-actions github-actions Bot added the bug Something isn't working label Aug 11, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 11, 2025

Codecov Report

❌ Patch coverage is 40.00000% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 33.56%. Comparing base (ec7579d) to head (1b8624f).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...d/base/langflow/components/processing/save_file.py 27.27% 8 Missing ⚠️
...d/base/langflow/components/agents/mcp_component.py 33.33% 4 Missing ⚠️

❌ Your project status has failed because the head coverage (2.71%) is below the target coverage (10.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #9014      +/-   ##
==========================================
+ Coverage   33.25%   33.56%   +0.31%     
==========================================
  Files        1209     1197      -12     
  Lines       57537    57006     -531     
  Branches     5363     5232     -131     
==========================================
+ Hits        19133    19135       +2     
+ Misses      38344    37811     -533     
  Partials       60       60              
Flag Coverage Δ
backend 55.15% <40.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...se/langflow/services/database/models/file/model.py 100.00% <100.00%> (ø)
...d/base/langflow/components/agents/mcp_component.py 18.91% <33.33%> (-0.12%) ⬇️
...d/base/langflow/components/processing/save_file.py 25.37% <27.27%> (-0.62%) ⬇️

... and 31 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Aug 11, 2025
@github-actions github-actions Bot removed the bug Something isn't working label Aug 11, 2025
@sonarqubecloud
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot mentioned this pull request Aug 26, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants