Skip to content

Update docs#721

Open
kpavlov wants to merge 1 commit into
mainfrom
docs
Open

Update docs#721
kpavlov wants to merge 1 commit into
mainfrom
docs

Conversation

@kpavlov

@kpavlov kpavlov commented May 30, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Documentation

    • Substantially revised README with new Quick Start guide for OpenAI including dependency configuration
    • Added tables for supported providers/protocols and tested integrations matrix
  • Bug Fixes

    • Improved Ollama integration with updated base URL handling and JSON streaming support

Walkthrough

The PR restructures the AI-Mocks README with new guidance tables and quick-start documentation, whilst updating MockOllama to opt into internal APIs, register JSON content type handling for newline-delimited JSON, and delegate its base URL configuration to the parent mokksy instance rather than constructing a hardcoded localhost URL.

Changes

Documentation and MockOllama Configuration

Layer / File(s) Summary
README restructuring with provider tables and quick-start
README.md
Badges and introduction rewritten to describe AI-Mocks as provider-compatible mock servers. New "Choose the right layer" table maps test scenarios to Mokksy or AI-Mocks; "Supported providers and protocols" and "Tested integrations" tables list modules and SDK coverage. "Quick start with OpenAI" section added with Gradle dependency and DSL example including baseUrl configuration guidance. "Why AI-Mocks?", "Build locally", and "Contributing" sections refreshed.
MockOllama internal API opt-in and baseUrl delegation
ai-mocks-ollama/src/commonMain/kotlin/dev/mokksy/aimocks/ollama/MockOllama.kt
Imports added for InternalMokksyApi and Highlighting to support opt-in and JSON content registration. Class decorated with @OptIn(InternalMokksyApi::class) annotation. Init block registers application/x-ndjson as JSON content via Highlighting.registerJsonContentType(). The baseUrl() override now delegates to mokksy.baseUrl() instead of constructing http://localhost:${port()}.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested labels

documentation

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Update docs' is vague and generic, using non-descriptive language that doesn't convey the specific nature of the changes made to the documentation. Consider using a more specific title that highlights the main documentation change, such as 'Refresh README with provider support matrix and quick start guide' or 'Update README documentation structure and content'.
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to assess whether it relates to the changeset. Add a description that outlines the key documentation changes, including the restructured README and updates to MockOllama, to help reviewers understand the scope and intent of the changes.
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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
`@ai-mocks-ollama/src/commonMain/kotlin/dev/mokksy/aimocks/ollama/MockOllama.kt`:
- Around line 253-258: Update the KDoc for MockOllama.baseUrl() to explicitly
state that it delegates to the parent mock server configuration by calling
mokksy.baseUrl(), describe that host and port are resolved from the parent mock
instance, and add a brief one-line usage example such as wiring a client with
client.baseUrl(mock.baseUrl()); retain `@return` and behavior notes so callers
understand delegation and resolution semantics.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: fd2896a8-14be-462c-988e-b1c3df35bdab

📥 Commits

Reviewing files that changed from the base of the PR and between bacff50 and 1ce0efa.

📒 Files selected for processing (2)
  • README.md
  • ai-mocks-ollama/src/commonMain/kotlin/dev/mokksy/aimocks/ollama/MockOllama.kt

Comment on lines 253 to +258
/**
* Returns the base URL of the mock Ollama server.
*
* @return The server URL in the format `http://localhost:<port>`.
* @return The server base URL.
*/
override fun baseUrl(): String = "http://localhost:${port()}"
override fun baseUrl(): String = mokksy.baseUrl()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Document the new baseUrl() behaviour explicitly in KDoc.

baseUrl() now delegates to the parent mock server configuration, but the KDoc still describes it generically. Please add a brief behaviour note and a small usage example (e.g. wiring client .baseUrl(mock.baseUrl())) so callers understand host/port resolution expectations.

As per coding guidelines, "Ensure all public APIs have proper KDoc/Javadoc comments including examples, parameters, return values, exceptions, and behavior explanation" and "Update KDocs when API is changed".

🤖 Prompt for 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.

In
`@ai-mocks-ollama/src/commonMain/kotlin/dev/mokksy/aimocks/ollama/MockOllama.kt`
around lines 253 - 258, Update the KDoc for MockOllama.baseUrl() to explicitly
state that it delegates to the parent mock server configuration by calling
mokksy.baseUrl(), describe that host and port are resolved from the parent mock
instance, and add a brief one-line usage example such as wiring a client with
client.baseUrl(mock.baseUrl()); retain `@return` and behavior notes so callers
understand delegation and resolution semantics.

