sillsdev / sillsdev/harmony

Test coverage: SnapshotWorker reference removal and cascade delete

Open
#97 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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.

https://github.com/sillsdev/harmony/blob/03f609f11a560433ce4a7ecd598a21921b324add/src/SIL.Harmony/SnapshotWorker.cs#L124-L148

No test:

  • deletes a referenced entity (e.g. a Tag referenced by a Word/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

  • DeletingReferencedEntityRemovesReferenceFromReferrers
  • DeletingEntityCascadesWhenRemovalDeletesReferrer

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.