Skip to content

[CHORE] Reimplement fork backstop #4511

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 1 commit into from
May 9, 2025

Conversation

drewkim
Copy link
Contributor

@drewkim drewkim commented May 9, 2025

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • ...
  • New functionality
    • Reimplements a backstop to prevent too many forks on a collection

Test plan

How are these changes tested?

  • Tests pass locally with pytest for python, yarn test for js, cargo test for rust

Documentation Changes

Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the docs section?

Copy link

github-actions bot commented May 9, 2025

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

Copy link
Contributor Author

drewkim commented May 9, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@drewkim drewkim marked this pull request as ready for review May 9, 2025 16:26
@drewkim drewkim enabled auto-merge (squash) May 9, 2025 16:26
Copy link
Contributor

This minor PR adds a defensive backstop to prevent excessive forking of collections. The change implements a simple check that returns an error if a collection's dependencies exceed 1,000,000.

This summary was automatically generated by @propel-code-bot


// Defensive backstop to prevent too many forks
if len(lineageFile.Dependencies) > 1000000 {
return common.ErrCollectionTooManyFork
Copy link
Contributor

Choose a reason for hiding this comment

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

[BestPractice]

The error name ErrCollectionTooManyFork doesn't follow the common Go naming convention for error variables, which typically use plural form for collections. Consider renaming it to ErrCollectionTooManyForks for consistency and clarity.

Comment on lines +970 to +972
// Defensive backstop to prevent too many forks
if len(lineageFile.Dependencies) > 1000000 {
return common.ErrCollectionTooManyFork
Copy link
Contributor

Choose a reason for hiding this comment

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

[BestPractice]

Consider making the hard-coded limit of 1,000,000 forks configurable through a constant variable at the package level. This would improve maintainability and make it easier to adjust the limit in the future without modifying the function code.

Suggested change
// Defensive backstop to prevent too many forks
if len(lineageFile.Dependencies) > 1000000 {
return common.ErrCollectionTooManyFork
// Defensive backstop to prevent too many forks
if len(lineageFile.Dependencies) > maxAllowedForks {
return common.ErrCollectionTooManyFork
}

Committable suggestion

Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

@drewkim drewkim merged commit 1be97d1 into main May 9, 2025
72 checks passed
itaismith pushed a commit that referenced this pull request May 23, 2025
## Description of changes

_Summarize the changes made by this PR._

- Improvements & Bug fixes
  - ...
- New functionality
  - Reimplements a backstop to prevent too many forks on a collection

## Test plan

_How are these changes tested?_

- [ ] Tests pass locally with `pytest` for python, `yarn test` for js,
`cargo test` for rust

## Documentation Changes

_Are all docstrings for user-facing APIs updated if required? Do we need
to make documentation changes in the [docs
section](https://github.com/chroma-core/chroma/tree/main/docs/docs.trychroma.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.

1 participant