-
Notifications
You must be signed in to change notification settings - Fork 667
console-shared: add getCreationTimestamp() selector #2808
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
console-shared: add getCreationTimestamp() selector #2808
Conversation
|
/assign @christianvogt |
|
/retest |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: christianvogt, mareklibra The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/hold |
|
/hold cancel |
|
/hold These selectors are an anti-pattern imo. We should be trying to remove them instead of adding more. |
|
@spadgett could you explain why? They simply look like a way to use lodash |
|
Sorry, I commented on a different PR since there are several of these open. One of my concerns is that they're not actually type safe. There's nothing guarding against having a typo in the string passed to get. In my opinion, this would be much better as return obj ? obj.metadata.creationTimestamp : null;
I don't think this scales very well. We seem to be adding these not just for the common fields, but for all properties on all types. While not the case in this PR, I've also seen some places where we're adding helpers like these instead of defining a type for a specific resource. We get more value in the end from defining the type. I'm not sure how this is really better than just using I also dislike that we're adding these in separate PRs instead of the PR where they're being used. That way we don't know the context during review and we might be creating orphaned code if the other PR changes or doesn't merge. |
|
Admittedly, my point is undercut by our types having I'll remove the hold since this seems to be the established pattern. We might want to go back and implement these without /hold cancel |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
1 similar comment
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
@mareklibra: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
I agree. The only reason for splitting the code was to simplify/speed-up the review process.
I agree that having properly typed input objects and accessing fields inline is definitely better than hiding behind On the higher level, the actual use of selectors brings benefits over inlined-access to data within their actual use. No matter of API documentation, the received input might not conform the reality and the app should stay reliable. And these checks for deeper objects can be complex. I believe the original argument for using |
It makes review much harder because the reviewer doesn't know how something is being used or if it's necessary. This is particularly true when you have PRs depending on 2-3 other PRs and the branches are frozen.
I don't see it as an implementation detail. It seems to be the whole purpose of these helpers.
The API documentation is generated from the code, and the API server enforces this. If that's broken, I'd honestly rather have it blow up to alert us there's a problem.
I'd really like to get us away from |
Required by: #2600