config: dead-code sweep — write_value, combobox-era helpers, propose_config_creation, ConfigReader wrapper, WorkflowStep.evaluate_condition

Đang mở
#142 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
52/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python

Hướng nghiên cứu

Start by reading the named helpers in src/profiles/core/config/ and checking their callers in src/ and tests/; inspect core/environment/workflow.py around the workflow condition evaluation. Remove the dead helpers, their re-exports and tests, and update core/config/__init__.py and AGENTS.md; for WorkflowStep.evaluate_condition, choose one evaluation seam. Done when the remaining production paths and tests use the retained APIs.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

code-quality

Dead code found in src/profiles/core/config/ (all verified by grepping src/ and tests/; complements the repo-wide #39 sweep)

  1. yaml_io.write_value (io/yaml_io.py:63-85) — zero production callers (only the io/__init__.py re-export and tests/core/config/io/test_yaml_io.py). Worse, it is the only non-atomic config writer left: plain p.open("w"), no temp file + os.replace — a crash mid-write truncates the user's config, exactly what #116 fixed elsewhere. Delete it, or reimplement on top of write_text_atomic if single-key writes are planned.

  2. Combobox-era helpers in service.py — get_directory_combobox_values (service.py:231-301), DirectoryEntry (service.py:22-35), find_config_by_name (service.py:75-89) — appear only in tests/core/config/test_service.py. The web UI consumes get_unique_directories + merge_config_overrides; no GUI module exists anymore.

  3. loader.propose_config_creation (loader.py:46-89) — dead in src/ (the real CLI path is app.init_default_config, the server path is launch.creation.propose_creation). It is also CLI I/O (print/input()) in the core layer (layering violation) and its ✓/✗ prints raise UnicodeEncodeError when stdout is piped through cp1252 on Windows.

  4. ConfigReader.find_configuration_by_hostname (reader.py:55-63) — wrapper with no production callers (production uses the pure service.find_configuration_by_hostname); when config=None it silently performs a full self.load() disk read — surprising I/O hidden behind a lookup-style method.

  5. WorkflowStep.evaluate_condition (models.py:94-102) — only called by tests; the engine bypasses it (core/environment/workflow.py:176-179 uses step.if_ + evaluate_hook_condition directly, because token substitution must happen first). Duplicated evaluation seam — remove or make the engine use it.

Suggested fix

Delete 1-4 (plus their re-exports and tests); for 5, pick one evaluation seam and remove the other. Update core/config/__init__.py __all__ and AGENTS.md in the same commit.

Ngôn ngữ chính
Python
Star
1
Fork
1
Merge trung bình
4 giờ 46 phút
Pull request đã merge (30 ngày)
55

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của falbany/ProFiles

Tất cả issue của falbany/ProFiles

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.