Skip to content

Use named GUIDs for predefined-data seed commits#2278

Merged
myieye merged 1 commit into
developfrom
named-seed-guids
May 20, 2026
Merged

Use named GUIDs for predefined-data seed commits#2278
myieye merged 1 commit into
developfrom
named-seed-guids

Conversation

@myieye
Copy link
Copy Markdown
Collaborator

@myieye myieye commented May 19, 2026

Each AddPredefined* now derives its seed commit-id per-project via UUIDv5 (Uuid.NewNameBased), avoiding the cross-project CrdtCommits PK collision a constant id would cause.

Signature changes from (DataModel, Guid clientId) to (DataModel, ProjectData) so each call has both Id and ClientId without risk of mismatch.

Conflicts trivially with #2277 at MigrateDb — whichever lands second needs a small rebase.

@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: 2bc5ca29-bc41-467c-a06f-d89911366e28

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

This PR refactors predefined data seeding to use per-project seed commit IDs derived from project UUIDs via UUIDv5, replacing hard-coded fixed GUIDs for morph types, parts of speech, complex form types, semantic domains, and custom views. Method signatures are updated to accept ProjectData instead of raw clientId GUIDs, and all call sites are propagated accordingly.

Changes

Per-Project Predefined Data Seeding

Layer / File(s) Summary
UUIDv5 Support Infrastructure
backend/FwLite/LcmCrdt/LcmCrdt.csproj, backend/FwLite/LcmCrdt/Objects/PreDefinedData.cs
UUIDNext package dependency is added and imported to enable UUIDv5 name-based GUID generation.
Per-Project Seed ID Computation and Method Refactoring
backend/FwLite/LcmCrdt/Objects/PreDefinedData.cs
Per-project namespace GUIDs and public helper methods (e.g., ComplexFormTypesSeedCommitId, MorphTypesSeedCommitId) compute seed commit IDs via UUIDv5. Seeding methods are refactored to accept ProjectData and pass the computed per-project seed commit IDs to dataModel.AddChanges.
Update All Call Sites to Pass ProjectData
backend/FwLite/LcmCrdt/CrdtProjectsService.cs, backend/FwLite/LcmCrdt/CurrentProjectService.cs, backend/FwLite/LcmCrdt.Tests/MiniLcmApiFixture.cs
CreateProject and SeedSystemData are updated to pass ProjectData instead of clientId; migration flow loads and passes projectData; test fixture passes projectData to AddPredefinedMorphTypes.

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly Related PRs

Suggested Reviewers

  • rmunn

Poem

🐰 Five namespaces bloom, per-project seeds now grow,
UUIDv5 magic makes each commit's ID flow,
No more fixed GUIDs haunting migration's way,
Fresh per-project seeding lights the CRDT day!

🚥 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 'Use named GUIDs for predefined-data seed commits' accurately and specifically describes the main change—converting seed commit IDs from constants to per-project named GUIDs.
Description check ✅ Passed The description clearly explains the rationale (preventing PK collisions), the implementation approach (UUIDv5 per-project), and the API changes, all directly related to the changeset.
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 named-seed-guids

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.

@github-actions github-actions Bot added the 💻 FW Lite issues related to the fw lite application, not miniLcm or crdt related label May 19, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

UI unit Tests

  1 files  ±0   59 suites  ±0   30s ⏱️ -1s
176 tests ±0  176 ✅ ±0  0 💤 ±0  0 ❌ ±0 
245 runs  ±0  245 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 3d72253. ± Comparison against base commit b1ab821.

♻️ This comment has been updated with latest results.

@argos-ci
Copy link
Copy Markdown

argos-ci Bot commented May 19, 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, 9:25 AM

@myieye myieye force-pushed the named-seed-guids branch from 7dfa5aa to 2d34539 Compare May 20, 2026 06:41
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@backend/FwLite/LcmCrdt/CurrentProjectService.cs`:
- Around line 114-119: The migration check currently only looks for the
per-project seed ID (PreDefinedData.MorphTypesSeedCommitId(projectData.Id)) and
will erroneously reseed projects that used the old global/fixed seed id; update
the AnyAsync predicate on dbContext.Set<Commit>() to consider both IDs (the
current PerProject ID and the legacy fixed ID provided by PreDefinedData, e.g.
PreDefinedData.LegacyMorphTypesSeedCommitId or a similarly named helper), so
that AddPredefinedMorphTypes(dataModel, projectData) is only called when neither
the new nor the legacy commit id exists; keep the retrieval of projectData and
the call to PreDefinedData.AddPredefinedMorphTypes unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0ede9480-3b64-4b91-b279-b4ca55119435

📥 Commits

Reviewing files that changed from the base of the PR and between b1ab821 and 2d34539.

📒 Files selected for processing (5)
  • backend/FwLite/LcmCrdt.Tests/MiniLcmApiFixture.cs
  • backend/FwLite/LcmCrdt/CrdtProjectsService.cs
  • backend/FwLite/LcmCrdt/CurrentProjectService.cs
  • backend/FwLite/LcmCrdt/LcmCrdt.csproj
  • backend/FwLite/LcmCrdt/Objects/PreDefinedData.cs

Comment thread backend/FwLite/LcmCrdt/CurrentProjectService.cs
Each AddPredefined* now derives its seed commit-id per-project via UUIDv5
(Uuid.NewNameBased), so the LexBox CrdtCommits PK no longer collides across
projects — the seed row gets attributed to its own project instead of whichever
client pushed first.

AddPredefined* signatures now take ProjectData instead of (clientId, projectId).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@myieye myieye force-pushed the named-seed-guids branch from 2d34539 to 3d72253 Compare May 20, 2026 09:22
@myieye myieye marked this pull request as draft May 20, 2026 11:45
@myieye myieye marked this pull request as ready for review May 20, 2026 15:00
@myieye myieye merged commit e362dd4 into develop May 20, 2026
23 checks passed
@myieye myieye deleted the named-seed-guids branch May 20, 2026 15:00
myieye added a commit that referenced this pull request May 21, 2026
The linq2db v6 + EF Core 10 work in 8d2b22a and 525cfd7 accidentally
reverted PR #2278 ('Use named GUIDs for predefined-data seed commits').
This restores PreDefinedData, CrdtProjectsService, CurrentProjectService,
the MiniLcmApiFixture call site, and the UUIDNext PackageReference, while
keeping the intended linq2db.AspNet -> linq2db.Extensions rename.
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant