Skip to content

Create morph types via MiniLcm API instead of seeding (alt to #2344)#2347

Closed
myieye wants to merge 6 commits into
developfrom
bug/morph-type-create-api-2343
Closed

Create morph types via MiniLcm API instead of seeding (alt to #2344)#2347
myieye wants to merge 6 commits into
developfrom
bug/morph-type-create-api-2343

Conversation

@myieye

@myieye myieye commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Alternative direction to #2344 for the morph-type seeding issue (#2343). Branches off the seeding rework on bug/morph-type-seeding-2343 (so it includes those commits) and takes the other path:

Keeps the decision about where/when morph types are seeded — only when SeedNewProjectData is set, or via the migrate-when-missing path; not on project download or fwdata import.

Instead of reintroducing unconditional seeding so MorphTypeSync doesn't throw, this adds CreateMorphType to the MiniLcm write API and has MorphTypeSync.Add create the morph type. Missing canonical morph types now arrive through the normal import/sync path.

  • CrdtMiniLcmApi.CreateMorphType uses the existing (idempotent) CreateMorphTypeChange; the validation/normalization/notify wrappers delegate. FwDataMiniLcmApi rejects creation since FieldWorks morph types are a fixed inventory.
  • Tests that depend on morph types seed them in MiniLcmApiFixture; DownloadProjectTests opts out to keep a pristine replica that fills in via sync.
  • MigrationTests: each theory gets its own RegressionTestHelper (the migrate-once static cache collided across theories); the migration-seeded morph types (random commit id) are excluded from the exact snapshot comparison and covered by the guid-scrubbed regenerated-snapshot test.

Local validation: LcmCrdt.Tests (465), MiniLcm.Tests (8336), and FwLiteProjectSync.Tests (169/170) green. The one local failure (ImportsANewlyCreatedWritingSystem) is a pre-existing Windows-vs-Linux font difference — fails identically on the base commit, passes on Linux CI.

🤖 Generated with Claude Code

hahn-kev and others added 6 commits June 9, 2026 13:25
…n seeding. Modify CreateMorphTypeChange to handle creating the same morph type multiple times due to migrations.
Alternative to reintroducing unconditional morph-type seeding. Keeps the
seeding decisions from this branch (seed only when SeedNewProjectData is set
or via the migrate-when-missing path, not on download/import). Instead of
throwing when MorphTypeSync encounters a morph type the target lacks, add a
CreateMorphType API method so missing canonical morph types are created
during import/sync.

- IMiniLcmWriteApi.CreateMorphType: implemented by CrdtMiniLcmApi (via the
  existing idempotent CreateMorphTypeChange) and threaded through the
  wrappers; FwDataMiniLcmApi rejects it since FieldWorks morph types are a
  fixed inventory.
- MorphTypeSync.Add now creates instead of throwing.
- Tests depending on morph types seed them in MiniLcmApiFixture; the download
  test opts out to keep a pristine replica that fills in via sync.
- MigrationTests: give each theory its own RegressionTestHelper (the
  migrate-once static cache collided across theories) and exclude the
  migration-seeded morph types (random commit id) from the exact snapshot
  comparison. The regenerated-snapshot test still covers them via guid scrubbing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

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: 37f5236c-1c6f-495b-9d37-c730d060303d

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bug/morph-type-create-api-2343

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 Jun 9, 2026
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

UI unit Tests

  1 files   62 suites   26s ⏱️
186 tests 186 ✅ 0 💤 0 ❌
258 runs  258 ✅ 0 💤 0 ❌

Results for commit 0cdc4a0.

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

C# FwHeadless Unit Tests

48 tests   48 ✅  16s ⏱️
 5 suites   0 💤
 1 files     0 ❌

Results for commit 0cdc4a0.

@argos-ci

argos-ci Bot commented Jun 9, 2026

Copy link
Copy Markdown

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

Build Status Details Updated (UTC)
default (Inspect) ✅ No changes detected - Jun 9, 2026, 3:26 PM

{
throw new InvalidOperationException(
$"MorphTypes are predefined and cannot be created. Unexpected morph type: {currentMorphType.Kind} ({currentMorphType.Id}). This indicates a data inconsistency.");
await api.CreateMorphType(currentMorphType);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

it seems like this is the only functional difference between this PR and #2344? The rest are fixing tests.

@myieye myieye closed this Jun 10, 2026
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.

2 participants