docs(examples): address cubic review comments on PR #37 - #39
Merged
Conversation
12 findings, all verified valid against the code. Walk-through:
P1 — CI signal:
- obs_evaluation: regression failures now `std::process::exit(1)` so a
CI runner job actually goes red. Was just printing a warning before.
P2 — examples that don't deliver what their scenario claims:
- state_machine: the hardcoded `job_done(attempt) returns true at 3`
meant the timeout branch was unreachable. Reshaped the example into
two runs sharing one `node_fn` — first with a stub that completes
on attempt 3 (success path), second with a stub that never returns
true (timeout path, `gave_up = true`). Both branches now exercised.
- models_embedding: `FakeEmbeddings` produces deterministic-but-not-
semantic vectors, so the keyboard-wins-the-typing-query claim was
hollow. Swapped to `OllamaEmbeddings("nomic-embed-text")`. Real
ranking now: keyboard 0.705, hiking 0.356, mug 0.334.
- retrieval_rag_pipeline: same FakeEmbeddings issue — the scenario
promised the retriever finds the cognis-rag chunk but with fake
embeddings it doesn't reliably. Swapped to `OllamaEmbeddings`. Top-1
retrieval now correctly picks the cognis-rag doc.
- chains_structured_extraction: `parser.parse(...)` errors were
swallowed with `eprintln!` and the example still exited 0. Now
propagates with `?` so a CI run flags broken extraction.
- reranking_retriever: score parsing took only the first whitespace
token, defaulting to 0.0 if the model wrote prose ("Score: 7.5",
"I'd say 8 / 10"). 0.0 catastrophically demotes a doc just because
the reranker model padded its reply. Now sweeps the entire response
for the first numeric token in the [0.0, 10.0] range and falls back
to a neutral 5.0 mid-scale instead of zero.
- docs/mintlify/examples/parsers.mdx: `parsers_retry` row claimed it
"re-runs the entire prompt with stricter guidance" — actually it
loops fixer + parse cycles. Rephrased to match the implementation.
P3 — documentation accuracy:
- docs/mintlify/examples/quickstart.mdx: claimed all 8 V2 demos
default to local Ollama. Demos 01 and 05 are pure-Rust offline
with no provider config. Now lists which demos are LLM-backed
vs offline.
- semantic_router: scenario said "ends with `?`"; code is
`contains('?')`. Fixed the scenario text.
- tool_orchestrator: header said "sequential ~240ms"; the example
runs three 100ms vendor calls so the baseline is ~300ms. Fixed.
- structured_parsing_demo: sample output block was carrying compiler
dead-code warnings as if they were part of the example output.
Stripped the warning lines from the captured sample and added a
minimal `#[allow(dead_code)]` on `Sentiment` (Debug-printed only).
- error_handling: the comment claimed a typed `Validation` error,
but the code emits `CognisError::Internal`. Updated the comment to
describe what the code actually does (and notes a real production
app would define its own variant).
Verified: all 10 affected examples run end-to-end against
COGNIS_PROVIDER=ollama COGNIS_OLLAMA_MODEL=llama3.1 with the
intended behavior. `cargo build -p cognis-examples` clean,
`cargo fmt --all --check` passes.
There was a problem hiding this comment.
No issues found across 12 files
You’re at about 97% of the daily review limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #37 (now merged). Cubic flagged 12 issues; all verified valid and fixed.
(Supersedes #38, which had merge conflicts because it was branched from a stale base. This PR is a clean cherry-pick of the same commit onto current
main.)P1 — CI signal
obs_evaluation— regression failures nowstd::process::exit(1)so a CI runner job actually goes red. Was just printing a warning and exiting 0.P2 — examples that didn't deliver what their scenario claimed
state_machine—job_donewas hardcodedattempt >= 3, so the timeout (gave_up) branch was unreachable. Reshaped into two runs sharing onenode_fn: first stub completes on attempt 3 (success path), second stub never returns true (timeout path,gave_up = true). Both branches now exercised.models_embedding—FakeEmbeddingsproduced deterministic-but-not-semantic vectors, so the "keyboard wins the typing query" claim was hollow. Swapped toOllamaEmbeddings("nomic-embed-text"). Real ranking: keyboard 0.705, hiking 0.356, mug 0.334.retrieval_rag_pipeline— same FakeEmbeddings issue. Swapped toOllamaEmbeddings. Top-1 retrieval now correctly picks the cognis-rag doc.chains_structured_extraction—parser.parse(...)errors were swallowed witheprintln!and the example still exited 0. Now propagates with?.reranking_retriever— score parsing took only the first whitespace token, defaulting to0.0when the model wrote prose ("Score: 7.5", "I'd say 8 / 10"). 0.0 catastrophically demotes a doc just because the reranker model padded its reply. Now sweeps the response for the first numeric token in[0.0, 10.0]and falls back to a neutral 5.0.docs/mintlify/examples/parsers.mdx—parsers_retryrow claimed it "re-runs the entire prompt with stricter guidance"; the implementation loops fixer + parse cycles. Rephrased.P3 — documentation accuracy
docs/mintlify/examples/quickstart.mdx— claimed all 8 V2 demos default to local Ollama. 01 and 05 are pure-Rust offline. Fixed.semantic_router— scenario said "ends with?"; code iscontains('?'). Fixed scenario text.tool_orchestrator— header said "sequential ~240ms"; example runs three 100ms vendor calls so baseline is ~300ms. Fixed.structured_parsing_demo— sample output block had compiler dead-code warnings as if they were part of the example output. Stripped + added#[allow(dead_code)]onSentiment(Debug-printed only).error_handling— comment claimed a typedValidationerror, but the code emitsCognisError::Internal. Updated to match.Test plan
COGNIS_PROVIDER=ollamaCOGNIS_OLLAMA_MODEL=llama3.1with the intended behavior captured in their headers.cargo build -p cognis-examplesclean.cargo fmt --all --checkpasses.Summary by cubic
Fixes 12 Cubic review findings from PR #37 to make examples behave as described and to surface failures in CI. CI now fails on regressions, and embeddings-based demos use real
OllamaEmbeddingsfor meaningful results.Bug Fixes
obs_evaluationexits with code 1 when tests regress.OllamaEmbeddings("nomic-embed-text")inmodels_embeddingandretrieval_rag_pipelineso rankings and retrievals are real.parser.parse(...)errors with?so failures aren’t silently ignored.Documentation
RetryParserdescription.semantic_routerscenario matchescontains('?');tool_orchestratorbaseline corrected to ~300ms.structured_parsing_demoand added#[allow(dead_code)];error_handlingcomment updated to matchCognisError::Internal.Written for commit 4e4fe32. Summary will update on new commits.