Skip to content

Commit

Permalink
refactor: update terminology to "disqualification threshold"
Browse files Browse the repository at this point in the history
Replaced "deadline" with "disqualification threshold" across code and docs.
  • Loading branch information
gentlementlegen committed Nov 25, 2024
1 parent 0b0dabb commit 3ebb2f2
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# @ubiquity-os/daemon-disqualifier

Watches user activity on issues, sends reminders on deadlines, and eventually unassigns inactive user to ensure that
Watches user activity on issues, sends reminders on disqualification threshold, and eventually unassigns inactive user to ensure that
tasks don't stall, and subtracts XP.

## Setup
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "User activity watcher",
"description": "Watches user activity on issues, sends reminders on deadlines, and unassign inactive users.",
"description": "Watches user activity on issues, sends reminders on disqualification threshold, and unassign inactive users.",
"ubiquity:listeners": ["pull_request_review_comment.created", "issue_comment.created", "push"],
"configuration": {
"default": {},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ubiquity-os/daemon-disqualifier",
"version": "1.0.0",
"description": "Watches user activity on issues, sends reminders on deadlines, and unassign inactive users.",
"description": "Watches user activity on issues, sends reminders on disqualification threshold, and unassign inactive users.",
"main": "src/index.ts",
"author": "Ubiquity DAO",
"license": "MIT",
Expand Down
9 changes: 6 additions & 3 deletions src/helpers/remind-and-remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,12 @@ async function removeAllAssignees(context: ContextPlugin, issue: ListIssueForRep
return false;
}
const logins = issue.assignees.map((o) => o?.login).filter((o) => !!o) as string[];
const logMessage = logger.info(`Passed the deadline and no activity is detected, removing assignees: ${logins.map((o) => `@${o}`).join(", ")}.`, {
issue: issue.html_url,
});
const logMessage = logger.info(
`Passed the disqualification threshold and no activity is detected, removing assignees: ${logins.map((o) => `@${o}`).join(", ")}.`,
{
issue: issue.html_url,
}
);
const metadata = createStructuredMetadata(UNASSIGN_HEADER, logMessage);

await octokit.rest.issues.createComment({
Expand Down
8 changes: 4 additions & 4 deletions src/helpers/task-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ type IssueLabel = Partial<Omit<RestEndpointMethodTypes["issues"]["listLabelsForR
};

/**
* Retrieves assignment events from the timeline of an issue and calculates the deadline based on the time label.
* Retrieves assignment events from the timeline of an issue and calculates the disqualification threshold based on the time label.
*
* It does not care about previous updates, comments or other events that might have happened on the issue.
*
* It returns who is assigned and the initial calculated deadline (start + time label duration).
* It returns who is assigned and the initial calculated disqualification threshold (start + time label duration).
*/
export async function getTaskAssignmentDetails(
context: ContextPlugin,
Expand Down Expand Up @@ -59,11 +59,11 @@ export async function getTaskAssignmentDetails(
// it could mean there was no time label set on the issue
// but it could still be workable and priced
} else if (durationInMs < 0 || !durationInMs) {
logger.error(`Invalid deadline found on ${issue.html_url}`);
logger.error(`Invalid disqualification threshold found on ${issue.html_url}`);
return false;
}

// if there are no assignment events, we can assume the deadline is the issue creation date
// if there are no assignment events, we can assume the disqualification threshold is the issue creation date
metadata.startPlusLabelDuration =
DateTime.fromISO(mostRecentAssignmentEvent?.created_at || issue.created_at)
.plus({ milliseconds: durationInMs })
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/task-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export async function updateTaskReminder(context: ContextPlugin, repo: ListForOr

const lastReminderComment = lastReminders.flat().shift();

logger.debug(`Handling metadata and deadline for ${issue.html_url}`, {
logger.debug(`Handling metadata and disqualification threshold for ${issue.html_url}`, {
now: now.toLocaleString(DateTime.DATETIME_MED),
assignedDate: DateTime.fromISO(assignedEvent.created_at).toLocaleString(DateTime.DATETIME_MED),
lastReminderComment: lastReminderComment ? DateTime.fromISO(lastReminderComment.created_at).toLocaleString(DateTime.DATETIME_MED) : "none",
Expand All @@ -80,7 +80,7 @@ export async function updateTaskReminder(context: ContextPlugin, repo: ListForOr
if (mostRecentActivityDate.plus({ milliseconds: prioritySpeed ? disqualificationTimeDifference / priorityLevel : disqualificationTimeDifference }) <= now) {
await unassignUserFromIssue(context, issue);
} else {
logger.info(`Reminder was sent for ${issue.html_url} already, not beyond disqualification deadline yet.`, {
logger.info(`Reminder was sent for ${issue.html_url} already, not beyond disqualification disqualification threshold yet.`, {
now: now.toLocaleString(DateTime.DATETIME_MED),
assignedDate: DateTime.fromISO(assignedEvent.created_at).toLocaleString(DateTime.DATETIME_MED),
lastReminderComment: lastReminderComment ? DateTime.fromISO(lastReminderComment.created_at).toLocaleString(DateTime.DATETIME_MED) : "none",
Expand Down

0 comments on commit 3ebb2f2

Please sign in to comment.