Skip to content

[@types/underscore] Collection and Array Tests - Usage Tests Cleanup#47543

Merged
typescript-bot merged 5 commits intoDefinitelyTyped:masterfrom
reubenrybnik:underscore-tests-usage-tests-cleanup
Sep 25, 2020
Merged

[@types/underscore] Collection and Array Tests - Usage Tests Cleanup#47543
typescript-bot merged 5 commits intoDefinitelyTyped:masterfrom
reubenrybnik:underscore-tests-usage-tests-cleanup

Conversation

@reubenrybnik
Copy link
Copy Markdown
Contributor

@reubenrybnik reubenrybnik commented Sep 13, 2020

This is the last of three planned cleanup PRs for #45201 and includes the following changes:

If folks feel that this PR contains more changes than they'd like to review in one go, I'd be happy to split this into three or four PRs that each address a different set of usage tests.

@typescript-bot typescript-bot added Popular package This PR affects a popular package (as counted by NPM download counts). Author is Owner The author of this PR is a listed owner of the package. labels Sep 13, 2020
@typescript-bot
Copy link
Copy Markdown
Contributor

typescript-bot commented Sep 13, 2020

@reubenrybnik Thank you for submitting this PR!

This is a live comment which I will keep updated.

1 package in this PR

Code Reviews

Because you edited one package and updated the tests (👏), I can help you merge this PR once someone else signs off on it.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • ✅ Most recent commit is approved by type definition owners or DT maintainers

All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 47543,
  "author": "reubenrybnik",
  "owners": [
    "borisyankov",
    "jbaldwin",
    "ccurrens",
    "confususs",
    "jgonggrijp",
    "ffflorian",
    "regevbr",
    "peterblazejewicz",
    "reubenrybnik"
  ],
  "dangerLevel": "ScopedAndTested",
  "headCommitAbbrOid": "7cbc73a",
  "headCommitOid": "7cbc73a9a5ea6ce47b53e4a7c268a615cd62851a",
  "mergeIsRequested": true,
  "stalenessInDays": 0,
  "lastPushDate": "2020-09-25T04:36:25.000Z",
  "reopenedDate": "2020-09-25T04:36:45.000Z",
  "lastCommentDate": "2020-09-25T16:57:23.000Z",
  "maintainerBlessed": false,
  "reviewLink": "https://github.com/DefinitelyTyped/DefinitelyTyped/pull/47543/files",
  "hasMergeConflict": false,
  "authorIsOwner": true,
  "isFirstContribution": false,
  "popularityLevel": "Popular",
  "newPackages": [],
  "packages": [
    "underscore"
  ],
  "files": [
    {
      "path": "types/underscore/index.d.ts",
      "kind": "definition",
      "package": "underscore"
    },
    {
      "path": "types/underscore/underscore-tests.ts",
      "kind": "test",
      "package": "underscore"
    }
  ],
  "hasDismissedReview": false,
  "ciResult": "pass",
  "lastReviewDate": "2020-09-25T09:50:06.000Z",
  "reviewersWithStaleReviews": [],
  "approvalFlags": 2,
  "isChangesRequested": false
}

@typescript-bot
Copy link
Copy Markdown
Contributor

🔔 @borisyankov @jbaldwin @ccurrens @confususs @jgonggrijp @ffflorian @regevbr @peterblazejewicz — please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

@reubenrybnik
Copy link
Copy Markdown
Contributor Author

reubenrybnik commented Sep 13, 2020

