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

Index creatorCoreId #7

Closed
Tracked by #83
gmaclennan opened this issue Jul 28, 2023 · 1 comment
Closed
Tracked by #83

Index creatorCoreId #7

gmaclennan opened this issue Jul 28, 2023 · 1 comment

Comments

@gmaclennan
Copy link
Member

gmaclennan commented Jul 28, 2023

Description

The frontend needs to know the device ID that first created a record, to restrict editing of records to the creator device.

Writing this into every record cannot be trusted (clients could write anything), so it's best to derive this from the data.

This issue is to add a field to the index table in sqlite for the creatorCoreId. It should be the core ID of root document for a particular Doc ID (e.g. the document with an empty links: [] field.)

It is possible that a document could have a "forked creator", e.g. more than one document with the same ID that has an empty links field. This could be created by an untrusted client, or a bug in the code which omitted the links field when updating/deleting a document. In the future we can add a creatorForks field or similar to track this, or maybe just a "questionable" boolean field, which could also be set if the createdAt dates change in a document history.

Task

Add a creatorCoreId to the generated SQLite table. We need a value for when it is not determined (e.g. the root document has not been indexed). We can use a null value.

Should check for a pre-existing value in the creatorCoreId field when writing, and if it does exist then check if createdAt matches, and it so overwrite the existing value. This is still not fully deterministic, nor does it establish which is the "correct" creator, but we can resolve that in a follow-up task if a priority.

@gmaclennan
Copy link
Member Author

Will instead solve this by encoding this to the docId as per digidem/mapeo-core-next#

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

No branches or pull requests

1 participant