Competition/Round architecture: full platform rewrite (Phases 1-9)
All checks were successful
Build and Push Docker Image / build (push) Successful in 7m45s

Replace Pipeline/Stage system with Competition/Round architecture.
New schema: Competition, Round (7 types), JuryGroup, AssignmentPolicy,
ProjectRoundState, DeliberationSession, ResultLock, SubmissionWindow.
New services: round-engine, round-assignment, deliberation, result-lock,
submission-manager, competition-context, ai-prompt-guard.
Full admin/jury/applicant/mentor UI rewrite. AI prompt hardening with
structured prompts, retry logic, and injection detection. All legacy
pipeline/stage code removed. 4 new migrations + seed aligned.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-15 23:04:15 +01:00
parent 9ab4717f96
commit 6ca39c976b
349 changed files with 69938 additions and 28767 deletions

View File

@@ -18,33 +18,33 @@ interface ReminderResult {
* Find active stages with approaching deadlines and send reminders
* to jurors who have incomplete assignments.
*/
export async function processEvaluationReminders(stageId?: string): Promise<ReminderResult> {
export async function processEvaluationReminders(roundId?: string): Promise<ReminderResult> {
const now = new Date()
let totalSent = 0
let totalErrors = 0
// Find active stages with window close dates in the future
const stages = await prisma.stage.findMany({
// Find active rounds with window close dates in the future
const rounds = await prisma.round.findMany({
where: {
status: 'STAGE_ACTIVE',
status: 'ROUND_ACTIVE' as const,
windowCloseAt: { gt: now },
windowOpenAt: { lte: now },
...(stageId && { id: stageId }),
...(roundId && { id: roundId }),
},
select: {
id: true,
name: true,
windowCloseAt: true,
track: { select: { name: true } },
competition: { select: { name: true } },
},
})
for (const stage of stages) {
if (!stage.windowCloseAt) continue
for (const round of rounds) {
if (!round.windowCloseAt) continue
const msUntilDeadline = stage.windowCloseAt.getTime() - now.getTime()
const msUntilDeadline = round.windowCloseAt.getTime() - now.getTime()
// Determine which reminder types should fire for this stage
// Determine which reminder types should fire for this round
const applicableTypes = REMINDER_TYPES.filter(
({ thresholdMs }) => msUntilDeadline <= thresholdMs
)
@@ -52,7 +52,7 @@ export async function processEvaluationReminders(stageId?: string): Promise<Remi
if (applicableTypes.length === 0) continue
for (const { type } of applicableTypes) {
const result = await sendRemindersForStage(stage, type, now)
const result = await sendRemindersForRound(round, type, now)
totalSent += result.sent
totalErrors += result.errors
}
@@ -61,12 +61,12 @@ export async function processEvaluationReminders(stageId?: string): Promise<Remi
return { sent: totalSent, errors: totalErrors }
}
async function sendRemindersForStage(
stage: {
async function sendRemindersForRound(
round: {
id: string
name: string
windowCloseAt: Date | null
track: { name: string }
competition: { name: string } | null
},
type: ReminderType,
now: Date
@@ -74,12 +74,12 @@ async function sendRemindersForStage(
let sent = 0
let errors = 0
if (!stage.windowCloseAt) return { sent, errors }
if (!round.windowCloseAt) return { sent, errors }
// Find jurors with incomplete assignments for this stage
// Find jurors with incomplete assignments for this round
const incompleteAssignments = await prisma.assignment.findMany({
where: {
stageId: stage.id,
roundId: round.id,
isCompleted: false,
},
select: {
@@ -92,10 +92,10 @@ async function sendRemindersForStage(
if (userIds.length === 0) return { sent, errors }
// Check which users already received this reminder type for this stage
// Check which users already received this reminder type for this round
const existingReminders = await prisma.reminderLog.findMany({
where: {
stageId: stage.id,
roundId: round.id,
type,
userId: { in: userIds },
},
@@ -114,7 +114,7 @@ async function sendRemindersForStage(
})
const baseUrl = process.env.NEXTAUTH_URL || 'https://monaco-opc.com'
const deadlineStr = stage.windowCloseAt.toLocaleDateString('en-US', {
const deadlineStr = round.windowCloseAt.toLocaleDateString('en-US', {
weekday: 'long',
year: 'numeric',
month: 'long',
@@ -144,12 +144,12 @@ async function sendRemindersForStage(
emailTemplateType,
{
name: user.name || undefined,
title: `Evaluation Reminder - ${stage.name}`,
message: `You have ${pendingCount} pending evaluation${pendingCount !== 1 ? 's' : ''} for ${stage.name}.`,
linkUrl: `${baseUrl}/jury/stages/${stage.id}/assignments`,
title: `Evaluation Reminder - ${round.name}`,
message: `You have ${pendingCount} pending evaluation${pendingCount !== 1 ? 's' : ''} for ${round.name}.`,
linkUrl: `${baseUrl}/jury/rounds/${round.id}/assignments`,
metadata: {
pendingCount,
stageName: stage.name,
roundName: round.name,
deadline: deadlineStr,
},
}
@@ -158,7 +158,7 @@ async function sendRemindersForStage(
// Log the sent reminder
await prisma.reminderLog.create({
data: {
stageId: stage.id,
roundId: round.id,
userId: user.id,
type,
},
@@ -167,7 +167,7 @@ async function sendRemindersForStage(
sent++
} catch (error) {
console.error(
`Failed to send ${type} reminder to ${user.email} for stage ${stage.name}:`,
`Failed to send ${type} reminder to ${user.email} for round ${round.name}:`,
error
)
errors++