@codecov

codecov Bot commented May 30, 2026

Copy link
Copy Markdown

❌ 3 Tests Failed:

Tests completed Failed Passed Skipped
534 3 531 0
View the top 2 failed test(s) by shortest run time
dev.mokksy.aimocks.gemini.genai.ChatCompletionGenaiTest::Should respond with stream to generateContent()[jvm]
Stack Traces | 2.75s run time
com.google.genai.errors.ClientException: 404 Not Found. 
	at com.google.genai.errors.ApiException.throwFromResponse(ApiException.java:94)
	at com.google.genai.HttpApiResponse.getBody(HttpApiResponse.java:37)
	at com.google.genai.Models.processResponseForPrivateGenerateContent(Models.java:5735)
	at com.google.genai.Models.privateGenerateContent(Models.java:5801)
	at com.google.genai.Models.generateContent(Models.java:7337)
	at com.google.genai.Models.generateContent(Models.java:7411)
	at dev.mokksy.aimocks.gemini.genai.ChatCompletionGenaiTest.Should respond with stream to generateContent(ChatCompletionGenaiTest.kt:34)
	Suppressed: java.lang.AssertionError: The following requests were unexpected: POST .../google/models/gemini-2.0-flash-lite:generateContent
Body: {"contents":[{"parts":[{"text":"Just say 'Hello!' as you do it"}],"role":"user"}],"systemInstruction":{"parts":[{"text":"You are a helpful pirate."}],"role":"system"},"generationConfig":{"temperature":0.772594,"topP":0.7444627,"topK":40.0,"maxOutputTokens":177,"seed":87101}}
		at dev.mokksy.mokksy.MokksyServer.verifyNoUnexpectedRequests(MokksyServer.kt:812)
		at dev.mokksy.aimocks.core.AbstractMockLlm.verifyNoUnexpectedRequests(AbstractMockLlm.kt:80)
		at dev.mokksy.aimocks.gemini.AbstractMockGeminiTest.afterEach(AbstractMockGeminiTest.kt:54)
		at java.base/java.lang.reflect.Method.invoke(Method.java:569)
		at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
		at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
		at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
		at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
		at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
dev.mokksy.aimocks.gemini.lc4j.GeminiChatCompletionLc4jTest::Should respond to Chat Completion()[jvm]
Stack Traces | 4.38s run time
java.lang.AssertionError: The following requests were unexpected: POST .../google/models/gemini-2.0-flash-lite:generateContent
Body: {"contents":[{"parts":[{"text":"Just say 'Hello!' as you do it"}],"role":"user"}],"systemInstruction":{"parts":[{"text":"You are a helpful pirate."}],"role":"system"},"generationConfig":{"temperature":0.772594,"topP":0.7444627,"topK":40.0,"maxOutputTokens":177,"seed":87101}}
	at dev.mokksy.mokksy.MokksyServer.verifyNoUnexpectedRequests(MokksyServer.kt:812)
	at dev.mokksy.aimocks.core.AbstractMockLlm.verifyNoUnexpectedRequests(AbstractMockLlm.kt:80)
	at dev.mokksy.aimocks.gemini.AbstractMockGeminiTest.afterEach(AbstractMockGeminiTest.kt:54)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
View the full list of 1 ❄️ flaky test(s)
dev.mokksy.aimocks.gemini.springai.GeminiChatCompletionSpringAiTest::Should respond to generateContent()[jvm]

Flake rate in main: 33.33% (Passed 2 times, Failed 1 times)

Stack Traces | 4.82s run time
java.lang.AssertionError: The following requests were unexpected: POST .../google/models/gemini-2.0-flash-lite:generateContent
Body: {"contents":[{"parts":[{"text":"Just say 'Hello!' as you do it"}],"role":"user"}],"systemInstruction":{"parts":[{"text":"You are a helpful pirate."}],"role":"system"},"generationConfig":{"temperature":0.772594,"topP":0.7444627,"topK":40.0,"maxOutputTokens":177,"seed":87101}}
	at dev.mokksy.mokksy.MokksyServer.verifyNoUnexpectedRequests(MokksyServer.kt:812)
	at dev.mokksy.aimocks.core.AbstractMockLlm.verifyNoUnexpectedRequests(AbstractMockLlm.kt:80)
	at dev.mokksy.aimocks.gemini.AbstractMockGeminiTest.afterEach(AbstractMockGeminiTest.kt:54)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

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.

1 participant