test: guard walkthrough.repl against public API drift - #194
test: guard walkthrough.repl against public API drift#194felipeofdev-ai wants to merge 1 commit into
Conversation
Add tests that the walkthrough file exists and still mentions key state-flow.api entry points that resolve. Fixes nubank#107 Signed-off-by: Felipe Fernandes <felipe.of.dev@gmail.com>
There was a problem hiding this comment.
🟡 Not ready to approve
One of the new tests can throw while slurping a missing walkthrough file, producing an error instead of a clear assertion failure (and failing when run in isolation).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
Adds a lightweight regression test to prevent doc/walkthrough.repl from drifting away from the library’s intended public API surface by asserting key walkthrough snippets remain present and that referenced state-flow.api vars still resolve.
Changes:
- Add a new test namespace that checks
doc/walkthrough.replexists. - Assert the walkthrough contains core teaching snippets and that the corresponding public API vars still resolve.
File summaries
| File | Description |
|---|---|
| test/state_flow/walkthrough_test.clj | New tests to guard the walkthrough doc against public API drift by checking file presence, content snippets, and resolvable state-flow.api symbols. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
| (let [body (slurp walkthrough-path) | ||
| required-snippets ["flow/swap-state" | ||
| "flow/get-state" | ||
| "match?" | ||
| "(flow \"" | ||
| "(run"]] | ||
| (doseq [snippet required-snippets] | ||
| (is (string/includes? body snippet) | ||
| (str "walkthrough should mention " (pr-str snippet)))) | ||
| (doseq [sym '[state-flow.api/swap-state | ||
| state-flow.api/get-state | ||
| state-flow.api/run | ||
| state-flow.api/match? | ||
| state-flow.api/flow]] | ||
| (is (some? (resolve sym)) | ||
| (str "API var missing: " sym)))))) |
Summary
state-flow.walkthrough-testassertingdoc/walkthrough.replexists, mentions the core teaching snippets, and that thosestate-flow.apivars still resolve.Why
Issue #107 asked for a way to keep the walkthrough current. A lightweight content + resolve guard catches deletions/renames of the public API surface the doc teaches, without requiring a full REPL evaluation harness.
Fixes #107
Test plan
lein test state-flow.walkthrough-test(0 failures)— Felipe Fernandes · Systems & Agentic AI Engineer
https://github.com/felipeofdev-ai · https://felipeofdev-ai.github.io/
Made with Cursor