Test coverage: SnapshotWorker reference removal and cascade delete
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 14
- Forks
- 4
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 3
Description
Follow-up from the test-suite review (batches merged as #92–#96). This is the most intricate merge logic in the engine and currently has no coverage.
Gap
SnapshotWorker.MarkDeleted: when an entity is deleted, references to it are removed from referencing snapshots (RemoveReference), and if that removal itself deletes another entity the method recurses (deletedByRemoveRef → recursive MarkDeleted). The recursion guard comment (L142–146) implies past loop bugs.
No test:
- deletes a referenced entity (e.g. a
Tagreferenced by aWord/WordTag) and asserts the reference is scrubbed from the referrer; - exercises the cascade where removing a reference deletes the referrer, driving the recursion.
Suggested tests
DeletingReferencedEntityRemovesReferenceFromReferrersDeletingEntityCascadesWhenRemovalDeletesReferrer
Why it matters
Reference scrubbing and cascade deletion are core CRDT-merge behaviors; a regression here silently corrupts entity relationships. The recursion guard is untested against the loop it exists to prevent.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/SIL.Harmony/SnapshotWorker.cs around MarkDeleted at lines 124–148, then locate the existing SnapshotWorker tests and related Tag, Word, and WordTag fixtures. Add coverage for reference removal and for the recursive cascade path, including the recursion guard; done means both suggested scenarios pass and the referrer relationship is scrubbed without a loop.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- distributed-systems, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100