These ended up being way more naturally organized than I thought they were (I hadn't originally anticipated being able to divide these into sections - at least not without moving a lot more stuff around), and except for chaining, each, reduce*, and map there was generally only one test function per Underscore function. In retrospect, I wish I would have cleaned up the existing tests for each function as I was adding their combinatorial tests rather than doing a larger cleanup PR like this.

I could potentially move the usage examples for each function to just above their corresponding combinatorial examples if folks think that that would be a better way to organize this file.

@typescript-bot
Copy link
Copy Markdown
Contributor

👋 Hi there! I’ve run some quick measurements against master and your PR. These metrics should help the humans reviewing this PR gauge whether it might negatively affect compile times or editor responsiveness for users who install these typings.

Let’s review the numbers, shall we?

Comparison details 📊
master #47543 diff
Batch compilation
Memory usage (MiB) 68.6 70.8 +3.3%
Type count 14711 14361 -2%
Assignability cache size 1754 1509 -14%
Language service
Samples taken 8350 7983 -4%
Identifiers in tests 8350 7983 -4%
getCompletionsAtPosition
    Mean duration (ms) 198.6 203.5 +2.5%
    Mean CV 6.8% 7.0%
    Worst duration (ms) 453.8 451.6 -0.5%
    Worst identifier context _
getQuickInfoAtPosition
    Mean duration (ms) 193.6 199.6 +3.1%
    Mean CV 6.8% 7.2% +6.7%
    Worst duration (ms) 431.7 453.8 +5.1%
    Worst identifier extractChainTypes extractChainTypes

It looks like nothing changed too much. I won’t post performance data again unless it gets worse.

@typescript-bot typescript-bot added the Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. label Sep 13, 2020
Copy link
Copy Markdown
Contributor

@jgonggrijp jgonggrijp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the current diff, it takes too much energy to track for each removal whether it was completely removed or whether just the notation changed and the diff algorithm moved it next to a nonmatching addition somewhere else in the file. Would it be possible to split this PR in three reviews, but rather than splitting by section, splitting by type of change? I'm thinking along the following lines.

Subset A (notation changes):

  • Removes EnumerableKey because it was causing issues with linting between different versions of TS (see #45201 (comment) for more details)
  • Updates usage tests to use $ExpectType

Subset B (order changes, see also comment below):

  • Splits usage tests into sections

Subset C (addition and removal of tests):

  • Removes a few redundant or impractical tests (pretty sure around 15 tests in total and mostly redundant or overly simple chain tests)
  • Adds some more chain tests

I don't care about the order between these subsets (whatever is most convenient for you), and we could do the opposite of what you did in the grand draft PR, i.e., construct the sub-PRs just for review and still merge the present one after we're done with those. You could create PRs on your own fork to give you more control over available branches, since you'll probably want to build one set of changes on top of another.

Regarding your later comment, I do think I'd prefer all tests for a given function to be in close proximity to each other. For review purposes, moving the usage tests for each function directly above its combinatorial tests (or the latter below the former) should be part of subset B.

@typescript-bot typescript-bot added the Revision needed This PR needs code changes before it can be merged. label Sep 14, 2020
@typescript-bot
Copy link
Copy Markdown
Contributor

@reubenrybnik One or more reviewers has requested changes. Please address their comments. I'll be back once they sign off or you've pushed new commits or comments. If you disagree with the reviewer's comments, you can "dismiss" the review using GitHub's review UI. Thank you!

@reubenrybnik
Copy link
Copy Markdown
Contributor Author

Works for me @jgonggrijp! I think I'll go C then A then B, but I think I'll need to move the removal of EnumerableKey into C. I'll put this into a draft status, force push it back to its original base, use it as an aggregate branch to merge the sub-PRs into, and reopen this for final merge once everything's back in it.

@reubenrybnik reubenrybnik marked this pull request as draft September 16, 2020 05:45
@reubenrybnik
Copy link
Copy Markdown
Contributor Author

The original commits and diff will be available for reference in master...reubenrybnik:underscore-tests-usage-tests-cleanup-old.

@reubenrybnik reubenrybnik force-pushed the underscore-tests-usage-tests-cleanup branch from f3669d0 to bacc188 Compare September 16, 2020 05:50
@typescript-bot typescript-bot added Mergebot Error Mergebot encountered errors when processing this PR and removed Author is Owner The author of this PR is a listed owner of the package. Popular package This PR affects a popular package (as counted by NPM download counts). Revision needed This PR needs code changes before it can be merged. labels Sep 16, 2020
@typescript-bot
Copy link
Copy Markdown
Contributor

@reubenrybnik — There was an error that prevented me from properly processing this PR:

No head commit found

@reubenrybnik
Copy link
Copy Markdown
Contributor Author

Well that didn't work, won't try to do that again 😞

@reubenrybnik
Copy link
Copy Markdown
Contributor Author

To be fair, I didn't force push it back to its original base like I said, instead I forced it to current master. My plan might have worked if I had stuck with the original base and then merged current master in instead.

@reubenrybnik
Copy link
Copy Markdown
Contributor Author

Looks like this is in a special place on the PR board with a special label now; to the DT maintainer that will likely end up looking at this, please feel free to drop this PR off the board, and sorry for getting this into an unpleasant state that you've needed to come and investigate.

@reubenrybnik reubenrybnik reopened this Sep 16, 2020
@reubenrybnik
Copy link
Copy Markdown
Contributor Author

reubenrybnik commented Sep 16, 2020

Huzzah, I did what I said was what I probably should have done and fixed it and now DT maintainers won't need to come visit! 😬

Edit: Except this still has the error label, so maybe I'll get a visit anyway. 😬 😬 😬 At least I know the right and wrong way to do this now.

@jgonggrijp
Copy link
Copy Markdown
Contributor

On the bright side, maybe they have enough PRs with an error label that they don't inspect each of them individually. ;-)

@reubenrybnik
Copy link
Copy Markdown
Contributor Author

@jgonggrijp The first child PR is up at reubenrybnik#1 😄

I've invited you to be a collaborator in my fork, which was hopefully the right thing to do; let me know if there's something different that I should be doing to provide you with the power to effectively review PRs in my fork.

@jgonggrijp
Copy link
Copy Markdown
Contributor

@reubenrybnik Since your fork is public, I probably didn’t need any type of special permission in order to review your PRs. In public repos, everyone can review everything. I have accepted the invitation, but I might never use it. I take no offense if you remove my access again.

@reubenrybnik
Copy link
Copy Markdown
Contributor Author

@jgonggrijp Meh, might as well leave things as they are for the moment at least to be safe, this way too I can directly request you as a reviewer which is nice. I'll only do that for PRs like these that you know about in advance, though.

reubenrybnik and others added 2 commits September 18, 2020 08:14
* Removing the EnumerableKey type alias because DT linting is not good at dealing with it between different versions of TypeScript.

(cherry picked from commit abe1df7)

* Adding comments that describe and anchor tests, changing a few tests slightly, and removing some tests.

* Adding some chain tests.

* Fixing spelling error.

Co-authored-by: Julian Gonggrijp <dev@juliangonggrijp.com>

* Updating the mixin test to properly augment Underscore types.

* Removing an unnecessary generic type specification.

* Wrapping a comment.

* Referencing DefinitelyTyped#33479 in more places.

Co-authored-by: Julian Gonggrijp <dev@juliangonggrijp.com>
* Adding type assertions to usage tests.

* Minor updates to the bind test.

* Removing comments for chain tests that are already in the chain tests section of the file and updating the chain tests header.

* Breaking a function into multiple lines for better readability.

* Adding a separate toArray test that infers a more interesting type than any[].

* Replacing a movie reference with a more generic example.

* Make indentation more consistent.

Co-authored-by: Julian Gonggrijp <dev@juliangonggrijp.com>

* Revert "Replacing a movie reference with a more generic example."

This reverts commit 49c0a79.

Co-authored-by: Julian Gonggrijp <dev@juliangonggrijp.com>
* Removing the combinatorial tests label for types.

* Making to the types section of tests.

* Making updates to the collections section of tests.

* Making updates to the arrays section of tests.

* Making updates to the functions section of tests.

* Making updates to the objects section of tests.

* Making updates to the utility section of tests.

* Making updates to the OOP section of tests and adding an OOP header to UnderscoreStatic.

* Making updates to the chaining section of tests.

* Adding a missing word to a sentence.

Co-authored-by: Julian Gonggrijp <dev@juliangonggrijp.com>

* Changing "sorting" to "order" when describing sortedIndex

Co-authored-by: Julian Gonggrijp <dev@juliangonggrijp.com>

* Switching "values its keys" to "vice versa"

Co-authored-by: Julian Gonggrijp <dev@juliangonggrijp.com>

* Removing an inaccurate "no-op" from a description

Co-authored-by: Julian Gonggrijp <dev@juliangonggrijp.com>

* Splitting up comments between calling mixin and augmenting type definitions

Co-authored-by: Julian Gonggrijp <dev@juliangonggrijp.com>

* Removing an extra memoize header.

* Changing "TSC" to "TypeScript."

Co-authored-by: Julian Gonggrijp <dev@juliangonggrijp.com>
@reubenrybnik reubenrybnik marked this pull request as ready for review September 25, 2020 04:36
@typescript-bot typescript-bot added Popular package This PR affects a popular package (as counted by NPM download counts). Author is Owner The author of this PR is a listed owner of the package. and removed Mergebot Error Mergebot encountered errors when processing this PR labels Sep 25, 2020
@typescript-bot
Copy link
Copy Markdown
Contributor

@jgonggrijp Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review?

@reubenrybnik
Copy link
Copy Markdown
Contributor Author

reubenrybnik commented Sep 25, 2020

Yay, the PR is fully back in a good state! Excellent job dealing with my fail @typescript-bot 😅

Copy link
Copy Markdown
Contributor

@jgonggrijp jgonggrijp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are five commits: two merge commits that synchronize the feature branch with the master branch, and three squash merge commits, one from each of the above linked sub-PRs on @reubenrybnik's own fork. I have verified that the latter three commits match. Since I reviewed and approved each of the sub-PRs, I approve the current one as well.

@reubenrybnik Congratulations with completing a huge project that extended over many PRs. Thank you for giving the Underscore typings as well the corresponding tests such a major, thorough quality boost. The improved types will benefit all Underscore+TypeScript users (which I suspect is a substantial population) in the coming years, while the improved tests will benefit all who will edit the types in the future.

Working with you has been a pleasure; I appreciate your high quality standards, your thoroughness and your considerateness. Last but not least, your perseverance is truly impressive. I look forward to the next time our paths will cross.

If you ever need support for Underscore, Underscore-contrib, (future) Underscore-Fusion, Backbone, Backbone-Machina, Backbone-Fractal, (future) Backbone-Bulma or (future) Backbone-RDF, just let me know.

@typescript-bot typescript-bot added Owner Approved A listed owner of this package signed off on the pull request. Self Merge This PR can now be self-merged by the PR author or an owner labels Sep 25, 2020
@typescript-bot
Copy link
Copy Markdown
Contributor

@reubenrybnik Everything looks good here. Great job! I am ready to merge this PR on your behalf.

If you'd like that to happen, please post a comment saying:

Ready to merge

and I'll merge this PR almost instantly. Thanks for helping out! ❤️

(@borisyankov, @jbaldwin, @ccurrens, @confususs, @jgonggrijp, @ffflorian, @regevbr, @peterblazejewicz: you can do this too.)

@reubenrybnik
Copy link
Copy Markdown
Contributor Author

Thanks @jgonggrijp! I appreciate your responsiveness during this round of reviews, your willingness to review so many PRs, and your feedback and ideas for improvement which provided a substantial quality boost to the result of this effort.

I look forward to working with you again as well, quite possibly on more improvements to these type definitions since there are definitely more that can be made both now and as future versions of TS become available but hopefully in other areas of the open-source world too 😄

@reubenrybnik
Copy link
Copy Markdown
Contributor Author

Ready to merge

@typescript-bot typescript-bot merged commit 61deea7 into DefinitelyTyped:master Sep 25, 2020
reubenrybnik added a commit to reubenrybnik/DefinitelyTyped that referenced this pull request Sep 25, 2020
…ay Tests - Usage Tests Cleanup by @reubenrybnik

(cherry picked from commit 61deea7)
@typescript-bot
Copy link
Copy Markdown
Contributor

I just published @types/underscore@1.10.24 to npm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author is Owner The author of this PR is a listed owner of the package. Owner Approved A listed owner of this package signed off on the pull request. Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. Popular package This PR affects a popular package (as counted by NPM download counts). Self Merge This PR can now be self-merged by the PR author or an owner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants