Skip to content

feat: add phase management api #635

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

Merged
merged 34 commits into from
Jul 5, 2023
Merged

feat: add phase management api #635

merged 34 commits into from
Jul 5, 2023

Conversation

rakibansary
Copy link
Contributor

No description provided.

@@ -2235,6 +2209,115 @@ deleteChallenge.schema = {
challengeId: Joi.id(),
};

async function advancePhase(currentUser, challengeId, data) {
if (currentUser && (currentUser.isMachine || hasAdminRole(currentUser))) {
Copy link
Member

Choose a reason for hiding this comment

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

this check looks unnecessary

);

const updatedChallenge = await challengeDomain.lookup(getLookupCriteria("id", challengeId));
await indexChallengeAndPostToKafka(updatedChallenge);
Copy link
Member

@eisbilir eisbilir May 17, 2023

Choose a reason for hiding this comment

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

we can avoid raising challenge.update event unless there is a change in challenge status or winners are set.
for other cases, we need to raise event using another topic and another format

}

async #areAllSubmissionsReviewed(challengeId) {
console.log(`Getting review count for challenge ${challengeId}`);
Copy link
Member

Choose a reason for hiding this comment

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

Note: also we need to check if enough review is present per submission according to "Reviewer Count" phase constraint.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will double check - however areAllSubmissionReviewed is an essential rule while checking if all submissions received the minimum requisite reviews would be a constraint check

{
"fact": "isPredecessorPhaseClosed",
"operator": "equal",
"value": true
Copy link
Member

@eisbilir eisbilir May 18, 2023

Choose a reason for hiding this comment

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

predecessor phase is "Submission" and it can be open
regular "isClosed" check can be added

"value": true
},
{
"fact": "isPostMortemOpen",
Copy link
Member

Choose a reason for hiding this comment

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

this looks unnecessary, post mortem is created following registration and submission. If Appeals response is already scheduled then it means that there is no post mortem created in the system.

"value": true
},
{
"all": [
Copy link
Member

Choose a reason for hiding this comment

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

I couldn't understand why submission phase is closed here if this is F2F and there is a submission pending to be reviewed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah this is an oversight - submission should not be closed! I'll fix it.

return facts;
}

async advancePhase(challengeId, phases, operation, phaseName) {
Copy link
Member

Choose a reason for hiding this comment

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

How to identify correct phase if phase name is "Iterative Review"

allSubmissionsReviewed: await this.#areAllSubmissionsReviewed(challengeId),
}),
"Iterative Review": async (challengeId) => ({
hasActiveUnreviewedSubmissions: await this.#hasActiveUnreviewedSubmissions(challengeId),
Copy link
Member

Choose a reason for hiding this comment

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

hasActiveUnreviewedSubmissions is for opening the phase.
for closing the phase, the fact should check if the earliest active submission has a committed review. there can be other active unreviewed submissions in the queue but they are ignored.

"value": true
},
{
"fact": "hasActiveUnreviewedSubmissions",
Copy link
Member

Choose a reason for hiding this comment

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

need a different fact to check if the earliest active submission has enough commited review(s)

"value": true
},
{
"fact": "isPastScheduledEndTime",
Copy link
Member

Choose a reason for hiding this comment

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

isPastScheduledEndTime or check if every submitters aggreed on early appeals

"value": true
},
{
"fact": "isPastScheduledEndTime",
Copy link
Member

Choose a reason for hiding this comment

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

scheduled end time is not considered to close Appeals Response phase

hasActiveUnreviewedSubmissions: await this.#hasActiveUnreviewedSubmissions(challengeId),
}),
Review: async (challengeId) => ({
allSubmissionsReviewed: await this.#areAllSubmissionsReviewed(challengeId),
Copy link
Member

Choose a reason for hiding this comment

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

There is another fact that checks if all test cases are uploaded If there is a development reviewer for challenge. But this could be something we are not doing anymore.

"value": true
},
{
"fact": "isPastScheduledEndTime",
Copy link
Member

Choose a reason for hiding this comment

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

scheduled end time is not considered to close Review phase

}

// prettier-ignore
#updateSubsequentPhases(phases, currentPhase, delta) {
Copy link
Member

Choose a reason for hiding this comment

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

If this is F2F, after submission phase is closed we shouldn't update iterative phases.

@rakibansary rakibansary merged commit a4bb399 into dev Jul 5, 2023
@eisbilir eisbilir deleted the feature/phase-advance branch September 16, 2023 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants