Let a family carry the actors it is attributed to (#57) - #177
Open
r0ny123 wants to merge 2 commits into
Open
Conversation
A family summary only had a name and its counters. FamilyEntry now carries a list of actor names (danielplohmann#57), settable through PUT /families/{id} (validated names, a comma separated string accepted too) and McritClient.modifyFamily(actors=...), stored on both backends, absent-tolerant for families stored before, and carried by exports as family_actors and merged on import into what the target instance already knows.
Contributor
Author
|
Live verification on the MongoDB-backed instance (server and worker restarted on this change, through
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #57 (consider adding actors field to families).
Changes
FamilyEntrycarriesactors, a list of names, intoDict()/fromDict(); families stored before this read as an empty list, so no migration.FamilyEntry.normalizeActors()strips, drops empties and duplicates, keeps the order given.actorsinmodifyFamily(); the MongoDB one sets the field on the family document.PUT /families/{id}acceptsactorsas a list of names (1 to 64 characters of letters, digits, spaces, dots, dashes, underscores; a comma separated string is accepted too); anything else is a 400 without touching the family.McritClient.modifyFamily(family_id, actors=[...]); an empty list clears them. The client now sends the update as JSON, since a list does not survive form encoding; the route readsreq.mediaand takes both.family_actors(family id to names, only for families that have any); imports merge them into what the target instance already knows for the remapped family. An importer without the key ignores it, an export without the key imports as before.Verification
tests/testFamilyActors.py(5 tests): entry round trip and legacy default; normalisation; route validation and pass-through, including the comma separated form and two rejected shapes; the client's JSON body with and without actors.tests/testStorage.py(both backends): set, normalised, kept through a rename, cleared, unknown family refused.tests/testMinHashIndex.py: an export carries the actors and an import through JSON merges them with the target's own.ruff check,ruff format --check,ty checkclean.