api: deprecate UserItem.CSVImport.validate_file_for_import in favor of a safer replacement
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
Research direction
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.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- Python
- Stars
- 716
- Forks
- 446
- Avg merge
- 8d 8h
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from tableau/server-client-python
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
tableau/server-client-python#1865 ·
-
in-progress
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
tableau/server-client-python#1829 · 1 comment ·
-
enhancement gap needs investigation
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
tableau/server-client-python#1322 · 1 comment ·
-
[Type2] Allow Incremental Refresh type schedules to be added via `server.schedules.add_to_schedule` Openhelp wanted Server-Side Enhancement ui-exists
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
tableau/server-client-python#1101 · 3 comments ·
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
tableau/server-client-python#783 · 5 comments ·
All issues in tableau/server-client-python
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
zostera/django-bootstrap4#894 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
use-agent-os/agent-os#3276 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
NousResearch/hermes-agent#117848 ·