-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should pre-commit hooks compare PhET-iO APIs? #1325
Comments
I agree that would be helpful for our current process with the main drawback being the time to regenerate the API each time. But I also started brainstorming notes in https://github.com/phetsims/phet-io-wrappers/issues/555 about the fact that we may not want to continue with checking in API files all the time anyways, if we can move toward a more migration-oriented approach. Then this issue could morph into "on precommit, make sure there are migration rules to accompany API changes" somehow. |
OK, thanks for commenting! I tried for a while to use |
@zepumph and @pixelzoom and I discussed this yesterday, I'd like to self-assign for consideration. |
From today's meeting:
|
I don't agree with the decision to turn off CT testing of APIs. And I find it strange that you've made that decision without consulting the person (me) who is responsible for the majority of the sims in the current batch release https://github.com/orgs/phetsims/projects/44. It's easy for developers who aren't trying to get things ready for this release to save "I don't care about API changes". For me, unintentional API changes have been disruptive and confusing. Addressing the problem by hiding it is not helpful. |
We discussed this further with @pixelzoom @kathy-phet @jonathanolson and @arouinfar. We agreed to:
We are hoping to run checks in 15 seconds or less (of additional time). |
Also, designers will need to be able to regenerate API files since they develop the overrides, like in phetsims/gravity-and-orbits#440 |
@samreid can you provide more information? I do not use my local development environment to make commits. I do it directly through the GitHub web interface. |
I added pre-commit hooks that test to make sure there was no change to the PhET-iO API file for any repo that depends on the repo. If there is any change, the pre-commit hook will fail and the developer will need to check why the API has changed. If it is a desirable change and the developer has already regenerated the API file, the pre-commit hook will pass. On my Macbook air M1, testing one repo takes around 5 seconds. Testing sun which compares 8 repos takes about 13.5 seconds. Results are cached based on the batch. If one batch has "friction, gravity and orbits, states of matter" and another batch has "friction, gravity and orbits, and states of matter basics" that would be a cache miss. That will probably be OK for now. Let's try this and see how it goes for a while. I'll schedule a dev meeting agenda item to discuss it with the team, and I'll also mention it on slack since it is live. |
See meeting notes for Sept. 29. |
@liammulh are these the "meeting notes" that you're referring to? In the PhET Developer Meeting 2022 doc?
|
Yes, thank you, @pixelzoom. |
@samreid there is no one assigned to this and it is "done" in the dev meeting project board. What is next here? Is phetsims/perennial@6c06470 our tactic for "fast-enough" pre-commit hooks? That will not scale. If we close now we will just need to discuss this again in some months or years. What about a list of sims that is pruned that we use for pre-commit. This "shortened" list can be a living list of the sims that embody the most churn or possibility for breakage. Then we can still have a stable list that takes all designed sims that we use to test on CT. That should cover the vast majority of what this issue is trying to solve. What do you think? |
Perhaps a dev meeting for check-in or scheduling a subteam is the next step? But not sure if that topic should be "should we prune the PhET-iO APIs listed in the precommit checks" or "how can we improve the precommit hook developer experience?? |
@samreid will revisit the caching of files, especially PhET-IO API files. We are discussing the idea of a log of the time it takes to run precommit hooks. #1342 In keeping a pruned list, we would want to prioritize 3 or 4 stable PhET-IO sims that include full coverage of common code components used in PhET-IO sims. |
|
I switched to per-repo caching. It made things simpler and seems to be working well. I tested by running |
This issue falls in the scope of #1350 and does not need a separate entry in the "subgroups" column, so I'll move it to "done discussing". |
@zepumph and @matthew-blackman and I noticed that the API comparison tests weren't running like we thought, so we updated that in the commits. Being listed in perennial/phet-io-api-stable means it will check for breaking API changes in precommit hooks and on CT. |
While doing the review work for this issue I kept running into the below pre-commit-hook error Seems related to the changes @zepumph made in phetsims/natural-selection@482f421 These went away after running @samreid could this be the result of caching? It seemed like unexpected results the whole way through the debugging process without reaching an answer. Is there more insight you can provide?
|
The errors that @marlitas reported are presumably coming from the phetioCompareAPIs.js task -- that's the only place that I could find Here's an example of ProportionsBarNode in the Intro screen; they are the green bars with "{{value}}%" labels above them. Every error that @marlitas reported is related to the "{{value}}%" label. And those errors are all identical:
I don't understand why the "value" was expected to be "NaN%", and why is was actually "". |
@zepumph volunteered to take a look |
Looks like the initial value of these bar graphs involves dividing by 0, because there are 0 total bunnies. I didn't get a callback back to set these again until "adding a mate" which put the total at 2. This doesn't seem like a problem to me unless @pixelzoom wants to fix it. It is just nice to. . . "understand the NaN"(™). @pixelzoom please create an NS issue if you would prefer a different initial value (I personally wouldn't do that work). I cannot reproduce the original issue with an empty string as the "actual" value. Next steps are to work with @marlitas to see if she can still reproduce. In the future I think these kinds of bugs would be better if created as standalone issues, rather than contributing to this already giant issue. |
@marlitas over to you to schedule some time with me to reproduce. |
@zepumph I have tried reproducing on my end by checking out the commit as a branch, and I can't reproduce. Maybe there's a better way to try this, but I'm skeptical since after running Happy to meet tomorrow and try this together as well. |
My guess is a caching problem or something weird with the transpiler. If you encounter it again please open a separate issue. As for the main point of this issue, I believe all that I have left here is covered by #1350 (comment) (test less sims for pre-commit-hooks). @samreid, I'm ready to close. How about you? |
I often forget about checking for breaking changes and commit changes that break CT or interrupt other devs. I think it would be helpful for pre-commit hooks to check apis. This would add some time to commit hooks, my machine takes ~1.5 minutes to `grunt compare-phet-io-apis for every sim in perennial/data/phet-io-api-stable. That almost doubles the time. But we need to be in the habit of doing this anyway. Maybe this can be an option for hook-pre-commit.js or it can only be done for common code repos.
I tried to add it but hit errors using
execute
, I am out of time for now. Here is a patch for next time (I commented everything else out so I could just testcompare-phet-io-api
).The text was updated successfully, but these errors were encountered: