Skip to content

Enable mocking IChangeContext#51

Merged
myieye merged 1 commit intomainfrom
enable-mocking-changecontext
Sep 26, 2025
Merged

Enable mocking IChangeContext#51
myieye merged 1 commit intomainfrom
enable-mocking-changecontext

Conversation

@myieye
Copy link
Contributor

@myieye myieye commented Sep 19, 2025

Summary by CodeRabbit

  • New Features
    • No user-facing features added in this release.
  • Refactor
    • Standardized an internal interface with a default implementation to align internal behavior.
  • Chores
    • Internal adjustments made to improve maintainability without altering application behavior.

No functional changes are expected for end-users.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 19, 2025

Walkthrough

Adds a default interface implementation for the internal method Adapt(object) in IChangeContext that throws NotImplementedException. No other members or control paths are changed.

Changes

Cohort / File(s) Summary
Core interface update
src/SIL.Harmony.Core/IChangeContext.cs
Converted internal method declaration Adapt(object) to a default interface implementation returning IObjectBase and throwing NotImplementedException; other members unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I twitch my ears at interface lore,
A default stub—just one, no more.
If you don’t override, exceptions hop,
A NotImplemented bunny stop.
I nibble mocks with gentle cheer—
The context clear, the change is dear.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Enable mocking IChangeContext" accurately and concisely describes the primary change — adding a default implementation to IChangeContext.Adapt to allow mocking. It is short, specific to the change, and contains no extraneous wording, so a teammate scanning PRs will understand the main intent.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch enable-mocking-changecontext

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 17334b3 and d3c1f56.

📒 Files selected for processing (1)
  • src/SIL.Harmony.Core/IChangeContext.cs (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/SIL.Harmony.Core/IChangeContext.cs (4)
src/SIL.Harmony/Changes/ChangeContext.cs (1)
  • IObjectBase (36-36)
src/SIL.Harmony/Adapters/CustomAdapterProvider.cs (1)
  • IObjectBase (52-55)
src/SIL.Harmony/Adapters/IObjectAdapterProvider.cs (1)
  • IObjectBase (11-11)
src/SIL.Harmony/CrdtConfig.cs (1)
  • IObjectBase (193-208)
⏰ 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). (3)
  • GitHub Check: build
  • GitHub Check: build
  • GitHub Check: Analyze (csharp)
🔇 Additional comments (1)
src/SIL.Harmony.Core/IChangeContext.cs (1)

15-15: Add message to default impl; confirm TFMs support default interface methods

Add the message below; quick scan shows an explicit implementation at src/SIL.Harmony/Changes/ChangeContext.cs:36 so this is non‑breaking. One csproj in the repo targets netstandard2.1 with LangVersion latest (DIM likely supported) — confirm SIL.Harmony.Core (or shared Directory.Build.props) targets netstandard2.1/.NET Core 3.0+ and C# 8+.

-internal IObjectBase Adapt(object obj) => throw new NotImplementedException(); /* allow mocking IChangeContext */
+internal IObjectBase Adapt(object obj) =>
+    throw new NotImplementedException("Default IChangeContext.Adapt is for mocking only; production implementations must override.");

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.

@myieye myieye merged commit a9600a0 into main Sep 26, 2025
6 checks passed
@myieye myieye deleted the enable-mocking-changecontext branch September 26, 2025 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants