Skip to content

fix: 处理问题 #189#195

Open
liaoyl830 wants to merge 1 commit into
shenminglinyi:masterfrom
liaoyl830:fix/issue-189
Open

fix: 处理问题 #189#195
liaoyl830 wants to merge 1 commit into
shenminglinyi:masterfrom
liaoyl830:fix/issue-189

Conversation

@liaoyl830

@liaoyl830 liaoyl830 commented Jun 9, 2026

Copy link
Copy Markdown

Summary

  • Make chapter continuity opening auto-fix opt-in by defaulting ChapterContinuityPolicy.auto_fix_threshold to 0.0
  • Keep continuity warnings active while preventing default silent manuscript rewrites
  • Preserve explicit opt-in auto-fix behavior for callers that configure a positive threshold
  • Update nearby comments to describe warning-only default behavior

Verification

  • PYTHONPATH='/e/Claude Projects/PlotPilot Pr/PlotPilot' python -m pytest '/e/Claude Projects/PlotPilot Pr/PlotPilot/tests/unit/application/engine/test_chapter_continuity.py' -v → 5 passed
  • python -m py_compile '/e/Claude Projects/PlotPilot Pr/PlotPilot/application/engine/services/chapter_bridge_service.py' '/e/Claude Projects/PlotPilot Pr/PlotPilot/engine/runtime/daemon_host.py' '/e/Claude Projects/PlotPilot Pr/PlotPilot/engine/runtime/legacy_writing_delegate.py' '/e/Claude Projects/PlotPilot Pr/PlotPilot/tests/unit/application/engine/test_chapter_continuity.py'
  • git diff --check

Closes #189

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Chapter continuity validation now defaults to warning-only mode; automatic opening adjustments require explicit policy configuration.
  • Tests

    • Added tests to verify default continuity behavior and confirm auto-fix remains disabled by default.

@liaoyl830 liaoyl830 requested a review from shenminglinyi as a code owner June 9, 2026 13:06
@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4b31a6ce-eb9a-48c8-ae03-c6d300e11e09

📥 Commits

Reviewing files that changed from the base of the PR and between 1c7df5e and 7e9e062.

📒 Files selected for processing (4)
  • application/engine/services/chapter_bridge_service.py
  • engine/runtime/daemon_host.py
  • engine/runtime/legacy_writing_delegate.py
  • tests/unit/application/engine/test_chapter_continuity.py

📝 Walkthrough

Walkthrough

This PR changes the default continuity policy to disable automatic chapter opening rewrites. The auto_fix_threshold defaults to 0.0 and should_auto_fix() now requires the threshold to be explicitly configured above zero, preventing accidental automatic text modifications unless the caller opts in.

Changes

Disable automatic opening continuity fix by default

Layer / File(s) Summary
Policy default and auto-fix logic
application/engine/services/chapter_bridge_service.py
ChapterContinuityPolicy.auto_fix_threshold default changed from 0.4 to 0.0. Method should_auto_fix(score) updated to return true only when auto_fix_threshold > 0 AND score < auto_fix_threshold, preventing automatic fixes under default policy. Module-level docstring reflects warning-only default behavior.
Documentation and comment updates
engine/runtime/daemon_host.py, engine/runtime/legacy_writing_delegate.py
Docstrings updated in _continuity_self_check and legacy_writing_delegate to document warning-only default and conditional auto-fix behavior based on explicit policy configuration, replacing prior threshold-based and round-capped repair descriptions.
Test coverage for default behavior
tests/unit/application/engine/test_chapter_continuity.py
Added test verifying default policy: needs_attention is true below threshold, but should_auto_fix is false for all test cases (sub-threshold, 0.0, negative). Added integration test confirming ChapterBridgeService.auto_fix_opening does not invoke text helper under default policy with monkeypatched failure detection.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • shenminglinyi

Poem

🐰 A rabbit hops through policy fields,
Where auto-fix no longer yields,
"Warn by default!" the new law sings,
No accidental text-altering things,
Only with care shall rewrites take wing!

🚥 Pre-merge checks | ✅ 1 | ❌ 4

❌ Failed checks (3 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete; it lacks completion of all required template sections including 变更类型 checkboxes, full 架构影响 details, and 风险说明. Complete all sections of the provided template: check the 'fix' category, explicitly fill all 架构影响 fields, add 风险说明 (even if 'none'), and ensure bash test commands are present.
Linked Issues check ⚠️ Warning The PR partially addresses issue #189 by making auto-fix opt-in (preventing accidental rewrites), but does not implement the three requested mitigations: preserving pre-adjustment versions, outputting diffs, or adding manual confirmation. Either implement all three requested mitigations (preserve original, output diff, manual confirmation) or update issue #189 to reflect that only the opt-in behavior change was chosen.
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title references issue #189 but fails to concisely describe the main change; it is vague and does not clearly convey the actual modification (defaulting auto-fix to opt-in). Replace with a more descriptive title such as 'fix: Make chapter continuity auto-fix opt-in by default' to clearly summarize the core behavior change.
✅ Passed checks (1 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed All changes (default threshold modification, logic updates, docstring updates, and new tests) are directly scoped to address the auto-fix behavior concern raised in issue #189; no out-of-scope changes detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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