-
-
Notifications
You must be signed in to change notification settings - Fork 5
Simplify no-op commit #2098
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify no-op commit #2098
Conversation
📝 WalkthroughWalkthroughA test file was refactored to replace a private tuple-returning helper method with a new nested FakeCommit class featuring a static NoOp factory. Unnecessary imports were removed, snapshot filtering logic was eliminated, and test flows were adjusted to use the new factory pattern. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
backend/FwLite/LcmCrdt.Tests/Data/MigrationTests.cs (1)
163-180: LGTM! Clean factory pattern implementation.The
FakeCommitclass with itsNoOpfactory method is a much cleaner solution than the previous approach. ReturningCommitinstead ofFakeCommitprovides good encapsulation.Minor observation: Lines 177-178 may be redundant if the base constructor already sets
HybridDateTimeand the parent hash. However, this could be intentional defensive programming or necessary due to base class behavior.If the base constructor already sets these properties correctly, consider this cleanup:
[SetsRequiredMembers] public FakeCommit(Guid id, HybridDateTime hybridDateTime) : base(id, "", NullParentHash, hybridDateTime) { - HybridDateTime = hybridDateTime; - SetParentHash(NullParentHash); }Only apply if the base constructor behavior is verified to handle these correctly.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
backend/FwLite/LcmCrdt.Tests/Data/MigrationTests.cs(2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: imnasnainaec
Repo: sillsdev/languageforge-lexbox PR: 1867
File: platform.bible-extension/src/main.ts:239-246
Timestamp: 2025-07-31T19:10:41.178Z
Learning: In the sillsdev/languageforge-lexbox repository, user imnasnainaec prefers to defer code improvements when there are related TODO comments indicating planned refactoring work, choosing to bundle related changes together rather than making incremental improvements that would need to be modified again during the larger refactoring.
📚 Learning: 2025-04-17T02:52:44.986Z
Learnt from: hahn-kev
Repo: sillsdev/languageforge-lexbox PR: 1609
File: backend/FwLite/LcmCrdt/CompiledModels/ComplexFormComponentEntityType.cs:138-182
Timestamp: 2025-04-17T02:52:44.986Z
Learning: Files in the LcmCrdt.CompiledModels namespace contain auto-generated Entity Framework Core model code that should be ignored during code reviews since they shouldn't be manually modified.
Applied to files:
backend/FwLite/LcmCrdt.Tests/Data/MigrationTests.cs
📚 Learning: 2025-11-07T08:54:01.604Z
Learnt from: myieye
Repo: sillsdev/languageforge-lexbox PR: 2093
File: backend/FwLite/LcmCrdt/HistoryService.cs:173-200
Timestamp: 2025-11-07T08:54:01.604Z
Learning: In LcmCrdt, the `DataModel.GetLatest<T>(Guid id)` method returns the latest snapshot of an entity regardless of whether it has been deleted or not. It only returns null (and thus throws NotFoundException when null-coalesced) when the entity truly never existed or the data is corrupt.
Applied to files:
backend/FwLite/LcmCrdt.Tests/Data/MigrationTests.cs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Analyze (csharp)
- GitHub Check: frontend
- GitHub Check: frontend-component-unit-tests
- GitHub Check: Build FW Lite and run tests
🔇 Additional comments (2)
backend/FwLite/LcmCrdt.Tests/Data/MigrationTests.cs (2)
117-118: LGTM! Much cleaner approach.The new
FakeCommit.NoOpfactory method is significantly cleaner than the previous tuple-based workaround. UsingDateTimeOffset.MinValueappropriately isolates this test commit from actual data timestamps.
123-129: LGTM! Simplified query aligns with the new approach.Removing the snapshot filtering is correct since the new
NoOpcommit creates zeroChangeEntities, eliminating the need to exclude a fake entity. This is cleaner and more maintainable.
For some reason I didn't originally think of the idea of simply creating 0 change objects, which works and is much cleaner than my weird hack.