Repository navigation
feat: implement upsert and delete [FC-0144] - #32
bradenmacdonald merged 29 commits into
Conversation
|
Thanks for the pull request, @rpenido! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
9688ff9 to
c68b3fb
Compare
navinkarkera
left a comment
There was a problem hiding this comment.
@rpenido Overall looks good. Just some suggestions
|
Thanks @blarghmatey! This is ready for another round! |
|
Hi @bradenmacdonald! Can I get your review here? |
bradenmacdonald
left a comment
There was a problem hiding this comment.
Looks great! My comments are all pretty minor, mostly code clarity and lints. Feel free to reject or ignore any that you don't want to do.
Co-authored-by: Braden MacDonald <mail@bradenm.com>
Type checks now raise TypeError; value checks such as empty sequences, invalid names and naive datetimes stay ValueError. Also removes the duplicate type aliases and the docstring whitespace left by the previous review commit.
5335110 to
1e3f18b
Compare
Derive the parent name from the prefix, rename inside_array to inside_object_array and explain the Typesense array rule in the validator. Also apply the adapter-registry docstring from the review.
5538b75 to
4b26bf9
Compare
Add -> None to every test function and type the fixtures, so mypy checks them. The test parameters that use fake_adapter are typed as FakeAdapter.
92d5052 to
4071d41
Compare
|
Thanks for the review @bradenmacdonald! I think I addressed all your comments. |
bradenmacdonald
left a comment
There was a problem hiding this comment.
Thanks, looks great! Merging now to unblock the stack. We can always refine the API as needed during later PRs too.
Description
Implements the write half of the consumer API on top of the contract in #20: the adapter registry, document validation,
upsert,deleteandcheck_write.The registry resolves the configured backend's engine, builds the adapter from the registration and the resolved
BackendConfig, and raisesAdapterNotRegisteredwhen the engine has no factory. Registrations and adapters are cleared between tests; neither registry is part of the consumer surface.Document validation runs before any adapter call, so both engines accept and reject the same documents. Every required field must be present; unknown fields (including a flat key with a dot, which is not a nested field),
nullvalues, wrong types and shapes, and naive datetimes are rejected. Datetimes are accepted as aware values or POSIX seconds, the documentidmust match the engine-safe pattern and fit the filterable limit, and free-form object values must be strings. A violation raisesDocumentErrornaming the document, the field and the reason.upserttakes one bounded sequence, validates it and returns the adapter'sWriteReceipt.deletetakes primary keys or the abstract filter expression, never both and never neither, rejects a raw string filter and an empty filter, normalizes a single key to a tuple and validates every key.check_writeperforms one status poll for a submitted write and never sleeps or retries; scheduling and backoff belong to the indexing worker. A synchronous engine returns an already-complete receipt.The optional rebuild target is already on
upsertanddelete, but the dual-write orchestration lands with the rebuild lifecycle; until then the library submits to the live index only.Testing instructions
uv run --group test pytest -q, and the linters withuv run tox -e quality.Additional Information
Used by:
Private ref: