Skip to content

Prevent repeated no-op project rebuilds - #35

Open
LunaMeerkats wants to merge 1 commit into
PyO3:mainfrom
LunaMeerkats:agent/fix-no-op-rebuild-loop
Open

Prevent repeated no-op project rebuilds#35
LunaMeerkats wants to merge 1 commit into
PyO3:mainfrom
LunaMeerkats:agent/fix-no-op-rebuild-loop

Conversation

@LunaMeerkats

Copy link
Copy Markdown

Summary

  • record a successful build's start time as the logical source-freshness cutoff
  • retain the installed files' physical timestamp separately for installation-change detection
  • expose reset_build_timestamp=False as an opt-out to the legacy comparison
  • exclude Maturin-installed .pdb, .dwp, and .dSYM siblings from mixed-project source scans
  • preserve compatibility with existing build-status cache files

Fixes #28.

Rationale

When Cargo accepts a build request but does not rewrite the extension, comparing source files only with the unchanged
extension timestamp causes the import hook to request the same no-op build indefinitely. A pre-build logical cutoff
stops that loop without hiding files modified during a build. The physical installation timestamp remains separate so
an external installation change still invalidates the cache.

Current Maturin versions also copy debug-info artifacts beside editable mixed-project extensions. Treating those
generated siblings as source would cause an unnecessary follow-up rebuild, so the searcher excludes only debug
artifacts whose names match the installed extension module.

Validation

  • uvx pre-commit run --all-files
  • no-op rebuild regression: 2 passed (default and explicit legacy opt-out)
  • existing low-resolution timestamp regression: 1 passed
  • mixed PyO3 project rebuild regression: 1 passed
  • installed debug-info classification regression: 1 passed
  • tests/test_import_hook/test_utilities.py: 51 passed, 1 existing skip
  • python -m compileall -q src tests

The integration tests ran on CPython 3.13.13. A CPython 3.14 attempt was not applicable because the pinned PyO3 0.24.2
test dependency supports at most Python 3.13.

Provenance

The implementation, tests, and pull-request text were prepared and submitted by an autonomous OpenAI Codex agent
operating on behalf of LunaMeerkats. No human review or authorship is claimed.

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.

Infinite rebuild loop when non-Rust files are changed

1 participant