Skip to content

fix(fsspec): keep last_modified and version in ls() detail entries - #791

Open
ccacciari wants to merge 2 commits into
developmentseed:mainfrom
ccacciari:fix/fsspec-ls-last-modified
Open

ccacciari wants to merge 2 commits into
developmentseed:mainfrom
ccacciari:fix/fsspec-ls-last-modified

Conversation

@ccacciari

@ccacciari ccacciari commented Oct 11, 2026 •

Copy link
Copy Markdown

FsspecStore._ls builds its file entries from list_with_delimiter_async, whose ObjectMeta already carries last_modified and version, but keeps only name, size, type and e_tag. So fs.ls(path, detail=True) gives no modification time, while fs.info(path) on the same file gives last_modified and version from its HEAD request.

The two disagree in practice:

  • ls(detail=True) users (file browsers, sync tools) see no date for any object, and fsspec's generic modified() cannot be answered from a listing.
  • _info answers from the directory cache when the parent was listed, so whether info() returns last_modified depends on whether the parent was listed first.

This adds both fields to each file entry, so a listed entry has the same fields info() returns. It needs no extra request, since the values are already in the listing response. The timestamps differ only in precision: a listing reports milliseconds, while HEAD's Last-Modified header has whole seconds. Directory entries (common prefixes) are unchanged: they have no metadata of their own.

The new test lists a file, clears the cache so info() goes to the store, and checks that the two agree on version and on last_modified to within a second.

@ds-release-bot ds-release-bot Bot added the fix label Oct 11, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant