api: deprecate UserItem.CSVImport.validate_file_for_import in favor of a safer replacement
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
Hướng nghiên cứu
Locate UserItem.CSVImport and its validate_file_for_import entry point, then inspect the samples/ callers and the existing _redact_password_column flow. Add the structured replacement and adapt the old method with its deprecation warning, ensuring the samples use the new method. Done means callers receive structured errors without raw field values while the legacy return shape remains available.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
validate_file_for_import is public API and its current shape invited the class of bug that #1829 patched. Proposing an additive replacement plus a deprecation on the existing method - no breaking change now, removal on the next major version.
Current signature:
def validate_file_for_import(csv_file, logger) -> tuple[int, list[str]]
Two problems with the shape:
- Logger as a parameter made #1829 possible in the first place - a caller-supplied verbose logger could receive credential material. Prefer a module logger with documented levels.
- Returning raw invalid lines forces callers to re-parse to give a useful error, and hands credential-bearing rows back to the caller (mitigated by
_redact_password_columnbut the shape invites the bug).
Proposed replacement:
@dataclass(frozen=True)
class CsvImportError:
row: int
column: ColumnType | None
reason: str # never the raw field value
@dataclass
class CsvImportResult:
valid_count: int
errors: list[CsvImportError]
@staticmethod
def validate_import_file(csv_file) -> CsvImportResult: ...
Migration:
- Add
validate_import_filereturning the structured result. - Reimplement
validate_file_for_importas a thin wrapper that emitsDeprecationWarningand adapts back to the old return shape. - Update
samples/to use the new method. - Remove the deprecated method on the next major version bump.
🤖 Generated with Claude Code
- Ngôn ngữ chính
- Python
- Star
- 716
- Fork
- 446
- Merge trung bình
- 8 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 2
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 tableau/server-client-python
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
tableau/server-client-python#1865 ·
-
in-progress
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
tableau/server-client-python#1829 · 1 bình luận ·
-
enhancement gap needs investigation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
tableau/server-client-python#1322 · 1 bình luận ·
-
[Type2] Allow Incremental Refresh type schedules to be added via `server.schedules.add_to_schedule` Đang mởhelp wanted Server-Side Enhancement ui-exists
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
tableau/server-client-python#1101 · 3 bình luận ·
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
tableau/server-client-python#783 · 5 bình luận ·
Tất cả issue của tableau/server-client-python
Issue tương tự
-
link-check link-check:sphinx-theme
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
OpenHands/extensions#626 · 1 bình luận ·
-
Change observation tooltip text Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
CSCfi/sd-search-api#39 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100