Skip to content

Added new reserved char and fixing studio tests #1196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 5, 2025

Conversation

ilongin
Copy link
Contributor

@ilongin ilongin commented Jul 2, 2025

Adding @ to reserved chars and fixing studio tests due to Studio companion PR changes: https://github.com/iterative/studio/pull/11823

Summary by Sourcery

Add '@' to reserved characters for dataset, namespace, and project names, and update the CI workflow variable to fix Studio tests.

Enhancements:

  • Include '@' in the list of reserved characters for dataset, namespace, and project naming

CI:

  • Rename CI environment variable from DATACHAIN_METASTORE_ARG_PROJECT to DATACHAIN_METASTORE_ARG_NAMESPACE in tests workflow

Copy link
Contributor

sourcery-ai bot commented Jul 2, 2025

Reviewer's Guide

This PR adds the '@' character to the reserved character sets for dataset, namespace, and project names, and adjusts the CI tests-studio workflow to use the correct environment variable for namespace.

Class diagram for reserved character changes in Dataset, Namespace, and Project

classDiagram
    class Dataset {
        +DATASET_NAME_RESERVED_CHARS = [".", "@"]
        +DATASET_NAME_REPLACEMENT_CHAR = "_"
    }
    class Namespace {
        +NAMESPACE_NAME_RESERVED_CHARS = [".", "@"]
    }
    class Project {
        +PROJECT_NAME_RESERVED_CHARS = [".", "@"]
    }
Loading

File-Level Changes

Change Details Files
Extend name validation to reserve '@'
  • Added '@' to reserved chars list for datasets
  • Added '@' to reserved chars list for namespaces
  • Added '@' to reserved chars list for projects
src/datachain/dataset.py
src/datachain/namespace.py
src/datachain/project.py
Update CI workflow variable for studio tests
  • Replaced DATACHAIN_METASTORE_ARG_PROJECT with DATACHAIN_METASTORE_ARG_NAMESPACE
.github/workflows/tests-studio.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@ilongin ilongin marked this pull request as draft July 2, 2025 14:26
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @ilongin - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

cloudflare-workers-and-pages bot commented Jul 2, 2025

Deploying datachain-documentation with  Cloudflare Pages  Cloudflare Pages

Latest commit: acd27c4
Status: ✅  Deploy successful!
Preview URL: https://8008966f.datachain-documentation.pages.dev
Branch Preview URL: https://ilongin-11817-change-default.datachain-documentation.pages.dev

View logs

Copy link

codecov bot commented Jul 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.72%. Comparing base (396d8a9) to head (acd27c4).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1196   +/-   ##
=======================================
  Coverage   88.72%   88.72%           
=======================================
  Files         152      152           
  Lines       13575    13575           
  Branches     1889     1889           
=======================================
  Hits        12044    12044           
  Misses       1088     1088           
  Partials      443      443           
Flag Coverage Δ
datachain 88.65% <100.00%> (ø)

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

Files with missing lines Coverage Δ
src/datachain/dataset.py 86.99% <100.00%> (ø)
src/datachain/namespace.py 97.43% <100.00%> (ø)
src/datachain/project.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ilongin ilongin marked this pull request as ready for review July 4, 2025 13:24
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @ilongin - I've reviewed your changes - here's some feedback:

  • Add unit tests to verify that names containing '@' now correctly trigger validation errors for datasets, namespaces, and projects.
  • Consider centralizing the reserved-character lists into a shared constant or utility to avoid duplication across dataset, namespace, and project modules.
  • Double-check handling or migration strategy for any existing resources with '@' in their names, as this change tightens name validation and may be breaking.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Add unit tests to verify that names containing '@' now correctly trigger validation errors for datasets, namespaces, and projects.
- Consider centralizing the reserved-character lists into a shared constant or utility to avoid duplication across dataset, namespace, and project modules.
- Double-check handling or migration strategy for any existing resources with '@' in their names, as this change tightens name validation and may be breaking.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@@ -6,7 +6,7 @@
from datachain.error import InvalidNamespaceNameError

N = TypeVar("N", bound="Namespace")
NAMESPACE_NAME_RESERVED_CHARS = ["."]
NAMESPACE_NAME_RESERVED_CHARS = [".", "@"]
Copy link
Member

Choose a reason for hiding this comment

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

just to make sure - are those replaced / escaped automatically if username contains them? do we check it when we create the default namespace from the username?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are replaced automatically for default namespace and validated when creating random namespace (error is thrown if name contains some of those)

@ilongin ilongin requested a review from shcheklein July 5, 2025 00:25
@ilongin ilongin merged commit 17060db into main Jul 5, 2025
35 checks passed
@ilongin ilongin deleted the ilongin/11817-change-default-project-namespace branch July 5, 2025 20:19
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.

3 participants