Skip to content

Conversation

@mitchellwrosen
Copy link
Member

@mitchellwrosen mitchellwrosen commented Oct 27, 2025

Overview

This PR equips run with an additional "staleness" check. A run x is considered "stale" if x (whether it exists in the codebase or is shadowed in the latest typechecked scratch file) depends (transitively) on some uncommitted update in the latest typechecked scratch file, via some intermediate dependency in the codebase.

The intention is to prevent the user from accidentally running old stuff, as they are likely to feel like their uncommitted updates in the latest typechecked scratch file are properly shadowing codebase definitions, especially since the x in run x can come from the scratch file.

If a run is stale, we print a path from the thing to an uncommitted updated thing in the scratch file, and recommend running edit.dependents on that thing. (N.B. an edit.dependencies is more like what you want here). Alternatively, we could recommend they comment out everything in the scratch file other than the thing they're trying to run.

Screenshot 2025-10-30 at 11 17 31 PM

Test coverage

I added a transcript to demonstrate the staleness check. I couldn't find where run was under test, because there wasn't a predicatably named run.md, so I also just tested a couple happy paths.

@ceedubs
Copy link
Contributor

ceedubs commented Oct 27, 2025

I often run a function that hasn't yet been added to my codebase or hasn't yet been updated in my codebase. Would this prevent that? Or is it only if there is one of its dependencies isn't in the scratch file and hasn't been updated yet?

@mitchellwrosen
Copy link
Member Author

@ceedubs the intention is to just prevent run x when x would have a different behavior if all of its transitive dependencies were pulled into the scratch file (i.e. x depends on y depends on z, where z is in the scratch file and different from the one in the codebase, and y isn't in the scratch file).

Kind of a stopgap solution, but easy to implement and better than the current behavior.

@aryairani aryairani added this to the 1.0.1 milestone Oct 29, 2025
@mitchellwrosen mitchellwrosen marked this pull request as ready for review October 31, 2025 17:12
@aryairani aryairani merged commit 888a184 into trunk Nov 1, 2025
32 checks passed
@aryairani aryairani deleted the 25-10-16-run-warn branch November 1, 2025 03:08
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.

4 participants