Repository navigation
lean_closure.py: score the working tree's repo, merges and faster proofs - #1663
Merged
Merged
Conversation
Three ways `score` misled: * It read the repository it was installed in, not the working directory's, so running main's copy from another worktree scored main. Every command now reads the working directory's repository (`--repo` for another). * It compared with REF itself, so a branch behind it counted REF's newer changes as its own. It now compares with where the branch forked. * A module that merges others took only its own old time, and a run that rebuilt a merged module was not counted as rebuilding it. `--merge NEW=A,B` gives NEW the modules' times together (less `IMPORT_TIME` for each but one) and maps their rebuilds to NEW. * Modules the branch changed kept REF's times, so making proofs faster scored as nothing. `--times FILE` and `--profile-branch` (the profile of the branch's local build) give them the branch's times, and those left without are listed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TyNFiywMtzf7eAdKcGMA5z
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.
Why
Other sessions used
ci/lean_closure.py scoreafter #1641 and found four ways it misled.origin/maincounted main's newer changes as its own. In one example, 670 modules looked changed instead of 5.The change
All in
ci/lean_closure.py:Every command reads the working directory's repository by default, with
--repofor another. The tool setslean_shards.LEANaccordingly.scorecompares withgit merge-base REF HEAD.score --merge NEW=A,B,…gives NEW the members' times together, lessIMPORT_TIMEfor each member but one. A run's rebuilt members map to NEW. If NEW has a time from the branch (below), that time wins.Branch times for the modules whose sources differ from the fork point:
score --times FILEreads them from a JSON object of module names and seconds;score --profile-branchreads them from the profile of the local build underlean/.lake, after building the branch.The changed modules left without a branch time are listed on stderr, since they keep REF's time (or the median, if new).
CLAUDE.md's paragraph on the tool mentions
--mergeand--profile-branch.Tests
ci/test_check_lean_closure.pygains 7 tests:use_reporeading another repository's modules.python3 -m unittest discover -s ci -p 'test_check_*.py': OK.Checked by hand: run from the worktree of the closed #1640, the tool now scores that worktree's 5 changed modules, where before it scored 670.
🤖 Generated with Claude Code
https://claude.ai/code/session_01TyNFiywMtzf7eAdKcGMA5z
Generated by Claude Code