Skip to content

Fix morph-types seed race condition#2277

Open
myieye wants to merge 1 commit into
developfrom
duplicate-commit-race-condition
Open

Fix morph-types seed race condition#2277
myieye wants to merge 1 commit into
developfrom
duplicate-commit-race-condition

Conversation

@myieye
Copy link
Copy Markdown
Collaborator

@myieye myieye commented May 19, 2026

Bumps Harmony to include the in-lock HasCommit check (sillsdev/harmony#66), closing the TOCTOU race between BG sync's CreateProject and the HTTP middleware's MigrateDb on a fresh project.

Drops the MigrateDb pre-check — it was an optimization, not a race guard.

⚠️ Will not build on develop until the .NET 10 chore (#2264) merges; Harmony main is on .NET 10.

@github-actions github-actions Bot added 💻 FW Lite issues related to the fw lite application, not miniLcm or crdt related 📦 Lexbox issues related to any server side code, fw-headless included labels May 19, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 9d083bfc-f3d9-410c-b316-ba5204b74f81

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR refactors database migration seeding logic to unconditionally seed predefined morph-types using idempotent operations, removing a prior conditional existence check. Comments updated to document concurrent-seeder safety. The backend/harmony dependency submodule is also bumped to a newer commit.

Changes

Seeding refactor and dependency update

Layer / File(s) Summary
Unconditional idempotent morph-type seeding
backend/FwLite/LcmCrdt/CurrentProjectService.cs
MigrateDb now unconditionally seeds predefined morph-types by fetching DataModel and ProjectData, then calling PreDefinedData.AddPredefinedMorphTypes(...) directly. Conditional existence check removed; comments updated to note idempotent AddChanges and concurrent seeder avoidance.
Backend harmony submodule version update
backend/harmony
Submodule pointer advanced to a newer Git commit.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • sillsdev/languageforge-lexbox#1613: Earlier work making MigrateDb thread-safe per project DB path, directly connected to this PR's idempotent seeding and concurrent-seeder safety comments.

Suggested labels

💻 FW Lite

Poem

🐰 The seeds of change now sow with grace,
No duplicate checks clutter the place,
Idempotent calls race without fear,
While harmony dances to a newer sphere!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and concisely describes the main change: fixing a race condition in morph-types seeding, which is the primary objective of this pull request.
Description check ✅ Passed The description is related to the changeset, explaining the Harmony bump and the removal of the pre-check that was part of the race condition fix.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch duplicate-commit-race-condition

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Bump Harmony submodule to include the in-lock HasCommit check (sillsdev/harmony#66),
which closes the TOCTOU race between concurrent AddPredefinedMorphTypes callers
on a fresh project (BG sync's CreateProject vs. HTTP middleware's MigrateDb).

The MigrateDb pre-check was a small optimization, not a race guard — drop it,
let Harmony's in-lock check handle idempotency.

Note: won't build on develop until the .NET 10 chore lands (Harmony main is on .NET 10).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@myieye myieye force-pushed the duplicate-commit-race-condition branch from 4f36f3d to ba00c59 Compare May 20, 2026 06:43
@github-actions
Copy link
Copy Markdown
Contributor

C# Unit Tests

0 tests   - 165   0 ✅  - 165   0s ⏱️ -20s
0 suites  -  23   0 💤 ±  0 
0 files    -   1   0 ❌ ±  0 

Results for commit ba00c59. ± Comparison against base commit b1ab821.

@github-actions
Copy link
Copy Markdown
Contributor

UI unit Tests

  1 files  ±0   59 suites  ±0   32s ⏱️ +3s
176 tests ±0  176 ✅ ±0  0 💤 ±0  0 ❌ ±0 
245 runs  ±0  245 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit ba00c59. ± Comparison against base commit b1ab821.

@argos-ci
Copy link
Copy Markdown

argos-ci Bot commented May 20, 2026

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No changes detected - May 20, 2026, 6:54 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💻 FW Lite issues related to the fw lite application, not miniLcm or crdt related 📦 Lexbox issues related to any server side code, fw-headless included

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant