Skip to content

Conversation

@magnus-asana
Copy link

@magnus-asana magnus-asana commented Nov 11, 2021

This is still WIP.

Pull Request synchronized with Asana task

Copy link
Contributor

@gregeinfrank gregeinfrank left a comment

Choose a reason for hiding this comment

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

Awesome start - thanks so much for picking this up. A couple comments, but directionally this looks good. Of course before getting ready for real review we'll need to add tests.

I'm also a bit worried about how this rollout will work at Asana, and anticipate lots of complaints from engineers who are going to get duplicate tasks. That's probably OK as long as we get ahead of it and communicate it in advance and get people to change their behavior to use CC correctly and not add everyone as reviewers no matter what.

Also good to loop in the code review AOR holder before rolling out, I think they were involved in the original discussion around this but this is a big enough process change that there should be a coordinated rollout. Thanks!

return response["gid"]

def create_subtask(
self, parent_task_id: str, reviewer: str, task_name: str, task_description,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I'd just call this assignee since this is a wrapper around the Asana API and doesn't necessarily need to know the context of "reviewer" - just to format and forward the request to the API

Suggested change
self, parent_task_id: str, reviewer: str, task_name: str, task_description,
self, parent_task_id: str, assignee: str, task_name: str, task_description,

return AsanaClient.singleton().update_task(task_id, fields)


def is_task_completed(task_id) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the pattern established here is to keep the naming consistent

Suggested change
def is_task_completed(task_id) -> bool:
def get_task_completed_status(task_id) -> bool:

maybe_complete_tasks_on_merge(pull_request)


def create_review_subtask(pull_request: PullRequest, parent_task_id: str, reviewer_handle: str):
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def create_review_subtask(pull_request: PullRequest, parent_task_id: str, reviewer_handle: str):
def create_review_subtask(pull_request: PullRequest, parent_task_id: str, reviewer_handle: str) -> str:

)


def update_subtask(pull_request: PullRequest, subtask_id):
Copy link
Contributor

Choose a reason for hiding this comment

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

The naming here is a bit confusing, perhaps just reopen_subtask_if_completed would be more accurate?

key is formed by concatenating the two GitHub node ids using a "-" separator.
"""
dynamo_db_key = _get_dynamodb_key_from_two_github_nodes(gh_node_id_a, gh_node_id_b)
print(f"Inserting key {dynamo_db_key} to DynamoDb.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
print(f"Inserting key {dynamo_db_key} to DynamoDb.")
logger.info(f"Inserting key {dynamo_db_key} to DynamoDb.")

)

def _get_dynamodb_key_from_two_github_nodes(gh_node_id_a: str, gh_node_id_b: str) -> str:
return f"{gh_node_id_a}-{gh_node_id_b}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps this function should sort the two node ids, so we don't have to remember which order to pass them in and reduce bugs around unexpected orders

)


def update_subtasks(pull_request: PullRequest, task_id: str) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it'd be more efficient to do this and upsert_subtasks in one loop rather than two separate functions. Mostly because it would cut the calls to dynamodb in half and updating wouldn't be necessary for newly created subtasks

@skeggse
Copy link
Member

skeggse commented May 1, 2023

It'd be so nice to have something like this!

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants