test: harden doctests and guard docs against fabricated APIs #426
No reviewers
Labels
No labels
adr
automated
bug
chore
dependencies
documentation
enhancement
epic
github-actions
P1-high
P2-medium
P3-low
release
research
rust
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Slipstream/eventcore!426
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "docs/doctest-harness"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Follow-up to #424. Prevents the documentation drift that PR from recurring, by making doc examples compile-checked where feasible and adding a permanent guard against fabricated APIs in the prose docs.
Rustdoc hardening
Converted 24 rustdoc
ignoreexamples tono_run, so CI's existingcargo test --doc --workspace --all-featuresnow compiles them against the real API (previously they were never compiled — the exact gap that let stale examples survive). Conversions added only minimal hidden setup. The remainingignoreexamples were deliberately left: they documentpub(crate)items (which rustdoc doesn't compile) or need a live store/heavy scaffolding that would obscure the example.Doctest counts now compiled:
eventcore_types13,eventcore_testing6,eventcore11, plus memory/macros/postgres — all green.Manual doc-accuracy guard
Added
eventcore-examples/tests/doc_accuracy_test.rs— a compiled test (run by the normalnextestsuite, so no CI changes) that scans the manual, blueprints, and published READMEs and fails if any Rust code block references an EventCore API that does not exist:EventToWrite,ExpectedVersion,ReadOptions,PoolConfig/MetricsConfig/SecurityConfig/EventCoreConfig,SchemaRegistry, …)eventcore::EventStoreet al. — these live ineventcore_types)write_events/list_all_streams/health_check/…)StreamId::from/new,.events_written,emit!)Why a symbol guard rather than full compilation
The manual's code blocks are illustrative, mostly-partial teaching snippets (axum handlers, app-owned structs) that cannot compile standalone, so a blanket "compile every block" (mdBook/skeptic) would drown in false positives or require annotating hundreds of blocks. The guard targets the actual failure mode — references to APIs that don't exist — with zero false positives. Self-contained, fully compiled examples already live in the other
eventcore-examplesintegration tests and in crate rustdoc.When EventCore genuinely gains one of these names, drop it from the lists in the test (the failure message says so).
Validation
Full pre-commit gate green (fmt, clippy, nextest incl. the new guard,
test --doc, check, audit). 24 converted doctests compile; guard passes on current docs.🤖 Generated with Claude Code
This PR enhances the documentation testing by converting ignored Rust examples to
no_runfor compilation checks and adds a new test to guard against fabricated API references in documentation. The changes appear safe to merge.Walkthrough
lib.rsfiles: Convertsignoretono_runin Rust code examples to ensure they are compiled, preventing stale examples from persisting.LLM usage and cost
Estimated total USD: $0.057532 via https://api.openai.com and https://api.openai.com