Add test coverage for 4 new chapter pipeline steps#147
Conversation
…etaphor reduction, copy edit Agent-Logs-Url: https://github.com/CyberSecDef/NovelForge/sessions/bcbc6a0d-1638-40f7-adfd-c4e78e35f3b5 Co-authored-by: CyberSecDef <17597068+CyberSecDef@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds dedicated unit + integration tests to ensure four always-on chapter-generation refinement steps (voice/dialogue differentiation, human oddities, metaphor reduction, copy edit) remain wired correctly and don’t silently regress due to prompt/template variable changes.
Changes:
- Extend the shared
mock_llmcanned response router to return step-specific outputs for the four new pipeline actions. - Add a new test module that:
- unit-tests each prompt builder for structure, variable injection, and determinism
- integration-tests that all four steps execute within
_run_all_chapter_agentsby recordingactionstrings at the actual LLM call site.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
tests/conftest.py |
Adds canned LLM responses for the four new refinement actions so tests don’t fall back to the generic response. |
tests/test_new_pipeline_prompts.py |
New unit + integration tests covering prompt builders and verifying the four pipeline steps execute during a full chapter pipeline run. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This is ready to merge |
|
@copilot |
Reviewed and approved. ✅ Summary of changes (commit
CI results:
Safe to merge. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Four production pipeline steps (voice & dialogue differentiation, human oddities, metaphor reduction, copy edit) execute on every chapter generation with no dedicated tests — regressions in template variables or prompt keys would be silent.
Changes
tests/conftest.py_canned_llm_response()so these actions no longer fall through to the generic fallback:"voice" in act and "dialogue" in act"human oddities" in act"metaphor" in act"copy edit" in acttests/test_new_pipeline_prompts.py(new)_run_all_chapter_agentsby patching a recording wrapper ontonovelforge.agents.chapter._helpers.call_llm(the actual call site) and asserting each action string appears:_action_present()helper de-duplicates the substring-matching assertions across the 4 per-step tests and the combinedtest_all_four_steps_execute_in_single_runtestWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
api.openai.com/usr/bin/python3 python3 -m pytest tests/ -x -q --tb=short(dns block)/usr/bin/python3 python3 -m pytest tests/ -q --cov=novelforge --cov-report=term-missing --cov-fail-under=85(dns block)If you need me to access, download, or install something from one of these locations, you can either: