Skip to content

Fix: Invite and Assignment Pre-Process Quota #2535

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions openreview/venue/process/assignment_pre_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,17 @@ async function process(client, edge, invitation) {

// Filter assignment edges to exclude the current edge.id
const filteredAssignmentEdges = assignmentEdges.filter(e => e.id !== edge.id)
// Filter invite assignment edges to exclude edges that are accepted
const filteredInviteAssignmentEdges = inviteAssignmentEdges.filter(e => !filteredLabels.includes(e?.label ?? ''))
// Convert filteredLabels to lowercase for case-insensitive comparison
const lowerCaseFilteredLabels = filteredLabels.map(label => label.toLowerCase());

// Filter invite assignment edges to exclude edges that do not contain any of the filteredLabels as substrings (case-insensitive) and the current edge.id
const filteredInviteAssignmentEdges = inviteAssignmentEdges.filter(e => {
const edgeLabel = e?.label?.toLowerCase() ?? '';
// Check if edgeLabel includes any of the filteredLabels
const includesFilteredLabel = lowerCaseFilteredLabels.some(filteredLabel => edgeLabel.includes(filteredLabel));
// Include edge only if it contains any of the filteredLabels and is not the current edge
return !includesFilteredLabel && e.id !== edge.id;
});

if (quota && filteredInviteAssignmentEdges.length + filteredAssignmentEdges.length >= quota) {
return Promise.reject(new OpenReviewError({ name: 'Error', message: `Can not make assignment, total assignments and invitations must not exceed ${quota}; invite edge ids=${filteredInviteAssignmentEdges.map(e=>e.id)} assignment edge ids=${filteredAssignmentEdges.map(e=>e.id)}` }))
Expand Down
13 changes: 11 additions & 2 deletions openreview/venue/process/invite_assignment_pre_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,17 @@ async function process(client, edge, invitation) {
client.getEdges({ invitation: assignmentInvitationId, head: edge.head })
])

// Filter invite assignment edges to exclude edges that are accepted and the current edge.id
const filteredInviteAssignmentEdges = inviteAssignmentEdges.filter(e => !filteredLabels.includes(e?.label ?? '') && e.id !== edge.id)
// Convert filteredLabels to lowercase for case-insensitive comparison
const lowerCaseFilteredLabels = filteredLabels.map(label => label.toLowerCase());

// Filter invite assignment edges to exclude edges that do not contain any of the filteredLabels as substrings (case-insensitive) and the current edge.id
const filteredInviteAssignmentEdges = inviteAssignmentEdges.filter(e => {
const edgeLabel = e?.label?.toLowerCase() ?? '';
// Check if edgeLabel includes any of the filteredLabels
const includesFilteredLabel = lowerCaseFilteredLabels.some(filteredLabel => edgeLabel.includes(filteredLabel));
// Include edge only if it contains any of the filteredLabels and is not the current edge
return !includesFilteredLabel && e.id !== edge.id;
});

if (filteredInviteAssignmentEdges.length + assignmentEdges.length >= quota) {
return Promise.reject(new OpenReviewError({ name: 'Error', message: `Can not invite assignment, total assignments and invitations must not exceed ${quota}; invite edge ids=${filteredInviteAssignmentEdges.map(e=>e.id)} assignment edge ids=${assignmentEdges.map(e=>e.id)}` }))
Expand Down
47 changes: 46 additions & 1 deletion tests/test_arr_venue_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3664,7 +3664,7 @@ def test_sae_ae_assignments(self, client, openreview_client, helpers, test_clien
for idx, reviewer_id in enumerate(test_reviewers):
inv_ending = 'Invite_Assignment'
label = 'Invitation Sent'
if idx == 1 or idx == 0:
if idx == 0:
inv_ending, label = 'Assignment', None
existing_edges.append(
openreview_client.post_edge(openreview.api.Edge(
Expand Down Expand Up @@ -3697,6 +3697,51 @@ def test_sae_ae_assignments(self, client, openreview_client, helpers, test_clien
label = "Invitation Sent"
))

# Decline as reviewer two with reason
messages = openreview_client.get_messages(to='reviewer2@aclrollingreview.com', subject=f'''[ARR - August 2023] Invitation to review paper titled "{submissions[1].content['title']['value']}"''')
assert len(messages) == 1

for idx, message in enumerate(messages):
text = message['content']['text']

invitation_url = re.search('https://.*\n', text).group(0).replace('https://openreview.net', 'http://localhost:3030').replace('&', '&')[:-1]
helpers.respond_invitation(selenium, request_page, invitation_url, accept=False, comment='I am busy')
helpers.await_queue_edit(openreview_client, invitation='aclweb.org/ACL/ARR/2023/August/Reviewers/-/Assignment_Recruitment', count=1)

reviewer_two_edge = client.get_all_edges(invitation='aclweb.org/ACL/ARR/2023/August/Reviewers/-/Invite_Assignment', tail='~Reviewer_ARRTwo1', head=submissions[1].id)
assert reviewer_two_edge[0].label == 'Declined: I am too busy.'

# Assignment for reviewer 4 should post
existing_edges.append(
openreview_client.post_edge(openreview.api.Edge(
invitation = 'aclweb.org/ACL/ARR/2023/August/Reviewers/-/Assignment',
head = submissions[1].id,
tail = '~Reviewer_ARRFour1',
signatures = ['aclweb.org/ACL/ARR/2023/August/Program_Chairs'],
weight = 1
))
)

# Invitation for reviewer 5 should NOT post
with pytest.raises(openreview.OpenReviewException, match=r'Can not make assignment, total assignments and invitations must not exceed 3'):
openreview_client.post_edge(openreview.api.Edge(
invitation = 'aclweb.org/ACL/ARR/2023/August/Reviewers/-/Assignment',
head = submissions[1].id,
tail = '~Reviewer_ARRFive1',
signatures = ['aclweb.org/ACL/ARR/2023/August/Program_Chairs'],
weight = 1
))
with pytest.raises(openreview.OpenReviewException, match=r'Can not invite assignment, total assignments and invitations must not exceed 3'):
openreview_client.post_edge(openreview.api.Edge(
invitation = 'aclweb.org/ACL/ARR/2023/August/Reviewers/-/Invite_Assignment',
head = submissions[1].id,
tail = 'invitereviewer@aclrollingreview.org',
signatures = ['aclweb.org/ACL/ARR/2023/August/Program_Chairs'],
weight = 0,
label = "Invitation Sent"
))

# Accept reviewer 3 invitation
messages = openreview_client.get_messages(to='reviewer3@aclrollingreview.com', subject=f'''[ARR - August 2023] Invitation to review paper titled "{submissions[1].content['title']['value']}"''')
assert len(messages) == 1

Expand Down