Skip to content

Make BasicListInfo 'size' a NotRequired key - #218

Closed
artem-sitd wants to merge 1 commit into
aio-libs:masterfrom
artem-sitd:master
Closed

artem-sitd wants to merge 1 commit into
aio-libs:masterfrom
artem-sitd:master

Conversation

@artem-sitd

Copy link
Copy Markdown

Fix #217.

parse_list_line_* are annotated as returning tuple[PurePosixPath, BasicListInfo], but for Windows directory entries (<DIR>) the returned info dict has no size key, which the code masks with # type: ignore[return-value] pragmas. Consumers then get a false static guarantee that size is always present.

Make BasicListInfo.size NotRequired[str] (backported via existing typing_extensions import for Python < 3.11).

Verified: mypy (strict) passes with no new results, ruff clean, full test suite passes (792 tests).

@greptile-apps

greptile-apps Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Changes the type contract for FTP file listing data.

Safe to merge based on the reviewed change: the type definition now reflects Windows directory output without weakening the Unix entry type.

What we checked:

  • Unix entries keep their size: UnixListInfo is a separate type and still requires size. T-Rex
  • The type definitions were compared before and after the change to allow a size-less BasicListInfo while keeping UnixListInfo.size required. T-Rex
  • LIST parsing was exercised, and a Windows directory entry without size appeared in both runs, consistent with the updated type definitions. T-Rex
  • All tests in tests/test_list_fallback.py passed and static type validation confirmed the updated acceptance/rejection rules for size-less BasicListInfo while UnixListInfo.size remained required. T-Rex

T-Rex evidence

Evidence from the check

  • The executed script extracts each revision’s TypedDict definitions, checks typed consumers, runs LIST parsers, and invokes focused tests.

Command output from the check

  • The command checked parent-revision definitions and current parser behavior; mypy required BasicListInfo size, while a Windows directory lacked it.

Command output from the check

  • The command checked current definitions and parser behavior; mypy rejected the unsafe size-requiring consumer, UnixListInfo still required size, and all 11 focused tests passed.

Evidence from the check

  • The executed script extracts each revision’s TypedDict definitions, checks typed consumers, runs LIST parsers, and invokes focused tests.

Command output from the check

  • The command checked parent-revision definitions and current parser behavior; mypy required BasicListInfo size, while a Windows directory lacked it.

Command output from the check

  • The command checked current definitions and parser behavior; mypy rejected the unsafe size-requiring consumer, UnixListInfo still required size, and all 11 focused tests passed.

View artifacts

Reviews (1) · Last reviewed commit: "Annotate BasicListInfo.size as NotRequir..." · Reviewed by Greptile

@pohmelie

Copy link
Copy Markdown
Collaborator

Fixed more radically, since all fields are optional according to RFC. Fixed in 11d8dd9

Thank you for an pr

@pohmelie pohmelie closed this Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BasicListInfo "size" should be NotRequired

2 participants