Skip to content
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

[CLN] Separate validation and transformation logic #2899

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

atroyn
Copy link
Contributor

@atroyn atroyn commented Oct 4, 2024

Description of changes

We perform validation, and transformations, on requests before we send them from the client to the server. Previously, these operations were not well modularized, leading to difficult to debug code, lots of exceptional paths, and overall not-niceness.

This PR separates validation, and makes it idemponent, from transformations. For each type of request against our API.

Along the way, this PR cleans up the possibility of sending empty lists or dicts as filters or lists of IDs, so that the tests are now consistent with our validators.

In a future PR, we will also repeat this same validation logic server-side for use with clients other than our first party.

Test plan

CI Passes

New validation to ensure empty filters trigger validators.

Documentation Changes

TODO

  • Technically this is a breaking API change, let's discuss

Copy link

github-actions bot commented Oct 4, 2024

Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas

Copy link

github-actions bot commented Oct 4, 2024

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

atroyn commented Oct 4, 2024

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

Join @atroyn and the rest of your teammates on Graphite Graphite

@atroyn atroyn changed the title Record & Validators [CLN] Separate validation and transformation logic Oct 4, 2024
@atroyn atroyn force-pushed the anton/separate_validation_logic branch 12 times, most recently from 4f829fc to 9d25975 Compare October 11, 2024 21:43
@atroyn atroyn force-pushed the anton/separate_validation_logic branch 4 times, most recently from b948c07 to 440e3b2 Compare October 19, 2024 17:48
coll.add(ids=ooo_ids, embeddings=embeddings)
get_ids = coll.get(ids=ooo_ids)["ids"]
assert get_ids == ooo_ids


@pytest.mark.xfail(reason="Partial records aren't in our API contract...")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we actually intend to support this? This is very old code and I'm not sure it's used anywhere.

@atroyn atroyn force-pushed the anton/separate_validation_logic branch from 440e3b2 to b91c9e5 Compare October 19, 2024 19:29
@atroyn atroyn force-pushed the anton/separate_validation_logic branch from b91c9e5 to 5d181a9 Compare October 20, 2024 00:58
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