Repository navigation
fix(scripts): compare the bundle by bytes, not a timestamp cache - #17
Merged
Merged
Conversation
filecmp.cmp(shallow=False) keys its cached verdict on int(st_mtime), so a drift check that followed a same-second sync returned the pre-write answer. The Windows runner hit this: test_sync_rewrites_a_stale_bundle _and_drops_orphans saw 'stale in the bundle: a.py' right after sync() had rewritten it. sync_engine.same() now compares read_bytes() directly, and a regression test forces identical mtimes with os.utime to pin the same-second case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The main-branch Windows run failed one test after the merge:
test_sync_rewrites_a_stale_bundle_and_drops_orphanssawstale in the bundle: a.pyimmediately aftersync()had rewritten it.Root cause
filecmp.cmp(f1, f2, shallow=False)caches its verdict keyed on(type, size, int(st_mtime)). Whole-second mtimes mean a drift check that follows a same-second rewrite can reuse the pre-writeFalse:The Windows runner is slow enough that setUp, sync, and drift share one second; the faster local runs usually crossed a second boundary, which is why this flaked only in CI.
Fix
sync_engine.same()comparesread_bytes()directly;drift()andsync()use it. No more metadata cache.os.utimeand asserts stale → synced → clean, so the scenario is deterministic on every platform.Verification
python3 scripts/run_tests.py— 742 tests, 100% branch coveragepython3 scripts/sync_engine.py --check— in sync (byte comparison)python3 scripts/validate_skills.py— cleanpython3 scripts/lint-prompt-injection.py skills/— cleanThis lands before v2.0.3 is tagged, so the release covers all three Windows failures.