Closed jessegreenberg closed 1 year ago
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 execute
to run grunt compare-phet-io-api
for repos with stable apis but for some reason could not get execute
to work with grunt
. I am starting to see diminishing returns from this so I will let it go. And it also sounds like there may be some process changes coming related to this so Ill close.
@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 https://github.com/phetsims/gravity-and-orbits/issues/440
Also, designers will need to be able to regenerate API files since they develop the overrides.
@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 https://github.com/phetsims/perennial/commit/6c0647099b364dcc1d9fb862282d858ea780e707 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?
Just a note that this has been working nicely for me. It's caught a couple of inadvertent API changes that I made. And it has not had a noticeable impact on my commit times.
In https://github.com/phetsims/sun/issues/790#issuecomment-1268696241 @zepumph said:
I can't help but feel like part of the issue is removing many sims from the API checking conversation in https://github.com/phetsims/perennial/commit/6c0647099b364dcc1d9fb862282d858ea780e707.
@samreid there is no one assigned to this and it is "done" in the dev meeting project board. What is next here? Is https://github.com/phetsims/perennial/commit/6c0647099b364dcc1d9fb862282d858ea780e707 our tactic for "fast-enough" pre-commit hooks? That will not scale.
I'm glad the list has more complete coverage at the moment while we are making lots of common code changes, in the future when the list takes too long to check everything then we can introduce a pruned list. But I also feel one day we should do more comprehensive timing testing of the precommit hooks and make sure our time is being spent wisely.
That is all fine and good, but doesn't really get to the bottom of if it was acceptable to remove the sims in https://github.com/phetsims/perennial/commit/6c0647099b364dcc1d9fb862282d858ea780e707 from our list. Are EFAC and SOM acceptable to have API changes because they haven't been published in a year and may not be for another year? That seems like a hard sell to the person that will have to do a full review of the API when next it is visited.
in the future when the list takes too long to check everything then we can introduce a pruned list.
What do you mean by "too long"? It is run by each dev potentially >10 times a day. Shouldn't it be perfectly sized from now in perpetuity?
That is all fine and good, but doesn't really get to the bottom of if it was acceptable to remove the sims in https://github.com/phetsims/perennial/commit/6c0647099b364dcc1d9fb862282d858ea780e707 from our list. Are EFAC and SOM acceptable to have API changes because they haven't been published in a year and may not be for another year?
That decision was made during the developer meeting and I'm surprised to see it was not well-documented in the notes. We removed EFAC and SOM because they were not in the "forward migration" channel of the spreadsheet. Sun was removed because of https://github.com/phetsims/scenery-phet/issues/439. I think density was removed since it hasn't had a phet-io release yet, but if I were the lead dev, I may opt to leave it checked so I could keep track of the changes.
What do you mean by "too long"? It is run by each dev potentially >10 times a day. Shouldn't it be perfectly sized from now in perpetuity?
I am not a big fan of the time it takes to run all the precommit hooks, but it seems the dev team generally votes in favor of more complete testing. Happy to discuss further, perhaps at an upcoming phet-io meeting may be most efficient?
I am sorry I wasn't able to attend that meeting, because it likely would have cleared up much of this confusion on my end. Thanks for your patience.
I think density was removed since it hasn't had a phet-io release yet
Density has been released, and the "Batch release" was originally only to add Studio support for setting mystery blocks in that sim (oh how time has changed that).
Part of my frustration is that with your amazing CacheLayer implementation, I had ~2 weeks of incredibly nice and fast git hooks, and now it is back to >1-2 minutes per run. That makes me sad. Happy to go with what the team prefers, but I'm skeptical that others wouldn't prefer this middle ground proposed in https://github.com/phetsims/chipper/issues/1325#issuecomment-1267229939
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. https://github.com/phetsims/chipper/issues/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 node ../chipper/js/scripts/hook-pre-commit.js --console
in gravity-and-orbits, then again in sun, and saw that sun no longer needed to test gravity-and-orbits with its batch. It seems the next step is discussion of pruned lists.
This issue falls in the scope of https://github.com/phetsims/chipper/issues/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 https://github.com/phetsims/natural-selection/commit/482f421eb9213365e86c0e88ac2d0d3473e4f129
These went away after running grunt generate-phet-io-api
, however no api files changed.
@pixelzoom and I investigated and couldn't understand why these errors are occurring in the first place.
@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 _data.initialState
. What's curious is that every one of those errors is from ProportionsBarNode.ts, and they correspond to the lines that @zepumph changed in https://github.com/phetsims/natural-selection/commit/482f421eb9213365e86c0e88ac2d0d3473e4f129.
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:
Expected: {"units":null,"validValues":null,"value":"NaN%"} actual: {"value":"","validValues":null,"units":null}
I don't understand why the "value" was expected to be "NaN%", and why is was actually "".
@zepumph volunteered to take a look
I don't understand why the "value" was expected to be "NaN%
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 grunt generate-phet-io-api
there were no file changes but the error went away. Because of that I don't know what state the code needs to be in to hit that error...
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 https://github.com/phetsims/chipper/issues/1350#issuecomment-1344767576 (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
).