Media hrefs resolve case-sensitively: Windows-authored folders get false missing-media on Linux
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 38/100
Hướng nghiên cứu
Bắt đầu tại src/sil_lift/_model.py, ở missing_media(), và so sánh phép thăm dò hai ứng viên của nó với _existing_file và thay đổi về việc phân giải tệp đi kèm trong #19. Quyết định giữa việc gộp im lặng, một phát hiện không khớp chữ hoa chữ thường của media hoặc tài liệu hóa; hoàn tất có nghĩa là hành vi được chọn đã được bao phủ và việc tra cứu thư mục đã được lưu trong bộ nhớ đệm xử lý toàn bộ vòng lặp media.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Lexicon.missing_media() resolves <media> and <illustration> hrefs with a plain is_file(), so a folder authored on Windows reports files as missing when it is read on a case-sensitive filesystem.
Dict.lift <illustration href="pictures\SDD.PNG"/>
pictures/sdd.png
Loads clean on Windows; on Linux sil-lift validate warns missing-media, and --strict fails the run. The image is right there.
The lookup is the two-candidate probe in missing_media() (src/sil_lift/_model.py):
candidates = [base / relative, base / subfolder[ref.kind] / relative]
if not any(candidate.is_file() for candidate in candidates):
This is the same Windows-authored/Linux-read mismatch that #19 fixed for .lift-ranges companions, in the one other place the library touches the filesystem.
Why this is not just "call _existing_file here too"
For a companion, folding the name is unambiguously right: resolve it or silently lose every range it defines. For media the opposite argument has real force. If an illustration href says SDD.PNG and the file is sdd.png, a web export, an APK build, or anything else serving that folder from a case-sensitive host will 404. A validator that silently resolves the mismatch reports a clean bill for a dictionary that is genuinely broken downstream — hiding the defect the check exists to surface.
Options:
- A. Fold silently. ~6 source lines. Consistent with companion resolution, kills the false positives, hides genuine portability defects.
- B. Fold, but report the mismatch as its own finding (
media-case-mismatch, warning).missing-mediagoes back to meaning "no such file under any spelling"; the new code says "found, but only case-insensitively — this will not survive a case-sensitive host." Costs a new problem code, which is a SemVer-covered interface here. - C. Leave it, document it. The status quo is at least honest about the portability problem, just unhelpfully worded and noisy.
B looks right, but it is a real interface decision and wants a deliberate call rather than a drive-by.
Two things to settle either way
- Only the final path component folds.
_existing_filesearches one directory listing for a name; it does not fold directory components. Media hrefs routinely includepictures/andaudio/, soPictures\x.pngagainst an on-diskpictures/would still misreport. Whether to fold directory components is more pressing here than it was for companions, where hrefs are basenames or same-folder relatives. - Cost.
missing_media()iterates every media ref in the document — thousands in a real dictionary — and media folders are large._existing_file'slistingscache has to be threaded across the whole loop so it is one directory read per folder per call, not one per reference.
Rough size
Option A: ~50 lines over 3 files. Option B: ~200-250 lines over ~10 — _model.py, _validate.py, _cli.py, docs/en/guides/{validate,cli,lift-export-interop}.md, a negative corpus fixture plus its PROVENANCE.md entry, test_validate.py, test_cli.py, and CHANGELOG.md.
Split out of review discussion on #19, which deliberately kept its scope to companion resolution.
- Ngôn ngữ chính
- Python
- Star
- 1
- Fork
- 0
- Merge trung bình
- 11 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của sillsdev/python-sil-lift
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
sillsdev/python-sil-lift#15 ·
-
bug
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
sillsdev/python-sil-lift#45 ·
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
sillsdev/python-sil-lift#35 ·
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
sillsdev/python-sil-lift#33 ·
-
Evaluate full API surface for anything unnecessaryCó thể đã có người làm @imnasnainaec đã nhận 20 ngày trước. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
sillsdev/python-sil-lift#30 · 1 bình luận · 1 người được giao ·
Tất cả issue của sillsdev/python-sil-lift
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
huggingface/sentence-transformers#4186 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
documentation good first issue
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 72/100
sujithputta02/Esapay#13 ·
-
bot-triaged module: correctness (silent) module: mps module: NaNs and Infs triage review
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
README: CI link/badge checkĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
SCIInstitute/SCIRun#2842 ·
Maintainer thường phản hồi trong vòng 3 ngày