inkandswitch / inkandswitch/keyhive
[Bug]: Initial commits from document creation are not synced upon delegating document access
- Dominant language
- Rust
- Stars
- 248
- Forks
- 21
- Avg merge
- 5d 15h
- Merged PRs (30d)
- 9
Description
### What happened?
The initial commit to a document does not appear to sync to any peers that are given access to the document.
By initial commit, I mean that one that is passed on document creation. All subsequent commits added are immediately synced. I noticed this in my own code and in the current beelay_core tests. The process is as follows:
1. Create 2 peers.
2. peer1 creates a document with an initial commit
3. peer1 adds peer2 to the document
4. peers connect and synchronize
5. load the doc on peer2 and it will be empty without the first commit. However, the doc status for peer2 will show that the local head is at the hash of the initial commit. The log line provided shows up claiming a KeyNotFound Decryption error that may be related.
### Version
Latest code in main branch
### Which librraies in this workspace are impacted?
beelay-core
### On which environment did you encounter this on?
System code
### Which OSes have you noticed the issue on?
Fedora
### Relevant log output
```shell
025-06-02T19:22:51.577529Z ERROR ThreadId(29) run:load_doc_commits: /git/checkouts/keyhive-9280979f16b10d15/af26dee/beelay/beelay-core/src/commands.rs:269: failed to decrypt commit err=Decrypt(KeyNotFound) local_peer_id=3c1d7a049bebe5cc3a1c81176e79ca5bf1fc8164251d7718dc005cd7a9353c69 doc_id=DocumentId(2DY6BQPJuiUH3DZMfPhKe92NGQt3nxAK5v6y8uzmu4f69tJQba) decrypt=true
```
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Research direction
Reproduce the two-peer scenario described in the issue using the beelay-core tests, then start at beelay-core/src/commands.rs:269 and inspect the reported Decrypt(KeyNotFound) path. Compare initial-commit handling with subsequent commit synchronization. Done means peer2 loads the initial commit after access is delegated and the decryption error no longer occurs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- distributed-systems, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100