Simplify CLI Preload Document Path#121
Conversation
📝 WalkthroughWalkthroughThe ChangesPreload delegation simplification
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Test
participant Ecli
participant OpenOrCreate
participant Filesystem
Test->>Ecli: preload_cli_document(path)
Ecli->>Ecli: resolve intended path
Ecli->>OpenOrCreate: open_or_create(intended)
alt file exists
OpenOrCreate->>Filesystem: read content
Filesystem-->>OpenOrCreate: file content
OpenOrCreate-->>Ecli: loaded buffer, modified=False
else file missing
OpenOrCreate-->>Ecli: empty buffer, modified=False
end
Test->>Ecli: save_file()
Ecli->>Filesystem: write content
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/ecli/core/Ecli.py (1)
787-802: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDrop the unused
_cli_intended_pathfield
preload_cli_document()is the only place that sets_cli_intended_path, and nothing reads it elsewhere.open_or_create()already setscurrent_file_path/file_path/filenameto the same resolved path, so this is dead state.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/ecli/core/Ecli.py` around lines 787 - 802, The `_cli_intended_path` state in `Ecli.preload_cli_document()` is dead and should be removed. Delete the assignment in `preload_cli_document()` and remove the unused field from `Ecli` if it is declared elsewhere, since `open_or_create()` already sets the active path fields (`current_file_path`, `file_path`, `filename`) to the resolved path.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/ecli/core/Ecli.py`:
- Around line 787-802: The `_cli_intended_path` state in
`Ecli.preload_cli_document()` is dead and should be removed. Delete the
assignment in `preload_cli_document()` and remove the unused field from `Ecli`
if it is declared elsewhere, since `open_or_create()` already sets the active
path fields (`current_file_path`, `file_path`, `filename`) to the resolved path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: bd32ec53-dcb9-4a18-a2a4-e6386aef9aa3
📒 Files selected for processing (2)
src/ecli/core/Ecli.pytests/core/test_file_open_safety.py



This PR removes dead fallback/probe logic from Ecli.preload_cli_document and delegates explicitly through open_or_create.
Changes:
Validation:
Manual smoke:
Non-goals:
Summary by CodeRabbit