Skip to content

Use Python for nanosecond-accurate source timestamp caching - #1

Merged
hallee merged 2 commits into
mainfrom
fix/restore-nanosecond-mtimes
Oct 31, 2026
Merged

hallee merged 2 commits into
mainfrom
fix/restore-nanosecond-mtimes

Conversation

@hallee

@hallee hallee commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

On macOS, system Ruby's File.utime truncates source mtimes to microseconds: a cached timestamp ending in .123456789 is restored as .123456000. Unchanged build inputs then have timestamps that differ from the cached Xcode build records.

Move both timestamp operations into one Python standard-library script. Storage reads st_mtime_ns; restoration uses os.utime(ns=...), preserving exact integer nanoseconds throughout. Cache transport still uses actions/cache through the composite action.

The metadata filename, schema, and content hashes remain compatible with existing caches. Preserve the default source patterns, custom brace alternatives, hidden-directory and symlink behavior, and cache-directory exclusions. File hashes are streamed, and recursive scans skip excluded cache directories.

Validation: reproduced file and directory precision failures with macOS system Ruby 2.6.10, then verified the Python implementation with local checks on Python 3.9.6 and 3.15.2. Checks covered exact timestamp restoration, legacy metadata compatibility, glob behavior, cache-directory exclusions, and changed or missing inputs. Action YAML parsing and git diff --check also pass.

The action now requires python3 on the runner, available through Xcode's command-line tools on macOS, with no third-party Python packages. Once this fix is released through v1, consumers such as Pub can remove their separate timestamp-restoration workaround.

@hallee
hallee merged commit dd5acce into main Oct 31, 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.

1 participant